From 0d384eea008994aea4b7def68ad5f9493fa2a63d Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Wed, 16 Jan 2019 09:30:48 +0100 Subject: [PATCH 1/5] FIX credit note can have negative value --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9ad793934990c..8541581fb494b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1695,7 +1695,7 @@ setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); $error++; } - if ($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not '' + if (($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) // Unit price can be 0 but not '' { if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) { @@ -2155,7 +2155,7 @@ setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); $error++; } - if (empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && $pu_ht_devise == '') // Unit price can be 0 but not '' + if ((empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && $pu_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) // Unit price can be 0 but not '' { if ($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) { From 7df86cb630d19a2ae3bda96f2792958bf77fe26b Mon Sep 17 00:00:00 2001 From: a-schild Date: Wed, 16 Jan 2019 13:06:12 +0100 Subject: [PATCH 2/5] Fix for issue #10333 paymentterm.class.php invalid SQL in fetch --- htdocs/compta/facture/class/paymentterm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 3697a61672b7f..90a564fa006d8 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -164,7 +164,7 @@ function fetch($id) global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; - $sql.= " t.entity"; + $sql.= " t.entity,"; $sql.= " t.code,"; $sql.= " t.sortorder,"; From 7e3bfd332e42e521dc8e708611a817802a260868 Mon Sep 17 00:00:00 2001 From: a-schild Date: Wed, 16 Jan 2019 13:07:00 +0100 Subject: [PATCH 3/5] Fix for issue #10333 paymentterm.class.php invalid SQL in fetch --- htdocs/compta/facture/class/paymentterm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index bc13b0d58766c..06a76d6559e81 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -167,7 +167,7 @@ function fetch($id) global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; - $sql.= " t.entity"; + $sql.= " t.entity,"; $sql.= " t.code,"; $sql.= " t.sortorder,"; From 6becdc8af4684dfb2c1400afe19e7a4e254cdda3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Jan 2019 16:34:36 +0100 Subject: [PATCH 4/5] Fix missing substitution of ID --- htdocs/adherents/class/adherent.class.php | 4 +++- htdocs/adherents/subscription.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 11fb1a1a11123..b4cedc9811846 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -213,7 +213,9 @@ function makeSubstitution($text) // Substitutions $substitutionarray=array( - '__CIVILITY__'=>$this->getCivilityLabel(), + '__ID__'=>$this->id, + '__MEMBER_ID__'=>$this->id, + '__CIVILITY__'=>$this->getCivilityLabel(), '__FIRSTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname, '__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname, '__FULLNAME__'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs), diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 60969908a4448..69e22adf8826a 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -558,7 +558,7 @@ if (! $error) { // Send confirmation Email - if ($object->email && $_POST["sendmail"]) + if ($object->email && $_POST["sendmail"]) // $object is 'Adherent' { $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT); $texttosend=$object->makeSubstitution($adht->getMailOnSubscription()); From 1d33b6ccbb64f3fbeb3ef1270b1ceeb6e239b915 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 17 Jan 2019 16:01:32 +0100 Subject: [PATCH 5/5] FIX broken external authentication module feature and avoid warning --- htdocs/cashdesk/class/Facturation.class.php | 3 +-- htdocs/cashdesk/index.php | 29 +++++++++++++++++++++ htdocs/cashdesk/tpl/liste_articles.tpl.php | 3 +-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index a0e992e9da95f..e76f6c3a1426e 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -211,8 +211,7 @@ public function calculTotaux() $total_localtax1 = 0; $total_localtax2 = 0; - $tab=array(); - $tab = $_SESSION['poscart']; + $tab = (! empty($_SESSION['poscart'])?$_SESSION['poscart']:array()); $tab_size=count($tab); for($i=0;$i < $tab_size;$i++) diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 24b945629157e..c09521585e60e 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -41,6 +41,8 @@ $usertxt=GETPOST('user','',1); $err=GETPOST("err"); +// Instantiate hooks of thirdparty module only if not already define +$hookmanager->initHooks(array('cashdeskloginpage')); /* * View @@ -51,6 +53,15 @@ $arrayofcss=array('/cashdesk/css/style.css'); top_htmlhead('','',0,0,'',$arrayofcss); + +// Execute hook getLoginPageOptions (for table) +$parameters=array('entity' => GETPOST('entity','int')); +$reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks. +if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) { + $morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility +} else { + $morelogincontent = $hookmanager->resPrint; +} ?> @@ -92,6 +103,24 @@ + $option) + { + if ($format == 'table') { + echo ''; + echo $option; + } + } + } + else { + echo ''; + echo $morelogincontent; + } +} +?> +   diff --git a/htdocs/cashdesk/tpl/liste_articles.tpl.php b/htdocs/cashdesk/tpl/liste_articles.tpl.php index 65f48b0603c24..082a1f901cd3e 100644 --- a/htdocs/cashdesk/tpl/liste_articles.tpl.php +++ b/htdocs/cashdesk/tpl/liste_articles.tpl.php @@ -46,8 +46,7 @@ $societe->fetch($thirdpartyid); /** end add Ditto */ -$tab=array(); -$tab = $_SESSION['poscart']; +$tab = (! empty($_SESSION['poscart'])?$_SESSION['poscart']:array()); $tab_size=count($tab); if ($tab_size <= 0) print '
'.$langs->trans("NoArticle").'

';