diff --git a/ChangeLog b/ChangeLog index f1a44ef58e03c90478e1e6775fc9caed2237a1ac..69f6556871d7a84cade6a6fc3839289abb9ae206 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ For users: - New: total per vat rate are available as tags for ODT templates. - New: Add more types for extra parameters (lists, phone, emails, checkbox, prices) - New: Some part of interface use more CSS3 (ie: agenda) +- New: [ task #707 ] Create option ProfIdx are mandatory to validate a invoice For developers: - System of menu managers has been rewritten to reduce code to do same things. diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 212429be67e2bb00992540a098a08a5624b30d5a..1753eb4b75a5b429776bc1cdae3acc6372a526df 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -366,6 +366,22 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu $object->fetch_thirdparty(); // Check parameters + + // Check for mandatory prof id + for ($i = 1; $i < 5; $i++) + { + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_INVOICE_MANDATORY'; + if (! $object->thirdparty->idprof.$i && ! empty($conf->global->$idprof_mandatory)) + { + if (! $error) $langs->load("errors"); + $error++; + + setEventMessage($langs->trans('ErrorProdIdIsMandatory',$langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)),'errors'); + } + } + + //Check for warehouse if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1)) { if (! $idwarehouse || $idwarehouse == -1) @@ -375,7 +391,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu $action=''; } } - + if (! $error) { $result = $object->validate($user,'',$idwarehouse); diff --git a/htdocs/langs/ca_ES/admin.lang b/htdocs/langs/ca_ES/admin.lang index 5bbc3472c98ff713b06ef4121a5b59ddb41f90dc..a80324836cc4f56d6ff205957c58702ee6cdaca8 100644 --- a/htdocs/langs/ca_ES/admin.lang +++ b/htdocs/langs/ca_ES/admin.lang @@ -962,7 +962,8 @@ DocumentModelOdt=Generació des dels documents amb format OpenDocument (Arxiu .O WatermarkOnDraft=Marca d'aigua en els documents esborrany CompanyIdProfChecker=Règles sobre els ID professionals MustBeUnique=Ha de ser únic? -MustBeMandatory=Ha de ser obligatori? +MustBeMandatory=Ha de ser obligatori per a crear tercers? +MustBeInvoiceMandatory=Ha de ser obligatori per a validar factures? Miscellanous=Miscel·lània ##### Webcal setup ##### WebCalSetup=Configuració d'enllaç amb el calendari webcalendar diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cc5d50c5139da0d23570f5a36544b42aa94037c7..ce66a55f94412e8f7153cb287b7c3afcfc880ae8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -978,7 +978,8 @@ DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT files for WatermarkOnDraft=Watermark on draft document CompanyIdProfChecker=Rules ono Professional Ids MustBeUnique=Must be unique ? -MustBeMandatory=Must be mandatory ? +MustBeMandatory=Must be mandatory to create thirds? +MustBeInvoiceMandatory=Must be mandatory to validate invoices? Miscellanous=Miscellaneous ##### Webcal setup ##### WebCalSetup=Webcalendar link setup diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index cbf151937425c54561bea378346d22bb28e12528..8013b56c2fb072c5e05561d6fdbea481a8e71a8c 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -964,7 +964,8 @@ DocumentModelOdt=Generación desde los documentos OpenDocument (Archivo .ODT Ope WatermarkOnDraft=Marca de agua en los documentos borrador CompanyIdProfChecker=Reglas sobre los ID profesionales MustBeUnique=¿Debe ser único? -MustBeMandatory=¿Debe ser obligatorio? +MustBeMandatory=¿Debe ser obligatorio para crear terceros? +MustBeInvoiceMandatory=¿Debe ser obligatorio para validar facturas? Miscellanous=Miscelánea ##### Webcal setup ##### WebCalSetup=Configuración de enlace con el calendario Webcalendar diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 46df03e5c63b0053eb1620cdff28a137341ccf91..f0e8198086dbbaf4b5c28b3b429dba13700c9e0e 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -975,7 +975,8 @@ DocumentModelOdt=Genération depuis des modèles OpenDocument (Fichier .ODT Open WatermarkOnDraft=Filigrane sur les documents brouillons CompanyIdProfChecker=Règles sur les Ids professionnels MustBeUnique=Doit être unique ? -MustBeMandatory=Doit être obligatoire? +MustBeMandatory=Doit être obligatoire pour creer tiers ? +MustBeInvoiceMandatory=Doit être obligatoire pour valider factures ? Miscellanous=Divers ##### Webcal setup ##### WebCalSetup= Configuration du lien vers le calendrier Webcalendar diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 1b0efa2c4b263446d3f6941472479a2d249e1663..1cd6fef8b4ba50bc31e73f4dd78709d984eca331 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -210,7 +210,7 @@ if ($action == 'setprofid') } } -//Activate ProfId +//Activate ProfId mandatory if ($action == 'setprofidmandatory') { $status = GETPOST('status','alpha'); @@ -227,6 +227,22 @@ if ($action == 'setprofidmandatory') } } +//Activate ProfId invoice mandatory +if ($action == 'setprofidinvoicemandatory') +{ + $status = GETPOST('status','alpha'); + + $idprof="SOCIETE_IDPROF".$value."_INVOICE_MANDATORY"; + if (dolibarr_set_const($db, $idprof,$status,'chaine',0,'',$conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } +} /* * View @@ -554,6 +570,7 @@ print '<td>'.$langs->trans("Name").'</td>'; print '<td>'.$langs->trans("Description").'</td>'; print '<td align="center">'.$langs->trans("MustBeUnique").'</td>'; print '<td align="center">'.$langs->trans("MustBeMandatory").'</td>'; +print '<td align="center">'.$langs->trans("MustBeInvoiceMandatory").'</td>'; print "</tr>\n"; $profid[0][0]=$langs->trans("ProfId1"); @@ -586,8 +603,10 @@ while ($i < $nbofloop) $idprof_unique ='SOCIETE_IDPROF'.($i+1).'_UNIQUE'; $idprof_mandatory ='SOCIETE_IDPROF'.($i+1).'_MANDATORY'; + $idprof_invoice_mandatory ='SOCIETE_IDPROF'.($i+1).'_INVOICE_MANDATORY'; $verif=(empty($conf->global->$idprof_unique)?false:true); $mandatory=(empty($conf->global->$idprof_mandatory)?false:true); + $invoice_mandatory=(empty($conf->global->$idprof_invoice_mandatory)?false:true); if ($verif) { @@ -614,6 +633,20 @@ while ($i < $nbofloop) print img_picto($langs->trans("Disabled"),'switch_off'); print '</a></td>'; } + + if ($invoice_mandatory) + { + print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.($i+1).'&status=0">'; + print img_picto($langs->trans("Activated"),'switch_on'); + print '</a></td>'; + } + else + { + print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.($i+1).'&status=1">'; + print img_picto($langs->trans("Disabled"),'switch_off'); + print '</a></td>'; + } + print "</tr>\n"; } $i++;