From f64092a1e84896b91d54c56cd7d9b49936bca74f Mon Sep 17 00:00:00 2001 From: atm-arnaud Date: Thu, 1 Aug 2019 11:00:49 +0200 Subject: [PATCH 1/5] FIX order or proposals billed if both workflow conf activated --- .../interface_20_modWorkflow_WorkflowManager.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 2c7ee724d2fb0..583701f7bc930 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -121,7 +121,8 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf if ($action == 'BILL_VALIDATE') { dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id ); - + $ret = null; + // First classify billed the order to allow the proposal classify process if (! empty($conf->commande->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) { @@ -142,7 +143,6 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf } } } - return $ret; } // Second classify billed the proposal. @@ -165,8 +165,9 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf } } } - return $ret; } + + return $ret; } // classify billed order & billed propososal From cd0d5c41f5d02952ba556f9487d03f3281024636 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2019 16:37:40 +0200 Subject: [PATCH 2/5] Update interface_20_modWorkflow_WorkflowManager.class.php --- .../triggers/interface_20_modWorkflow_WorkflowManager.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 583701f7bc930..8c849f5fa4038 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -121,7 +121,7 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf if ($action == 'BILL_VALIDATE') { dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id ); - $ret = null; + $ret = 0; // First classify billed the order to allow the proposal classify process if (! empty($conf->commande->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) From 5339bb71ac2df1cfae61ab90acdce8c340179209 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2019 20:53:18 +0200 Subject: [PATCH 3/5] FIX Fatal situation if payment removed on expense report. Action set_unpaid was not available. --- htdocs/expensereport/card.php | 40 +++++++++++++++++-- .../class/expensereport.class.php | 4 +- htdocs/langs/en_US/bills.lang | 1 + htdocs/langs/fr_FR/bills.lang | 1 + 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 21e716d7ac16d..22410ee408512 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -967,6 +967,34 @@ } } + if ($action == 'set_unpaid' && $id > 0 && $user->rights->expensereport->to_paid) + { + $object = new ExpenseReport($db); + $object->fetch($id); + + $result = $object->set_unpaid($user); + + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + } + if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) { $object = new ExpenseReport($db); @@ -2349,8 +2377,8 @@ } - // If status is Appoved - // -------------------- + // If status is Approved + // --------------------- if ($user->rights->expensereport->approve && $object->fk_statut == 5) { @@ -2394,9 +2422,15 @@ print ''; } + if ($user->rights->expensereport->to_paid && $object->paid && $object->fk_statut == ExpenseReport::STATUS_CLOSED) + { + // Set unpaid + print ''; + } + // Clone if ($user->rights->expensereport->creer) { - print ''; + print ''; } /* If draft, validated, cancel, and user can create, he can always delete its card before it is approved */ diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 3f5029c4ef685..9bbf6617369d4 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1366,12 +1366,12 @@ function set_unpaid($fuser, $notrigger = 0) { $error = 0; - if ($this->fk_c_deplacement_statuts != 5) + if ($this->paid) { $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql.= " SET fk_statut = 5"; + $sql.= " SET paid = 0"; $sql.= ' WHERE rowid = '.$this->id; dol_syslog(get_class($this)."::set_unpaid sql=".$sql, LOG_DEBUG); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index fae0f88fcc542..02bddd4b923f3 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -94,6 +94,7 @@ PaymentHigherThanReminderToPay=Payment higher than reminder to pay HelpPaymentHigherThanReminderToPay=Attention, the payment amount of one or more bills is higher than the rest to pay.
Edit your entry, otherwise confirm and think about creating a credit note of the excess received for each overpaid invoices. HelpPaymentHigherThanReminderToPaySupplier=Attention, the payment amount of one or more bills is higher than the rest to pay.
Edit your entry, otherwise confirm and think about creating a credit note of the excess paid for each overpaid invoice. ClassifyPaid=Classify 'Paid' +ClassifyUnPaid=Classify 'Unpaid' ClassifyPaidPartially=Classify 'Paid partially' ClassifyCanceled=Classify 'Abandoned' ClassifyClosed=Classify 'Closed' diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 4b088f8dea26a..cbdcd3aefafbd 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -95,6 +95,7 @@ HelpPaymentHigherThanReminderToPay=Attention, le montant de paiement pour une ou HelpPaymentHigherThanReminderToPaySupplier=Attention, le montant de paiement pour une ou plusieurs factures est supérieur au reste à payer.
Corrigez votre saisie, sinon, confirmez et pensez à créer un avoir pour l'excédent pour chaque facture surpayée. ClassifyPaid=Classer 'Payée' ClassifyPaidPartially=Classer 'Payée partiellement' +ClassifyUnPaid=Classer 'Non payée' ClassifyCanceled=Classer 'Abandonnée' ClassifyClosed=Classer 'Fermée' ClassifyUnBilled=Classer 'Non facturée' From 41c07b9b4364dc5c6a261dcbd65cb00a68ee1d45 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 5 Aug 2019 13:10:26 +0200 Subject: [PATCH 4/5] fix bad test in delivery card --- htdocs/livraison/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 2e1c9cb47c10e..028ce581358a4 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -570,7 +570,7 @@ } // Other attributes - if ($action = 'create_delivery') { + if ($action == 'create_delivery') { // copy from expedition $expeditionExtrafields = new Extrafields($db); $expeditionExtrafieldLabels = $expeditionExtrafields->fetch_name_optionals_label($expedition->table_element); From 1d4fc32c20f0beb8d5eb21965ae413e9fc616674 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 5 Aug 2019 13:13:56 +0200 Subject: [PATCH 5/5] fix second bad test --- htdocs/livraison/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 028ce581358a4..13a6196d3a389 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -675,7 +675,7 @@ $mode = ($object->statut == 0) ? 'edit' : 'view'; $line = new LivraisonLigne($db); $line->fetch_optionals($object->lines[$i]->id); - if ($action = 'create_delivery') { + if ($action == 'create_delivery') { $srcLine = new ExpeditionLigne($db); $expeditionLineExtrafields = new Extrafields($db); $expeditionLineExtrafieldLabels = $expeditionLineExtrafields->fetch_name_optionals_label($srcLine->table_element);