From 83412e3c90692961c3f2ce5aaaad85147d2b5e12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2019 16:38:57 +0200 Subject: [PATCH 1/5] Fix warning --- htdocs/modulebuilder/template/class/myobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 3c68b0472e2..173fb975438 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -388,7 +388,7 @@ class MyObject extends CommonObject $sql = 'SELECT '; $sql .= $this->getFieldList(); $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; - if ($this->ismultientitymanaged) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; + if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; else $sql .= ' WHERE 1 = 1'; // Manage filter $sqlwhere = array(); From b40f2cbcce1c633e646a2f1ce58afefcc890e656 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2019 20:20:09 +0200 Subject: [PATCH 2/5] Fix responsive --- htdocs/expensereport/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index a764e2df47c..f76e96e78a1 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1679,7 +1679,7 @@ else if ($action == 'cancel') { - $array_input = array('text'=>$langs->trans("ConfirmCancelTrip"), array('type'=>"text",'label'=>''.$langs->trans("Comment").'','name'=>"detail_cancel",'size'=>"50",'value'=>"")); + $array_input = array('text'=>$langs->trans("ConfirmCancelTrip"), array('type'=>"text",'label'=>''.$langs->trans("Comment").'','name'=>"detail_cancel",'value'=>"")); $formconfirm=$form->formconfirm($_SEVER["PHP_SELF"]."?id=".$id, $langs->trans("Cancel"), "", "confirm_cancel", $array_input, "", 1); } @@ -1690,7 +1690,7 @@ else if ($action == 'refuse') // Deny { - $array_input = array('text'=>$langs->trans("ConfirmRefuseTrip"), array('type'=>"text",'label'=>$langs->trans("Comment"),'name'=>"detail_refuse",'size'=>"50",'value'=>"")); + $array_input = array('text'=>$langs->trans("ConfirmRefuseTrip"), array('type'=>"text",'label'=>$langs->trans("Comment"),'name'=>"detail_refuse",'value'=>"")); $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("Deny"), '', "confirm_refuse", $array_input, "yes", 1); } From f3e38f4b09ebcd7e41372cd7f40da9de9010f7a1 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 f76e96e78a1..c7cb9776aeb 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -996,6 +996,34 @@ if (empty($reshook)) } } + 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); @@ -2662,8 +2690,8 @@ if ($action != 'create' && $action != 'edit') } - // If status is Appoved - // -------------------- + // If status is Approved + // --------------------- if ($user->rights->expensereport->approve && $object->fk_statut == ExpenseReport::STATUS_APPROVED) { @@ -2707,9 +2735,15 @@ if ($action != 'create' && $action != 'edit') 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 1160a6dcb94..dceb31c89fb 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1397,12 +1397,12 @@ class ExpenseReport extends CommonObject // phpcs:enable $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 4b67ced59c9..ab4d9096df2 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -95,6 +95,7 @@ PaymentHigherThanReminderToPay=Payment higher than reminder to pay HelpPaymentHigherThanReminderToPay=Attention, the payment amount of one or more bills is higher than the outstanding amount to pay.
Edit your entry, otherwise confirm and consider creating a credit note for the excess received for each overpaid invoice. HelpPaymentHigherThanReminderToPaySupplier=Attention, the payment amount of one or more bills is higher than the outstanding amount to pay.
Edit your entry, otherwise confirm and consider creating a credit note for 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 41f5aca717c..ca251ed0d93 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -96,6 +96,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 f210e286bd6cc927fca6d2d5970113f78f0b2dcc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2019 20:53:28 +0200 Subject: [PATCH 4/5] Fix balance of div --- htdocs/expensereport/payment/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index 73da11f4619..890884b2e37 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.php @@ -286,7 +286,6 @@ else dol_print_error($db); } -print ''; /* From d663657f15fc813523566af00c77493e41436734 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Aug 2019 13:04:37 +0200 Subject: [PATCH 5/5] FIX format of field with type timestamp --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e607e8f214a..4e88348c6d0 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6056,7 +6056,7 @@ abstract class CommonObject { $morecss = 'minwidth100imp'; } - elseif ($type == 'datetime') + elseif ($type == 'datetime' || $type == 'timestamp') { $morecss = 'minwidth200imp'; } @@ -6100,7 +6100,7 @@ abstract class CommonObject $value=''; } } - elseif ($type == 'datetime') + elseif ($type == 'datetime' || $type == 'timestamp') { if(! empty($value)) { $value=dol_print_date($value, 'dayhour');