From ad7278e6a51173ea31b2f022cd68102afd322a68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 02:48:24 +0100 Subject: [PATCH 1/7] FIX Label of DEPOSIT on screen Fix look and feel v11 --- htdocs/commande/card.php | 10 +++--- htdocs/compta/facture/card.php | 45 +++++++++++++++---------- htdocs/core/tpl/objectline_view.tpl.php | 8 ++++- htdocs/fourn/facture/card.php | 2 +- htdocs/langs/en_US/bills.lang | 2 +- 5 files changed, 42 insertions(+), 25 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index c1dfd1ae43b..7da9fcca7d1 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2542,6 +2542,11 @@ if ($action == 'create' && $usercancreate) // Note that $action and $object may be modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); if (empty($reshook)) { + // Reopen a closed order + if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) { + print '
'.$langs->trans('ReOpen').'
'; + } + // Send if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) { if ($usercansend) { @@ -2619,11 +2624,6 @@ if ($action == 'create' && $usercancreate) } } - // Reopen a closed order - if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) { - print '
'.$langs->trans('ReOpen').'
'; - } - // Set to shipped if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) { print '
'.$langs->trans('ClassifyShipped').'
'; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6e5ed9de613..3057d5ebe11 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -103,7 +103,9 @@ $extrafields = new ExtraFields($db); // Load object if ($id > 0 || !empty($ref)) { - $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION); + if ($action != 'add') { + $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION); + } } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -134,6 +136,7 @@ if ($user->socid) $socid = $user->socid; $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft); + /* * Actions */ @@ -941,11 +944,13 @@ if (empty($reshook)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); + $action = 'create'; } if (!($_POST['fac_replacement'] > 0)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors'); + $action = 'create'; } $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); @@ -992,6 +997,7 @@ if (empty($reshook)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), null, 'errors'); + $action = 'create'; } $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); @@ -999,6 +1005,7 @@ if (empty($reshook)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); + $action = 'create'; } $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); @@ -1181,6 +1188,7 @@ if (empty($reshook)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); + $action = 'create'; } $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); @@ -1223,6 +1231,7 @@ if (empty($reshook)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors'); + $action = 'create'; } $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); @@ -1230,6 +1239,7 @@ if (empty($reshook)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); + $action = 'create'; } $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); @@ -1642,6 +1652,7 @@ if (empty($reshook)) $error++; $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation")); setEventMessages($mesg, null, 'errors'); + $action = 'create'; } if (!$error) { @@ -2939,7 +2950,7 @@ if ($action == 'create') if (($origin == 'propal') || ($origin == 'commande')) { print ''; - $arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount'), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit'))); + $arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit'))); print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1); print ''; print ''.$langs->trans('Value').':'; @@ -5082,21 +5093,6 @@ elseif ($id > 0 || !empty($ref)) } } - // Clone - if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) - { - print ''.$langs->trans("ToClone").''; - } - - // Clone as predefined / Create template - if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate) - { - if (!$objectidnext && count($object->lines) > 0) - { - print ''.$langs->trans("ChangeIntoRepeatableInvoice").''; - } - } - // Create a credit note if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate) { @@ -5123,6 +5119,21 @@ elseif ($id > 0 || !empty($ref)) } } + // Clone + if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) + { + print ''.$langs->trans("ToClone").''; + } + + // Clone as predefined / Create template + if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate) + { + if (!$objectidnext && count($object->lines) > 0) + { + print ''.$langs->trans("ChangeIntoRepeatableInvoice").''; + } + } + // Remove situation from cycle if ($object->statut > Facture::STATUS_DRAFT && $object->type == Facture::TYPE_SITUATION diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 12bb5053a46..408a2a6f5b2 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -135,7 +135,13 @@ else echo $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); } else { if (!empty($line->fk_parent_line)) echo img_picto('', 'rightarrow'); - echo $text.' '.dol_htmlentitiesbr($line->description); + if (preg_match('/^\(DEPOSIT\)/', $line->description)) { + $newdesc = preg_replace('/^\(DEPOSIT\)/', $langs->trans("Deposit"), $line->description); + echo $text.' '.dol_htmlentitiesbr($newdesc); + } + else { + echo $text.' '.dol_htmlentitiesbr($line->description); + } } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 9872874a1d0..d7a258b517e 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1845,7 +1845,7 @@ if ($action == 'create') if (($origin == 'propal') || ($origin == 'commande')) { print ''; - $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); + $arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit'))); print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1); print ''; print '' . $langs->trans('Value') . ':'; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index e6ea4390fd8..83ebdece24b 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -416,7 +416,7 @@ PaymentConditionShort14D=14 days PaymentCondition14D=14 days PaymentConditionShort14DENDMONTH=14 days of month-end PaymentCondition14DENDMONTH=Within 14 days following the end of the month -FixAmount=Fixed amount +FixAmount=Fixed amount - 1 line with label '%s' VarAmount=Variable amount (%% tot.) VarAmountOneLine=Variable amount (%% tot.) - 1 line with label '%s' # PaymentType From 849c78f4cd6a347687ce813dd43c5b52dc10ca05 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 10:12:39 +0100 Subject: [PATCH 2/7] Doc --- htdocs/compta/facture/card.php | 36 ++++++++++++++++--------------- htdocs/core/lib/functions.lib.php | 3 ++- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3057d5ebe11..ffed0ec77b0 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2134,7 +2134,7 @@ if (empty($reshook)) if (!GETPOST('qty')) $special_code = 3; $line = new FactureLigne($db); - $line->fetch(GETPOST('lineid')); + $line->fetch(GETPOST('lineid', 'int')); $percent = $line->get_prev_progress($object->id); if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0) @@ -2294,17 +2294,17 @@ if (empty($reshook)) } } - elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) + elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) // Update all lines of situation invoice { if (!$object->fetch($id) > 0) dol_print_error($db); - if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "") + if (GETPOST('all_progress') != "") { $all_progress = GETPOST('all_progress', 'int'); foreach ($object->lines as $line) { $percent = $line->get_prev_progress($object->id); if (floatval($all_progress) < floatval($percent)) { - $mesg = $langs->trans("Line").' '.$i.' '.$line->ref.' : '.$langs->trans("CantBeLessThanMinPercent"); + $mesg = $langs->trans("Line").' '.$i.' : '.$langs->trans("CantBeLessThanMinPercent"); setEventMessages($mesg, null, 'warnings'); $result = -1; } else @@ -2314,7 +2314,7 @@ if (empty($reshook)) } elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) { - header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // Pour reaffichage de la fiche en cours d'edition + header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page exit(); } @@ -3003,14 +3003,16 @@ if ($action == 'create') exit(); } $options = ""; - foreach ($facids as $facparam) - { - $options .= ''; + if (is_array($facids)) { + foreach ($facids as $facparam) + { + $options .= ''; + } } print ''; @@ -4251,7 +4253,7 @@ elseif ($id > 0 || !empty($ref)) } else { - print $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none'); if (!$displayWarranty) { print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" '); } @@ -4568,7 +4570,7 @@ elseif ($id > 0 || !empty($ref)) print ''; // Payments already done (from payment on this invoice) - $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,'; + $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,'; $sql .= ' c.code as payment_code, c.libelle as payment_label,'; $sql .= ' pf.amount,'; $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal'; @@ -4594,7 +4596,7 @@ elseif ($id > 0 || !empty($ref)) $paymentstatic->id = $objp->rowid; $paymentstatic->datepaye = $db->jdate($objp->dp); $paymentstatic->ref = $objp->ref; - $paymentstatic->num_paiement = $objp->num_paiement; + $paymentstatic->num_payment = $objp->num_payment; $paymentstatic->payment_code = $objp->payment_code; print ''; @@ -4602,7 +4604,7 @@ elseif ($id > 0 || !empty($ref)) print ''; print ''.dol_print_date($db->jdate($objp->dp), 'dayhour').''; $label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label; - print ''.$label.' '.$objp->num_paiement.''; + print ''.$label.' '.$objp->num_payment.''; if (!empty($conf->banque->enabled)) { $bankaccountstatic->id = $objp->baid; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 228a0583ac4..112e09daad3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4515,7 +4515,8 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ /** * Function that return a number with universal decimal format (decimal separator is '.') from an amount typed by a user. - * Function to use on each input amount before any numeric test or database insert + * Function to use on each input amount before any numeric test or database insert. A better name for this function + * should be text2num(). * * @param float $amount Amount to convert/clean * @param string $rounding ''=No rounding From d7423c23de19ab13461022a6c1f730859778a2e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 12:34:53 +0100 Subject: [PATCH 3/7] Doc --- htdocs/core/class/conf.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 7d344717514..4136cef1be5 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -309,7 +309,7 @@ class Conf { if (!empty($this->$module->enabled)) { - foreach ($dirs as $type => $name) + foreach ($dirs as $type => $name) // $type is 'output' or 'temp' { $subdir = ($type == 'temp' ? '/temp' : ''); // For multicompany sharings From 6318f21a8fc457d9c790b9fed0422985ca27870d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 15:07:18 +0100 Subject: [PATCH 4/7] Trans --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 011bb0b613d..020e61f721a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1766,6 +1766,7 @@ GoOntoUserCardToAddMore=Go to the tab "Notifications" of a user to add or remove GoOntoContactCardToAddMore=Go to the tab "Notifications" of a third party to add or remove notifications for contacts/addresses Threshold=Threshold BackupDumpWizard=Wizard to build the backup file +BackupZipWizard=Wizard to archive the documents SomethingMakeInstallFromWebNotPossible=Installation of external module is not possible from the web interface for the following reason: SomethingMakeInstallFromWebNotPossible2=For this reason, process to upgrade described here is a manual process only a privileged user may perform. InstallModuleFromWebHasBeenDisabledByFile=Install of external module from application has been disabled by your administrator. You must ask him to remove the file %s to allow this feature. From 76e7c147b3cab8db555006df3f9e531f0e051de8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 18:03:57 +0100 Subject: [PATCH 5/7] Look and feel v11 --- htdocs/compta/paiement.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 67da7f0d766..5b297eed309 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -637,7 +637,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } - print ''; + print ''; print ''; print $invoice->getNomUrl(1, ''); @@ -715,7 +715,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } // Price - print 'id == $facid) ? ' style="font-weight: bold" ' : '').'>'.price($sign * $objp->total_ttc).''; + print ''.price($sign * $objp->total_ttc).''; // Received or paid back print ''.price($sign * $paiement); From 1d058e8707ab6412c7b46173000679dccd611977 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 18:09:29 +0100 Subject: [PATCH 6/7] Fix look and feel v11 --- htdocs/fourn/facture/paiement.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 53ccf3d4d58..0949f179d5b 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -606,7 +606,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $multicurrency_remaintopay = price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits, 'MT'); } - print ''; + print ''; // Ref print ''; @@ -619,7 +619,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Date if ($objp->df > 0) { - print ''; + print ''; print dol_print_date($db->jdate($objp->df), 'day').''; } else @@ -630,7 +630,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Date Max Payment if ($objp->dlr > 0) { - print ''; + print ''; print dol_print_date($db->jdate($objp->dlr), 'day'); if ($invoice->hasDelay()) @@ -973,7 +973,7 @@ if (empty($action) || $action == 'list') { $objp = $db->fetch_object($resql); - print ''; + print ''; // Ref payment print ''.img_object($langs->trans('ShowPayment'), 'payment').' '.$objp->pid.''; From a8fd6f56ea8d8e251647aa25123aa6df6fdb74eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2020 18:12:52 +0100 Subject: [PATCH 7/7] Look and feel v11 --- htdocs/fourn/facture/paiement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 0949f179d5b..e9198ebcc91 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -973,7 +973,7 @@ if (empty($action) || $action == 'list') { $objp = $db->fetch_object($resql); - print ''; + print ''; // Ref payment print ''.img_object($langs->trans('ShowPayment'), 'payment').' '.$objp->pid.'';