diff --git a/ChangeLog b/ChangeLog index 361cd1145ba..803703caf9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,10 +62,12 @@ For users: - New: Can choose menu entry to show with external site module. - New: Add hidden option MAIN_PDF_MARGIN_LEFT, MAIN_PDF_MARGIN_RIGHT, MAIN_PDF_MARGIN_TOP, MAIN_PDF_MARGIN_BOTTOM to force margins of generated PDF. +- New: [ task #314 ] Can define if prof id are mandatory or not New experimental modules: - New: Add margin management module. - New: Add commissions management module. + - Fix: [ bug #499 ]: Supplier order input method not translated - Fix: No images into product description lines as PDF generation does not work with this. diff --git a/htdocs/langs/ca_ES/errors.lang b/htdocs/langs/ca_ES/errors.lang index fd43de81c10..ec04e3ff9ce 100644 --- a/htdocs/langs/ca_ES/errors.lang +++ b/htdocs/langs/ca_ES/errors.lang @@ -21,6 +21,7 @@ ErrorThisContactIsAlreadyDefinedAsThisType=Aquest contacte ja està definit com ErrorCashAccountAcceptsOnlyCashMoney=Aquesta compte bancari és de tipus caixa i només accepta el mètode de pagament de tipus espècie. ErrorFromToAccountsMustDiffers=El compte origen i destinació han de ser diferents. ErrorBadThirdPartyName=Nom de tercer incorrecte +ErrorProdIdIsMandatory=El %s es obligatori ErrorBadCustomerCodeSyntax=La sintaxi del codi client és incorrecta ErrorCustomerCodeRequired=Codi client obligatori ErrorCustomerCodeAlreadyUsed=Codi de client ja utilitzat diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 19a36f64c22..f2f537453e7 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -25,6 +25,7 @@ ErrorThisContactIsAlreadyDefinedAsThisType=This contact is already defined as co ErrorCashAccountAcceptsOnlyCashMoney=This bank account is a cash account, so it accepts payments of type cash only. ErrorFromToAccountsMustDiffers=Source and targets bank accounts must be different. ErrorBadThirdPartyName=Bad value for third party name +ErrorProdIdIsMandatory=The %s is mandatory ErrorBadCustomerCodeSyntax=Bad syntax for customer code ErrorCustomerCodeRequired=Customer code required ErrorCustomerCodeAlreadyUsed=Customer code already used diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index 580627e6cab..d723910a5bd 100644 --- a/htdocs/langs/es_ES/errors.lang +++ b/htdocs/langs/es_ES/errors.lang @@ -21,6 +21,7 @@ ErrorThisContactIsAlreadyDefinedAsThisType=Este contacto ya está definido como ErrorCashAccountAcceptsOnlyCashMoney=Esta cuenta bancaria es de tipo caja y solo acepta el método de pago de tipo especie. ErrorFromToAccountsMustDiffers=La cuenta origen y destino deben ser diferentes. ErrorBadThirdPartyName=Nombre de tercero incorrecto +ErrorProdIdIsMandatory=El %s es obligatorio ErrorBadCustomerCodeSyntax=La sintaxis del código cliente es incorrecta ErrorCustomerCodeRequired=Código cliente obligatorio ErrorCustomerCodeAlreadyUsed=Código de cliente ya utilizado diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 87715bea1fe..b6fcbb6611b 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -26,6 +26,7 @@ ErrorThisContactIsAlreadyDefinedAsThisType=Ce contact est déjà défini comme c ErrorCashAccountAcceptsOnlyCashMoney=Ce compte bancaire est de type caisse et n'accepte que les mode de règlement de type espèce. ErrorFromToAccountsMustDiffers=Le compte source et destination doivent être différents. ErrorBadThirdPartyName=Nom de tiers incorrect +ErrorProdIdIsMandatory=Le %s est obligatoire ErrorBadCustomerCodeSyntax=La syntaxe du code client est incorrecte ErrorCustomerCodeRequired=Code client obligatoire ErrorCustomerCodeAlreadyUsed=Code client déjà utilisé diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index e058869d586..32ad23eafbe 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -550,6 +550,10 @@ $profid[2][0]=$langs->trans("ProfId3"); $profid[2][1]=$langs->transcountry('ProfId3', $mysoc->country_code); $profid[3][0]=$langs->trans("ProfId4"); $profid[3][1]=$langs->transcountry('ProfId4', $mysoc->country_code); +$profid[4][0]=$langs->trans("ProfId5"); +$profid[4][1]=$langs->transcountry('ProfId5', $mysoc->country_code); +$profid[5][0]=$langs->trans("ProfId6"); +$profid[5][1]=$langs->transcountry('ProfId6', $mysoc->country_code); $var = true; $i=0; @@ -557,44 +561,47 @@ $i=0; $nbofloop=count($profid); while ($i < $nbofloop) { - $var = !$var; - - print ''; - print ''.$profid[$i][0]."\n"; - print $profid[$i][1]; - print ''; - - $idprof_unique ='SOCIETE_IDPROF'.($i+1).'_UNIQUE'; - $idprof_mandatory ='SOCIETE_IDPROF'.($i+1).'_MANDATORY'; - $verif=(empty($conf->global->$idprof_unique)?false:true); - $mandatory=(empty($conf->global->$idprof_mandatory)?false:true); - - if ($verif) + if ($profid[$i][1]!='-') { - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; - } - else - { - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); - print ''; - } + $var = !$var; - if ($mandatory) - { - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; - } - else - { - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); - print ''; + print ''; + print ''.$profid[$i][0]."\n"; + print $profid[$i][1]; + print ''; + + $idprof_unique ='SOCIETE_IDPROF'.($i+1).'_UNIQUE'; + $idprof_mandatory ='SOCIETE_IDPROF'.($i+1).'_MANDATORY'; + $verif=(empty($conf->global->$idprof_unique)?false:true); + $mandatory=(empty($conf->global->$idprof_mandatory)?false:true); + + if ($verif) + { + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + } + else + { + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ''; + } + + if ($mandatory) + { + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + } + else + { + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ''; + } + print "\n"; } - print "\n"; $i++; } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 528672e3592..9dc51c37737 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Patrick Raguin - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -202,9 +202,18 @@ if (empty($reshook)) $error++; $errors[] = $langs->trans("ErrorSupplierModuleNotEnabled"); $action = ($action=='add'?'create':'edit'); } + + // We set country_id, country_code and country for the selected country + $object->country_id=GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id; + if ($object->country_id) + { + $tmparray=getCountry($object->country_id,'all'); + $object->country_code=$tmparray['code']; + $object->country=$tmparray['label']; + } - // Check for duplicate prof id - for ($i = 1; $i < 3; $i++) + // Check for duplicate or mandatory prof id + for ($i = 1; $i < 5; $i++) { $slabel="idprof".$i; $_POST[$slabel]=trim($_POST[$slabel]); @@ -218,8 +227,18 @@ if (empty($reshook)) $action = ($action=='add'?'create':'edit'); } } + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) + { + $langs->load("errors"); + $error++; + $errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code)); + $action = ($action=='add'?'create':'edit'); + } } } + if (! $error) { if ($action == 'add') @@ -293,7 +312,7 @@ if (empty($reshook)) // Gestion du logo de la société } else - { + { $error=$object->error; $errors=$object->errors; } @@ -834,7 +853,13 @@ else if ($idprof!='-') { if (($j % 2) == 0) print ''; - print ''.$idprof.''; + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + if(empty($conf->global->$idprof_mandatory)) + print ''.$idprof.''; + else + print ''.$idprof.''; + $key='idprof'.$i; print $formcompany->get_input_id_prof($i,'idprof'.$i,$object->$key,$object->country_code); print ''; @@ -1271,7 +1296,13 @@ else if ($idprof!='-') { if (($j % 2) == 0) print ''; - print ''.$idprof.''; + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + if(empty($conf->global->$idprof_mandatory)) + print ''.$idprof.''; + else + print ''.$idprof.''; + $key='idprof'.$i; print $formcompany->get_input_id_prof($i,'idprof'.$i,$object->$key,$object->country_code); print '';