From b0905c90cbca648a225f83d10e89aa5238d10d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean=20Traull=C3=A9?= <613615+jtraulle@users.noreply.github.com> Date: Tue, 27 Aug 2019 12:58:28 +0200 Subject: [PATCH 1/4] Fix Minimum PHP vers. requirement in Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a59e3e8d8f3..cc18e1c0d12 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Multi-company by adding of an external module. - Very user friendly and easy to use. - Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one) -- Works with PHP 5.3+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite)) +- Works with PHP 5.5+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite)) - Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites. - APIs. - An easy to understand, maintain and develop code (PHP with no heavy framework; trigger and hook architecture) From 478b1fea2546694f8ba106201dcb148401413be0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2019 15:06:50 +0200 Subject: [PATCH 2/4] FIX #11711 --- htdocs/adherents/class/adherent_type.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 3a39632d783..0d3980318a4 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -121,10 +121,12 @@ class AdherentType extends CommonObject $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type ("; - $sql.= "libelle"; + $sql.= " morphy"; + $sql.= ", libelle"; $sql.= ", entity"; $sql.= ") VALUES ("; - $sql.= "'".$this->db->escape($this->label)."'"; + $sql.= "'".$this->db->escape($this->morphy)."'"; + $sql.= ", '".$this->db->escape($this->label)."'"; $sql.= ", ".$conf->entity; $sql.= ")"; From 7165389f6c091aa1a4d57a8a592ccd3117241561 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2019 15:39:35 +0200 Subject: [PATCH 3/4] Add log Add protection to avoid change on a non draft invoice. --- htdocs/takepos/invoice.php | 11 ++++++++--- htdocs/takepos/takepos.php | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index a44771da63a..a1b51e6b50b 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -138,7 +138,9 @@ if ($action == 'valid' && $user->rights->facture->creer) if (! empty($conf->stock->enabled) && $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]} != "1") { - $invoice->validate($user, '', $conf->global->{'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]}); + $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; + dol_syslog("Validate invoice with stock change into warehouse id ".$constantforkey); + $invoice->validate($user, '', $conf->global->$cosntantforkey); } else { @@ -259,10 +261,13 @@ if ($action == "deleteline") { } if ($action == "delete") { - if ($placeid > 0) { //If invoice exists + // $placeid is the invoice id (it differs from place) and is defined if the place is set and the ref of invoice is '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')', so the fetch at begining of page works. + if ($placeid > 0) { $result = $invoice->fetch($placeid); - if ($result > 0) + + if ($result > 0 && $invoice->statut == Facture::STATUS_DRAFT) { + // We delete the lines $sql = "DELETE FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture='".$placeid."'"; $resql = $db->query($sql); diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index dba42a105ae..b7061c0e135 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -391,8 +391,9 @@ function Refresh() { } function New() { - console.log("New"); - var r = confirm('trans("ConfirmDeletionOfThisPOSSale"); ?>'); + // If we go here,it means $conf->global->TAKEPOS_BAR_RESTAURANT is not defined + console.log("New with place = , js place="+place); + var r = confirm(' 0 ? $langs->trans("ConfirmDeletionOfThisPOSSale") : $langs->trans("ConfirmDiscardOfThisPOSSale")); ?>'); if (r == true) { $("#poslines").load("invoice.php?action=delete&place="+place, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); @@ -651,7 +652,7 @@ if (empty($conf->global->TAKEPOS_BAR_RESTAURANT)) else { // BAR RESTAURANT specific menu - $menus[$r++]=array('title'=>'
'.$langs->trans("Floors").'
', 'action'=>'Floors();'); + $menus[$r++]=array('title'=>'
'.$langs->trans("Place").'
', 'action'=>'Floors();'); } $menus[$r++]=array('title'=>'
'.$langs->trans("Customer").'
', 'action'=>'Customer();'); From a2b1d96d427016496605137aef116c3b9c3670e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2019 15:42:35 +0200 Subject: [PATCH 4/4] Fix protection in cleaning invoice with transaction. Delete also extrafield lines. --- htdocs/takepos/invoice.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index a1b51e6b50b..9616085f6fb 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -267,9 +267,22 @@ if ($action == "delete") { if ($result > 0 && $invoice->statut == Facture::STATUS_DRAFT) { + $db->begin(); + // We delete the lines - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture='".$placeid."'"; - $resql = $db->query($sql); + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "facturedet_extrafields where fk_object = ".$placeid; + $resql1 = $db->query($sql); + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture = ".$placeid; + $resql2 = $db->query($sql); + + if ($resql1 && $resql2) + { + $db->commit(); + } + else + { + $db->rollback(); + } $invoice->fetch($placeid); }