From bc5c762b8f4a20ae65d7e44d8a8a47e8e7b6452e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 21:00:44 +0100 Subject: [PATCH 01/11] Add DCO file. --- DCO | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 DCO diff --git a/DCO b/DCO new file mode 100644 index 00000000000..aefad374602 --- /dev/null +++ b/DCO @@ -0,0 +1,34 @@ +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2002 - Today The Dolibarr team and its contributors. + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. From b2cb087013915b04059e0b3efd6f8e0351e7ba3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 21:01:07 +0100 Subject: [PATCH 02/11] Add DCO file. --- DCO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DCO b/DCO index aefad374602..d54f007a8c5 100644 --- a/DCO +++ b/DCO @@ -1,7 +1,7 @@ Developer Certificate of Origin Version 1.1 -Copyright (C) 2002 - Today The Dolibarr team and its contributors. +Copyright (C) 2002 - Today, The Dolibarr team and its contributors. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. From d4512c48cde579cc6ebab8ed2ffd7b75e3fa9fcc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 21:11:55 +0100 Subject: [PATCH 03/11] Fix regression --- htdocs/public/payment/newpayment.php | 134 +++------------------------ 1 file changed, 14 insertions(+), 120 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 85ad11bb74b..16cea8746c3 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -914,13 +914,9 @@ if ($source == 'order') { if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment $amount = $order->total_ttc; -<<<<<<< HEAD - if (GETPOST("amount", 'int')) { - $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) { + $amount = GETPOST("amount", 'alpha'); } -======= - if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git $amount = price2num($amount); } @@ -969,14 +965,8 @@ if ($source == 'order') { print ' ('.$langs->trans("ToComplete").')'; } print ''; -<<<<<<< HEAD if (empty($amount) || !is_numeric($amount)) { - print ''; -======= - if (empty($amount) || !is_numeric($amount)) - { print ''; ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git print ''; } else { print ''.price($amount).''; @@ -1048,13 +1038,9 @@ if ($source == 'invoice') { if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment $amount = price2num($invoice->total_ttc - ($invoice->getSommePaiement() + $invoice->getSumCreditNotesUsed() + $invoice->getSumDepositsUsed())); -<<<<<<< HEAD - if (GETPOST("amount", 'int')) { - $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) { + $amount = GETPOST("amount", 'alpha'); } -======= - if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'alpha'); ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git $amount = price2num($amount); } @@ -1106,14 +1092,8 @@ if ($source == 'invoice') { if ($object->type == $object::TYPE_CREDIT_NOTE) { print ''.$langs->trans("CreditNote").''; } elseif (empty($object->paye)) { -<<<<<<< HEAD if (empty($amount) || !is_numeric($amount)) { - print ''; -======= - if (empty($amount) || !is_numeric($amount)) - { print ''; ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git print ''; } else { print ''.price($amount).''; @@ -1224,13 +1204,9 @@ if ($source == 'contractline') { } } -<<<<<<< HEAD - if (GETPOST("amount", 'int')) { - $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) { + $amount = GETPOST("amount", 'alpha'); } -======= - if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git $amount = price2num($amount); } @@ -1320,14 +1296,8 @@ if ($source == 'contractline') { print ' ('.$langs->trans("ToComplete").')'; } print ''; -<<<<<<< HEAD if (empty($amount) || !is_numeric($amount)) { - print ''; -======= - if (empty($amount) || !is_numeric($amount)) - { print ''; ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git print ''; } else { print ''.price($amount).''; @@ -1400,15 +1370,10 @@ if ($source == 'membersubscription') { if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment $amount = $subscription->total_ttc; -<<<<<<< HEAD - if (GETPOST("amount", 'int')) { - $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) { + $amount = GETPOST("amount", 'alpha'); } - $amount = price2num($amount); -======= - if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); $amount = price2num($amount, 'MT'); ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git } if (GETPOST('fulltag', 'alpha')) { @@ -1505,14 +1470,9 @@ if ($source == 'membersubscription') { } if (empty($amount) || !is_numeric($amount)) { //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); -<<<<<<< HEAD if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); } - print ''; - print ''; -======= - if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); print ''; if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { print ''; @@ -1520,15 +1480,11 @@ if ($source == 'membersubscription') { } else { print ''; } ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git } else { $valtoshow = $amount; if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); -<<<<<<< HEAD -======= $amount = $valtoshow; ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git } print ''.price($valtoshow).''; print ''; @@ -1598,13 +1554,9 @@ if ($source == 'donation') { if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment $amount = $subscription->total_ttc; -<<<<<<< HEAD - if (GETPOST("amount", 'int')) { - $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) { + $amount = GETPOST("amount", 'alpha'); } -======= - if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git $amount = price2num($amount); } @@ -1678,24 +1630,16 @@ if ($source == 'donation') { } if (empty($amount) || !is_numeric($amount)) { //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); -<<<<<<< HEAD if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); } - print ''; -======= - if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); print ''; ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git print ''; } else { $valtoshow = $amount; if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); -<<<<<<< HEAD -======= $amount = $valtoshow; ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git } print ''.price($valtoshow).''; print ''; @@ -2181,7 +2125,6 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme console.log("We click on buttontopay"); event.preventDefault(); -<<<<<<< HEAD if (cardholderName.value == '') { console.log("Field Card holder is empty"); @@ -2190,6 +2133,10 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme } else { + /* Disable button to pay and show hourglass cursor */ + jQuery('#hourglasstopay').show(); + jQuery('#buttontopay').hide(); + stripe.handleCardPayment( clientSecret, cardElement, { payment_method_data: { @@ -2240,59 +2187,6 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme }); } }); -======= - if (cardholderName.value == '') - { - console.log("Field Card holder is empty"); - var displayError = document.getElementById('card-errors'); - displayError.textContent = 'trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardOwner"))); ?>'; - } - else - { - /* Disable button to pay and show hourglass cursor */ - jQuery('#hourglasstopay').show(); - jQuery('#buttontopay').hide(); - - stripe.handleCardPayment( - clientSecret, cardElement, { - payment_method_data: { - billing_details: { - name: cardholderName.value - thirdparty) && !empty($object->thirdparty->email))) { ?>, email: 'thirdparty->email); ?>' - thirdparty) && !empty($object->thirdparty->phone)) { ?>, phone: 'thirdparty->phone); ?>' - thirdparty)) { ?>, address: { - city: 'thirdparty->town); ?>', - thirdparty->country_code) { ?>country: 'thirdparty->country_code); ?>', - line1: 'thirdparty->address)); ?>', - postal_code: 'thirdparty->zip); ?>' - } - - } - }, - save_payment_method: /* true when a customer was provided when creating payment intent. true ask to save the card */ - } - ).then(function(result) { - console.log(result); - if (result.error) { - console.log("Error on result of handleCardPayment"); - jQuery('#buttontopay').show(); - jQuery('#hourglasstopay').hide(); - // Inform the user if there was an error - var errorElement = document.getElementById('card-errors'); - errorElement.textContent = result.error.message; - } else { - // The payment has succeeded. Display a success message. - console.log("No error on result of handleCardPayment, so we submit the form"); - // Submit the form - jQuery('#buttontopay').hide(); - jQuery('#hourglasstopay').show(); - // Send form (action=charge that will do nothing) - jQuery('#payment-form').submit(); - } - }); - } - }); ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git Date: Tue, 2 Mar 2021 00:11:15 +0100 Subject: [PATCH 04/11] Close #16395 - Can filter on proposal source in list --- htdocs/comm/propal/card.php | 36 +++++++++++++-------------- htdocs/comm/propal/list.php | 33 ++++++++++++++++++++++-- htdocs/core/class/html.form.class.php | 8 +++--- 3 files changed, 54 insertions(+), 23 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 754d01e3b78..17c36226333 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2113,6 +2113,24 @@ if ($action == 'create') { print ''; print ''; + // Payment mode + print ''; + print ''; + print ''; + if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { + print ''; + } + print '
'; + print $langs->trans('PaymentMode'); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'
'; + print ''; + if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); + } else { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); + } + print ''; + // Delivery date $langs->load('deliveries'); print ''; @@ -2200,24 +2218,6 @@ if ($action == 'create') { print ''; print ''; - // Payment mode - print ''; - print ''; - print ''; - if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print ''; - } - print '
'; - print $langs->trans('PaymentMode'); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'
'; - print ''; - if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); - } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); - } - print ''; - // Multicurrency if (!empty($conf->multicurrency->enabled)) { // Multicurrency code diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index c75589c1aa0..085b9196820 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -95,6 +95,7 @@ $search_availability = GETPOST('search_availability', 'int'); $search_categ_cus = GETPOST("search_categ_cus", 'int'); $search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int'); $search_fk_shipping_method = GETPOST("search_fk_shipping_method", 'int'); +$search_fk_input_reason = GETPOST("search_fk_input_reason", 'int'); $search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int'); $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); @@ -189,6 +190,7 @@ $arrayfields = array( 'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0), 'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0), 'p.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'enabled'=>!empty($conf->expedition->enabled)), + 'p.fk_input_reason'=>array('label'=>"Origin", 'checked'=>0, 'enabled'=>1), 'p.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>0), 'p.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0), 'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), @@ -277,6 +279,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_categ_cus = 0; $search_fk_cond_reglement = ''; $search_fk_shipping_method = ''; + $search_fk_input_reason = ''; $search_fk_mode_reglement = ''; } if ($object_statut != '') { @@ -414,7 +417,7 @@ $sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.total_tva, p.total_tt $sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,'; $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; $sql .= ' p.note_public, p.note_private,'; -$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,'; +$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,'; $sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; $sql .= ' u.login'; if (!$user->rights->societe->client->voir && !$socid) { @@ -547,6 +550,9 @@ if ($search_fk_cond_reglement > 0) { if ($search_fk_shipping_method > 0) { $sql .= " AND p.fk_shipping_method = ".$db->escape($search_fk_shipping_method); } +if ($search_fk_input_reason > 0) { + $sql .= " AND p.fk_input_reason = ".$db->escape($search_fk_input_reason); +} if ($search_fk_mode_reglement > 0) { $sql .= " AND p.fk_mode_reglement = ".$db->escape($search_fk_mode_reglement); } @@ -735,6 +741,9 @@ if ($resql) { if ($search_fk_shipping_method > 0) { $param .= '&search_fk_shipping_method='.$search_fk_shipping_method; } + if ($search_fk_input_reason > 0) { + $param .= '&search_fk_input_reason='.$search_fk_input_reason; + } if ($search_fk_mode_reglement > 0) { $param .= '&search_fk_mode_reglement='.$search_fk_mode_reglement; } @@ -983,6 +992,12 @@ if ($resql) { $form->selectShippingMethod($search_fk_shipping_method, 'search_fk_shipping_method', '', 1, '', 1); print ''; } + // Source - Input reason + if (!empty($arrayfields['p.fk_input_reason']['checked'])) { + print ''; + $form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, 'maxwidth125', 1); + print ''; + } // Payment term if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { print ''; @@ -1169,6 +1184,9 @@ if ($resql) { if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { print_liste_field_titre($arrayfields['p.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "p.fk_shipping_method", "", $param, '', $sortfield, $sortorder); } + if (!empty($arrayfields['p.fk_input_reason']['checked'])) { + print_liste_field_titre($arrayfields['p.fk_input_reason']['label'], $_SERVER["PHP_SELF"], "p.fk_input_reason", "", $param, '', $sortfield, $sortorder); + } if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { print_liste_field_titre($arrayfields['p.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_cond_reglement", "", $param, '', $sortfield, $sortorder); } @@ -1473,7 +1491,7 @@ if ($resql) { $totalarray['nbfield']++; } } - //Shipping Method + // Shipping Method if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { print ''; $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1); @@ -1482,6 +1500,17 @@ if ($resql) { $totalarray['nbfield']++; } } + // Source - input reason + if (!empty($arrayfields['p.fk_input_reason']['checked'])) { + print ''; + if ($obj->fk_input_reason > 0) { + print $form->cache_demand_reason[$obj->fk_input_reason]['label']; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Payment terms if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 08a83d5ad0a..5ecbf41586b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3729,15 +3729,17 @@ class Form * @param string $htmlname Nom de la zone select * @param string $exclude To exclude a code value (Example: SRC_PROP) * @param int $addempty Add an empty entry + * @param string $morecss Add more css to the HTML select component + * @param int $notooltip Do not show the tooltip for admin * @return void */ - public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0) + public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0, $morecss = '', $notooltip = 0) { global $langs, $user; $this->loadCacheInputReason(); - print ''; if ($addempty) { print ''; } @@ -3756,7 +3758,7 @@ class Form print ''; } print ''; - if ($user->admin) { + if ($user->admin && empty($notooltip)) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } print ajax_combobox('select_'.$htmlname); From ebc32103088b7fa845a917a461d121fb15397c76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Mar 2021 01:58:36 +0100 Subject: [PATCH 05/11] FIX #16343 --- htdocs/admin/propal.php | 6 +++--- htdocs/includes/odtphp/odf.php | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index c515fe27a58..a0d590579ca 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -402,13 +402,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -417,7 +417,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PROPALE_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 800b29a918d..91fec8d998e 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -913,16 +913,20 @@ IMG; { dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG); $filename=''; $linenum=0; - if (headers_sent($filename, $linenum)) { - throw new OdfException("headers already sent ($filename at $linenum)"); + + if (php_sapi_name() != 'cli') { // If we are in a web context (not into CLI context) + if (headers_sent($filename, $linenum)) { + throw new OdfException("headers already sent ($filename at $linenum)"); + } + + if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $name=preg_replace('/\.od(x|t)/i', '', $name); + header('Content-type: application/pdf'); + header('Content-Disposition: attachment; filename="'.$name.'.pdf"'); + readfile($name.".pdf"); + } } - if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - $name=preg_replace('/\.od(x|t)/i', '', $name); - header('Content-type: application/pdf'); - header('Content-Disposition: attachment; filename="'.$name.'.pdf"'); - readfile($name.".pdf"); - } if (!empty($conf->global->MAIN_ODT_AS_PDF_DEL_SOURCE)) { unlink($name); @@ -931,7 +935,7 @@ IMG; dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG); dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr, true), LOG_DEBUG); - if ($retval==126) { + if ($retval == 126) { throw new OdfException('Permission execute convert script : ' . $command); } else { From 0670a00b833b2abb62d1cf7251ae239bbb44f6fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Mar 2021 02:06:09 +0100 Subject: [PATCH 06/11] Fix phpcs --- htdocs/compta/bank/various_payment/card.php | 3 +- htdocs/don/card.php | 3 +- htdocs/public/payment/newpayment.php | 46 +++++++++---------- .../canvas/company/tpl/card_create.tpl.php | 16 +++---- .../canvas/individual/tpl/card_create.tpl.php | 16 +++---- test/phpunit/DateLibTzFranceTest.php | 12 ++--- 6 files changed, 46 insertions(+), 50 deletions(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 27dfe941f88..d19ccbed908 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -341,8 +341,7 @@ foreach ($bankcateg->fetchAll() as $bankcategory) { /* ************************************************************************** */ if ($action == 'create') { // Update fields properties in realtime - if (!empty($conf->use_javascript_ajax)) - { + if (!empty($conf->use_javascript_ajax)) { print "\n".'