add msg to formconfirm on propal invoice and commande

This commit is contained in:
jpb 2021-07-20 14:46:56 +02:00
parent 367e839239
commit 1237c5ba55
5 changed files with 50 additions and 0 deletions

View File

@ -1958,8 +1958,24 @@ if ($action == 'create') {
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object);
}
// mandatoryPeriod
$nbMandated = 0;
foreach ($object->lines as $line){
$res = $line->fetch_product();
if ($res > 0 ){
if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )){
$nbMandated++;
break;
}
}
}
if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
if (!$error) {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1);
}

View File

@ -1910,6 +1910,21 @@ if ($action == 'create' && $usercancreate) {
);
}
// mandatoryPeriod
$nbMandated = 0;
foreach ($object->lines as $line){
$res = $line->fetch_product();
if ($res > 0 ){
if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )){
$nbMandated++;
break;
}
}
}
if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
}

View File

@ -4001,6 +4001,21 @@ if ($action == 'create') {
if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) { // Can happen only if $conf->global->FACTURE_ENABLE_NEGATIVE is on
$text .= '<br>'.img_warning().' '.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive");
}
// mandatoryPeriod
$nbMandated = 0;
foreach ($object->lines as $line){
$res = $line->fetch_product();
if ($res > 0 ){
if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )){
$nbMandated++;
break;
}
}
}
if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, (($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) ? "no" : "yes"), 2);
}

View File

@ -399,3 +399,6 @@ ProductSupplierExtraFields=Additional Attributes (Supplier Prices)
DeleteLinkedProduct=Delete the child product linked to the combination
PMPValue=Weighted average price
PMPValueShort=WAP
mandatoryperiod=Mandatory periods
mandatoryPeriodNeedTobeSet=Attention periods not entered and mandatory
mandatoryPeriodNeedTobeSetMsgValidate=A service requires a start and end period

View File

@ -401,3 +401,4 @@ PMPValue=Prix moyen pondéré (PMP)
PMPValueShort=PMP
mandatoryperiod=Périodes obligatoires
mandatoryPeriodNeedTobeSet=Attention périodes non saisies et obligatoires
mandatoryPeriodNeedTobeSetMsgValidate=Un service nécessite une période de début et de fin