From 99633eb8152e983faa97de8da843c30a06f8821c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Apr 2018 11:12:27 +0200 Subject: [PATCH 1/7] FIX button "Classify bill" on supplier order was not visible --- htdocs/fourn/commande/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ec9426f7a3c..03d405d905e 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2176,6 +2176,7 @@ elseif (! empty($object->id)) // modified by hook if (empty($reshook)) { + $object->fetchObjectLinked(); // Links are used to show or not button, so we load them now. // Validate if ($object->statut == 0 && $num > 0) From 0d26bdcdc55fc4c0ad9bd3e9eccd72488592d423 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Apr 2018 11:12:27 +0200 Subject: [PATCH 2/7] FIX Button receive products not visible --- htdocs/fourn/commande/card.php | 7 ++++--- htdocs/langs/en_US/stocks.lang | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ec9426f7a3c..0198bcc24ac 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2176,6 +2176,7 @@ elseif (! empty($object->id)) // modified by hook if (empty($reshook)) { + $object->fetchObjectLinked(); // Links are used to show or not button, so we load them now. // Validate if ($object->statut == 0 && $num > 0) @@ -2304,11 +2305,11 @@ elseif (! empty($object->id)) // Ship if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { - if (in_array($object->statut, array(3,4))) { + if (in_array($object->statut, array(3,4,5))) { if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->receptionner) { - print ''; + print ''; } else { - print ''; + print ''; } } } diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 62d2e23e66c..9405157a473 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -199,4 +199,5 @@ inventoryDeleteLine=Delete line RegulateStock=Regulate Stock ListInventory=List StockSupportServices=Stock management support services -StockSupportServicesDesc=By default, you can stock only product with type "product". If on, and if module service is on, you can also stock a product with type "service" \ No newline at end of file +StockSupportServicesDesc=By default, you can stock only product with type "product". If on, and if module service is on, you can also stock a product with type "service" +ReceiveProducts=Receive products \ No newline at end of file From 14ed19265c49e951955296fc972ffce6e23c048e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Apr 2018 13:53:59 +0200 Subject: [PATCH 3/7] FIX environment shown on cron card --- htdocs/cron/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 707b75b95fe..7730f6aafe4 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -624,7 +624,7 @@ else } else { - $mc->getInfo($obj->entity); + $mc->getInfo($object->entity); print $mc->label; } print ""; From f1ad3912e732f7734ff018259745f2f3236ad235 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Apr 2018 14:18:38 +0200 Subject: [PATCH 4/7] Fix multicompany compatibility for recurring invoice generation --- .../facture/class/facture-rec.class.php | 89 +++++++++++-------- htdocs/cron/class/cronjob.class.php | 3 +- 2 files changed, 52 insertions(+), 40 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index aeed921d136..799fd25c5ae 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -973,6 +973,7 @@ class FactureRec extends CommonInvoice $sql.= " AND (date_when IS NULL OR date_when <= '".$db->idate($today)."')"; $sql.= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)'; $sql.= ' AND suspended = 0'; + $sql.= ' AND entity = '.$conf->entity; // MUST STAY = $conf->entity here $sql.= $db->order('entity', 'ASC'); //print $sql;exit; @@ -987,7 +988,7 @@ class FactureRec extends CommonInvoice $saventity = $conf->entity; - while ($i < $num) // Loop on each template invoice + while ($i < $num) // Loop on each template invoice. If $num = 0, test is false at first pass. { $line = $db->fetch_object($resql); @@ -996,49 +997,59 @@ class FactureRec extends CommonInvoice $facturerec = new FactureRec($db); $facturerec->fetch($line->rowid); - // Set entity context - $conf->entity = $facturerec->entity; + if ($facturerec->id > 0) + { + // Set entity context + $conf->entity = $facturerec->entity; - dol_syslog("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref.", entity=".$facturerec->entity); + dol_syslog("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref.", entity=".$facturerec->entity); - $error=0; + $error=0; - $facture = new Facture($db); - $facture->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice - $facture->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice + $facture = new Facture($db); + $facture->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice + $facture->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice - $facture->type = self::TYPE_STANDARD; - $facture->brouillon = 1; - $facture->date = (empty($facturerec->date_when)?$now:$facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. - $facture->socid = $facturerec->socid; + $facture->type = self::TYPE_STANDARD; + $facture->brouillon = 1; + $facture->date = (empty($facturerec->date_when)?$now:$facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. + $facture->socid = $facturerec->socid; - $invoiceidgenerated = $facture->create($user); - if ($invoiceidgenerated <= 0) - { - $this->errors = $facture->errors; - $this->error = $facture->error; - $error++; - } - if (! $error && $facturerec->auto_validate) - { - $result = $facture->validate($user); - if ($result <= 0) - { - $this->errors = $facture->errors; - $this->error = $facture->error; - $error++; - } - } - if (! $error && $facturerec->generate_pdf) - { - $result = $facture->generateDocument($facturerec->modelpdf, $langs); - if ($result <= 0) - { - $this->errors = $facture->errors; - $this->error = $facture->error; - $error++; - } - } + $invoiceidgenerated = $facture->create($user); + if ($invoiceidgenerated <= 0) + { + $this->errors = $facture->errors; + $this->error = $facture->error; + $error++; + } + if (! $error && $facturerec->auto_validate) + { + $result = $facture->validate($user); + if ($result <= 0) + { + $this->errors = $facture->errors; + $this->error = $facture->error; + $error++; + } + } + if (! $error && $facturerec->generate_pdf) + { + $result = $facture->generateDocument($facturerec->modelpdf, $langs); + if ($result <= 0) + { + $this->errors = $facture->errors; + $this->error = $facture->error; + $error++; + } + } + } + else + { + $error++; + $this->error="Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity."\n"; + $this->errors[]="Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity; + dol_syslog("createRecurringInvoices Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity); + } if (! $error && $invoiceidgenerated >= 0) { diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index f890391431b..20d332e7cbd 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1044,8 +1044,9 @@ class Cronjob extends CommonObject { dol_syslog(get_class($this)."::run_jobs START ".$this->objectname."->".$this->methodename."(".$this->params.");", LOG_DEBUG); - // Create Object for the call module + // Create Object for the called module $object = new $this->objectname($this->db); + if ($this->entity > 0) $object->entity = $this->entity; // We work on a dedicated entity $params_arr = array_map('trim', explode(",",$this->params)); From 50d86a7cfd492ed68b1c0c1e9fd615926f78f1ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Apr 2018 14:25:39 +0200 Subject: [PATCH 5/7] Fix accounting area when advanced accounting module not enabled --- htdocs/accountancy/index.php | 209 ++++++++++++++++++----------------- 1 file changed, 108 insertions(+), 101 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 270a6b1ab09..cad9547ec4c 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -63,111 +63,118 @@ print load_fiche_titre($langs->trans("AccountancyArea"), '', 'title_accountancy' $step = 0; -print $langs->trans("AccountancyAreaDescIntro")."
\n"; -print "
\n";print "
\n"; - -print_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."
\n"; -print '
'; -print "
\n"; - -// STEPS -$step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").''); -print "
\n"; -$step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").''); -print "
\n"; -$step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").''); -print "
\n"; - -print "
\n"; -print $langs->trans("AccountancyAreaDescActionOnceBis"); -print "
\n"; -print "
\n"; - -$step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); -print "
\n"; - -$step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuBankAccounts").'')."\n"; -print "
\n"; - -$step++; -$textlink = ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").''; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); -print "
\n"; -if (! empty($conf->tax->enabled)) +if ($conf->accounting->enabled) { - $textlink = ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); - print "
\n"; + print $langs->trans("AccountancyAreaDescIntro")."
\n"; + print "
\n";print "
\n"; + + print_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."
\n"; + print '
'; + print "
\n"; + + // STEPS + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").''); + print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").''); + print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").''); + print "
\n"; + + print "
\n"; + print $langs->trans("AccountancyAreaDescActionOnceBis"); + print "
\n"; + print "
\n"; + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuBankAccounts").'')."\n"; + print "
\n"; + + $step++; + $textlink = ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").''; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); + print "
\n"; + if (! empty($conf->tax->enabled)) + { + $textlink = ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); + print "
\n"; + } + /*if (! empty($conf->salaries->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + // htdocs/admin/salaries.php + print "
\n"; + print "
\n"; + }*/ + if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); + print "
\n"; + } + /* + if (! empty($conf->loan->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + } + if (! empty($conf->don->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").''); + print "
\n"; + }*/ + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").''); + print "
\n"; + + + print '
'; + + + print "
\n"; + print_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionFreq"), '', ''); + print '
'; + print "
\n"; + $step = 0; + + $langs->loadLangs(array('bills', 'trips')); + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'')."\n"; + print "
\n"; + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'')."\n"; + print "
\n"; + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'')."\n"; + print "
\n"; + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n"; + print "
\n"; + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64+$step))."
\n"; + print "
\n"; } -/*if (! empty($conf->salaries->enabled)) +else { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - // htdocs/admin/salaries.php - print "
\n"; - print "
\n"; -}*/ -if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. -{ - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); - print "
\n"; + print $langs->trans("Module10Desc")."
\n"; } -/* -if (! empty($conf->loan->enabled)) -{ - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; -} -if (! empty($conf->don->enabled)) -{ - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").''); - print "
\n"; -}*/ - -$step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").''); -print "
\n"; - - -print '
'; - - -print "
\n"; -print_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionFreq"), '', ''); -print '
'; -print "
\n"; -$step = 0; - -$langs->loadLangs(array('bills', 'trips')); - -$step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'')."\n"; -print "
\n"; - -$step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'')."\n"; -print "
\n"; - -$step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'')."\n"; -print "
\n"; - -$step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n"; -print "
\n"; - -$step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64+$step))."
\n"; -print "
\n"; llxFooter(); $db->close(); From 622042e9b21269bd29530ac258035e2fcf677494 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Apr 2018 15:05:35 +0200 Subject: [PATCH 6/7] FIX Max nb of generation of recurring invoice should not show warning --- htdocs/compta/facture/fiche-rec.php | 11 +++++++-- .../compta/facture/invoicetemplate_list.php | 23 ++++++++++++++----- htdocs/langs/en_US/bills.lang | 1 + 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index a3d93608ebf..bb6358ed160 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1518,7 +1518,7 @@ else } print ''; - // Date when + // Date when (next invoice generation) print ''; if ($action == 'date_when' || $object->frequency > 0) { @@ -1534,7 +1534,14 @@ else print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day', $object->date_when, null, '', '', 0, 'strikeIfMaxNbGenReached'); } //var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour')); - if ($action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late")); + if (! $object->isMaxNbGenReached()) + { + if ($action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late")); + } + else + { + print img_info($langs->trans("MaxNumberOfGenerationReached")); + } print ''; print ''; diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 0966807facd..306106d4889 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -598,11 +598,18 @@ if ($resql) // Date next generation if (! empty($arrayfields['f.date_when']['checked'])) { - print ''; - print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'':'').dol_print_date($db->jdate($objp->date_when),'day').($invoicerectmp->isMaxNbGenReached()?'':'') : ''.$langs->trans('NA').''); - if ($objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late")); - print ''; - if (! $i) $totalarray['nbfield']++; + print ''; + print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'':'').dol_print_date($db->jdate($objp->date_when),'day').($invoicerectmp->isMaxNbGenReached()?'':'') : ''.$langs->trans('NA').''); + if (! $invoicerectmp->isMaxNbGenReached()) + { + if ($objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late")); + } + else + { + print img_info($langs->trans("MaxNumberOfGenerationReached")); + } + print ''; + if (! $i) $totalarray['nbfield']++; } if (! empty($arrayfields['f.datec']['checked'])) { @@ -629,7 +636,11 @@ if ($resql) print ''; if ($user->rights->facture->creer && empty($invoicerectmp->suspended)) { - if (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) + if ($invoicerectmp->isMaxNbGenReached()) + { + print $langs->trans("MaxNumberOfGenerationReached"); + } + elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { print ''; print $langs->trans("CreateBill").''; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 668090129ff..3e5aaca5198 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -521,3 +521,4 @@ BillCreated=%s bill(s) created StatusOfGeneratedDocuments=Status of document generation DoNotGenerateDoc=Do not generate document file AutogenerateDoc=Auto generate document file +MaxNumberOfGenerationReached=Max number of gen. reached From 27a8476117fcb9dfc4fa9f5333846226dbf5820e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Apr 2018 17:02:54 +0200 Subject: [PATCH 7/7] FIX remove var_dump --- htdocs/expensereport/note.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/note.php b/htdocs/expensereport/note.php index a715d85f6a6..063406b1878 100644 --- a/htdocs/expensereport/note.php +++ b/htdocs/expensereport/note.php @@ -90,7 +90,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; -var_dump($value_public); + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';