From 1f4bd8476b057f687efec464ebeb18a13ebe7a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 25 Oct 2020 15:42:15 +0100 Subject: [PATCH 01/79] doxygen --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index fe7866f3a50..9ea5808c374 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3952,7 +3952,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss * However, one must try to call it only within php pages, classes must return their error through their property "error". * * @param DoliDB $db Database handler - * @param string|[string] $error String or array of errors strings to show + * @param string|string[] $error String or array of errors strings to show * @param array $errors Array of errors * @return void * @see dol_htmloutput_errors() @@ -6691,7 +6691,7 @@ function dolGetFirstLastname($firstname, $lastname, $nameorder = -1) * Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function. * Note: Prefer to use setEventMessages instead. * - * @param string|[string] $mesgs Message string or array + * @param string|string[] $mesgs Message string or array * @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors') * @return void * @see dol_htmloutput_events() From 3efcb0dfeb2286532fa8c5e321fa0d05eb16ebf8 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sun, 25 Oct 2020 16:19:16 +0100 Subject: [PATCH 02/79] Display application Title if filled on login page --- htdocs/core/tpl/login.tpl.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 6ae102d47fb..3f4507ebfe3 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -52,7 +52,13 @@ $arrayofjs = array( '/includes/jstz/jstz.min.js'.(empty($conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION)), '/core/js/dst.js'.(empty($conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION)) ); -$titleofloginpage = $langs->trans('Login').' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version. + +// we display application title instead Login term +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) + $titleofloginpage = $conf->global->MAIN_APPLICATION_TITLE; +else + $titleofloginpage = $langs->trans('Login'); +$titleofloginpage.= ' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version. $disablenofollow = 1; if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) $disablenofollow = 0; From 949be12e19cade59ab345f9729974d7b9ff98381 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 25 Oct 2020 17:26:15 +0100 Subject: [PATCH 03/79] fix migration livraison to delivery --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 7 +++++-- htdocs/install/mysql/tables/llx_deliverydet.key.sql | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index a73ca40d86f..9957e23e012 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -456,9 +456,12 @@ ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); -ALTER TABLE llx_deliverydet CHANGE COLUMN fk_livraison fk_delivery integer; +ALTER TABLE llx_deliverydet DROP CONSTRAINT fk_livraisondet_fk_livraison; +ALTER TABLE llx_deliverydet DROP INDEX idx_livraisondet_fk_expedition; +ALTER TABLE llx_deliverydet CHANGE COLUMN fk_livraison fk_delivery integer; +ALTER TABLE llx_deliverydet ADD INDEX idx_deliverydet_fk_delivery (fk_delivery); +ALTER TABLE llx_deliverydet ADD CONSTRAINT fk_deliverydet_fk_delivery FOREIGN KEY (fk_delivery) REFERENCES llx_delivery (rowid); --- update llx_extrafields UPDATE llx_extrafields SET elementtype = 'delivery' WHERE elementtype = 'livraison'; UPDATE llx_extrafields SET elementtype = 'deliverydet' WHERE elementtype = 'livraisondet'; diff --git a/htdocs/install/mysql/tables/llx_deliverydet.key.sql b/htdocs/install/mysql/tables/llx_deliverydet.key.sql index 67ad3c37615..ce302383f4b 100644 --- a/htdocs/install/mysql/tables/llx_deliverydet.key.sql +++ b/htdocs/install/mysql/tables/llx_deliverydet.key.sql @@ -18,5 +18,5 @@ -- =================================================================== -ALTER TABLE llx_deliverydet ADD INDEX idx_deliverydet_fk_expedition (fk_delivery); +ALTER TABLE llx_deliverydet ADD INDEX idx_deliverydet_fk_delivery (fk_delivery); ALTER TABLE llx_deliverydet ADD CONSTRAINT fk_deliverydet_fk_delivery FOREIGN KEY (fk_delivery) REFERENCES llx_delivery (rowid); From f2d21d68d68173de15bc4dbc5a8a126901865551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 25 Oct 2020 18:23:00 +0100 Subject: [PATCH 04/79] selectTypeContact return void --- htdocs/core/tpl/contacts.tpl.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 1cb8b813001..012c39c126d 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -108,7 +108,7 @@ if ($permission) element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject = $objectsrc; - echo $formcompany->selectTypeContact($tmpobject, '', 'type', 'internal'); + $formcompany->selectTypeContact($tmpobject, '', 'type', 'internal'); ?>
 
">
@@ -117,8 +117,7 @@ if ($permission)
address = 'Twist road'; @@ -239,7 +247,8 @@ class Don extends CommonObject $this->note_private = 'Private note'; $this->note_public = 'Public note'; $this->email = 'email@email.com'; - $this->note = ''; + $this->phone = '0123456789'; + $this->phone_mobile = '0606060606'; $this->statut = 1; } @@ -392,17 +401,17 @@ class Don extends CommonObject $sql .= ", '".$this->db->escape($this->address)."'"; $sql .= ", '".$this->db->escape($this->zip)."'"; $sql .= ", '".$this->db->escape($this->town)."'"; - $sql .= ", ".($this->country_id > 0 ? $this->country_id : '0'); - $sql .= ", ".((int) $this->public); - $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null"); + $sql .= ", ".(int) $this->country_id; + $sql .= ", ".(int) $this->public; + $sql .= ", ".($this->fk_project > 0 ? (int) $this->fk_project : "null"); $sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL"); $sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL"); $sql .= ", ".$user->id; $sql .= ", null"; $sql .= ", '".$this->db->idate($this->date)."'"; - $sql .= ", '".$this->db->escape($this->email)."'"; - $sql .= ", '".$this->db->escape($this->phone)."'"; - $sql .= ", '".$this->db->escape($this->phone_mobile)."'"; + $sql .= ", '".$this->db->escape(trim($this->email))."'"; + $sql .= ", '".$this->db->escape(trim($this->phone))."'"; + $sql .= ", '".$this->db->escape(trim($this->phone_mobile))."'"; $sql .= ")"; $resql = $this->db->query($sql); @@ -426,13 +435,9 @@ class Don extends CommonObject // Update extrafield if (!$error) { - if (!$error) - { - $result = $this->insertExtraFields(); - if ($result < 0) - { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } } @@ -490,9 +495,9 @@ class Don extends CommonObject $sql .= ",note_public=".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL"); $sql .= ",datedon='".$this->db->idate($this->date)."'"; $sql .= ",date_valid=".($this->date_valid ? "'".$this->db->idate($this->date)."'" : "null"); - $sql .= ",email='".$this->db->escape($this->email)."'"; - $sql .= ",phone='".$this->db->escape($this->phone)."'"; - $sql .= ",phone_mobile='".$this->db->escape($this->phone_mobile)."'"; + $sql .= ",email='".$this->db->escape(trim($this->email))."'"; + $sql .= ",phone='".$this->db->escape(trim($this->phone))."'"; + $sql .= ",phone_mobile='".$this->db->escape(trim($this->phone_mobile))."'"; $sql .= ",fk_statut=".$this->statut; $sql .= " WHERE rowid = ".$this->id; @@ -511,13 +516,10 @@ class Don extends CommonObject // Update extrafield if (!$error) { - if (!$error) + $result = $this->insertExtraFields(); + if ($result < 0) { - $result = $this->insertExtraFields(); - if ($result < 0) - { - $error++; - } + $error++; } } @@ -555,18 +557,14 @@ class Don extends CommonObject $this->db->begin(); - if (!$error) - { - if (!$notrigger) - { - // Call trigger - $result = $this->call_trigger('DON_DELETE', $user); + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('DON_DELETE', $user); - if ($result < 0) { - $error++; - } - // End call triggers + if ($result < 0) { + $error++; } + // End call triggers } // Delete donation From 772661c6ba3203ff3795222d5124060f7e509569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 25 Oct 2020 19:44:01 +0100 Subject: [PATCH 06/79] clean code --- htdocs/categories/class/categorie.class.php | 359 +++++++------------- htdocs/categories/edit.php | 35 +- 2 files changed, 138 insertions(+), 256 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index d3752ef43d8..0a7654917a5 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -208,6 +208,11 @@ class Categorie extends CommonObject */ public $color; + /** + * @var int Visible + */ + public $visible; + /** * @var int Id of thirdparty when CATEGORY_ASSIGNED_TO_A_CUSTOMER is set */ @@ -312,11 +317,9 @@ class Categorie extends CommonObject $sql = "SELECT rowid, fk_parent, entity, label, description, color, fk_soc, visible, type, ref_ext"; $sql .= ", date_creation, tms, fk_user_creat, fk_user_modif"; $sql .= " FROM ".MAIN_DB_PREFIX."categorie"; - if ($id > 0) - { + if ($id > 0) { $sql .= " WHERE rowid = ".$id; - } elseif (!empty($ref_ext)) - { + } elseif (!empty($ref_ext)) { $sql .= " WHERE ref_ext LIKE '".$this->db->escape($ref_ext)."'"; } else { $sql .= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category').")"; @@ -325,27 +328,25 @@ class Categorie extends CommonObject dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql) > 0) - { + if ($resql) { + if ($this->db->num_rows($resql) > 0) { $res = $this->db->fetch_array($resql); $this->id = $res['rowid']; //$this->ref = $res['rowid']; - $this->fk_parent = $res['fk_parent']; + $this->fk_parent = (int) $res['fk_parent']; $this->label = $res['label']; $this->description = $res['description']; $this->color = $res['color']; - $this->socid = $res['fk_soc']; - $this->visible = $res['visible']; - $this->type = $res['type']; + $this->socid = (int) $res['fk_soc']; + $this->visible = (int) $res['visible']; + $this->type = (int) $res['type']; $this->ref_ext = $res['ref_ext']; - $this->entity = $res['entity']; + $this->entity = (int) $res['entity']; $this->date_creation = $this->db->jdate($res['date_creation']); $this->date_modification = $this->db->jdate($res['tms']); - $this->user_creation = $res['fk_user_creat']; - $this->user_modification = $res['fk_user_modif']; + $this->user_creation = (int) $res['fk_user_creat']; + $this->user_modification = (int) $res['fk_user_modif']; // Retrieve all extrafield // fetch optionals attributes and labels @@ -397,8 +398,7 @@ class Categorie extends CommonObject if (empty($this->visible)) $this->visible = 0; $this->fk_parent = ($this->fk_parent != "" ? intval($this->fk_parent) : 0); - if ($this->already_exists()) - { + if ($this->already_exists()) { $this->error = $langs->trans("ImpossibleAddCat", $this->label); $this->error .= " : ".$langs->trans("CategoryExistsAtSameLevel"); dol_syslog($this->error, LOG_WARNING); @@ -412,8 +412,7 @@ class Categorie extends CommonObject $sql .= " label,"; $sql .= " description,"; $sql .= " color,"; - if (!empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) - { + if (!empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) { $sql .= "fk_soc,"; } $sql .= " visible,"; @@ -424,54 +423,47 @@ class Categorie extends CommonObject $sql .= " date_creation,"; $sql .= " fk_user_creat"; $sql .= ") VALUES ("; - $sql .= $this->db->escape($this->fk_parent).","; + $sql .= (int) $this->fk_parent.","; $sql .= "'".$this->db->escape($this->label)."',"; $sql .= "'".$this->db->escape($this->description)."',"; $sql .= "'".$this->db->escape($this->color)."',"; - if (!empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) - { + if (!empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) { $sql .= ($this->socid != -1 ? $this->socid : 'null').","; } $sql .= "'".$this->db->escape($this->visible)."',"; $sql .= $this->db->escape($type).","; $sql .= (!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : 'null').","; $sql .= (!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : 'null').","; - $sql .= $this->db->escape($conf->entity).","; + $sql .= (int) $conf->entity.","; $sql .= "'".$this->db->idate($now)."', "; $sql .= (int) $user->id; $sql .= ")"; $res = $this->db->query($sql); - if ($res) - { + if ($res) { $id = $this->db->last_insert_id(MAIN_DB_PREFIX."categorie"); - if ($id > 0) - { + if ($id > 0) { $this->id = $id; $action = 'create'; // Actions on extra fields - if (!$error) - { + if (!$error) { $result = $this->insertExtraFields(); - if ($result < 0) - { + if ($result < 0) { $error++; } } - if (!$error) - { + if (!$error) { // Call trigger $result = $this->call_trigger('CATEGORY_CREATE', $user); if ($result < 0) { $error++; } // End call triggers } - if (!$error) - { + if (!$error) { $this->db->commit(); return $id; } else { @@ -510,8 +502,7 @@ class Categorie extends CommonObject $this->fk_parent = ($this->fk_parent != "" ? intval($this->fk_parent) : 0); $this->visible = ($this->visible != "" ? intval($this->visible) : 0); - if ($this->already_exists()) - { + if ($this->already_exists()) { $this->error = $langs->trans("ImpossibleUpdateCat"); $this->error .= " : ".$langs->trans("CategoryExistsAtSameLevel"); return -1; @@ -524,8 +515,7 @@ class Categorie extends CommonObject $sql .= " description = '".$this->db->escape($this->description)."',"; $sql .= " ref_ext = '".$this->db->escape($this->ref_ext)."',"; $sql .= " color = '".$this->db->escape($this->color)."'"; - if (!empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) - { + if (!empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) { $sql .= ", fk_soc = ".($this->socid != -1 ? $this->socid : 'null'); } $sql .= ", visible = '".$this->db->escape($this->visible)."'"; @@ -534,22 +524,18 @@ class Categorie extends CommonObject $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); - if ($this->db->query($sql)) - { + if ($this->db->query($sql)) { $action = 'update'; // Actions on extra fields - if (!$error) - { + if (!$error) { $result = $this->insertExtraFields(); - if ($result < 0) - { + if ($result < 0) { $error++; } } - if (!$error) - { + if (!$error) { // Call trigger $result = $this->call_trigger('CATEGORY_MODIFY', $user); if ($result < 0) { $error++; $this->db->rollback(); return -1; } @@ -586,8 +572,7 @@ class Categorie extends CommonObject $this->db->begin(); - if (!$error && !$notrigger) - { + if (!$error && !$notrigger) { // Call trigger $result = $this->call_trigger('CATEGORY_DELETE', $user); if ($result < 0) $error++; @@ -595,14 +580,12 @@ class Categorie extends CommonObject } /* FIX #1317 : Check for child category and move up 1 level*/ - if (!$error) - { + if (!$error) { $sql = "UPDATE ".MAIN_DB_PREFIX."categorie"; $sql .= " SET fk_parent = ".$this->fk_parent; $sql .= " WHERE fk_parent = ".$this->id; - if (!$this->db->query($sql)) - { + if (!$this->db->query($sql)) { $this->error = $this->db->lasterror(); $error++; } @@ -630,18 +613,15 @@ class Categorie extends CommonObject } // Removed extrafields - if (!$error) - { + if (!$error) { $result = $this->deleteExtraFields(); - if ($result < 0) - { + if ($result < 0) { $error++; dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR); } } - if (!$error) - { + if (!$error) { $this->db->commit(); return 1; } else { @@ -676,29 +656,23 @@ class Categorie extends CommonObject $sql .= " VALUES (".$this->id.", ".$obj->id.")"; dol_syslog(get_class($this).'::add_type', LOG_DEBUG); - if ($this->db->query($sql)) - { - if (!empty($conf->global->CATEGORIE_RECURSIV_ADD)) - { + if ($this->db->query($sql)) { + if (!empty($conf->global->CATEGORIE_RECURSIV_ADD)) { $sql = 'SELECT fk_parent FROM '.MAIN_DB_PREFIX.'categorie'; $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::add_type", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql) > 0) - { + if ($resql) { + if ($this->db->num_rows($resql) > 0) { $objparent = $this->db->fetch_object($resql); - if (!empty($objparent->fk_parent)) - { + if (!empty($objparent->fk_parent)) { $cat = new Categorie($this->db); $cat->id = $objparent->fk_parent; if (!$cat->containsObject($type, $obj->id)) { $result = $cat->add_type($obj, $type); - if ($result < 0) - { + if ($result < 0) { $this->error = $cat->error; $error++; } @@ -710,8 +684,7 @@ class Categorie extends CommonObject $this->error = $this->db->lasterror(); } - if ($error) - { + if ($error) { $this->db->rollback(); return -1; } @@ -725,8 +698,7 @@ class Categorie extends CommonObject if ($result < 0) { $error++; } // End call triggers - if (!$error) - { + if (!$error) { $this->db->commit(); return 1; } else { @@ -735,8 +707,7 @@ class Categorie extends CommonObject } } else { $this->db->rollback(); - if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { + if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error = $this->db->lasterrno(); return -3; } else { @@ -778,16 +749,14 @@ class Categorie extends CommonObject $sql .= " AND fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".$obj->id; dol_syslog(get_class($this).'::del_type', LOG_DEBUG); - if ($this->db->query($sql)) - { + if ($this->db->query($sql)) { // Call trigger $this->context = array('unlinkoff'=>$obj); // Save object we want to link category to into category instance to provide information to trigger $result = $this->call_trigger('CATEGORY_UNLINK', $user); if ($result < 0) { $error++; } // End call triggers - if (!$error) - { + if (!$error) { $this->db->commit(); return 1; } else { @@ -829,8 +798,7 @@ class Categorie extends CommonObject $sql .= " AND c.fk_categorie = ".$this->id; $sql .= " AND c.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = o.rowid"; // Protection for external users - if (($type == 'customer' || $type == 'supplier') && $user->socid > 0) - { + if (($type == 'customer' || $type == 'supplier') && $user->socid > 0) { $sql .= " AND o.rowid = ".$user->socid; } if ($limit > 0 || $offset > 0) $sql .= $this->db->plimit($limit + 1, $offset); @@ -838,10 +806,8 @@ class Categorie extends CommonObject dol_syslog(get_class($this)."::getObjectsInCateg", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) - { - while ($rec = $this->db->fetch_array($resql)) - { + if ($resql) { + while ($rec = $this->db->fetch_array($resql)) { if ($onlyids) { $objs[] = $rec['fk_'.(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])]; } else { @@ -927,20 +893,17 @@ class Categorie extends CommonObject $offset = 0; $nbtotalofrecords = ''; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) - { + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $this->db->query($sql); $nbtotalofrecords = $this->db->num_rows($result); - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 - { + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } } if ($limit) { - if ($page < 0) - { + if ($page < 0) { $page = 0; } $offset = $limit * $page; @@ -949,17 +912,14 @@ class Categorie extends CommonObject } $result = $this->db->query($sql); - if ($result) - { + if ($result) { $i = 0; $num = $this->db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); - while ($i < $min) - { + while ($i < $min) { $obj = $this->db->fetch_object($result); $category_static = new Categorie($this->db); - if ($category_static->fetch($obj->rowid)) - { + if ($category_static->fetch($obj->rowid)) { $categories[$i]['id'] = $category_static->id; $categories[$i]['fk_parent'] = $category_static->fk_parent; $categories[$i]['label'] = $category_static->label; @@ -1004,11 +964,9 @@ class Categorie extends CommonObject $sql .= " AND entity IN (".getEntity('category').")"; $res = $this->db->query($sql); - if ($res) - { + if ($res) { $cats = array(); - while ($rec = $this->db->fetch_array($res)) - { + while ($rec = $this->db->fetch_array($res)) { $cat = new Categorie($this->db); $cat->fetch($rec['rowid']); $cats[] = $cat; @@ -1039,10 +997,8 @@ class Categorie extends CommonObject dol_syslog(get_class($this)."::load_motherof", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) - { - while ($obj = $this->db->fetch_object($resql)) - { + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { $this->motherof[$obj->id_son] = $obj->id_parent; } return 1; @@ -1083,19 +1039,15 @@ class Categorie extends CommonObject return -1; } - if (is_string($markafterid)) - { + if (is_string($markafterid)) { $markafterid = explode(',', $markafterid); - } elseif (is_numeric($markafterid)) - { - if ($markafterid > 0) - { + } elseif (is_numeric($markafterid)) { + if ($markafterid > 0) { $markafterid = array($markafterid); } else { $markafterid = array(); } - } elseif (!is_array($markafterid)) - { + } elseif (!is_array($markafterid)) { $markafterid = array(); } @@ -1115,11 +1067,9 @@ class Categorie extends CommonObject dol_syslog(get_class($this)."::get_full_arbo get category list", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) - { + if ($resql) { $i = 0; - while ($obj = $this->db->fetch_object($resql)) - { + while ($obj = $this->db->fetch_object($resql)) { $this->cats[$obj->rowid]['rowid'] = $obj->rowid; $this->cats[$obj->rowid]['id'] = $obj->rowid; $this->cats[$obj->rowid]['fk_parent'] = $obj->fk_parent; @@ -1137,15 +1087,13 @@ class Categorie extends CommonObject // We add the fullpath property to each elements of first level (no parent exists) dol_syslog(get_class($this)."::get_full_arbo call to build_path_from_id_categ", LOG_DEBUG); - foreach ($this->cats as $key => $val) - { + foreach ($this->cats as $key => $val) { //print 'key='.$key.'
'."\n"; $this->build_path_from_id_categ($key, 0); // Process a branch from the root category key (this category has no parent) } // Include or exclude leaf including $markafterid from tree - if (count($markafterid) > 0) - { + if (count($markafterid) > 0) { $keyfiltercatid = '('.implode('|', $markafterid).')'; //print "Look to discard category ".$markafterid."\n"; @@ -1153,13 +1101,11 @@ class Categorie extends CommonObject $keyfilter2 = '_'.$keyfiltercatid.'$'; $keyfilter3 = '^'.$keyfiltercatid.'_'; $keyfilter4 = '_'.$keyfiltercatid.'_'; - foreach ($this->cats as $key => $val) - { + foreach ($this->cats as $key => $val) { $test = (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath']) || preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath'])); - if (($test && !$include) || (!$test && $include)) - { + if (($test && !$include) || (!$test && $include)) { unset($this->cats[$key]); } } @@ -1189,8 +1135,7 @@ class Categorie extends CommonObject // phpcs:enable dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG); - if (!empty($this->cats[$id_categ]['fullpath'])) - { + if (!empty($this->cats[$id_categ]['fullpath'])) { // Already defined dol_syslog(get_class($this)."::build_path_from_id_categ fullpath and fulllabel already defined", LOG_WARNING); return; @@ -1204,8 +1149,7 @@ class Categorie extends CommonObject $this->cats[$id_categ]['fulllabel'] = $this->cats[$id_categ]['label']; $i = 0; $cursor_categ = $id_categ; //print 'Work for id_categ='.$id_categ.'
'."\n"; - while ((empty($protection) || $i < $protection) && !empty($this->motherof[$cursor_categ])) - { + while ((empty($protection) || $i < $protection) && !empty($this->motherof[$cursor_categ])) { //print '  cursor_categ='.$cursor_categ.' i='.$i.' '.$this->motherof[$cursor_categ].'
'."\n"; $this->cats[$id_categ]['fullpath'] = '_'.$this->motherof[$cursor_categ].$this->cats[$id_categ]['fullpath']; $this->cats[$id_categ]['fulllabel'] = $this->cats[$this->motherof[$cursor_categ]]['label'].' >> '.$this->cats[$id_categ]['fulllabel']; @@ -1231,8 +1175,7 @@ class Categorie extends CommonObject { // phpcs:enable // Display $this->cats - foreach ($this->cats as $key => $val) - { + foreach ($this->cats as $key => $val) { print 'id: '.$this->cats[$key]['id']; print ' label: '.$this->cats[$key]['label']; print ' mother: '.$this->cats[$key]['fk_parent']; @@ -1265,11 +1208,9 @@ class Categorie extends CommonObject $sql .= " AND fk_parent = 0"; $res = $this->db->query($sql); - if ($res) - { + if ($res) { $cats = array(); - while ($rec = $this->db->fetch_array($res)) - { + while ($rec = $this->db->fetch_array($res)) { $cat = new Categorie($this->db); $cat->fetch($rec['rowid']); $cats[$rec['rowid']] = $cat; @@ -1319,18 +1260,15 @@ class Categorie extends CommonObject dol_syslog(get_class($this)."::already_exists", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql) > 0) // Checking for empty resql - { + if ($resql) { + if ($this->db->num_rows($resql) > 0) { // Checking for empty resql $obj = $this->db->fetch_array($resql); /* If object called create, obj cannot have is id. * If object called update, he mustn't have the same label as an other category for this mother. * So if the result have the same id, update is not for label, and if result have an other one, * update may be for label. */ - if ($obj[0] > 0 && $obj[0] != $this->id) - { + if ($obj[0] > 0 && $obj[0] != $this->id) { dol_syslog(get_class($this)."::already_exists category with name=".$this->label." and parent ".$this->fk_parent." exists: rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG); return 1; } @@ -1361,24 +1299,19 @@ class Categorie extends CommonObject $ways = array(); $allways = $this->get_all_ways(); // Load array of categories - foreach ($allways as $way) - { + foreach ($allways as $way) { $w = array(); $i = 0; $forced_color = ''; - foreach ($way as $cat) - { + foreach ($way as $cat) { $i++; - if (empty($nocolor)) - { + if (empty($nocolor)) { $forced_color = 'toreplace'; - if ($i == count($way)) - { + if ($i == count($way)) { // Check contrast with background and correct text color $forced_color = 'categtextwhite'; - if ($cat->color) - { + if ($cat->color) { if (colorIsLight($cat->color)) $forced_color = 'categtextblack'; } } @@ -1421,12 +1354,9 @@ class Categorie extends CommonObject $res = $this->db->query($sql); - if ($res) - { - while ($rec = $this->db->fetch_array($res)) - { - if ($rec['fk_parent'] > 0) - { + if ($res) { + while ($rec = $this->db->fetch_array($res)) { + if ($rec['fk_parent'] > 0) { $cat = new Categorie($this->db); $cat->fetch($rec['fk_parent']); $parents[] = $cat; @@ -1452,13 +1382,10 @@ class Categorie extends CommonObject $ways = array(); $parents = $this->get_meres(); - if (!empty($parents)) - { - foreach ($parents as $parent) - { + if (!empty($parents)) { + foreach ($parents as $parent) { $allways = $parent->get_all_ways(); - foreach ($allways as $way) - { + foreach ($allways as $way) { $w = $way; $w[] = $this; $ways[] = $w; @@ -1488,8 +1415,7 @@ class Categorie extends CommonObject if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; - if ($type === Categorie::TYPE_BANK_LINE) // TODO Remove this with standard category code - { + if ($type === Categorie::TYPE_BANK_LINE) { // TODO Remove this with standard category code // Load bank groups $sql = "SELECT c.label, c.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."bank_categ as c"; @@ -1497,10 +1423,8 @@ class Categorie extends CommonObject $sql .= " ORDER BY c.label"; $res = $this->db->query($sql); - if ($res) - { - while ($obj = $this->db->fetch_object($res)) - { + if ($res) { + while ($obj = $this->db->fetch_object($res)) { if ($mode == 'id') { $cats[] = $obj->rowid; } elseif ($mode == 'label') { @@ -1523,10 +1447,8 @@ class Categorie extends CommonObject $sql .= " AND c.entity IN (".getEntity('category').")"; $res = $this->db->query($sql); - if ($res) - { - while ($obj = $this->db->fetch_object($res)) - { + if ($res) { + while ($obj = $this->db->fetch_object($res)) { if ($mode == 'id') { $cats[] = $obj->rowid; } elseif ($mode == 'label') { @@ -1579,24 +1501,20 @@ class Categorie extends CommonObject $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; $sql .= " WHERE type = ".$this->MAP_ID[$type]; $sql .= " AND entity IN (".getEntity('category').")"; - if ($nom) - { + if ($nom) { if (!$exact) $nom = '%'.str_replace('*', '%', $nom).'%'; if (!$case) $sql .= " AND label LIKE '".$this->db->escape($nom)."'"; else $sql .= " AND label LIKE BINARY '".$this->db->escape($nom)."'"; } - if ($id) - { + if ($id) { $sql .= " AND rowid = '".$id."'"; } $res = $this->db->query($sql); - if ($res) - { - while ($rec = $this->db->fetch_array($res)) - { + if ($res) { + while ($rec = $this->db->fetch_array($res)) { $cat = new Categorie($this->db); $cat->fetch($rec['rowid']); $cats[] = $cat; @@ -1628,8 +1546,7 @@ class Categorie extends CommonObject // Check contrast with background and correct text color $forced_color = 'categtextwhite'; - if ($this->color) - { + if ($this->color) { if (colorIsLight($this->color)) $forced_color = 'categtextblack'; } @@ -1662,14 +1579,12 @@ class Categorie extends CommonObject $dir = $sdir.'/'.get_exdir($this->id, 2, 0, 0, $this, 'category').$this->id."/"; $dir .= "photos/"; - if (!file_exists($dir)) - { + if (!file_exists($dir)) { dol_mkdir($dir); } if (file_exists($dir)) { - if (is_array($file['name']) && count($file['name']) > 0) - { + if (is_array($file['name']) && count($file['name']) > 0) { $nbfile = count($file['name']); for ($i = 0; $i <= $nbfile; $i++) { $originImage = $dir.$file['name'][$i]; @@ -1714,22 +1629,17 @@ class Categorie extends CommonObject $dirthumb = $dir.'thumbs/'; - if (file_exists($dir)) - { + if (file_exists($dir)) { $handle = opendir($dir); - if (is_resource($handle)) - { - while (($file = readdir($handle)) !== false) - { - if (dol_is_file($dir.$file) && preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $dir.$file)) - { + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { + if (dol_is_file($dir.$file) && preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $dir.$file)) { $nbphoto++; $photo = $file; // On determine nom du fichier vignette $photo_vignette = ''; - if (preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $photo, $regs)) - { + if (preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $photo, $regs)) { $photo_vignette = preg_replace('/'.$regs[0].'/i', '', $photo).'_small'.$regs[0]; } @@ -1773,11 +1683,9 @@ class Categorie extends CommonObject dol_delete_file($file, 1); // Si elle existe, on efface la vignette - if (preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $filename, $regs)) - { + if (preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $filename, $regs)) { $photo_vignette = preg_replace('/'.$regs[0].'/i', '', $filename).'_small'.$regs[0]; - if (file_exists($dirthumb.$photo_vignette)) - { + if (file_exists($dirthumb.$photo_vignette)) { dol_delete_file($dirthumb.$photo_vignette, 1); } } @@ -1812,8 +1720,7 @@ class Categorie extends CommonObject $langs_available = $langs->get_available_languages(); $current_lang = $langs->getDefaultLang(); - foreach ($langs_available as $key => $value) - { + foreach ($langs_available as $key => $value) { $sql = "SELECT rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."categorie_lang"; $sql .= " WHERE fk_category=".$this->id; @@ -1821,10 +1728,8 @@ class Categorie extends CommonObject $result = $this->db->query($sql); - if ($key == $current_lang) - { - if ($this->db->num_rows($result)) // si aucune ligne dans la base - { + if ($key == $current_lang) { + if ($this->db->num_rows($result)) { // si aucune ligne dans la base $sql2 = "UPDATE ".MAIN_DB_PREFIX."categorie_lang"; $sql2 .= " SET label='".$this->db->escape($this->label)."',"; $sql2 .= " description='".$this->db->escape($this->description)."'"; @@ -1835,15 +1740,12 @@ class Categorie extends CommonObject $sql2 .= "','".$this->db->escape($this->multilangs["$key"]["description"])."')"; } dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG); - if (!$this->db->query($sql2)) - { + if (!$this->db->query($sql2)) { $this->error = $this->db->lasterror(); return -1; } - } elseif (isset($this->multilangs["$key"])) - { - if ($this->db->num_rows($result)) // si aucune ligne dans la base - { + } elseif (isset($this->multilangs["$key"])) { + if ($this->db->num_rows($result)) { // si aucune ligne dans la base $sql2 = "UPDATE ".MAIN_DB_PREFIX."categorie_lang"; $sql2 .= " SET label='".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'"; @@ -1857,8 +1759,7 @@ class Categorie extends CommonObject // on ne sauvegarde pas des champs vides if ($this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"]) dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG); - if (!$this->db->query($sql2)) - { + if (!$this->db->query($sql2)) { $this->error = $this->db->lasterror(); return -1; } @@ -1892,13 +1793,10 @@ class Categorie extends CommonObject $sql .= " WHERE fk_category=".$this->id; $result = $this->db->query($sql); - if ($result) - { - while ($obj = $this->db->fetch_object($result)) - { + if ($result) { + while ($obj = $this->db->fetch_object($result)) { //print 'lang='.$obj->lang.' current='.$current_lang.'
'; - if ($obj->lang == $current_lang) // si on a les traduct. dans la langue courante on les charge en infos principales. - { + if ($obj->lang == $current_lang) { // si on a les traduct. dans la langue courante on les charge en infos principales. $this->label = $obj->label; $this->description = $obj->description; } @@ -1988,26 +1886,21 @@ class Categorie extends CommonObject { if ($type == 'bank_account') $type = 'account'; - if (empty($searchList) && !is_array($searchList)) - { + if (empty($searchList) && !is_array($searchList)) { return ""; } - foreach ($searchList as $searchCategory) - { - if (intval($searchCategory) == -2) - { + foreach ($searchList as $searchCategory) { + if (intval($searchCategory) == -2) { $searchCategorySqlList[] = " cp.fk_categorie IS NULL"; - } elseif (intval($searchCategory) > 0) - { + } elseif (intval($searchCategory) > 0) { $searchCategorySqlList[] = " ".$rowIdName ." IN (SELECT fk_".$type." FROM ".MAIN_DB_PREFIX."categorie_".$type ." WHERE fk_categorie = ".$searchCategory.")"; } } - if (!empty($searchCategorySqlList)) - { + if (!empty($searchCategorySqlList)) { return " AND (".implode(' AND ', $searchCategorySqlList).")"; } else { return ""; diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 8c05c313987..9f7aebf7fec 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -34,7 +34,7 @@ $langs->load("categories"); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alphanohtml'); -$type = GETPOST('type', 'alphanohtml'); +$type = (int) GETPOST('type', 'int'); $action = (GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'edit'); $confirm = GETPOST('confirm'); $cancel = GETPOST('cancel', 'alpha'); @@ -43,11 +43,10 @@ $socid = GETPOST('socid', 'int'); $label = GETPOST('label', 'alphanohtml'); $description = GETPOST('description', 'restricthtml'); $color = preg_replace('/[^0-9a-f#]/i', '', GETPOST('color', 'alphanohtml')); -$visible = GETPOST('visible'); -$parent = GETPOST('parent'); +$visible = (int) GETPOST('visible', 'int'); +$parent = (int) GETPOST('parent', 'int'); -if ($id == "") -{ +if ($id == "") { dol_print_error('', 'Missing parameter id'); exit(); } @@ -56,8 +55,7 @@ if ($id == "") $result = restrictedArea($user, 'categorie', $id, '&category'); $object = new Categorie($db); -if ($id > 0) -{ +if ($id > 0) { $result = $object->fetch($id); } @@ -72,40 +70,32 @@ $hookmanager->initHooks(array('categorycard')); * Actions */ -if ($cancel) -{ +if ($cancel) { header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type); exit; } // Action mise a jour d'une categorie -if ($action == 'update' && $user->rights->categorie->creer) -{ +if ($action == 'update' && $user->rights->categorie->creer) { $object->oldcopy = dol_clone($object); $object->label = $label; $object->description = dol_htmlcleanlastbr($description); $object->color = $color; $object->socid = ($socid ? $socid : 'null'); $object->visible = $visible; - - if ($parent != "-1") - $object->fk_parent = $parent; - else $object->fk_parent = ""; + $object->fk_parent = $parent != -1 ? $parent : 0; - if (empty($object->label)) - { + if (empty($object->label)) { $error++; $action = 'edit'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); } - if (!$error && empty($object->error)) - { + if (!$error && empty($object->error)) { $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) $error++; - if (!$error && $object->update($user) > 0) - { + if (!$error && $object->update($user) > 0) { header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type); exit; } else { @@ -173,8 +163,7 @@ print ''; $parameters = array(); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (empty($reshook)) -{ +if (empty($reshook)) { print $object->showOptionals($extrafields, 'edit', $parameters); } From 81ed97c9ba935bf49f9357341c3b66c7576554df Mon Sep 17 00:00:00 2001 From: javierybar <36415318+javierybar@users.noreply.github.com> Date: Sun, 25 Oct 2020 20:03:25 +0100 Subject: [PATCH 07/79] NEW Credit invoice in TakePOS --- htdocs/takepos/index.php | 26 ++++-- htdocs/takepos/invoice.php | 157 +++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+), 6 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8e6eb397c55..83a8fc7931b 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -25,13 +25,13 @@ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; @@ -888,6 +888,20 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { + + +
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3a67c81d4ba..00a227e8041 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -271,6 +271,154 @@ if ($action == 'valid' && $user->rights->facture->creer) } } +if ($action == 'creditnote') +{ + $creditnote = new Facture($db); + $creditnote->socid = $invoice->socid; + $creditnote->date = dol_now(); + $creditnote->type = Facture::TYPE_CREDIT_NOTE; + $creditnote->fk_facture_source = $placeid; + $creditnote->remise_absolue = $invoice->remise_absolue; + $creditnote->remise_percent = $invoice->remise_percent; + $creditnote->create($user); + + foreach ($invoice->lines as $line) + { + // Extrafields + if (method_exists($line, 'fetch_optionals')) { + // load extrafields + $line->fetch_optionals(); + } + // Reset fk_parent_line for no child products and special product + if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { + $fk_parent_line = 0; + } + if ($invoice->type == Facture::TYPE_SITUATION) + { + $source_fk_prev_id = $line->fk_prev_id; // temporary storing situation invoice fk_prev_id + $line->fk_prev_id = $line->id; // The new line of the new credit note we are creating must be linked to the situation invoice line it is created from + if (!empty($invoice->tab_previous_situation_invoice)) + { + // search the last standard invoice in cycle and the possible credit note between this last and invoice + // TODO Move this out of loop of $invoice->lines + $tab_jumped_credit_notes = array(); + $lineIndex = count($invoice->tab_previous_situation_invoice) - 1; + $searchPreviousInvoice = true; + while ($searchPreviousInvoice) + { + if ($invoice->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_SITUATION || $lineIndex < 1) + { + $searchPreviousInvoice = false; // find, exit; + break; + } else { + if ($invoice->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_CREDIT_NOTE) { + $tab_jumped_credit_notes[$lineIndex] = $invoice->tab_previous_situation_invoice[$lineIndex]->id; + } + $lineIndex--; // go to previous invoice in cycle + } + } + + $maxPrevSituationPercent = 0; + foreach ($invoice->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine) + { + if ($prevLine->id == $source_fk_prev_id) + { + $maxPrevSituationPercent = max($maxPrevSituationPercent, $prevLine->situation_percent); + + //$line->subprice = $line->subprice - $prevLine->subprice; + $line->total_ht = $line->total_ht - $prevLine->total_ht; + $line->total_tva = $line->total_tva - $prevLine->total_tva; + $line->total_ttc = $line->total_ttc - $prevLine->total_ttc; + $line->total_localtax1 = $line->total_localtax1 - $prevLine->total_localtax1; + $line->total_localtax2 = $line->total_localtax2 - $prevLine->total_localtax2; + + $line->multicurrency_subprice = $line->multicurrency_subprice - $prevLine->multicurrency_subprice; + $line->multicurrency_total_ht = $line->multicurrency_total_ht - $prevLine->multicurrency_total_ht; + $line->multicurrency_total_tva = $line->multicurrency_total_tva - $prevLine->multicurrency_total_tva; + $line->multicurrency_total_ttc = $line->multicurrency_total_ttc - $prevLine->multicurrency_total_ttc; + } + } + + // prorata + $line->situation_percent = $maxPrevSituationPercent - $line->situation_percent; + + //print 'New line based on invoice id '.$invoice->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'
'; + + // If there is some credit note between last situation invoice and invoice used for credit note generation (note: credit notes are stored as delta) + $maxPrevSituationPercent = 0; + foreach ($tab_jumped_credit_notes as $index => $creditnoteid) { + foreach ($invoice->tab_previous_situation_invoice[$index]->lines as $prevLine) + { + if ($prevLine->fk_prev_id == $source_fk_prev_id) + { + $maxPrevSituationPercent = $prevLine->situation_percent; + + $line->total_ht -= $prevLine->total_ht; + $line->total_tva -= $prevLine->total_tva; + $line->total_ttc -= $prevLine->total_ttc; + $line->total_localtax1 -= $prevLine->total_localtax1; + $line->total_localtax2 -= $prevLine->total_localtax2; + + $line->multicurrency_subprice -= $prevLine->multicurrency_subprice; + $line->multicurrency_total_ht -= $prevLine->multicurrency_total_ht; + $line->multicurrency_total_tva -= $prevLine->multicurrency_total_tva; + $line->multicurrency_total_ttc -= $prevLine->multicurrency_total_ttc; + } + } + } + + // prorata + $line->situation_percent += $maxPrevSituationPercent; + + //print 'New line based on invoice id '.$invoice->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'
'; + } + } + + $line->fk_facture = $creditnote->id; + $line->fk_parent_line = $fk_parent_line; + + $line->subprice = -$line->subprice; // invert price for object + $line->pa_ht = $line->pa_ht; // we choosed to have buy/cost price always positive, so no revert of sign here + $line->total_ht = -$line->total_ht; + $line->total_tva = -$line->total_tva; + $line->total_ttc = -$line->total_ttc; + $line->total_localtax1 = -$line->total_localtax1; + $line->total_localtax2 = -$line->total_localtax2; + + $line->multicurrency_subprice = -$line->multicurrency_subprice; + $line->multicurrency_total_ht = -$line->multicurrency_total_ht; + $line->multicurrency_total_tva = -$line->multicurrency_total_tva; + $line->multicurrency_total_ttc = -$line->multicurrency_total_ttc; + + $result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked + + $creditnote->lines[] = $line; // insert new line in current object + + // Defined the new fk_parent_line + if ($result > 0 && $line->product_type == 9) { + $fk_parent_line = $result; + } + } + $creditnote->update_price(1); + + $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; + if (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") { + $savconst = $conf->global->STOCK_CALCULATE_ON_BILL; + $conf->global->STOCK_CALCULATE_ON_BILL = 1; + $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; + dol_syslog("Validate invoice with stock change into warehouse defined into constant ".$constantforkey." = ".$conf->global->$constantforkey); + $batch_rule = 0; + if (!empty($conf->productbatch->enabled) && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; + $batch_rule = Productbatch::BATCH_RULE_SELLBY_EATBY_DATES_FIRST; + } + $res = $creditnote->validate($user, '', $conf->global->$constantforkey, 0, $batch_rule); + $conf->global->STOCK_CALCULATE_ON_BILL = $savconst; + } else { + $res = $creditnote->validate($user); + } +} + if ($action == 'history') { $placeid = (int) GETPOST('placeid', 'int'); @@ -785,6 +933,11 @@ function DolibarrTakeposPrinting(id) { }); } +function CreditNote() { + $("#poslines").load("invoice.php?action=creditnote&invoiceid="+placeid, function() { + }); +} + $( document ).ready(function() { console.log("Set customer info and sales in header"); @@ -1162,6 +1315,10 @@ if ($placeid > 0) print ''; +if ($action == "valid" || $action == "history"){ + print ''; +} + if ($action == "search") { From a66be11e71dc4248191db53141accc7bdde9b28b Mon Sep 17 00:00:00 2001 From: javierybar <36415318+javierybar@users.noreply.github.com> Date: Sun, 25 Oct 2020 20:06:50 +0100 Subject: [PATCH 08/79] Update index.php --- htdocs/takepos/index.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 83a8fc7931b..a30ccc2935f 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -25,13 +25,13 @@ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; From a031adf99e670ad498e47d80627d13cb318aa3d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 25 Oct 2020 20:07:22 +0100 Subject: [PATCH 09/79] clean code --- htdocs/categories/class/categorie.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 0a7654917a5..302366f6669 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -323,7 +323,7 @@ class Categorie extends CommonObject $sql .= " WHERE ref_ext LIKE '".$this->db->escape($ref_ext)."'"; } else { $sql .= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category').")"; - if (!is_null($type)) $sql .= " AND type = ".$this->db->escape($type); + if (!is_null($type)) $sql .= " AND type = ".(int) $type; } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -518,8 +518,8 @@ class Categorie extends CommonObject if (!empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) { $sql .= ", fk_soc = ".($this->socid != -1 ? $this->socid : 'null'); } - $sql .= ", visible = '".$this->db->escape($this->visible)."'"; - $sql .= ", fk_parent = ".$this->fk_parent; + $sql .= ", visible = ".(int) $this->visible; + $sql .= ", fk_parent = ".(int) $this->fk_parent; $sql .= ", fk_user_modif = ".(int) $user->id; $sql .= " WHERE rowid = ".$this->id; @@ -1203,7 +1203,7 @@ class Categorie extends CommonObject $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; $sql .= " WHERE entity IN (".getEntity('category').")"; if (!is_null($type)) - $sql .= " AND type = ".$type; + $sql .= " AND type = ".(int) $type; if ($parent) $sql .= " AND fk_parent = 0"; From d23b6e145a9f3afa328c285e47303a2bef0fe0e6 Mon Sep 17 00:00:00 2001 From: javierybar <36415318+javierybar@users.noreply.github.com> Date: Sun, 25 Oct 2020 20:24:17 +0100 Subject: [PATCH 10/79] Fixes --- htdocs/takepos/invoice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 00a227e8041..8975c7426c3 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -281,7 +281,7 @@ if ($action == 'creditnote') $creditnote->remise_absolue = $invoice->remise_absolue; $creditnote->remise_percent = $invoice->remise_percent; $creditnote->create($user); - + foreach ($invoice->lines as $line) { // Extrafields @@ -400,7 +400,7 @@ if ($action == 'creditnote') } } $creditnote->update_price(1); - + $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; if (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") { $savconst = $conf->global->STOCK_CALCULATE_ON_BILL; From 9dfc08d2bdf60e0d83756f0b99a1053a7f077b89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Oct 2020 21:11:05 +0100 Subject: [PATCH 11/79] Fix bad var name --- htdocs/core/boxes/box_services_contracts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index d2008901b09..1c769116331 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -125,7 +125,7 @@ class box_services_contracts extends ModeleBoxes $contractlinestatic->type = $objp->type; $contractlinestatic->product_id = $objp->product_id; $contractlinestatic->product_ref = $objp->product_ref; - $contratlignestatic->product_type = $objp->product_type; + $contractlinestatic->product_type = $objp->product_type; $contractstatic->id = $objp->rowid; $contractstatic->ref = $objp->ref; From 10ff359889d3c7d354bfa61bc9c41f9548392b14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 25 Oct 2020 22:39:12 +0100 Subject: [PATCH 12/79] set unknow variables --- htdocs/ticket/class/ticket.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 391bd4dce2d..5ef0bb4148a 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1515,6 +1515,8 @@ class Ticket extends CommonObject $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; } include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $sendtocc = ''; + $deliveryreceipt = 0; $mailfile = new CMailFile($subject, $info_sendto['email'], $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, 0); if ($mailfile->error || $mailfile->errors) { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); From f2c0e3765d4bef91136e66dc678faeff0c6a1afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 25 Oct 2020 23:29:51 +0100 Subject: [PATCH 13/79] Update card.php --- htdocs/fourn/facture/card.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c304a4edce7..3c60501342b 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2304,20 +2304,17 @@ if ($action == 'create') if ($action == 'valid') { // We check if number is temporary number - if (preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) // empty should not happened, but when it occurs, the test save life - { + if (preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) { + // empty should not happened, but when it occurs, the test save life $numref = $object->getNextNumRef($societe); } else { $numref = $object->ref; } - if ($numref < 0) - { + if ($numref < 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; - } - else - { + } else { $text = $langs->trans('ConfirmValidateBill', $numref); /*if (! empty($conf->notification->enabled)) { From ab0d5514c708019a01323b29174a552a620111a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 25 Oct 2020 23:55:08 +0100 Subject: [PATCH 14/79] doxygen --- htdocs/delivery/class/delivery.class.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index bd6ef948c6c..b6614892c38 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -67,8 +67,19 @@ class Delivery extends CommonObject */ public $picto = 'sending'; - public $draft; - public $socid; + /** + * @var int draft status + */ + public $draft; + + /** + * @var int thirdparty id + */ + public $socid; + + /** + * @var string ref custome + */ public $ref_customer; /** @@ -86,7 +97,9 @@ class Delivery extends CommonObject */ public $date_valid; - + /** + * @var string model pdf + */ public $model_pdf; From 44152c934324bbba791eff174bdb61ecaf4a0fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 00:00:37 +0100 Subject: [PATCH 15/79] undefined variable --- htdocs/datapolicy/class/datapolicy.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index ff9abcf5dce..411e5a46b34 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -167,6 +167,7 @@ class DataPolicy } else { $l = $langs->defaultlang; } + // TODO Use a dolibarr email template $s = "DATAPOLICIESSUBJECT_".$l; $ma = "DATAPOLICIESCONTENT_".$l; $la = 'TXTLINKDATAPOLICIESACCEPT_'.$l; @@ -242,6 +243,7 @@ class DataPolicy } else { $l = $langs->defaultlang; } + // TODO Use a dolibarr email template $s = "DATAPOLICIESSUBJECT_".$l; $ma = "DATAPOLICIESCONTENT_".$l; $la = 'TXTLINKDATAPOLICIESACCEPT_'.$l; @@ -310,9 +312,6 @@ class DataPolicy $sendto = $adherent->email; - // TODO Use a dolibarr email template - $s = 'TXTLINKDATAPOLICIESSUBJECT_'.$l; - $ma = 'TXTLINKDATAPOLICIESMESSAGE_'.$l; $code = md5($adherent->email); if (!empty($adherent->default_lang)) { @@ -320,6 +319,9 @@ class DataPolicy } else { $l = $langs->defaultlang; } + // TODO Use a dolibarr email template + $s = 'TXTLINKDATAPOLICIESSUBJECT_'.$l; + $ma = 'TXTLINKDATAPOLICIESMESSAGE_'.$l; $la = 'TXTLINKDATAPOLICIESACCEPT_'.$l; $lr = 'TXTLINKDATAPOLICIESREFUSE_'.$l; From c2b6ff969a630d5e21e51bda9ed9715c5a61c981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 00:05:43 +0100 Subject: [PATCH 16/79] Update datapolicy.class.php --- htdocs/datapolicy/class/datapolicy.class.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index 411e5a46b34..24490b9fb19 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -152,7 +152,7 @@ class DataPolicy * @param mixed $contact Contact * @return void */ - public function sendMailDataPolicyContact($contact) + public static function sendMailDataPolicyContact($contact) { global $langs, $conf, $db, $user; @@ -227,7 +227,7 @@ class DataPolicy * @param Societe $societe Object societe * @return void */ - public function sendMailDataPolicyCompany($societe) + public static function sendMailDataPolicyCompany($societe) { global $langs, $conf, $db, $user; @@ -266,10 +266,8 @@ class DataPolicy $actiontypecode = 'AC_EMAIL'; $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) - { + if ($message) { + if ($sendtocc) { $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc); } $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject); @@ -302,7 +300,7 @@ class DataPolicy * @param Adherent $adherent Member * @return void */ - public function sendMailDataPolicyAdherent($adherent) + public static function sendMailDataPolicyAdherent($adherent) { global $langs, $conf, $db, $user; From 457f8b9766535c709a07f1f2847161aa0dc832d8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 26 Oct 2020 10:49:07 +0100 Subject: [PATCH 17/79] fix bad link index thirdparty --- htdocs/societe/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 24538c78d66..ddd865521d7 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -293,15 +293,15 @@ if ($result) $s = ''; if (($obj->client == 2 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - $s .= ''.dol_substr($langs->trans("Prospect"), 0, 1).''; + $s .= ''.dol_substr($langs->trans("Prospect"), 0, 1).''; } if (($obj->client == 1 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - $s .= ''.dol_substr($langs->trans("Customer"), 0, 1).''; + $s .= ''.dol_substr($langs->trans("Customer"), 0, 1).''; } if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur) { - $s .= ''.dol_substr($langs->trans("Supplier"), 0, 1).''; + $s .= ''.dol_substr($langs->trans("Supplier"), 0, 1).''; } print $s; print ''; From 3f839c2a961f204fddfc74ab4cbe4f25758596f9 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Mon, 26 Oct 2020 16:11:21 +0100 Subject: [PATCH 18/79] FIX: product customer prices: missing triggers in CRUD class --- .../class/productcustomerprice.class.php | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 8405120ddef..7e77154fb32 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -219,15 +219,11 @@ class Productcustomerprice extends CommonObject $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_customer_price"); if (! $notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + $result = $this->call_trigger('PRODUCT_CUSTOMER_PRICE_CREATE', $user); - // // Call triggers - // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - // $interface=new Interfaces($this->db); - // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); - // if ($result < 0) { $error++; $this->errors=$interface->errors; } - // // End call triggers + if ($result < 0) { + $error++; + } } } @@ -714,12 +710,11 @@ class Productcustomerprice extends CommonObject if (! $error) { if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PRODUCT_CUSTOMER_PRICE_UPDATE', $this, $user, $langs, $conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // End call triggers + $result = $this->call_trigger('PRODUCT_CUSTOMER_PRICE_UPDATE', $user); + + if ($result < 0) { + $error++; + } } } @@ -854,15 +849,11 @@ class Productcustomerprice extends CommonObject if (! $error) { if (! $notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + $result = $this->call_trigger('PRODUCT_CUSTOMER_PRICE_DELETE', $user); - // // Call triggers - // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - // $interface=new Interfaces($this->db); - // $result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); - // if ($result < 0) { $error++; $this->errors=$interface->errors; } - // // End call triggers + if ($result < 0) { + $error++; + } } } From e7e8a91b1388c180cb1ecf85a16d34824a4182ec Mon Sep 17 00:00:00 2001 From: CHABANE HADJER <50581285+hchabane21@users.noreply.github.com> Date: Mon, 26 Oct 2020 16:38:11 +0100 Subject: [PATCH 19/79] Adding Payzen payment module hooks. --- htdocs/public/payment/newpayment.php | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index c188dd1db7a..1986416e4de 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -50,6 +50,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; +// Hook added by Payzen. +include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; +$hookmanager = new HookManager($db); +$hookmanager->initHooks(array('newpayment')); // Load translation files $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data @@ -202,6 +206,12 @@ if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->strip // Initialize $validpaymentmethod $validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod); +// This hook is used to push to $validpaymentmethod the Payzen payment method as valid. +$parameters = [ + 'paymentmethod' => $paymentmethod, + 'validpaymentmethod' => &$validpaymentmethod +]; +$reshook = $hookmanager->executeHooks('doValidatePayment', $parameters, $object, $action); // Check security token $valid = true; @@ -1641,6 +1651,12 @@ if ($action != 'dopayment') { if ($found && !$error) // We are in a management option and no error { + // Check status of the object (Invoice) to verify if it is paid in Payzen. + $parameters = [ + 'source' => $source, + 'object' => $object + ]; + $reshook = $hookmanager->executeHooks('doCheckStatus', $parameters, $object, $action); if ($source == 'order' && $object->billed) { print '

'.$langs->trans("OrderBilled").''; @@ -1661,6 +1677,11 @@ if ($action != 'dopayment') // Buttons for all payments registration methods + // This hook is used to add Payzen Button to newpayment.php. + $parameters = [ + 'paymentmethod' => $paymentmethod + ]; + $reshook = $hookmanager->executeHooks('doAddButton', $parameters, $object, $action); if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled)) { print '
'; @@ -2249,6 +2270,14 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment print ''; } } + // This hook is used to show the embedded form to make payments with Payzen. + $parameters = [ + 'paymentmethod' => $paymentmethod, + 'amount' => price2num(GETPOST("newamount"), 'MT'), + 'tag' => GETPOST("tag", 'alpha'), + 'dopayment' => GETPOST('dopayment', 'alpha') + ]; + $reshook = $hookmanager->executeHooks('doPayment', $parameters, $object, $action); } From 7fa7f0a3908a6ddfaaeb5e36d2b9f3ff6b58fcd1 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 26 Oct 2020 16:50:52 +0100 Subject: [PATCH 20/79] Re-add set_date_livraison as a deprecated function. Use correct naming convention for new method naming. --- htdocs/comm/propal/card.php | 2 +- htdocs/comm/propal/class/propal.class.php | 18 +++++++++++++++-- htdocs/commande/card.php | 2 +- htdocs/commande/class/commande.class.php | 16 ++++++++++++++- htdocs/delivery/card.php | 2 +- htdocs/delivery/class/delivery.class.php | 4 ++-- htdocs/expedition/card.php | 2 +- htdocs/expedition/class/expedition.class.php | 20 ++++++++++++++++--- htdocs/expedition/shipment.php | 2 +- .../class/fournisseur.commande.class.php | 16 ++++++++++++++- htdocs/fourn/commande/card.php | 4 ++-- htdocs/reception/card.php | 2 +- htdocs/reception/class/reception.class.php | 7 +++---- htdocs/supplier_proposal/card.php | 2 +- .../class/supplier_proposal.class.php | 18 +++++++++++++++-- 15 files changed, 93 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 4a4cf3c37dd..1f813b6c6ad 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -287,7 +287,7 @@ if (empty($reshook)) dol_print_error($db, $object->error); } elseif ($action == 'setdate_livraison' && $usercancreate) { - $result = $object->set_delivery_date($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear'])); + $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear'])); if ($result < 0) dol_print_error($db, $object->error); } // Positionne ref client diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c772044af81..5d31463125c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2060,8 +2060,22 @@ class Propal extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** + * Set delivery date + * + * @param User $user Object user that modify + * @param int $delivery_date Delivery date + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if ko, >0 if ok + * @deprecated Use setDeliveryDate + */ + public function set_date_livraison($user, $delivery_date, $notrigger = 0) + { + return $this->setDeliveryDate($user, $delivery_date, $notrigger); + } + + /** * Set delivery date * * @param User $user Object user that modify @@ -2069,7 +2083,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - public function set_delivery_date($user, $delivery_date, $notrigger = 0) + public function setDeliveryDate($user, $delivery_date, $notrigger = 0) { // phpcs:enable if (!empty($user->rights->propal->creer)) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 596fe4e94bc..795a120cee6 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -541,7 +541,7 @@ if (empty($reshook)) $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); - $result = $object->set_delivery_date($user, $datedelivery); + $result = $object->setDeliveryDate($user, $datedelivery); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index b7095bef93a..9019e3fb3ae 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2548,6 +2548,20 @@ class Commande extends CommonOrder } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Set delivery date + * + * @param User $user Object user that modify + * @param int $delivery_date Delivery date + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if ko, >0 if ok + * @deprecated Use setDeliveryDate + */ + public function set_date_livraison($user, $delivery_date, $notrigger = 0) + { + return $this->setDeliveryDate($user, $delivery_date, $notrigger); + } + /** * Set the planned delivery date * @@ -2556,7 +2570,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ - public function set_delivery_date($user, $delivery_date, $notrigger = 0) + public function setDeliveryDate($user, $delivery_date, $notrigger = 0) { // phpcs:enable if ($user->rights->commande->creer) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 3510fd2a4f2..440de00499e 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -171,7 +171,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expeditio if ($action == 'setdate_livraison' && $user->rights->expedition->delivery->creer) { $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); - $result = $object->set_delivery_date($user, $datedelivery); + $result = $object->setDeliveryDate($user, $datedelivery); if ($result < 0) { $mesg = '
'.$object->error.'
'; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index bd6ef948c6c..983558d0844 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -1007,7 +1007,7 @@ class Delivery extends CommonObject * @param integer $delivery_date Delivery date * @return int <0 if KO, >0 if OK */ - public function set_delivery_date($user, $delivery_date) + public function setDeliveryDate($user, $delivery_date) { // phpcs:enable if ($user->rights->expedition->creer) @@ -1016,7 +1016,7 @@ class Delivery extends CommonObject $sql .= " SET date_delivery = ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : 'null'); $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_delivery_date", LOG_DEBUG); + dol_syslog(get_class($this)."::setDeliveryDate", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index a2e1c3a26db..d89d08bc1b2 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -479,7 +479,7 @@ if (empty($reshook)) $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); - $result = $object->set_delivery_date($user, $datedelivery); + $result = $object->setDeliveryDate($user, $datedelivery); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index ccc67a1c256..f604af94813 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1957,15 +1957,29 @@ class Expedition extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** + * Set delivery date + * + * @param User $user Object user that modify + * @param int $delivery_date Delivery date + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if ko, >0 if ok + * @deprecated Use setDeliveryDate + */ + public function set_date_livraison($user, $delivery_date, $notrigger = 0) + { + return $this->setDeliveryDate($user, $delivery_date, $notrigger); + } + + /** * Set the planned delivery date * * @param User $user Objet user that modify * @param integer $delivery_date Date of delivery * @return int <0 if KO, >0 if OK */ - public function set_delivery_date($user, $delivery_date) + public function setDeliveryDate($user, $delivery_date) { // phpcs:enable if ($user->rights->expedition->creer) @@ -1974,7 +1988,7 @@ class Expedition extends CommonObject $sql .= " SET date_delivery = ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : 'null'); $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_delivery_date", LOG_DEBUG); + dol_syslog(get_class($this)."::setDeliveryDate", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 31d6fcaed02..4d4dd365c5f 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -108,7 +108,7 @@ if (empty($reshook)) $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); - $result = $object->set_delivery_date($user, $datedelivery); + $result = $object->setDeliveryDate($user, $datedelivery); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ba9f79a3c99..488ccb276cf 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2258,6 +2258,20 @@ class CommandeFournisseur extends CommonOrder } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Set delivery date + * + * @param User $user Object user that modify + * @param int $delivery_date Delivery date + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if ko, >0 if ok + * @deprecated Use setDeliveryDate + */ + public function set_date_livraison($user, $delivery_date, $notrigger = 0) + { + return $this->setDeliveryDate($user, $delivery_date, $notrigger); + } + /** * Set the planned delivery date * @@ -2266,7 +2280,7 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - public function set_delivery_date($user, $delivery_date, $notrigger = 0) + public function setDeliveryDate($user, $delivery_date, $notrigger = 0) { // phpcs:enable if ($user->rights->fournisseur->commande->creer) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index e202b3e8efd..524d67e55b9 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -203,7 +203,7 @@ if (empty($reshook)) // date of delivery if ($action == 'setdate_livraison' && $usercancreate) { - $result = $object->set_delivery_date($user, $datelivraison); + $result = $object->setDeliveryDate($user, $datelivraison); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } @@ -1199,7 +1199,7 @@ if (empty($reshook)) $result = $srcobject->fetch($object->origin_id); if ($result > 0) { - $object->set_delivery_date($user, $srcobject->date_livraison); + $object->setDeliveryDate($user, $srcobject->date_livraison); $object->set_id_projet($user, $srcobject->fk_project); $lines = $srcobject->lines; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 450dc1ebd57..1f79364a618 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -425,7 +425,7 @@ if (empty($reshook)) $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); - $result = $object->set_delivery_date($user, $datedelivery); + $result = $object->setDeliveryDate($user, $datedelivery); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 0a2458f57a6..eb268fbc695 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1219,15 +1219,14 @@ class Reception extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** + /** * Set the planned delivery date * * @param User $user Objet utilisateur qui modifie * @param integer $delivery_date Delivery date * @return int <0 if KO, >0 if OK */ - public function set_delivery_date($user, $delivery_date) + public function setDeliveryDate($user, $delivery_date) { // phpcs:enable if ($user->rights->reception->creer) @@ -1236,7 +1235,7 @@ class Reception extends CommonObject $sql .= " SET date_delivery = ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : 'null'); $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_delivery_date", LOG_DEBUG); + dol_syslog(get_class($this)."::setDeliveryDate", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index c364d3c63f4..7d70a9d49ba 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -229,7 +229,7 @@ if (empty($reshook)) else setEventMessages($langs->trans($object->error), null, 'errors'); } } elseif ($action == 'setdate_livraison' && $usercancreate) { - $result = $object->set_delivery_date($user, dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); + $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); if ($result < 0) dol_print_error($db, $object->error); } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index cf18491e493..03daddc6c48 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1507,6 +1507,20 @@ class SupplierProposal extends CommonObject } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Set delivery date + * + * @param User $user Object user that modify + * @param int $delivery_date Delivery date + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if ko, >0 if ok + * @deprecated Use setDeliveryDate + */ + public function set_date_livraison($user, $delivery_date, $notrigger = 0) + { + return $this->setDeliveryDate($user, $delivery_date, $notrigger); + } + /** * Set delivery date * @@ -1514,7 +1528,7 @@ class SupplierProposal extends CommonObject * @param int $delivery_date Delivery date * @return int <0 if ko, >0 if ok */ - public function set_delivery_date($user, $delivery_date) + public function setDeliveryDate($user, $delivery_date) { // phpcs:enable if (!empty($user->rights->supplier_proposal->creer)) @@ -1529,7 +1543,7 @@ class SupplierProposal extends CommonObject return 1; } else { $this->error = $this->db->error(); - dol_syslog(get_class($this)."::set_delivery_date Erreur SQL"); + dol_syslog(get_class($this)."::setDeliveryDate Erreur SQL"); return -1; } } From d6839ddca60c47ed3d57711a3265a70b1a71b210 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 26 Oct 2020 16:59:25 +0100 Subject: [PATCH 21/79] No trigger for expedition --- htdocs/expedition/class/expedition.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index f604af94813..b55243dd08c 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1963,13 +1963,12 @@ class Expedition extends CommonObject * * @param User $user Object user that modify * @param int $delivery_date Delivery date - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok * @deprecated Use setDeliveryDate */ - public function set_date_livraison($user, $delivery_date, $notrigger = 0) + public function set_date_livraison($user, $delivery_date) { - return $this->setDeliveryDate($user, $delivery_date, $notrigger); + return $this->setDeliveryDate($user, $delivery_date); } /** From fa8e4a9bb022c18d1d14bcd0afdbbcfff06a7e5c Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 26 Oct 2020 17:02:33 +0100 Subject: [PATCH 22/79] No trigger for supplier proposal --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 03daddc6c48..f27a3df4438 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1512,13 +1512,12 @@ class SupplierProposal extends CommonObject * * @param User $user Object user that modify * @param int $delivery_date Delivery date - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok * @deprecated Use setDeliveryDate */ - public function set_date_livraison($user, $delivery_date, $notrigger = 0) + public function set_date_livraison($user, $delivery_date) { - return $this->setDeliveryDate($user, $delivery_date, $notrigger); + return $this->setDeliveryDate($user, $delivery_date); } /** From d803c7f42997f4d80b9caf4d99e85486adeee5d7 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 26 Oct 2020 16:06:05 +0000 Subject: [PATCH 23/79] Fixing style errors. --- htdocs/commande/class/commande.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9019e3fb3ae..f1584d826ef 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2550,7 +2550,7 @@ class Commande extends CommonOrder // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set delivery date - * + * * @param User $user Object user that modify * @param int $delivery_date Delivery date * @param int $notrigger 1=Does not execute triggers, 0= execute triggers diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 488ccb276cf..d16b62ba004 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2260,7 +2260,7 @@ class CommandeFournisseur extends CommonOrder // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set delivery date - * + * * @param User $user Object user that modify * @param int $delivery_date Delivery date * @param int $notrigger 1=Does not execute triggers, 0= execute triggers From adeddc70ca630187c9556fcbcc82177f7007e490 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Oct 2020 18:10:58 +0100 Subject: [PATCH 24/79] FIX Deletion of expensereport + other generated object not complete. --- htdocs/core/class/commonobject.class.php | 12 +++++ htdocs/ecm/class/ecmfiles.class.php | 2 +- .../class/expensereport.class.php | 47 +++++++++++++------ 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1aba76fe2c2..1ff633f46ce 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7947,6 +7947,18 @@ abstract class CommonObject } } + // Delete llx_ecm_files + if (!$error) { + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id; + $resql = $this->db->query($sql); + if (!$resql) + { + $this->error = $this->db->lasterror(); + $this->errors[] = $this->error; + $error++; + } + } + if (!$error && !empty($this->isextrafieldmanaged)) { $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields"; diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 8f1b2c91d78..a4ca91a11c0 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -312,7 +312,7 @@ class EcmFiles extends CommonObject * @param string $relativepath Relative path of file from document directory. Example: path/path2/file * @param string $hashoffile Hash of file content. Take the first one found if same file is at different places. This hash will also change if file content is changed. * @param string $hashforshare Hash of file sharing. - * @param string $src_object_type src_object_type to search + * @param string $src_object_type src_object_type to search (value of object->table_element) * @param string $src_object_id src_object_id to search * @return int <0 if KO, 0 if not found, >0 if OK */ diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 5a7a087a1ff..4548e2b77d6 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1106,30 +1106,47 @@ class ExpenseReport extends CommonObject if (!$rowid) $rowid = $this->id; + $error = 0; + + // Delete lines $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element_line.' WHERE '.$this->fk_element.' = '.$rowid; - if ($this->db->query($sql)) + if (!$error && !$this->db->query($sql)) { + $this->error = $this->db->error()." sql=".$sql; + dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); + $error++; + } + + // Delete llx_ecm_files + if (!$error) { + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id; + $resql = $this->db->query($sql); + if (!$resql) + { + $this->error = $this->db->lasterror(); + $this->errors[] = $this->error; + $error++; + } + } + + // Delete main record + if (!$error) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid = '.$rowid; $resql = $this->db->query($sql); - if ($resql) - { - $this->db->commit(); - return 1; - } - else + if (!$resql) { $this->error = $this->db->error()." sql=".$sql; dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); - $this->db->rollback(); - return -6; } } - else - { - $this->error = $this->db->error()." sql=".$sql; - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); - $this->db->rollback(); - return -4; + + // Commit or rollback + if ($error) { + $this->db->rollback(); + return -1; + } else { + $this->db->commit(); + return 1; } } From 3ff6f6a04a8dd186375b8583e8bf96d1b534bc66 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 26 Oct 2020 18:13:25 +0100 Subject: [PATCH 25/79] Move phpcs enable to correct location @frederic34 --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 5d31463125c..78804dacec2 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2072,6 +2072,7 @@ class Propal extends CommonObject */ public function set_date_livraison($user, $delivery_date, $notrigger = 0) { + // phpcs:enable return $this->setDeliveryDate($user, $delivery_date, $notrigger); } @@ -2085,7 +2086,6 @@ class Propal extends CommonObject */ public function setDeliveryDate($user, $delivery_date, $notrigger = 0) { - // phpcs:enable if (!empty($user->rights->propal->creer)) { $error = 0; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9019e3fb3ae..12652e0868e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2559,6 +2559,7 @@ class Commande extends CommonOrder */ public function set_date_livraison($user, $delivery_date, $notrigger = 0) { + // phpcs:enable return $this->setDeliveryDate($user, $delivery_date, $notrigger); } @@ -2572,7 +2573,6 @@ class Commande extends CommonOrder */ public function setDeliveryDate($user, $delivery_date, $notrigger = 0) { - // phpcs:enable if ($user->rights->commande->creer) { $error = 0; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index b55243dd08c..d288e7172df 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1968,6 +1968,7 @@ class Expedition extends CommonObject */ public function set_date_livraison($user, $delivery_date) { + // phpcs:enable return $this->setDeliveryDate($user, $delivery_date); } @@ -1980,7 +1981,6 @@ class Expedition extends CommonObject */ public function setDeliveryDate($user, $delivery_date) { - // phpcs:enable if ($user->rights->expedition->creer) { $sql = "UPDATE ".MAIN_DB_PREFIX."expedition"; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 488ccb276cf..25aab5b7492 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2269,6 +2269,7 @@ class CommandeFournisseur extends CommonOrder */ public function set_date_livraison($user, $delivery_date, $notrigger = 0) { + // phpcs:enable return $this->setDeliveryDate($user, $delivery_date, $notrigger); } @@ -2282,7 +2283,6 @@ class CommandeFournisseur extends CommonOrder */ public function setDeliveryDate($user, $delivery_date, $notrigger = 0) { - // phpcs:enable if ($user->rights->fournisseur->commande->creer) { $error = 0; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index f27a3df4438..44f8245a496 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1517,6 +1517,7 @@ class SupplierProposal extends CommonObject */ public function set_date_livraison($user, $delivery_date) { + // phpcs:enable return $this->setDeliveryDate($user, $delivery_date); } @@ -1529,7 +1530,6 @@ class SupplierProposal extends CommonObject */ public function setDeliveryDate($user, $delivery_date) { - // phpcs:enable if (!empty($user->rights->supplier_proposal->creer)) { $sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal "; From 93ab281d816c0a5324f2840fc3b5ab0e481e3f14 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 26 Oct 2020 18:21:47 +0100 Subject: [PATCH 26/79] Fix tab indent --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 78804dacec2..7496f98a394 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2070,7 +2070,7 @@ class Propal extends CommonObject * @return int <0 if ko, >0 if ok * @deprecated Use setDeliveryDate */ - public function set_date_livraison($user, $delivery_date, $notrigger = 0) + public function set_date_livraison($user, $delivery_date, $notrigger = 0) { // phpcs:enable return $this->setDeliveryDate($user, $delivery_date, $notrigger); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 1dba8792581..d4f44913a17 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2557,7 +2557,7 @@ class Commande extends CommonOrder * @return int <0 if ko, >0 if ok * @deprecated Use setDeliveryDate */ - public function set_date_livraison($user, $delivery_date, $notrigger = 0) + public function set_date_livraison($user, $delivery_date, $notrigger = 0) { // phpcs:enable return $this->setDeliveryDate($user, $delivery_date, $notrigger); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index d288e7172df..6ac3b4a5290 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1966,7 +1966,7 @@ class Expedition extends CommonObject * @return int <0 if ko, >0 if ok * @deprecated Use setDeliveryDate */ - public function set_date_livraison($user, $delivery_date) + public function set_date_livraison($user, $delivery_date) { // phpcs:enable return $this->setDeliveryDate($user, $delivery_date); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 5c7081ceb71..383e5ba4d07 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2267,7 +2267,7 @@ class CommandeFournisseur extends CommonOrder * @return int <0 if ko, >0 if ok * @deprecated Use setDeliveryDate */ - public function set_date_livraison($user, $delivery_date, $notrigger = 0) + public function set_date_livraison($user, $delivery_date, $notrigger = 0) { // phpcs:enable return $this->setDeliveryDate($user, $delivery_date, $notrigger); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 44f8245a496..bb8387c55e3 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1515,7 +1515,7 @@ class SupplierProposal extends CommonObject * @return int <0 if ko, >0 if ok * @deprecated Use setDeliveryDate */ - public function set_date_livraison($user, $delivery_date) + public function set_date_livraison($user, $delivery_date) { // phpcs:enable return $this->setDeliveryDate($user, $delivery_date); From 1ba0e92c41a9a57ce4f531a04528cff9827ae153 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 26 Oct 2020 18:30:32 +0100 Subject: [PATCH 27/79] Fix reception fetch_lines --- htdocs/reception/class/reception.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 0a2458f57a6..f084a8cd8b9 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1018,12 +1018,12 @@ class Reception extends CommonObject if (!empty($resql)) { $this->lines = array(); - while ($obj = $resql->fetch_object()) { + while ($obj = $this->db->fetch_object($resql)) { $line = new CommandeFournisseurDispatch($this->db); $line->fetch($obj->rowid); $line->fetch_product(); $sql_commfourndet = 'SELECT qty, ref, label, tva_tx, vat_src_code, subprice, multicurrency_subprice, remise_percent FROM llx_commande_fournisseurdet WHERE rowid='.$line->fk_commandefourndet; - $resql_commfourndet = $db->query($sql_commfourndet); + $resql_commfourndet = $this->db->query($sql_commfourndet); if (!empty($resql_commfourndet)) { $obj = $this->db->fetch_object($resql_commfourndet); $line->qty_asked = $obj->qty; From 3ee618d736448f28d5a6e2d478176b7cdac3a858 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Oct 2020 18:31:12 +0100 Subject: [PATCH 28/79] FIX Clean orphan records in llx_ecm_files into repair script. --- htdocs/install/mysql/migration/repair.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index aa5ab65d3ff..021cb61c1fc 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -185,6 +185,7 @@ delete from llx_categorie_project where fk_categorie not in (select rowid from l -- Fix: delete orphelins in ecm_files delete from llx_ecm_files where src_object_type = 'expensereport' and src_object_id NOT IN (select rowid from llx_expensereport); +delete from llx_ecm_files where (src_object_type = 'contrat' OR src_object_type = 'contract') and src_object_id NOT IN (select rowid from llx_contrat); -- Fix: delete orphelin deliveries. Note: deliveries are linked to shipment by llx_element_element only. No other links. delete from llx_livraisondet where fk_livraison not in (select fk_target from llx_element_element where targettype = 'delivery') AND fk_livraison not in (select fk_source from llx_element_element where sourcetype = 'delivery'); From 3e686e167c0412a2e6ffa2d3059d2e8e3aeb3bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 18:31:45 +0100 Subject: [PATCH 29/79] clean triggers --- .../core/triggers/dolibarrtriggers.class.php | 14 +- .../interface_20_all_Logevents.class.php | 73 ++++---- ...e_20_modWorkflow_WorkflowManager.class.php | 168 +++++++----------- ...face_99_modZapier_ZapierTriggers.class.php | 24 +-- 4 files changed, 111 insertions(+), 168 deletions(-) diff --git a/htdocs/core/triggers/dolibarrtriggers.class.php b/htdocs/core/triggers/dolibarrtriggers.class.php index 3d60ea890ed..e2af4d44a30 100644 --- a/htdocs/core/triggers/dolibarrtriggers.class.php +++ b/htdocs/core/triggers/dolibarrtriggers.class.php @@ -70,8 +70,19 @@ abstract class DolibarrTriggers */ public $errors = array(); + /** + * @var string module is in development + */ const VERSION_DEVELOPMENT = 'development'; + + /** + * @var string module is experimental + */ const VERSION_EXPERIMENTAL = 'experimental'; + + /** + * @var string module is dolibarr + */ const VERSION_DOLIBARR = 'dolibarr'; /** @@ -84,8 +95,7 @@ abstract class DolibarrTriggers $this->db = $db; - if (empty($this->name)) - { + if (empty($this->name)) { $this->name = preg_replace('/^Interface/i', '', get_class($this)); } } diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 4f368f95473..8088143cb2b 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -31,20 +31,27 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceLogevents extends DolibarrTriggers { - /** - * @var string Image of the trigger - */ - public $picto = 'technic'; + /** + * @var DoliDB Database handler + */ + protected $db; - public $family = 'core'; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; - public $description = "Triggers of this module allows to add security event records inside Dolibarr."; - - /** - * Version of the trigger - * @var string - */ - public $version = self::VERSION_DOLIBARR; + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "core"; + $this->description = "Triggers of this module allows to add security event records inside Dolibarr."; + // 'development', 'experimental', 'dolibarr' or version + $this->version = self::VERSION_DOLIBARR; + $this->picto = 'technic'; + } /** * Function called when a Dolibarrr security audit event is done. @@ -70,8 +77,7 @@ class InterfaceLogevents extends DolibarrTriggers $date = dol_now(); // Actions - if ($action == 'USER_LOGIN') - { + if ($action == 'USER_LOGIN') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); @@ -81,16 +87,14 @@ class InterfaceLogevents extends DolibarrTriggers $desc = "(UserLogged,".$object->login.")"; $desc .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg); } - if ($action == 'USER_LOGIN_FAILED') - { + if ($action == 'USER_LOGIN_FAILED') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // Initialisation donnees (date,duree,texte,desc) $text = $object->trigger_mesg; // Message direct $desc = $object->trigger_mesg; // Message direct } - if ($action == 'USER_LOGOUT') - { + if ($action == 'USER_LOGOUT') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); @@ -98,47 +102,40 @@ class InterfaceLogevents extends DolibarrTriggers $text = "(UserLogoff,".$object->login.")"; $desc = "(UserLogoff,".$object->login.")"; } - if ($action == 'USER_CREATE') - { + if ($action == 'USER_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) $text = $langs->transnoentities("NewUserCreated", $object->login); $desc = $langs->transnoentities("NewUserCreated", $object->login); - } elseif ($action == 'USER_MODIFY') - { + } elseif ($action == 'USER_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) $text = $langs->transnoentities("EventUserModified", $object->login); $desc = $langs->transnoentities("EventUserModified", $object->login); - } elseif ($action == 'USER_NEW_PASSWORD') - { + } elseif ($action == 'USER_NEW_PASSWORD') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) $text = $langs->transnoentities("NewUserPassword", $object->login); $desc = $langs->transnoentities("NewUserPassword", $object->login); - } elseif ($action == 'USER_ENABLEDISABLE') - { + } elseif ($action == 'USER_ENABLEDISABLE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - if ($object->statut == 0) - { + if ($object->statut == 0) { $text = $langs->transnoentities("UserEnabled", $object->login); $desc = $langs->transnoentities("UserEnabled", $object->login); } - if ($object->statut == 1) - { + if ($object->statut == 1) { $text = $langs->transnoentities("UserDisabled", $object->login); $desc = $langs->transnoentities("UserDisabled", $object->login); } - } elseif ($action == 'USER_DELETE') - { + } elseif ($action == 'USER_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) @@ -147,22 +144,19 @@ class InterfaceLogevents extends DolibarrTriggers } // Groupes - elseif ($action == 'USERGROUP_CREATE') - { + elseif ($action == 'USERGROUP_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) $text = $langs->transnoentities("NewGroupCreated", $object->name); $desc = $langs->transnoentities("NewGroupCreated", $object->name); - } elseif ($action == 'USERGROUP_MODIFY') - { + } elseif ($action == 'USERGROUP_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) $text = $langs->transnoentities("GroupModified", $object->name); $desc = $langs->transnoentities("GroupModified", $object->name); - } elseif ($action == 'USERGROUP_DELETE') - { + } elseif ($action == 'USERGROUP_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) @@ -193,8 +187,7 @@ class InterfaceLogevents extends DolibarrTriggers $event->user_agent = $_SERVER["HTTP_USER_AGENT"]; $result = $event->create($user); - if ($result > 0) - { + if ($result > 0) { return 1; } else { $error = "Failed to insert security event: ".$event->error; diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index b40900dd6c7..1fb75ea961a 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -32,19 +32,27 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; class InterfaceWorkflowManager extends DolibarrTriggers { - /** - * @var string Image of the trigger - */ - public $picto = 'technic'; + /** + * @var DoliDB Database handler + */ + protected $db; - public $family = 'core'; - public $description = "Triggers of this module allows to manage workflows"; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; - /** - * Version of the trigger - * @var string - */ - public $version = self::VERSION_DOLIBARR; + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "core"; + $this->description = "Triggers of this module allows to manage workflows"; + // 'development', 'experimental', 'dolibarr' or version + $this->version = self::VERSION_DOLIBARR; + $this->picto = 'technic'; + } /** * Function called when a Dolibarrr business event is done. @@ -62,11 +70,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers if (empty($conf->workflow->enabled)) return 0; // Module not active, we do nothing // Proposals to order - if ($action == 'PROPAL_CLOSE_SIGNED') - { + if ($action == 'PROPAL_CLOSE_SIGNED') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) - { + if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $newobject = new Commande($this->db); @@ -81,11 +87,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers } // Order to invoice - if ($action == 'ORDER_CLOSE') - { + if ($action == 'ORDER_CLOSE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE)) - { + if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE)) { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $newobject = new Facture($this->db); @@ -100,24 +104,18 @@ class InterfaceWorkflowManager extends DolibarrTriggers } // Order classify billed proposal - if ($action == 'ORDER_CLASSIFY_BILLED') - { + if ($action == 'ORDER_CLASSIFY_BILLED') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL)) - { + if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL)) { $object->fetchObjectLinked('', 'propal', $object->id, $object->element); - if (!empty($object->linkedObjects)) - { + if (!empty($object->linkedObjects)) { $totalonlinkedelements = 0; - foreach ($object->linkedObjects['propal'] as $element) - { + foreach ($object->linkedObjects['propal'] as $element) { if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht; } dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); - if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) - { - foreach ($object->linkedObjects['propal'] as $element) - { + if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { + foreach ($object->linkedObjects['propal'] as $element) { $ret = $element->classifyBilled($user); } } @@ -127,27 +125,21 @@ class InterfaceWorkflowManager extends DolibarrTriggers } // classify billed order & billed propososal - if ($action == 'BILL_VALIDATE') - { + if ($action == 'BILL_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $ret = 0; // First classify billed the order to allow the proposal classify process - if (!empty($conf->commande->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) - { + if (!empty($conf->commande->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) { $object->fetchObjectLinked('', 'commande', $object->id, $object->element); - if (!empty($object->linkedObjects)) - { + if (!empty($object->linkedObjects)) { $totalonlinkedelements = 0; - foreach ($object->linkedObjects['commande'] as $element) - { + foreach ($object->linkedObjects['commande'] as $element) { if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht; } dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); - if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) - { - foreach ($object->linkedObjects['commande'] as $element) - { + if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { + foreach ($object->linkedObjects['commande'] as $element) { $ret = $element->classifyBilled($user); } } @@ -155,21 +147,16 @@ class InterfaceWorkflowManager extends DolibarrTriggers } // Second classify billed the proposal. - if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL)) - { + if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL)) { $object->fetchObjectLinked('', 'propal', $object->id, $object->element); - if (!empty($object->linkedObjects)) - { + if (!empty($object->linkedObjects)) { $totalonlinkedelements = 0; - foreach ($object->linkedObjects['propal'] as $element) - { + foreach ($object->linkedObjects['propal'] as $element) { if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht; } dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); - if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) - { - foreach ($object->linkedObjects['propal'] as $element) - { + if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { + foreach ($object->linkedObjects['propal'] as $element) { $ret = $element->classifyBilled($user); } } @@ -180,26 +167,20 @@ class InterfaceWorkflowManager extends DolibarrTriggers } // classify billed order & billed propososal - if ($action == 'BILL_SUPPLIER_VALIDATE') - { + if ($action == 'BILL_SUPPLIER_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // First classify billed the order to allow the proposal classify process - if (!empty($conf->fournisseur->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER)) - { + if (!empty($conf->fournisseur->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER)) { $object->fetchObjectLinked('', 'order_supplier', $object->id, $object->element); - if (!empty($object->linkedObjects)) - { + if (!empty($object->linkedObjects)) { $totalonlinkedelements = 0; - foreach ($object->linkedObjects['order_supplier'] as $element) - { + foreach ($object->linkedObjects['order_supplier'] as $element) { if ($element->statut == CommandeFournisseur::STATUS_ACCEPTED || $element->statut == CommandeFournisseur::STATUS_ORDERSENT || $element->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $element->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) $totalonlinkedelements += $element->total_ht; } dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); - if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) - { - foreach ($object->linkedObjects['order_supplier'] as $element) - { + if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { + foreach ($object->linkedObjects['order_supplier'] as $element) { $ret = $element->classifyBilled($user); } } @@ -208,21 +189,16 @@ class InterfaceWorkflowManager extends DolibarrTriggers } // Second classify billed the proposal. - if (!empty($conf->supplier_proposal->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL)) - { + if (!empty($conf->supplier_proposal->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL)) { $object->fetchObjectLinked('', 'supplier_proposal', $object->id, $object->element); - if (!empty($object->linkedObjects)) - { + if (!empty($object->linkedObjects)) { $totalonlinkedelements = 0; - foreach ($object->linkedObjects['supplier_proposal'] as $element) - { + foreach ($object->linkedObjects['supplier_proposal'] as $element) { if ($element->statut == SupplierProposal::STATUS_SIGNED || $element->statut == SupplierProposal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht; } dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); - if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) - { - foreach ($object->linkedObjects['supplier_proposal'] as $element) - { + if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { + foreach ($object->linkedObjects['supplier_proposal'] as $element) { $ret = $element->classifyBilled($user); } } @@ -232,25 +208,19 @@ class InterfaceWorkflowManager extends DolibarrTriggers } // Invoice classify billed order - if ($action == 'BILL_PAYED') - { + if ($action == 'BILL_PAYED') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER)) - { + if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER)) { $object->fetchObjectLinked('', 'commande', $object->id, $object->element); - if (!empty($object->linkedObjects)) - { + if (!empty($object->linkedObjects)) { $totalonlinkedelements = 0; - foreach ($object->linkedObjects['commande'] as $element) - { + foreach ($object->linkedObjects['commande'] as $element) { if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht; } dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); - if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) - { - foreach ($object->linkedObjects['commande'] as $element) - { + if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { + foreach ($object->linkedObjects['commande'] as $element) { $ret = $element->classifyBilled($user); } } @@ -259,12 +229,10 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } - if ($action == 'SHIPPING_VALIDATE') - { + if ($action == 'SHIPPING_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING)) - { + if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING)) { $qtyshipped = array(); $qtyordred = array(); require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -318,25 +286,19 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } // classify billed reception - if ($action == 'BILL_SUPPLIER_VALIDATE') - { + if ($action == 'BILL_SUPPLIER_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG); - if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) - { + if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) { $object->fetchObjectLinked('', 'reception', $object->id, $object->element); - if (!empty($object->linkedObjects)) - { + if (!empty($object->linkedObjects)) { $totalonlinkedelements = 0; - foreach ($object->linkedObjects['reception'] as $element) - { + foreach ($object->linkedObjects['reception'] as $element) { if ($element->statut == Reception::STATUS_VALIDATED) $totalonlinkedelements += $element->total_ht; } dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); - if ($totalonlinkedelements == $object->total_ht) - { - foreach ($object->linkedObjects['reception'] as $element) - { + if ($totalonlinkedelements == $object->total_ht) { + foreach ($object->linkedObjects['reception'] as $element) { $ret = $element->set_billed(); } } diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index 62d84295915..9c9fffff8ae 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -57,31 +57,10 @@ class InterfaceZapierTriggers extends DolibarrTriggers $this->family = "technic"; $this->description = "Zapier triggers."; // 'development', 'experimental', 'dolibarr' or version - $this->version = 'development'; + $this->version = self::VERSION_DEVELOPMENT; $this->picto = 'zapier'; } - /** - * Trigger name - * - * @return string Name of trigger file - */ - public function getName() - { - return $this->name; - } - - /** - * Trigger description - * - * @return string Description of trigger file - */ - public function getDesc() - { - return $this->description; - } - - /** * Function called when a Dolibarrr business event is done. * All functions "runTrigger" are triggered if file @@ -96,7 +75,6 @@ class InterfaceZapierTriggers extends DolibarrTriggers */ public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { - global $db; if (empty($conf->zapier->enabled)) { // Module not active, we do nothing return 0; From 66fbddb89257d903132baec5ba24f2e0c4d66860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 18:35:27 +0100 Subject: [PATCH 30/79] clean triggers --- ...terface_50_modAgenda_ActionsAuto.class.php | 288 +++++++----------- ..._modBlockedlog_ActionsBlockedLog.class.php | 54 ++-- 2 files changed, 132 insertions(+), 210 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 15637dc4a61..694b12faf4d 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -34,19 +34,27 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceActionsAuto extends DolibarrTriggers { - public $family = 'agenda'; - public $description = "Triggers of this module add actions in agenda according to setup made in agenda setup."; + /** + * @var DoliDB Database handler + */ + protected $db; - /** - * Version of the trigger - * @var string - */ - public $version = self::VERSION_DOLIBARR; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; - /** - * @var string Image of the trigger - */ - public $picto = 'action'; + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "agenda"; + $this->description = "Triggers of this module add actions in agenda according to setup made in agenda setup."; + // 'development', 'experimental', 'dolibarr' or version + $this->version = self::VERSION_DOLIBARR; + $this->picto = 'action'; + } /** * Function called when a Dolibarrr business event is done. @@ -87,8 +95,7 @@ class InterfaceActionsAuto extends DolibarrTriggers if (empty($object->actiontypecode)) $object->actiontypecode = 'AC_OTH_AUTO'; // Actions - if ($action == 'COMPANY_CREATE') - { + if ($action == 'COMPANY_CREATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "companies")); @@ -97,8 +104,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; $object->socid = $object->id; - } elseif ($action == 'COMPANY_SENTBYMAIL') - { + } elseif ($action == 'COMPANY_SENTBYMAIL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -106,8 +112,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'CONTACT_CREATE') - { + } elseif ($action == 'CONTACT_CREATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "companies")); @@ -116,8 +121,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array($object->id => $object->id); $object->socid = $object->socid; - } elseif ($action == 'CONTRACT_VALIDATE') - { + } elseif ($action == 'CONTRACT_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "contracts")); @@ -125,21 +129,18 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); $object->sendtoid = 0; - } elseif ($action == 'CONTRACT_SENTBYMAIL') - { + } elseif ($action == 'CONTRACT_SENTBYMAIL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "contracts")); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ContractSentByEMail", $object->ref); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("ContractSentByEMail", $object->ref); } // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'PROPAL_VALIDATE') - { + } elseif ($action == 'PROPAL_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -147,21 +148,18 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); $object->sendtoid = 0; - } elseif ($action == 'PROPAL_SENTBYMAIL') - { + } elseif ($action == 'PROPAL_SENTBYMAIL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref); } // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'PROPAL_CLOSE_SIGNED') - { + } elseif ($action == 'PROPAL_CLOSE_SIGNED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -169,8 +167,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'PROPAL_CLASSIFY_BILLED') - { + } elseif ($action == 'PROPAL_CLASSIFY_BILLED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -178,8 +175,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'PROPAL_CLOSE_REFUSED') - { + } elseif ($action == 'PROPAL_CLOSE_REFUSED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -187,8 +183,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'ORDER_VALIDATE') - { + } elseif ($action == 'ORDER_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "orders")); @@ -196,8 +191,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); $object->sendtoid = 0; - } elseif ($action == 'ORDER_CLOSE') - { + } elseif ($action == 'ORDER_CLOSE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -205,8 +199,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("OrderDeliveredInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'ORDER_CLASSIFY_BILLED') - { + } elseif ($action == 'ORDER_CLASSIFY_BILLED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -214,8 +207,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("OrderBilledInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'ORDER_CANCEL') - { + } elseif ($action == 'ORDER_CANCEL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -223,21 +215,18 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'ORDER_SENTBYMAIL') - { + } elseif ($action == 'ORDER_SENTBYMAIL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderSentByEMail", $object->ref); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("OrderSentByEMail", $object->ref); } // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'BILL_VALIDATE') - { + } elseif ($action == 'BILL_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -245,8 +234,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); $object->sendtoid = 0; - } elseif ($action == 'BILL_UNVALIDATE') - { + } elseif ($action == 'BILL_UNVALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -254,21 +242,18 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'BILL_SENTBYMAIL') - { + } elseif ($action == 'BILL_SENTBYMAIL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceSentByEMail", $object->ref); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("InvoiceSentByEMail", $object->ref); } // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'BILL_PAYED') - { + } elseif ($action == 'BILL_PAYED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -277,8 +262,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'BILL_CANCEL') - { + } elseif ($action == 'BILL_CANCEL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -286,8 +270,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'FICHINTER_CREATE') - { + } elseif ($action == 'FICHINTER_CREATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -297,8 +280,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; $object->fk_element = 0; $object->elementtype = ''; - } elseif ($action == 'FICHINTER_VALIDATE') - { + } elseif ($action == 'FICHINTER_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -308,8 +290,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; $object->fk_element = 0; $object->elementtype = ''; - } elseif ($action == 'FICHINTER_MODIFY') - { + } elseif ($action == 'FICHINTER_MODIFY') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -319,21 +300,18 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; $object->fk_element = 0; $object->elementtype = ''; - } elseif ($action == 'FICHINTER_SENTBYMAIL') - { + } elseif ($action == 'FICHINTER_SENTBYMAIL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionSentByEMail", $object->ref); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("InterventionSentByEMail", $object->ref); } // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'FICHINTER_CLASSIFY_BILLED') - { + } elseif ($action == 'FICHINTER_CLASSIFY_BILLED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -341,8 +319,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED') - { + } elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -350,8 +327,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'FICHINTER_DELETE') - { + } elseif ($action == 'FICHINTER_DELETE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -361,62 +337,53 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; $object->fk_element = 0; $object->elementtype = ''; - } elseif ($action == 'SHIPPING_VALIDATE') - { + } elseif ($action == 'SHIPPING_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "sendings")); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref)); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref)); } // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'SHIPPING_SENTBYMAIL') - { + } elseif ($action == 'SHIPPING_SENTBYMAIL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "sendings")); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ShippingSentByEMail", $object->ref); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("ShippingSentByEMail", $object->ref); } // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'RECEPTION_VALIDATE') - { + } elseif ($action == 'RECEPTION_VALIDATE') { $langs->load("agenda"); $langs->load("other"); $langs->load("receptions"); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref)); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref)); } // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'RECEPTION_SENTBYMAIL') - { + } elseif ($action == 'RECEPTION_SENTBYMAIL') { $langs->load("agenda"); $langs->load("other"); $langs->load("receptions"); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ReceptionSentByEMail", $object->ref); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("ReceptionSentByEMail", $object->ref); } // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE') - { + } elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -424,21 +391,18 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); $object->sendtoid = 0; - } elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL') - { + } elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref); } // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED') - { + } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -446,8 +410,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED') - { + } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -455,8 +418,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'ORDER_SUPPLIER_CREATE') - { + } elseif ($action == 'ORDER_SUPPLIER_CREATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -464,8 +426,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); $object->sendtoid = 0; - } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') - { + } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -473,8 +434,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); $object->sendtoid = 0; - } elseif ($action == 'ORDER_SUPPLIER_APPROVE') - { + } elseif ($action == 'ORDER_SUPPLIER_APPROVE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -482,8 +442,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("OrderApprovedInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'ORDER_SUPPLIER_REFUSE') - { + } elseif ($action == 'ORDER_SUPPLIER_REFUSE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -491,8 +450,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'ORDER_SUPPLIER_SUBMIT') - { + } elseif ($action == 'ORDER_SUPPLIER_SUBMIT') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -500,8 +458,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref)); $object->sendtoid = 0; - } elseif ($action == 'ORDER_SUPPLIER_RECEIVE') - { + } elseif ($action == 'ORDER_SUPPLIER_RECEIVE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -509,33 +466,28 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref)); $object->sendtoid = 0; - } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') - { + } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills", "orders")); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref); } // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED') - { + } elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills", "orders")); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref); } $object->sendtoid = 0; - } elseif ($action == 'BILL_SUPPLIER_VALIDATE') - { + } elseif ($action == 'BILL_SUPPLIER_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -543,8 +495,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref)); $object->sendtoid = 0; - } elseif ($action == 'BILL_SUPPLIER_UNVALIDATE') - { + } elseif ($action == 'BILL_SUPPLIER_UNVALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -552,21 +503,18 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') - { + } elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills", "orders")); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref); - if (empty($object->actionmsg)) - { + if (empty($object->actionmsg)) { $object->actionmsg = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref); } // Parameters $object->sendtoid defined by caller //$object->sendtoid=0; - } elseif ($action == 'BILL_SUPPLIER_PAYED') - { + } elseif ($action == 'BILL_SUPPLIER_PAYED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -574,8 +522,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref); $object->sendtoid = 0; - } elseif ($action == 'BILL_SUPPLIER_CANCELED') - { + } elseif ($action == 'BILL_SUPPLIER_CANCELED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -586,8 +533,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } // Members - elseif ($action == 'MEMBER_VALIDATE') - { + elseif ($action == 'MEMBER_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -597,8 +543,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; $object->sendtoid = 0; - } elseif ($action == 'MEMBER_MODIFY') - { + } elseif ($action == 'MEMBER_MODIFY') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -608,14 +553,12 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; $object->sendtoid = 0; - } elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE') - { + } elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); $member = $this->context['member']; - if (!is_object($member)) // This should not happen - { + if (!is_object($member)) { // This should not happen include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $member = new Adherent($this->db); $member->fetch($this->fk_adherent); @@ -630,14 +573,12 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; if ($object->fk_soc > 0) $object->socid = $object->fk_soc; - } elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY') - { + } elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); $member = $this->context['member']; - if (!is_object($member)) // This should not happen - { + if (!is_object($member)) { // This should not happen include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $member = new Adherent($this->db); $member->fetch($this->fk_adherent); @@ -652,8 +593,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; if ($object->fk_soc > 0) $object->socid = $object->fk_soc; - } elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') - { + } elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -666,8 +606,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; if ($object->fk_soc > 0) $object->socid = $object->fk_soc; - } elseif ($action == 'MEMBER_RESILIATE') - { + } elseif ($action == 'MEMBER_RESILIATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -677,8 +616,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; $object->sendtoid = 0; - } elseif ($action == 'MEMBER_DELETE') - { + } elseif ($action == 'MEMBER_DELETE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -691,8 +629,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } // Projects - elseif ($action == 'PROJECT_CREATE') - { + elseif ($action == 'PROJECT_CREATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -701,8 +638,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref; $object->sendtoid = 0; - } elseif ($action == 'PROJECT_VALIDATE') - { + } elseif ($action == 'PROJECT_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -711,8 +647,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref; $object->sendtoid = 0; - } elseif ($action == 'PROJECT_MODIFY') - { + } elseif ($action == 'PROJECT_MODIFY') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -724,8 +659,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } // Project tasks - elseif ($action == 'TASK_CREATE') - { + elseif ($action == 'TASK_CREATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -734,8 +668,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref; $object->sendtoid = 0; - } elseif ($action == 'TASK_MODIFY') - { + } elseif ($action == 'TASK_MODIFY') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -744,8 +677,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref; $object->sendtoid = 0; - } elseif ($action == 'TASK_DELETE') - { + } elseif ($action == 'TASK_DELETE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -754,23 +686,20 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref; $object->sendtoid = 0; - } elseif ($action == 'TICKET_ASSIGNED') - { + } elseif ($action == 'TICKET_ASSIGNED') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref); $object->actionmsg = $langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref); - if ($object->oldcopy->fk_user_assign > 0) - { + if ($object->oldcopy->fk_user_assign > 0) { $tmpuser = new User($this->db); $tmpuser->fetch($object->oldcopy->fk_user_assign); $object->actionmsg .= "\n".$langs->transnoentities("OldUser").': '.$tmpuser->getFullName($langs); } else { $object->actionmsg .= "\n".$langs->transnoentities("OldUser").': '.$langs->trans("None"); } - if ($object->fk_user_assign > 0) - { + if ($object->fk_user_assign > 0) { $tmpuser = new User($this->db); $tmpuser->fetch($object->fk_user_assign); $object->actionmsg .= "\n".$langs->transnoentities("NewUser").': '.$tmpuser->getFullName($langs); @@ -816,11 +745,9 @@ class InterfaceActionsAuto extends DolibarrTriggers // Add entry in event table $now = dol_now(); - if (isset($_SESSION['listofnames-'.$object->trackid])) - { + if (isset($_SESSION['listofnames-'.$object->trackid])) { $attachs = $_SESSION['listofnames-'.$object->trackid]; - if ($attachs && strpos($action, 'SENTBYMAIL')) - { + if ($attachs && strpos($action, 'SENTBYMAIL')) { $object->actionmsg = dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs); } } @@ -830,8 +757,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $societeforaction = new Societe($this->db); // Set contactforaction if there is only 1 contact. - if (is_array($object->sendtoid)) - { + if (is_array($object->sendtoid)) { if (count($object->sendtoid) == 1) $contactforaction->fetch(reset($object->sendtoid)); } else { if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid); @@ -846,8 +772,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $elementid = $object->id; // id of object $elementtype = $object->element; $elementmodule = $object->module; - if ($object->element == 'subscription') - { + if ($object->element == 'subscription') { $elementid = $object->fk_adherent; $elementtype = 'member'; } @@ -881,8 +806,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table // for such objects because there is already a dedicated field into table llx_actioncomm or llx_actioncomm_resources. - if (!in_array($elementtype, array('societe', 'contact', 'project'))) - { + if (!in_array($elementtype, array('societe', 'contact', 'project'))) { $actioncomm->fk_element = $elementid; $actioncomm->elementtype = $elementtype.($elementmodule ? '@'.$elementmodule : ''); } @@ -901,8 +825,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $ret = $actioncomm->create($user); // User creating action - if ($ret > 0 && $conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO) - { + if ($ret > 0 && $conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO) { if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) { foreach ($object->attachedfiles['paths'] as $key=>$filespath) { $srcfile = $filespath; @@ -918,8 +841,7 @@ class InterfaceActionsAuto extends DolibarrTriggers unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action. - if ($ret > 0) - { + if ($ret > 0) { $_SESSION['LAST_ACTION_CREATED'] = $ret; return 1; } else { diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 0800d66eea3..aa41a4d375b 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -30,19 +30,27 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceActionsBlockedLog extends DolibarrTriggers { - public $family = 'system'; - public $description = "Triggers of this module add action for BlockedLog module (Module of unalterable logs)."; + /** + * @var DoliDB Database handler + */ + protected $db; - /** - * Version of the trigger - * @var string - */ - public $version = self::VERSION_DOLIBARR; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; - /** - * @var string Image of the trigger - */ - public $picto = 'technic'; + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "system"; + $this->description = "Triggers of this module add action for BlockedLog module (Module of unalterable logs)."; + // 'development', 'experimental', 'dolibarr' or version + $this->version = self::VERSION_DOLIBARR; + $this->picto = 'technic'; + } /** * Function called on Dolibarr payment or invoice event. @@ -68,8 +76,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers $b = new BlockedLog($this->db); // Tracked events - if (!in_array($action, array_keys($b->trackedevents))) - { + if (!in_array($action, array_keys($b->trackedevents))) { return 0; } @@ -84,15 +91,13 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers || (in_array($object->element, array('facture', 'supplier_invoice')) && $action === 'DOC_DOWNLOAD' && $object->statut != 0) || (in_array($object->element, array('facture', 'supplier_invoice')) && $action === 'DOC_PREVIEW' && $object->statut != 0) || (!empty($conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED) && in_array($action, explode(',', $conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED))) - ) - { + ) { $qualified++; if (in_array($action, array( 'MEMBER_SUBSCRIPTION_CREATE', 'MEMBER_SUBSCRIPTION_MODIFY', 'MEMBER_SUBSCRIPTION_DELETE', 'DON_VALIDATE', 'DON_MODIFY', 'DON_DELETE'))) $amounts = (double) $object->amount; - elseif ($action == 'CASHCONTROL_VALIDATE') - { + elseif ($action == 'CASHCONTROL_VALIDATE') { $amounts = (double) $object->cash + (double) $object->cheque + (double) $object->card; } else $amounts = (double) $object->total_ttc; } @@ -103,8 +108,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers $amounts= (double) $object->total_ttc; }*/ if ($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_SUPPLIER_CREATE' || $action === 'DONATION_PAYMENT_CREATE' - || $action === 'PAYMENT_CUSTOMER_DELETE' || $action === 'PAYMENT_SUPPLIER_DELETE' || $action === 'DONATION_PAYMENT_DELETE') - { + || $action === 'PAYMENT_CUSTOMER_DELETE' || $action === 'PAYMENT_SUPPLIER_DELETE' || $action === 'DONATION_PAYMENT_DELETE') { $qualified++; $amounts = 0; if (!empty($object->amounts)) { @@ -112,23 +116,20 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers $amounts += price2num($amount); } } - } elseif (strpos($action, 'PAYMENT') !== false && !in_array($action, array('PAYMENT_ADD_TO_BANK'))) - { + } elseif (strpos($action, 'PAYMENT') !== false && !in_array($action, array('PAYMENT_ADD_TO_BANK'))) { $qualified++; $amounts = (double) $object->amount; } // Another protection. // May be used when event is DOC_DOWNLOAD or DOC_PREVIEW and element is not an invoice - if (!$qualified) - { + if (!$qualified) { return 0; // not implemented action log } $result = $b->setObjectData($object, $action, $amounts, $user); // Set field date_object, ref_object, fk_object, element, object_data - if ($result < 0) - { + if ($result < 0) { $this->error = $b->error; $this->errors = $b->errors; return -1; @@ -136,8 +137,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers $res = $b->create($user); - if ($res < 0) - { + if ($res < 0) { $this->error = $b->error; $this->errors = $b->errors; return -1; From b6142dded60f814efaee8d129e1b21bc9bc05c66 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 26 Oct 2020 18:40:24 +0100 Subject: [PATCH 31/79] Remove phpcs disable enable from setDeliveryDate in delivery class --- htdocs/delivery/class/delivery.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 983558d0844..17f1087c25b 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -999,8 +999,7 @@ class Delivery extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** + /** * Set the planned delivery date * * @param User $user Objet utilisateur qui modifie @@ -1009,7 +1008,6 @@ class Delivery extends CommonObject */ public function setDeliveryDate($user, $delivery_date) { - // phpcs:enable if ($user->rights->expedition->creer) { $sql = "UPDATE ".MAIN_DB_PREFIX."delivery"; From 360ea91be58dc806772cb65a0765e4c80cdfffb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 18:46:03 +0100 Subject: [PATCH 32/79] clean triggers --- .../core/triggers/dolibarrtriggers.class.php | 2 +- .../interface_20_all_Logevents.class.php | 5 - ...e_20_modWorkflow_WorkflowManager.class.php | 5 - ...terface_50_modAgenda_ActionsAuto.class.php | 5 - ..._modBlockedlog_ActionsBlockedLog.class.php | 5 - ...interface_50_modLdap_Ldapsynchro.class.php | 339 ++++++------------ ...odMailmanspip_Mailmanspipsynchro.class.php | 70 ++-- ..._50_modNotification_Notification.class.php | 43 ++- ...terface_50_modTicket_TicketEmail.class.php | 77 +--- .../interface_80_modStripe_Stripe.class.php | 85 ++--- ...rface_90_modSociete_ContactRoles.class.php | 31 +- 11 files changed, 216 insertions(+), 451 deletions(-) diff --git a/htdocs/core/triggers/dolibarrtriggers.class.php b/htdocs/core/triggers/dolibarrtriggers.class.php index e2af4d44a30..a06b4f89528 100644 --- a/htdocs/core/triggers/dolibarrtriggers.class.php +++ b/htdocs/core/triggers/dolibarrtriggers.class.php @@ -81,7 +81,7 @@ abstract class DolibarrTriggers const VERSION_EXPERIMENTAL = 'experimental'; /** - * @var string module is dolibarr + * @var string module is dolibarr ready */ const VERSION_DOLIBARR = 'dolibarr'; diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 8088143cb2b..7fa7e32da08 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -31,11 +31,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceLogevents extends DolibarrTriggers { - /** - * @var DoliDB Database handler - */ - protected $db; - /** * Constructor * diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 1fb75ea961a..3b2e4fb6db0 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -32,11 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; class InterfaceWorkflowManager extends DolibarrTriggers { - /** - * @var DoliDB Database handler - */ - protected $db; - /** * Constructor * diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 694b12faf4d..ce5d6da1b30 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -34,11 +34,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceActionsAuto extends DolibarrTriggers { - /** - * @var DoliDB Database handler - */ - protected $db; - /** * Constructor * diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index aa41a4d375b..8409d96e5e0 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -30,11 +30,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceActionsBlockedLog extends DolibarrTriggers { - /** - * @var DoliDB Database handler - */ - protected $db; - /** * Constructor * diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index 9c3987cbeb1..bed87b0377f 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -31,19 +31,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceLdapsynchro extends DolibarrTriggers { - public $family = 'ldap'; - public $description = "Triggers of this module allows to synchronize Dolibarr toward a LDAP database."; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; - /** - * Version of the trigger - * @var string - */ - public $version = self::VERSION_DOLIBARR; - - /** - * @var string Image of the trigger - */ - public $picto = 'technic'; + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "ldap"; + $this->description = "Triggers of this module allows to synchronize Dolibarr toward a LDAP database."; + // 'development', 'experimental', 'dolibarr' or version + $this->version = self::VERSION_DOLIBARR; + $this->picto = 'technic'; + } /** * Function called when a Dolibarrr business event is done. @@ -61,8 +64,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing if (defined('DISABLE_LDAP_SYNCHRO')) return 0; // If constant defined, we do nothing - if (!function_exists('ldap_connect')) - { + if (!function_exists('ldap_connect')) { dol_syslog("Warning, module LDAP is enabled but LDAP functions not available in this PHP", LOG_WARNING); return 0; } @@ -73,16 +75,13 @@ class InterfaceLdapsynchro extends DolibarrTriggers $result = 0; // Users - if ($action == 'USER_CREATE') - { + if ($action == 'USER_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') - { + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); @@ -91,18 +90,14 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } - } elseif ($action == 'USER_MODIFY') - { + } elseif ($action == 'USER_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') - { + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { - if (empty($object->oldcopy) || !is_object($object->oldcopy)) - { + if ($result > 0) { + if (empty($object->oldcopy) || !is_object($object->oldcopy)) { dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING); $object->oldcopy = clone $object; } @@ -114,8 +109,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $object->oldcopy->_load_ldap_dn($oldinfo, 1); $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -129,18 +123,14 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } - } elseif ($action == 'USER_NEW_PASSWORD') - { + } elseif ($action == 'USER_NEW_PASSWORD') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') - { + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { - if (empty($object->oldcopy) || !is_object($object->oldcopy)) - { + if ($result > 0) { + if (empty($object->oldcopy) || !is_object($object->oldcopy)) { dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING); $object->oldcopy = clone $object; } @@ -152,8 +142,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $object->oldcopy->_load_ldap_dn($oldinfo, 1); $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -165,19 +154,15 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } - } elseif ($action == 'USER_ENABLEDISABLE') - { + } elseif ($action == 'USER_ENABLEDISABLE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - } elseif ($action == 'USER_DELETE') - { + } elseif ($action == 'USER_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') - { + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); @@ -186,20 +171,16 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } - } elseif ($action == 'USER_SETINGROUP') - { + } elseif ($action == 'USER_SETINGROUP') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') - { + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { // Must edit $object->newgroupid $usergroup = new UserGroup($this->db); - if ($object->newgroupid > 0) - { + if ($object->newgroupid > 0) { $usergroup->fetch($object->newgroupid); $oldinfo = $usergroup->_load_ldap_info(); @@ -209,8 +190,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $usergroup->_load_ldap_dn($oldinfo, 1); $search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -223,20 +203,16 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } - } elseif ($action == 'USER_REMOVEFROMGROUP') - { + } elseif ($action == 'USER_REMOVEFROMGROUP') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') - { + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { // Must edit $object->newgroupid $usergroup = new UserGroup($this->db); - if ($object->oldgroupid > 0) - { + if ($object->oldgroupid > 0) { $usergroup->fetch($object->oldgroupid); $oldinfo = $usergroup->_load_ldap_info(); @@ -246,8 +222,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $usergroup->_load_ldap_dn($oldinfo, 1); $search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -263,16 +238,13 @@ class InterfaceLdapsynchro extends DolibarrTriggers } // Groupes - elseif ($action == 'USERGROUP_CREATE') - { + elseif ($action == 'USERGROUP_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') - { + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); @@ -286,18 +258,14 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } - } elseif ($action == 'USERGROUP_MODIFY') - { + } elseif ($action == 'USERGROUP_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') - { + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { - if (empty($object->oldcopy) || !is_object($object->oldcopy)) - { + if ($result > 0) { + if (empty($object->oldcopy) || !is_object($object->oldcopy)) { dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING); $object->oldcopy = clone $object; } @@ -309,8 +277,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $object->oldcopy->_load_ldap_dn($oldinfo, 1); $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -322,16 +289,13 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } - } elseif ($action == 'USERGROUP_DELETE') - { + } elseif ($action == 'USERGROUP_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') - { + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); @@ -343,16 +307,13 @@ class InterfaceLdapsynchro extends DolibarrTriggers } // Contacts - elseif ($action == 'CONTACT_CREATE') - { + elseif ($action == 'CONTACT_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) - { + if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); @@ -361,18 +322,14 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } - } elseif ($action == 'CONTACT_MODIFY') - { + } elseif ($action == 'CONTACT_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) - { + if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { - if (empty($object->oldcopy) || !is_object($object->oldcopy)) - { + if ($result > 0) { + if (empty($object->oldcopy) || !is_object($object->oldcopy)) { dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING); $object->oldcopy = clone $object; } @@ -384,8 +341,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $object->oldcopy->_load_ldap_dn($oldinfo, 1); $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -397,16 +353,13 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } - } elseif ($action == 'CONTACT_DELETE') - { + } elseif ($action == 'CONTACT_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) - { + if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); @@ -418,26 +371,21 @@ class InterfaceLdapsynchro extends DolibarrTriggers } // Members - elseif ($action == 'MEMBER_CREATE') - { + elseif ($action == 'MEMBER_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') - { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); $result = $ldap->add($dn, $info, $user); // For member type - if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') - { - if ($object->typeid > 0) - { + if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') { + if ($object->typeid > 0) { require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php"; $membertype = new AdherentType($this->db); $membertype->fetch($object->typeid); @@ -450,8 +398,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $membertype->_load_ldap_dn($oldinfo, 1); $search = "(".$membertype->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -465,19 +412,15 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } - } elseif ($action == 'MEMBER_VALIDATE') - { + } elseif ($action == 'MEMBER_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') - { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') { // If status field is setup to be synchronized - if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) - { + if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); $olddn = $dn; // We know olddn=dn as we change only status @@ -488,23 +431,19 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } } - } elseif ($action == 'MEMBER_SUBSCRIPTION') - { + } elseif ($action == 'MEMBER_SUBSCRIPTION') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') - { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') { // If subscriptions fields are setup to be synchronized if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE || $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT || $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE || $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT - || $conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) - { + || $conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); $olddn = $dn; // We know olddn=dn as we change only subscriptions @@ -515,18 +454,14 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } } - } elseif ($action == 'MEMBER_MODIFY') - { + } elseif ($action == 'MEMBER_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') - { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { - if (empty($object->oldcopy) || !is_object($object->oldcopy)) - { + if ($result > 0) { + if (empty($object->oldcopy) || !is_object($object->oldcopy)) { dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING); $object->oldcopy = clone $object; } @@ -538,8 +473,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $object->oldcopy->_load_ldap_dn($oldinfo, 1); $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -551,8 +485,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $result = $ldap->update($dn, $info, $user, $olddn, $newrdn, $newparent); // For member type - if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') - { + if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') { require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php"; /* @@ -569,8 +502,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $newmembertype->_load_ldap_dn($oldinfo, 1); $search = "(".$newmembertype->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -579,8 +511,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $result = $ldap->update($dn, $info, $user, $olddn); - if ($object->oldcopy->typeid != $object->typeid) - { + if ($object->oldcopy->typeid != $object->typeid) { /* * Remove member in old member type */ @@ -595,8 +526,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $oldmembertype->_load_ldap_dn($oldinfo, 1); $search = "(".$oldmembertype->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -608,24 +538,19 @@ class InterfaceLdapsynchro extends DolibarrTriggers } } - if ($result <= 0) - { + if ($result <= 0) { $this->errors[] = "ErrorLDAP ".$ldap->error; } } - } elseif ($action == 'MEMBER_NEW_PASSWORD') - { + } elseif ($action == 'MEMBER_NEW_PASSWORD') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') - { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') { // If password field is setup to be synchronized - if ($conf->global->LDAP_FIELD_PASSWORD || $conf->global->LDAP_FIELD_PASSWORD_CRYPTED) - { + if ($conf->global->LDAP_FIELD_PASSWORD || $conf->global->LDAP_FIELD_PASSWORD_CRYPTED) { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); $olddn = $dn; // We know olddn=dn as we change only password @@ -633,25 +558,20 @@ class InterfaceLdapsynchro extends DolibarrTriggers $result = $ldap->update($dn, $info, $user, $olddn); } - if ($result <= 0) - { + if ($result <= 0) { $this->errors[] = "ErrorLDAP ".$ldap->error; } } } - } elseif ($action == 'MEMBER_RESILIATE') - { + } elseif ($action == 'MEMBER_RESILIATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') - { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') { // If status field is setup to be synchronized - if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) - { + if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); $olddn = $dn; // We know olddn=dn as we change only status @@ -659,32 +579,26 @@ class InterfaceLdapsynchro extends DolibarrTriggers $result = $ldap->update($dn, $info, $user, $olddn); } - if ($result <= 0) - { + if ($result <= 0) { $this->errors[] = "ErrorLDAP ".$ldap->error; } } } - } elseif ($action == 'MEMBER_DELETE') - { + } elseif ($action == 'MEMBER_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') - { + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); $result = $ldap->delete($dn); // For member type - if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') - { - if ($object->typeid > 0) - { + if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') { + if ($object->typeid > 0) { require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php"; /* @@ -701,8 +615,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $membertype->_load_ldap_dn($oldinfo, 1); $search = "(".$membertype->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -714,24 +627,20 @@ class InterfaceLdapsynchro extends DolibarrTriggers } } - if ($result <= 0) - { + if ($result <= 0) { $this->errors[] = "ErrorLDAP ".$ldap->error; } } } // Members types - elseif ($action == 'MEMBER_TYPE_CREATE') - { + elseif ($action == 'MEMBER_TYPE_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') - { + if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); @@ -743,23 +652,18 @@ class InterfaceLdapsynchro extends DolibarrTriggers $result = $ldap->add($dn, $info, $user); } - if ($result <= 0) - { + if ($result <= 0) { $this->errors[] = "ErrorLDAP ".$ldap->error; } } - } elseif ($action == 'MEMBER_TYPE_MODIFY') - { + } elseif ($action == 'MEMBER_TYPE_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') - { + if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { - if (empty($object->oldcopy) || !is_object($object->oldcopy)) - { + if ($result > 0) { + if (empty($object->oldcopy) || !is_object($object->oldcopy)) { dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING); $object->oldcopy = clone $object; } @@ -773,8 +677,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $object->oldcopy->_load_ldap_dn($oldinfo, 1); $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -790,24 +693,20 @@ class InterfaceLdapsynchro extends DolibarrTriggers $this->errors[] = "ErrorLDAP ".$ldap->error; } } - } elseif ($action == 'MEMBER_TYPE_DELETE') - { + } elseif ($action == 'MEMBER_TYPE_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') - { + if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) - { + if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); $result = $ldap->delete($dn); } - if ($result <= 0) - { + if ($result <= 0) { $this->errors[] = "ErrorLDAP ".$ldap->error; } } diff --git a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php index 59005b2f34d..e8766401219 100644 --- a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php @@ -29,19 +29,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceMailmanSpipsynchro extends DolibarrTriggers { - public $family = 'mailmanspip'; - public $description = "Triggers of this module allows to synchronize Mailman an Spip."; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; - /** - * Version of the trigger - * @var string - */ - public $version = self::VERSION_DOLIBARR; - - /** - * @var string Image of the trigger - */ - public $picto = 'technic'; + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "mailmanspip"; + $this->description = "Triggers of this module allows to synchronize Mailman an Spip."; + // 'development', 'experimental', 'dolibarr' or version + $this->version = self::VERSION_DOLIBARR; + $this->picto = 'technic'; + } /** * Function called when a Dolibarrr business event is done. @@ -61,13 +64,11 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers require_once DOL_DOCUMENT_ROOT."/mailmanspip/class/mailmanspip.class.php"; require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"; - if ($action == 'CATEGORY_LINK') - { + if ($action == 'CATEGORY_LINK') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // We add subscription if we change category (new category may means more mailing-list to subscribe) - if (is_object($object->context['linkto']) && method_exists($object->context['linkto'], 'add_to_abo') && $object->context['linkto']->add_to_abo() < 0) - { + if (is_object($object->context['linkto']) && method_exists($object->context['linkto'], 'add_to_abo') && $object->context['linkto']->add_to_abo() < 0) { $this->error = $object->context['linkto']->error; $this->errors = $object->context['linkto']->errors; $return = -1; @@ -76,13 +77,11 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers } return $return; - } elseif ($action == 'CATEGORY_UNLINK') - { + } elseif ($action == 'CATEGORY_UNLINK') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // We remove subscription if we change category (lessw category may means less mailing-list to subscribe) - if (is_object($object->context['unlinkoff']) && method_exists($object->context['unlinkoff'], 'del_to_abo') && $object->context['unlinkoff']->del_to_abo() < 0) - { + if (is_object($object->context['unlinkoff']) && method_exists($object->context['unlinkoff'], 'del_to_abo') && $object->context['unlinkoff']->del_to_abo() < 0) { $this->error = $object->context['unlinkoff']->error; $this->errors = $object->context['unlinkoff']->errors; $return = -1; @@ -94,13 +93,11 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers } // Members - elseif ($action == 'MEMBER_VALIDATE') - { + elseif ($action == 'MEMBER_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $return = 0; - if ($object->add_to_abo() < 0) - { + if ($object->add_to_abo() < 0) { $this->errors = $object->errors; if (!empty($object->error)) $this->errors[] = $object->error; $return = -1; @@ -109,28 +106,23 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers } return $return; - } elseif ($action == 'MEMBER_MODIFY') - { + } elseif ($action == 'MEMBER_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $return = 0; // Add user into some linked tools (mailman, spip, etc...) - if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid)) - { - if (is_object($object->oldcopy) && (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))) // If email has changed or if list has changed we delete mailman subscription for old email - { - if ($object->oldcopy->del_to_abo() < 0) - { + if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid)) { + if (is_object($object->oldcopy) && (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))) { // If email has changed or if list has changed we delete mailman subscription for old email + if ($object->oldcopy->del_to_abo() < 0) { $this->errors = $object->oldcopy->errors; if (!empty($object->oldcopy->error)) $this->errors[] = $object->oldcopy->error; $return = -1; - } else { + } else { $return = 1; - } + } } // We add subscription if new email or new type (new type may means more mailing-list to subscribe) - if ($object->add_to_abo() < 0) - { + if ($object->add_to_abo() < 0) { $this->errors = $object->errors; if (!empty($object->error)) $this->errors[] = $object->error; $return = -1; @@ -140,14 +132,12 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers } return $return; - } elseif ($action == 'MEMBER_RESILIATE' || $action == 'MEMBER_DELETE') - { + } elseif ($action == 'MEMBER_RESILIATE' || $action == 'MEMBER_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $return = 0; // Remove from external tools (mailman, spip, etc...) - if ($object->del_to_abo() < 0) - { + if ($object->del_to_abo() < 0) { $this->errors = $object->errors; if (!empty($object->error)) $this->errors[] = $object->error; $return = -1; diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index a7157ea866a..a0b5638dbca 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -30,20 +30,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceNotification extends DolibarrTriggers { - public $family = 'notification'; - public $description = "Triggers of this module send email notifications according to Notification module setup."; - - /** - * Version of the trigger - * @var string - */ - public $version = self::VERSION_DOLIBARR; - - /** - * @var string Image of the trigger - */ - public $picto = 'email'; - // @todo Defined also into notify.class.php) public $listofmanagedevents = array( 'BILL_VALIDATE', @@ -63,6 +49,23 @@ class InterfaceNotification extends DolibarrTriggers 'HOLIDAY_APPROVE' ); + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "notification"; + $this->description = "Triggers of this module send email notifications according to Notification module setup."; + // 'development', 'experimental', 'dolibarr' or version + $this->version = self::VERSION_DOLIBARR; + $this->picto = 'email'; + } + /** * Function called when a Dolibarrr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) @@ -107,20 +110,17 @@ class InterfaceNotification extends DolibarrTriggers $sql .= $this->db->order("rang, elementtype, code"); dol_syslog("getListOfManagedEvents Get list of notifications", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) - { + if ($resql) { $num = $this->db->num_rows($resql); $i = 0; - while ($i < $num) - { + while ($i < $num) { $obj = $this->db->fetch_object($resql); $qualified = 0; // Check is this event is supported by notification module if (in_array($obj->code, $this->listofmanagedevents)) $qualified = 1; // Check if module for this event is active - if ($qualified) - { + if ($qualified) { //print 'xx'.$obj->code; $element = $obj->elementtype; @@ -133,8 +133,7 @@ class InterfaceNotification extends DolibarrTriggers elseif (!in_array($element, array('order_supplier', 'invoice_supplier', 'withdraw', 'shipping', 'member', 'expensereport')) && empty($conf->$element->enabled)) $qualified = 0; } - if ($qualified) - { + if ($qualified) { $ret[] = array('rowid'=>$obj->rowid, 'code'=>$obj->code, 'label'=>$obj->label, 'description'=>$obj->description, 'elementtype'=>$obj->elementtype); } diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index d541f2e82d0..3743d044e44 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -30,11 +30,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceTicketEmail extends DolibarrTriggers { - /** - * @var DoliDB Database handler. - */ - public $db; - /** * Constructor * @@ -47,53 +42,10 @@ class InterfaceTicketEmail extends DolibarrTriggers $this->name = preg_replace('/^Interface/i', '', get_class($this)); $this->family = "ticket"; $this->description = "Triggers of the module ticket to send notifications to internal users and to third-parties"; - $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version + $this->version = self::VERSION_DOLIBARR; // 'development', 'experimental', 'dolibarr' or version $this->picto = 'ticket'; } - /** - * Return name of trigger file - * - * @return string Name of trigger file - */ - public function getName() - { - return $this->name; - } - - /** - * Return description of trigger file - * - * @return string Description of trigger file - */ - public function getDesc() - { - return $this->description; - } - - /** - * Return version of trigger file - * - * @return string Version of trigger file - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') { - return $langs->trans("Development"); - } elseif ($this->version == 'experimental') { - return $langs->trans("Experimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } else { - return $langs->trans("Unknown"); - } - } - /** * Function called when a Dolibarrr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers @@ -115,16 +67,13 @@ class InterfaceTicketEmail extends DolibarrTriggers case 'TICKET_ASSIGNED': dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id) - { + if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id) { $userstat = new User($this->db); $res = $userstat->fetch($object->fk_user_assign); - if ($res > 0) - { + if ($res > 0) { // Send email to notification email - if (empty($conf->global->TICKET_DISABLE_ALL_MAILS)) - { + if (empty($conf->global->TICKET_DISABLE_ALL_MAILS)) { // Init to avoid errors $filepath = array(); $filename = array(); @@ -184,10 +133,8 @@ class InterfaceTicketEmail extends DolibarrTriggers // Send email to notification email $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; - if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) - { - if ($sendto) - { + if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) { + if ($sendto) { // Init to avoid errors $filepath = array(); $filename = array(); @@ -248,8 +195,7 @@ class InterfaceTicketEmail extends DolibarrTriggers // Send email to customer - if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) - { + if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { $sendto = ''; if (empty($user->socid) && empty($user->email)) { $object->fetch_thirdparty(); @@ -272,16 +218,13 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_customer .= '
  • '.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'
  • '; // Extrafields - foreach ($this->attributes[$object->table_element]['label'] as $key => $value) - { + foreach ($this->attributes[$object->table_element]['label'] as $key => $value) { $enabled = 1; - if ($enabled && isset($this->attributes[$object->table_element]['list'][$key])) - { + if ($enabled && isset($this->attributes[$object->table_element]['list'][$key])) { $enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1); } $perms = 1; - if ($perms && isset($this->attributes[$object->table_element]['perms'][$key])) - { + if ($perms && isset($this->attributes[$object->table_element]['perms'][$key])) { $perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1); } diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index 49bfae82247..25b7f57b6a5 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -35,11 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceStripe extends DolibarrTriggers { - /** - * @var DoliDB Database handler. - */ - public $db; - /** * Constructor * @@ -52,31 +47,10 @@ class InterfaceStripe extends DolibarrTriggers $this->name = preg_replace('/^Interface/i', '', get_class($this)); $this->family = 'stripe'; $this->description = "Triggers of the module Stripe"; - $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version + $this->version = self::VERSION_DOLIBARR; // 'development', 'experimental', 'dolibarr' or version $this->picto = 'stripe'; } - /** - * Trigger name - * - * @return string Name of trigger file - */ - public function getName() - { - return $this->name; - } - - - /** - * Trigger description - * - * @return string Description of trigger file - */ - public function getDesc() - { - return $this->description; - } - /** * Function called when a Dolibarrr business event is done. * All functions "runTrigger" are triggered if file @@ -104,8 +78,7 @@ class InterfaceStripe extends DolibarrTriggers $service = 'StripeTest'; $servicestatus = 0; - if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) - { + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { $service = 'StripeLive'; $servicestatus = 1; } @@ -118,8 +91,7 @@ class InterfaceStripe extends DolibarrTriggers if ($object->client != 0) { $customer = $stripe->customerStripe($object, $stripeacc, $servicestatus); // This make a network request - if ($customer) - { + if ($customer) { $namecleaned = $object->name ? $object->name : null; $vatcleaned = $object->tva_intra ? $object->tva_intra : null; // Example of valid numbers are 'FR12345678901' or 'FR12345678902' $desccleaned = $object->name_alias ? $object->name_alias : null; @@ -147,15 +119,13 @@ class InterfaceStripe extends DolibarrTriggers if ($desccleaned != $customer->description) $changerequested++; if (($customer->tax_exempt == 'exempt' && !$object->tva_assuj) || (!$customer->tax_exempt == 'exempt' && empty($object->tva_assuj))) $changerequested++; if (!isset($customer->tax_ids['data']) && !is_null($vatcleaned)) $changerequested++; - elseif (isset($customer->tax_ids['data'])) - { + elseif (isset($customer->tax_ids['data'])) { $taxinfo = reset($customer->tax_ids['data']); if (empty($taxinfo) && !empty($vatcleaned)) $changerequested++; if (isset($taxinfo->value) && $vatcleaned != $taxinfo->value) $changerequested++; } - if ($changerequested) - { + if ($changerequested) { /*if (! empty($object->email)) $customer->email = $object->email; $customer->description = $namecleaned; if (empty($taxinfo)) $customer->tax_info = array('type'=>'vat', 'tax_id'=>null); @@ -167,22 +137,17 @@ class InterfaceStripe extends DolibarrTriggers try { // Update Tax info on Stripe - if (!empty($conf->global->STRIPE_SAVE_TAX_IDS)) // We setup to save Tax info on Stripe side. Warning: This may result in error when saving customer - { - if (!empty($vatcleaned)) - { + if (!empty($conf->global->STRIPE_SAVE_TAX_IDS)) { // We setup to save Tax info on Stripe side. Warning: This may result in error when saving customer + if (!empty($vatcleaned)) { $isineec = isInEEC($object); - if ($object->country_code && $isineec) - { + if ($object->country_code && $isineec) { //$taxids = $customer->allTaxIds($customer->id); $customer->createTaxId($customer->id, array('type'=>'eu_vat', 'value'=>$vatcleaned)); } } else { $taxids = $customer->allTaxIds($customer->id); - if (is_array($taxids->data)) - { - foreach ($taxids->data as $taxidobj) - { + if (is_array($taxids->data)) { + foreach ($taxids->data as $taxidobj) { $customer->deleteTaxId($customer->id, $taxidobj->id); } } @@ -191,8 +156,7 @@ class InterfaceStripe extends DolibarrTriggers // Update Customer on Stripe $customer->save(); - } catch (Exception $e) - { + } catch (Exception $e) { //var_dump(\Stripe\Stripe::getApiVersion()); $this->errors[] = $e->getMessage(); $ok = -1; @@ -209,12 +173,10 @@ class InterfaceStripe extends DolibarrTriggers $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. $customer = $stripe->customerStripe($object, $stripeacc, $servicestatus); - if ($customer) - { + if ($customer) { try { $customer->delete(); - } catch (Exception $e) - { + } catch (Exception $e) { dol_syslog("Failed to delete Stripe customer ".$e->getMessage(), LOG_WARNING); } } @@ -232,13 +194,11 @@ class InterfaceStripe extends DolibarrTriggers if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object->type == 'card') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($object->stripe_card_ref)) - { + if (!empty($object->stripe_card_ref)) { $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. $stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this - if ($stripecu) - { + if ($stripecu) { // Get customer (required to get a card) if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage $customer = \Stripe\Customer::retrieve($stripecu); @@ -246,15 +206,13 @@ class InterfaceStripe extends DolibarrTriggers $customer = \Stripe\Customer::retrieve($stripecu, array("stripe_account" => $stripeacc)); } - if ($customer) - { + if ($customer) { $card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus); if ($card) { $card->metadata = array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'])); try { $card->save(); - } catch (Exception $e) - { + } catch (Exception $e) { $ok = -1; $this->error = $e->getMessages(); } @@ -266,13 +224,11 @@ class InterfaceStripe extends DolibarrTriggers if ($action == 'COMPANYPAYMENTMODE_DELETE' && $object->type == 'card') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($object->stripe_card_ref)) - { + if (!empty($object->stripe_card_ref)) { $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. $stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this - if ($stripecu) - { + if ($stripecu) { // Get customer (required to get a card) if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage $customer = \Stripe\Customer::retrieve($stripecu); @@ -280,8 +236,7 @@ class InterfaceStripe extends DolibarrTriggers $customer = \Stripe\Customer::retrieve($stripecu, array("stripe_account" => $stripeacc)); } - if ($customer) - { + if ($customer) { $card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus); if ($card) { if (method_exists($card, 'detach')) $card->detach(); diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index b51fd0a20b7..46cb7c56f17 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -33,23 +33,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceContactRoles extends DolibarrTriggers { + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; - public $family = 'agenda'; - - public $description = "Triggers of this module auto link contact to company."; - - /** - * Version of the trigger - * - * @var string - */ - public $version = self::VERSION_DOLIBARR; - - /** - * - * @var string Image of the trigger - */ - public $picto = 'action'; + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "agenda"; + $this->description = "Triggers of this module auto link contact to company."; + // 'development', 'experimental', 'dolibarr' or version + $this->version = self::VERSION_DOLIBARR; + $this->picto = 'action'; + } /** * Function called when a Dolibarrr business event is done. From 9c51d467b5bfdb0a330fd9d33d54107432ab9224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 18:49:38 +0100 Subject: [PATCH 33/79] clean triggers --- .../interface_99_modMyModule_MyModuleTriggers.class.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index be6d42047ce..4c661f42a24 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -40,11 +40,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceMyModuleTriggers extends DolibarrTriggers { - /** - * @var DoliDB Database handler - */ - protected $db; - /** * Constructor * @@ -106,7 +101,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers // For example : COMPANY_CREATE => public function companyCreate($action, $object, User $user, Translate $langs, Conf $conf) $methodName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($action))))); $callback = array($this, $methodName); - if (is_callable($callback)){ + if (is_callable($callback)) { dol_syslog( "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id ); From c58d3d0cf77327b63d7a88586bbd06c3827ea2cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Oct 2020 19:02:26 +0100 Subject: [PATCH 34/79] FIX #15163 --- htdocs/main.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 63b8eaa5561..88d13320271 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1591,6 +1591,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $appli.="
    ".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL; $logouttext=''; + $logouthtmltext = ''; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { //$logouthtmltext=$appli.'
    '; From b2f08e576235a7afa639585bfabd3e1d2c32c1f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Oct 2020 19:23:23 +0100 Subject: [PATCH 35/79] Update categorie.class.php --- htdocs/categories/class/categorie.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 302366f6669..8d9b96976cd 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -323,7 +323,7 @@ class Categorie extends CommonObject $sql .= " WHERE ref_ext LIKE '".$this->db->escape($ref_ext)."'"; } else { $sql .= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category').")"; - if (!is_null($type)) $sql .= " AND type = ".(int) $type; + if (!is_null($type)) $sql .= " AND type = ".((int) $type); } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); From 5e19483c99bed54895c2fee9a6ef279ac3a20dbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Oct 2020 19:26:55 +0100 Subject: [PATCH 36/79] Update don.class.php --- htdocs/don/class/don.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index eedd82fc7e0..a6fa9fa987d 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -401,7 +401,7 @@ class Don extends CommonObject $sql .= ", '".$this->db->escape($this->address)."'"; $sql .= ", '".$this->db->escape($this->zip)."'"; $sql .= ", '".$this->db->escape($this->town)."'"; - $sql .= ", ".(int) $this->country_id; + $sql .= ", ".(int) ($this->country_id > 0 ? $this->country_id : 0); $sql .= ", ".(int) $this->public; $sql .= ", ".($this->fk_project > 0 ? (int) $this->fk_project : "null"); $sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL"); From 680f4f9feeaa9a3469364043b19067c5922c9985 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Oct 2020 19:32:21 +0100 Subject: [PATCH 37/79] Update login.tpl.php --- htdocs/core/tpl/login.tpl.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 3f4507ebfe3..07229bcfed8 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -53,11 +53,12 @@ $arrayofjs = array( '/core/js/dst.js'.(empty($conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION)) ); -// we display application title instead Login term -if (!empty($conf->global->MAIN_APPLICATION_TITLE)) +// We display application title instead Login term +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { $titleofloginpage = $conf->global->MAIN_APPLICATION_TITLE; -else +} else { $titleofloginpage = $langs->trans('Login'); +} $titleofloginpage.= ' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version. $disablenofollow = 1; From a352c2d82ad92f2e8887582e338e79b947f5ed5d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Oct 2020 19:34:57 +0100 Subject: [PATCH 38/79] Doc --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index eae34c792a6..2e365b4f645 100644 --- a/ChangeLog +++ b/ChangeLog @@ -222,6 +222,7 @@ NEW: standardizes API thirdparties by email like other object NEW: thirdparty REST API: endpoint to set price level NEW: Use new category API for project list view NEW: Triggers Attributes and Attributes values +NEW: Add hooks on newpayment page to allow external payment modules WARNING: From c918acaadc3571d2186ec489a0de5ff5a6cda140 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Oct 2020 19:37:30 +0100 Subject: [PATCH 39/79] Doc --- htdocs/public/payment/newpayment.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 1986416e4de..a44428808a4 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -50,7 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; -// Hook added by Payzen. +// Hook to be used by external payment modules (ie Payzen, ...) include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); @@ -206,7 +206,7 @@ if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->strip // Initialize $validpaymentmethod $validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod); -// This hook is used to push to $validpaymentmethod the Payzen payment method as valid. +// This hook is used to push to $validpaymentmethod by external payment modules (ie Payzen, ...) $parameters = [ 'paymentmethod' => $paymentmethod, 'validpaymentmethod' => &$validpaymentmethod @@ -1651,7 +1651,7 @@ if ($action != 'dopayment') { if ($found && !$error) // We are in a management option and no error { - // Check status of the object (Invoice) to verify if it is paid in Payzen. + // Check status of the object (Invoice) to verify if it is paid by external payment modules (ie Payzen, ...) $parameters = [ 'source' => $source, 'object' => $object @@ -1677,7 +1677,7 @@ if ($action != 'dopayment') // Buttons for all payments registration methods - // This hook is used to add Payzen Button to newpayment.php. + // This hook is used to add Button to newpayment.php for external payment modules (ie Payzen, ...) $parameters = [ 'paymentmethod' => $paymentmethod ]; @@ -2270,7 +2270,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment print ''; } } - // This hook is used to show the embedded form to make payments with Payzen. + // This hook is used to show the embedded form to make payments with external payment modules (ie Payzen, ...) $parameters = [ 'paymentmethod' => $paymentmethod, 'amount' => price2num(GETPOST("newamount"), 'MT'), From 557a0caa912792b1bbaa1af146e46378df6ef3a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 20:10:19 +0100 Subject: [PATCH 40/79] Update interface_20_all_Logevents.class.php --- .../triggers/interface_20_all_Logevents.class.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 7fa7e32da08..d5e31c36d28 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -81,23 +81,20 @@ class InterfaceLogevents extends DolibarrTriggers $text .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg); $desc = "(UserLogged,".$object->login.")"; $desc .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg); - } - if ($action == 'USER_LOGIN_FAILED') { + } elseif ($action == 'USER_LOGIN_FAILED') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // Initialisation donnees (date,duree,texte,desc) $text = $object->trigger_mesg; // Message direct $desc = $object->trigger_mesg; // Message direct - } - if ($action == 'USER_LOGOUT') { + } elseif ($action == 'USER_LOGOUT') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) $text = "(UserLogoff,".$object->login.")"; $desc = "(UserLogoff,".$object->login.")"; - } - if ($action == 'USER_CREATE') { + } elseif ($action == 'USER_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); @@ -136,10 +133,8 @@ class InterfaceLogevents extends DolibarrTriggers // Initialisation donnees (date,duree,texte,desc) $text = $langs->transnoentities("UserDeleted", $object->login); $desc = $langs->transnoentities("UserDeleted", $object->login); - } - - // Groupes - elseif ($action == 'USERGROUP_CREATE') { + } elseif ($action == 'USERGROUP_CREATE') { + // Groups dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) From 0bdd6abca96aac49a9c30dd90806cfc9d8619988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 20:14:45 +0100 Subject: [PATCH 41/79] Update interface_99_modZapier_ZapierTriggers.class.php --- .../interface_99_modZapier_ZapierTriggers.class.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index 9c9fffff8ae..d028cf0f59f 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017-2020 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,11 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceZapierTriggers extends DolibarrTriggers { - /** - * @var DoliDB Database handler - */ - protected $db; - /** * Constructor * From 42f5fd7d5f7df201edb03d0a6a6fa8cf1088fc3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 21:38:16 +0100 Subject: [PATCH 42/79] display last members like on list --- htdocs/adherents/index.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index c63bb9049ca..aa7564007a6 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -285,6 +285,7 @@ print '
    '; $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; $sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; +$sql .= " a.gender, a.email, a.photo, a.morphy,"; $sql .= " a.tms as datem, datefin as date_end_subscription,"; $sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; @@ -307,8 +308,13 @@ if ($resql) { $obj = $db->fetch_object($resql); print ''; $staticmember->id = $obj->rowid; + $staticmember->ref = $obj->rowid; $staticmember->lastname = $obj->lastname; $staticmember->firstname = $obj->firstname; + $staticmember->gender = $obj->gender; + $staticmember->email = $obj->email; + $staticmember->photo = $obj->photo; + $staticmember->morphy = $obj->morphy; if (!empty($obj->fk_soc)) { $staticmember->fk_soc = $obj->fk_soc; $staticmember->fetch_thirdparty(); @@ -316,10 +322,9 @@ if ($resql) { } else { $staticmember->name = $obj->company; } - $staticmember->ref = $staticmember->getFullName($langs); $statictype->id = $obj->typeid; $statictype->label = $obj->label; - print ''.$staticmember->getNomUrl(1, 32).''; + print ''.$staticmember->getNomUrl(-1, 32).''; print ''.$statictype->getNomUrl(1, 32).''; print ''.dol_print_date($db->jdate($obj->datem), 'dayhour').''; print ''.$staticmember->LibStatut($obj->statut, ($obj->subscription == 'yes' ? 1 : 0), $db->jdate($obj->date_end_subscription), 3).''; @@ -340,7 +345,8 @@ if ($resql) { $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; $sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; -$sql .= " datefin as date_end_subscription,"; +$sql .= " a.gender, a.email, a.photo, a.morphy,"; +$sql .= " a.datefin as date_end_subscription,"; $sql .= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."subscription as c"; $sql .= " WHERE a.entity IN (".getEntity('adherent').")"; @@ -364,8 +370,13 @@ if ($resql) { $subscriptionstatic->id = $obj->cid; $subscriptionstatic->ref = $obj->cid; $staticmember->id = $obj->rowid; + $staticmember->ref = $obj->rowid; $staticmember->lastname = $obj->lastname; $staticmember->firstname = $obj->firstname; + $staticmember->gender = $obj->gender; + $staticmember->email = $obj->email; + $staticmember->photo = $obj->photo; + $staticmember->morphy = $obj->morphy; if (!empty($obj->fk_soc)) { $staticmember->fk_soc = $obj->fk_soc; $staticmember->fetch_thirdparty(); @@ -373,9 +384,8 @@ if ($resql) { } else { $staticmember->name = $obj->company; } - $staticmember->ref = $staticmember->getFullName($langs); print ''.$subscriptionstatic->getNomUrl(1).''; - print ''.$staticmember->getNomUrl(1, 32, 'subscription').''; + print ''.$staticmember->getNomUrl(-1, 32, 'subscription').''; print ''.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).''; print ''.price($obj->subscription).''; //print ''.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).''; From d3c87dabab1c8fc2da0eae5f33729de61a858890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 21:51:17 +0100 Subject: [PATCH 43/79] display members --- htdocs/adherents/list.php | 7 +++---- htdocs/adherents/subscription/list.php | 7 +++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index ef4639e4b5e..05100582ec2 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -656,6 +656,7 @@ while ($i < min($num, $limit)) { $memberstatic->datefin = $datefin; $memberstatic->socid = $obj->fk_soc; $memberstatic->photo = $obj->photo; + $memberstatic->email = $obj->email; $memberstatic->morphy = $obj->morphy; $memberstatic->note_public = $obj->note_public; $memberstatic->note_private = $obj->note_private; @@ -725,12 +726,10 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['d.morphy']['checked'])) { print ''; $s = ''; - if ($obj->morphy == 'phy') - { + if ($obj->morphy == 'phy') { $s .= ''.dol_substr($langs->trans("Physical"), 0, 1).''; } - if ($obj->morphy == 'mor') - { + if ($obj->morphy == 'mor') { $s .= ''.dol_substr($langs->trans("Moral"), 0, 1).''; } print $s; diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 364a7854fb7..9b5efa214b9 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -142,6 +142,7 @@ $now = dol_now(); // List of subscriptions $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo, d.statut,"; +$sql .= " d.gender, d.email, d.morphy,"; $sql .= " c.rowid as crowid, c.fk_type, c.subscription,"; $sql .= " c.dateadh, c.datef, c.datec as date_creation, c.tms as date_update,"; $sql .= " c.fk_bank as bank, c.note,"; @@ -151,8 +152,7 @@ $sql .= " JOIN ".MAIN_DB_PREFIX."subscription as c on d.rowid = c.fk_adherent"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")"; -if (isset($date_select) && $date_select != '') -{ +if (isset($date_select) && $date_select != '') { $sql .= " AND c.dateadh >= '".((int) $date_select)."-01-01 00:00:00'"; $sql .= " AND c.dateadh < '".((int) $date_select + 1)."-01-01 00:00:00'"; } @@ -403,6 +403,9 @@ while ($i < min($num, $limit)) { $adherent->statut = $obj->statut; $adherent->login = $obj->login; $adherent->photo = $obj->photo; + $adherent->gender = $obj->gender; + $adherent->morphy = $obj->morphy; + $adherent->email = $obj->email; $adherent->typeid = $obj->type; $typeid = ($obj->fk_type > 0 ? $obj->fk_type : $adherent->typeid); From 4a0dd3b4bce9e323c3d701b58cba7d7db0033ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Oct 2020 22:05:40 +0100 Subject: [PATCH 44/79] add small photo in picto link --- htdocs/core/lib/functions2.lib.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index d49085ecb8e..2f859d3093a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -227,12 +227,12 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; if (is_object($object->user_creation)) { - if ($object->user_creation->id) print $object->user_creation->getNomUrl(1, '', 0, 0, 0); + if ($object->user_creation->id) print $object->user_creation->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db); $userstatic->fetch($object->user_creation_id ? $object->user_creation_id : $object->user_creation); - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); + if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } if ($usetable) print ''; @@ -261,12 +261,12 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; if (is_object($object->user_modification)) { - if ($object->user_modification->id) print $object->user_modification->getNomUrl(1, '', 0, 0, 0); + if ($object->user_modification->id) print $object->user_modification->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db); $userstatic->fetch($object->user_modification_id ? $object->user_modification_id : $object->user_modification); - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); + if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } if ($usetable) print ''; @@ -295,12 +295,12 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; if (is_object($object->user_validation)) { - if ($object->user_validation->id) print $object->user_validation->getNomUrl(1, '', 0, 0, 0); + if ($object->user_validation->id) print $object->user_validation->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db); $userstatic->fetch($object->user_validation_id ? $object->user_validation_id : $object->user_validation); - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); + if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } if ($usetable) print ''; @@ -329,12 +329,12 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; if (is_object($object->user_approve)) { - if ($object->user_approve->id) print $object->user_approve->getNomUrl(1, '', 0, 0, 0); + if ($object->user_approve->id) print $object->user_approve->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db); $userstatic->fetch($object->user_approve_id ? $object->user_approve_id : $object->user_approve); - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); + if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } if ($usetable) print ''; @@ -363,7 +363,7 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; $userstatic = new User($db); $userstatic->fetch($object->user_approve_id2); - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); + if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); if ($usetable) print ''; else print '
    '; @@ -392,12 +392,12 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; if (is_object($object->user_closing)) { - if ($object->user_closing->id) print $object->user_closing->getNomUrl(1, '', 0, 0, 0); + if ($object->user_closing->id) print $object->user_closing->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db); $userstatic->fetch($object->user_closing); - if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); + if ($userstatic->id) print $userstatic->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } if ($usetable) print ''; @@ -427,7 +427,7 @@ function dol_print_object_info($object, $usetable = 0) else print ': '; if (is_object($object->user_rappro)) { - if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(1, '', 0, 0, 0); + if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(-1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db); From 43fd659d2a9d415a23c53a14cc00e2f0e7c27c32 Mon Sep 17 00:00:00 2001 From: Alfredo Altamirano Date: Mon, 26 Oct 2020 15:36:23 -0600 Subject: [PATCH 45/79] Rename translation string MO for ManufacturingOrder --- htdocs/langs/am_ET/mrp.lang | 2 +- htdocs/langs/ar_SA/mrp.lang | 2 +- htdocs/langs/az_AZ/mrp.lang | 2 +- htdocs/langs/bg_BG/mrp.lang | 2 +- htdocs/langs/bn_BD/mrp.lang | 2 +- htdocs/langs/bn_IN/mrp.lang | 2 +- htdocs/langs/bs_BA/mrp.lang | 2 +- htdocs/langs/ca_ES/mrp.lang | 2 +- htdocs/langs/cs_CZ/mrp.lang | 2 +- htdocs/langs/da_DK/mrp.lang | 2 +- htdocs/langs/de_DE/mrp.lang | 2 +- htdocs/langs/el_GR/mrp.lang | 2 +- htdocs/langs/en_US/mrp.lang | 4 ++-- htdocs/langs/es_AR/mrp.lang | 2 +- htdocs/langs/es_CL/mrp.lang | 2 +- htdocs/langs/es_ES/mrp.lang | 2 +- htdocs/langs/es_PE/mrp.lang | 2 +- htdocs/langs/et_EE/mrp.lang | 2 +- htdocs/langs/eu_ES/mrp.lang | 2 +- htdocs/langs/fa_IR/mrp.lang | 2 +- htdocs/langs/fi_FI/mrp.lang | 2 +- htdocs/langs/fr_FR/mrp.lang | 2 +- htdocs/langs/gl_ES/mrp.lang | 2 +- htdocs/langs/he_IL/mrp.lang | 2 +- htdocs/langs/hi_IN/mrp.lang | 2 +- htdocs/langs/hr_HR/mrp.lang | 2 +- htdocs/langs/hu_HU/mrp.lang | 2 +- htdocs/langs/id_ID/mrp.lang | 2 +- htdocs/langs/is_IS/mrp.lang | 2 +- htdocs/langs/it_IT/mrp.lang | 2 +- htdocs/langs/ja_JP/mrp.lang | 2 +- htdocs/langs/ka_GE/mrp.lang | 2 +- htdocs/langs/km_KH/mrp.lang | 2 +- htdocs/langs/kn_IN/mrp.lang | 2 +- htdocs/langs/ko_KR/mrp.lang | 2 +- htdocs/langs/lo_LA/mrp.lang | 2 +- htdocs/langs/lt_LT/mrp.lang | 2 +- htdocs/langs/lv_LV/mrp.lang | 2 +- htdocs/langs/mk_MK/mrp.lang | 2 +- htdocs/langs/mn_MN/mrp.lang | 2 +- htdocs/langs/nb_NO/mrp.lang | 2 +- htdocs/langs/ne_NP/mrp.lang | 2 +- htdocs/langs/nl_NL/mrp.lang | 2 +- htdocs/langs/pl_PL/mrp.lang | 2 +- htdocs/langs/pt_BR/mrp.lang | 2 +- htdocs/langs/pt_PT/mrp.lang | 2 +- htdocs/langs/ro_RO/mrp.lang | 2 +- htdocs/langs/ru_RU/mrp.lang | 2 +- htdocs/langs/sk_SK/mrp.lang | 2 +- htdocs/langs/sl_SI/mrp.lang | 2 +- htdocs/langs/sq_AL/mrp.lang | 2 +- htdocs/langs/sr_RS/mrp.lang | 2 +- htdocs/langs/sv_SE/mrp.lang | 2 +- htdocs/langs/sw_SW/mrp.lang | 2 +- htdocs/langs/th_TH/mrp.lang | 2 +- htdocs/langs/tr_TR/mrp.lang | 2 +- htdocs/langs/uk_UA/mrp.lang | 2 +- htdocs/langs/uz_UZ/mrp.lang | 2 +- htdocs/langs/vi_VN/mrp.lang | 2 +- htdocs/langs/zh_CN/mrp.lang | 2 +- htdocs/langs/zh_HK/mrp.lang | 2 +- htdocs/langs/zh_TW/mrp.lang | 2 +- 62 files changed, 63 insertions(+), 63 deletions(-) diff --git a/htdocs/langs/am_ET/mrp.lang b/htdocs/langs/am_ET/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/am_ET/mrp.lang +++ b/htdocs/langs/am_ET/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/ar_SA/mrp.lang b/htdocs/langs/ar_SA/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/ar_SA/mrp.lang +++ b/htdocs/langs/ar_SA/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/az_AZ/mrp.lang b/htdocs/langs/az_AZ/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/az_AZ/mrp.lang +++ b/htdocs/langs/az_AZ/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/bg_BG/mrp.lang b/htdocs/langs/bg_BG/mrp.lang index f7de7b6522b..9c5eb1f04bc 100644 --- a/htdocs/langs/bg_BG/mrp.lang +++ b/htdocs/langs/bg_BG/mrp.lang @@ -1,5 +1,5 @@ Mrp=Поръчки за производство -MO=Поръчка за производство +ManufacturingOrder=Поръчка за производство MRPDescription=Модул за управление на поръчки за производство (ПП) MRPArea=Секция за планиране на материални изисквания MrpSetupPage=Настройка на модул за планиране на материални изисквания diff --git a/htdocs/langs/bn_BD/mrp.lang b/htdocs/langs/bn_BD/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/bn_BD/mrp.lang +++ b/htdocs/langs/bn_BD/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/bn_IN/mrp.lang b/htdocs/langs/bn_IN/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/bn_IN/mrp.lang +++ b/htdocs/langs/bn_IN/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/bs_BA/mrp.lang b/htdocs/langs/bs_BA/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/bs_BA/mrp.lang +++ b/htdocs/langs/bs_BA/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/ca_ES/mrp.lang b/htdocs/langs/ca_ES/mrp.lang index a143763ecb2..bec1303cd22 100644 --- a/htdocs/langs/ca_ES/mrp.lang +++ b/htdocs/langs/ca_ES/mrp.lang @@ -1,5 +1,5 @@ Mrp=Comandes de Fabricació -MO=Comanda de fabricació +ManufacturingOrder=Comanda de fabricació MRPDescription=Mòdul per gestionar ordres de producció i fabricació (MO). MRPArea=Àrea MRP MrpSetupPage=Configuració del mòdul MRP diff --git a/htdocs/langs/cs_CZ/mrp.lang b/htdocs/langs/cs_CZ/mrp.lang index 85aecf46280..1383770e1cf 100644 --- a/htdocs/langs/cs_CZ/mrp.lang +++ b/htdocs/langs/cs_CZ/mrp.lang @@ -1,5 +1,5 @@ Mrp=Výrobní zakázky -MO=Výrobní zakázka +ManufacturingOrder=Výrobní zakázka MRPDescription=Modul pro správu výrobních a výrobních objednávek (MO). MRPArea=Oblast MRP MrpSetupPage=Nastavení modulu MRP diff --git a/htdocs/langs/da_DK/mrp.lang b/htdocs/langs/da_DK/mrp.lang index fb16840d5aa..d9f63d181e8 100644 --- a/htdocs/langs/da_DK/mrp.lang +++ b/htdocs/langs/da_DK/mrp.lang @@ -1,5 +1,5 @@ Mrp=Fremstillingsordrer -MO=Fremstillingsordre +ManufacturingOrder=Fremstillingsordre MRPDescription=Modul til styring af produktions- og produktionsordrer (MO). MRPArea=MRP-område MrpSetupPage=Opsætning af modul MRP diff --git a/htdocs/langs/de_DE/mrp.lang b/htdocs/langs/de_DE/mrp.lang index b99efb6f04f..a95677dec51 100644 --- a/htdocs/langs/de_DE/mrp.lang +++ b/htdocs/langs/de_DE/mrp.lang @@ -1,5 +1,5 @@ Mrp=Fertigungsaufträge -MO=Fertigungsauftrag +ManufacturingOrder=Fertigungsauftrag MRPDescription=Modul zur Verwaltung von Produktions- und Fertigungsaufträgen (MO). MRPArea=MRP Bereich MrpSetupPage=Einrichtung des Moduls MRP diff --git a/htdocs/langs/el_GR/mrp.lang b/htdocs/langs/el_GR/mrp.lang index 71ba5135b5c..12bc839cd16 100644 --- a/htdocs/langs/el_GR/mrp.lang +++ b/htdocs/langs/el_GR/mrp.lang @@ -1,5 +1,5 @@ Mrp=Παραγγελίες Παραγωγής -MO=Παραγγελία Παραγωγής +ManufacturingOrder=Παραγγελία Παραγωγής MRPDescription=Ενότητα για τη διαχείριση της παραγωγής και των Παραγγελιών Παραγωγής (MO). MRPArea=Περιοχή MRP MrpSetupPage=Ρύθμιση της μονάδας MRP diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index faa8eb60cf4..fda6f6a2c82 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -74,4 +74,4 @@ ProductsToConsume=Products to consume ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost -BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) \ No newline at end of file +BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) diff --git a/htdocs/langs/es_AR/mrp.lang b/htdocs/langs/es_AR/mrp.lang index a8b70a8377e..0fcf28a866f 100644 --- a/htdocs/langs/es_AR/mrp.lang +++ b/htdocs/langs/es_AR/mrp.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - mrp Mrp=Ordenes de Fabricación -MO=Orden de Fabricación +ManufacturingOrder=Orden de Fabricación MRPDescription=Módulo para administrar producción y Ordenes de Fabricación (OF). MRPArea=Area MRP MrpSetupPage=Configuración de módulo MRP diff --git a/htdocs/langs/es_CL/mrp.lang b/htdocs/langs/es_CL/mrp.lang index c523e0836b6..f43c1d88ba9 100644 --- a/htdocs/langs/es_CL/mrp.lang +++ b/htdocs/langs/es_CL/mrp.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - mrp Mrp=Ordenes de Fabricación -MO=Orden de Fabricación +ManufacturingOrder=Orden de Fabricación MrpSetupPage=Configuración del módulo de MRP MenuBOM=Facturas de material LatestBOMModified=Últimas %s Cuentas de materiales modificadas diff --git a/htdocs/langs/es_ES/mrp.lang b/htdocs/langs/es_ES/mrp.lang index 8a35d78dd40..e8936abfb5c 100644 --- a/htdocs/langs/es_ES/mrp.lang +++ b/htdocs/langs/es_ES/mrp.lang @@ -1,5 +1,5 @@ Mrp=Órdenes de fabricación -MO=Orden de fabricación +ManufacturingOrder=Orden de fabricación MRPDescription=Módulo para gestionar producción y Órdenes de Fabricación (OF). MRPArea=Área MRP MrpSetupPage=Configuración del módulo MRP diff --git a/htdocs/langs/es_PE/mrp.lang b/htdocs/langs/es_PE/mrp.lang index 8488907e055..9b371e0293e 100644 --- a/htdocs/langs/es_PE/mrp.lang +++ b/htdocs/langs/es_PE/mrp.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - mrp Mrp=Órdenes de Fabricación -MO=Orden de Fabricación +ManufacturingOrder=Orden de Fabricación MRPDescription=Modulo para gestionar la producción y órdenes de fabricación (OF). MRPArea=Área PRM MrpSetupPage=Configuración del modulo PRM diff --git a/htdocs/langs/et_EE/mrp.lang b/htdocs/langs/et_EE/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/et_EE/mrp.lang +++ b/htdocs/langs/et_EE/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/eu_ES/mrp.lang b/htdocs/langs/eu_ES/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/eu_ES/mrp.lang +++ b/htdocs/langs/eu_ES/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/fa_IR/mrp.lang b/htdocs/langs/fa_IR/mrp.lang index b7189492a94..fe55d666a78 100644 --- a/htdocs/langs/fa_IR/mrp.lang +++ b/htdocs/langs/fa_IR/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=بخش برنامه‌ریزی مواد اولیه MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/fi_FI/mrp.lang b/htdocs/langs/fi_FI/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/fi_FI/mrp.lang +++ b/htdocs/langs/fi_FI/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/fr_FR/mrp.lang b/htdocs/langs/fr_FR/mrp.lang index 5a6d8b77e54..8dc5633d669 100644 --- a/htdocs/langs/fr_FR/mrp.lang +++ b/htdocs/langs/fr_FR/mrp.lang @@ -1,5 +1,5 @@ Mrp=Ordres de fabrication -MO=Ordre de fabrication +ManufacturingOrder=Ordre de fabrication MRPDescription=Module de gestion de production et Ordres de Fabrication (OF). MRPArea=Espace MRP MrpSetupPage=Configuration du module MRP diff --git a/htdocs/langs/gl_ES/mrp.lang b/htdocs/langs/gl_ES/mrp.lang index b2f6f187500..c1d2a98b4b0 100644 --- a/htdocs/langs/gl_ES/mrp.lang +++ b/htdocs/langs/gl_ES/mrp.lang @@ -1,5 +1,5 @@ Mrp=Ordes de fabricación -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/he_IL/mrp.lang b/htdocs/langs/he_IL/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/he_IL/mrp.lang +++ b/htdocs/langs/he_IL/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/hi_IN/mrp.lang b/htdocs/langs/hi_IN/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/hi_IN/mrp.lang +++ b/htdocs/langs/hi_IN/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/hr_HR/mrp.lang b/htdocs/langs/hr_HR/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/hr_HR/mrp.lang +++ b/htdocs/langs/hr_HR/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/hu_HU/mrp.lang b/htdocs/langs/hu_HU/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/hu_HU/mrp.lang +++ b/htdocs/langs/hu_HU/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/id_ID/mrp.lang b/htdocs/langs/id_ID/mrp.lang index 21cb567fd68..06710cfacbb 100644 --- a/htdocs/langs/id_ID/mrp.lang +++ b/htdocs/langs/id_ID/mrp.lang @@ -1,5 +1,5 @@ Mrp=Pesanan Manufaktur -MO=Pesanan manufaktur +ManufacturingOrder=Pesanan manufaktur MRPDescription=Modul untuk mengelola produksi dan Pesanan Manufaktur (MO). MRPArea=Area MRP MrpSetupPage=Pengaturan MRP modul diff --git a/htdocs/langs/is_IS/mrp.lang b/htdocs/langs/is_IS/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/is_IS/mrp.lang +++ b/htdocs/langs/is_IS/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/it_IT/mrp.lang b/htdocs/langs/it_IT/mrp.lang index 140ab7b5de4..143c73adf53 100644 --- a/htdocs/langs/it_IT/mrp.lang +++ b/htdocs/langs/it_IT/mrp.lang @@ -1,5 +1,5 @@ Mrp=Ordini di produzione -MO=Ordine di produzione +ManufacturingOrder=Ordine di produzione MRPDescription=Modulo per la gestione degli ordini di produzione (MO). MRPArea=MRP Area MrpSetupPage=Configurazione del modulo MRP diff --git a/htdocs/langs/ja_JP/mrp.lang b/htdocs/langs/ja_JP/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/ja_JP/mrp.lang +++ b/htdocs/langs/ja_JP/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/ka_GE/mrp.lang b/htdocs/langs/ka_GE/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/ka_GE/mrp.lang +++ b/htdocs/langs/ka_GE/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/km_KH/mrp.lang b/htdocs/langs/km_KH/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/km_KH/mrp.lang +++ b/htdocs/langs/km_KH/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/kn_IN/mrp.lang b/htdocs/langs/kn_IN/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/kn_IN/mrp.lang +++ b/htdocs/langs/kn_IN/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/ko_KR/mrp.lang b/htdocs/langs/ko_KR/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/ko_KR/mrp.lang +++ b/htdocs/langs/ko_KR/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/lo_LA/mrp.lang b/htdocs/langs/lo_LA/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/lo_LA/mrp.lang +++ b/htdocs/langs/lo_LA/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/lt_LT/mrp.lang b/htdocs/langs/lt_LT/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/lt_LT/mrp.lang +++ b/htdocs/langs/lt_LT/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/lv_LV/mrp.lang b/htdocs/langs/lv_LV/mrp.lang index 30b84687b15..cb77c9d01bf 100644 --- a/htdocs/langs/lv_LV/mrp.lang +++ b/htdocs/langs/lv_LV/mrp.lang @@ -1,5 +1,5 @@ Mrp=Ražošanas pasūtījumi -MO=Ražošanas pasūtījums +ManufacturingOrder=Ražošanas pasūtījums MRPDescription=Ražošanas un ražošanas pasūtījumu (MO) pārvaldības modulis. MRPArea=MRP apgabals MrpSetupPage=MRP moduļa iestatīšana diff --git a/htdocs/langs/mk_MK/mrp.lang b/htdocs/langs/mk_MK/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/mk_MK/mrp.lang +++ b/htdocs/langs/mk_MK/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/mn_MN/mrp.lang b/htdocs/langs/mn_MN/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/mn_MN/mrp.lang +++ b/htdocs/langs/mn_MN/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/nb_NO/mrp.lang b/htdocs/langs/nb_NO/mrp.lang index 5d307d14280..fe0f2685757 100644 --- a/htdocs/langs/nb_NO/mrp.lang +++ b/htdocs/langs/nb_NO/mrp.lang @@ -1,5 +1,5 @@ Mrp=Produksjonsordrer -MO=Produksjonsordre +ManufacturingOrder=Produksjonsordre MRPDescription=Modul for å administrere produksjons- og produksjonsordrer (PO). MRPArea=MRP-område MrpSetupPage=Oppsett av MRP-modul diff --git a/htdocs/langs/ne_NP/mrp.lang b/htdocs/langs/ne_NP/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/ne_NP/mrp.lang +++ b/htdocs/langs/ne_NP/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/nl_NL/mrp.lang b/htdocs/langs/nl_NL/mrp.lang index e8efd2673df..99976e215ed 100644 --- a/htdocs/langs/nl_NL/mrp.lang +++ b/htdocs/langs/nl_NL/mrp.lang @@ -1,5 +1,5 @@ Mrp=Productieorders -MO=Productieorder +ManufacturingOrder=Productieorder MRPDescription=Module om productie- en productieorders (PO) te beheren. MRPArea=MRP-gebied MrpSetupPage=Installatie van module MRP diff --git a/htdocs/langs/pl_PL/mrp.lang b/htdocs/langs/pl_PL/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/pl_PL/mrp.lang +++ b/htdocs/langs/pl_PL/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/pt_BR/mrp.lang b/htdocs/langs/pt_BR/mrp.lang index bfb2005baea..41c7190a7ac 100644 --- a/htdocs/langs/pt_BR/mrp.lang +++ b/htdocs/langs/pt_BR/mrp.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - mrp Mrp=Ordens de fabricação -MO=Ordem de fabricação +ManufacturingOrder=Ordem de fabricação MRPDescription=Módulo para gerenciar ordens de produção e manufatura (MO). MRPArea=Area MRP MrpSetupPage=Configuração do módulo MRP diff --git a/htdocs/langs/pt_PT/mrp.lang b/htdocs/langs/pt_PT/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/pt_PT/mrp.lang +++ b/htdocs/langs/pt_PT/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/ro_RO/mrp.lang b/htdocs/langs/ro_RO/mrp.lang index 1c7d38c59a0..dd71ef007a7 100644 --- a/htdocs/langs/ro_RO/mrp.lang +++ b/htdocs/langs/ro_RO/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/ru_RU/mrp.lang b/htdocs/langs/ru_RU/mrp.lang index d56a9365a62..8f877d49fa0 100644 --- a/htdocs/langs/ru_RU/mrp.lang +++ b/htdocs/langs/ru_RU/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/sk_SK/mrp.lang b/htdocs/langs/sk_SK/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/sk_SK/mrp.lang +++ b/htdocs/langs/sk_SK/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/sl_SI/mrp.lang b/htdocs/langs/sl_SI/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/sl_SI/mrp.lang +++ b/htdocs/langs/sl_SI/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/sq_AL/mrp.lang b/htdocs/langs/sq_AL/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/sq_AL/mrp.lang +++ b/htdocs/langs/sq_AL/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/sr_RS/mrp.lang b/htdocs/langs/sr_RS/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/sr_RS/mrp.lang +++ b/htdocs/langs/sr_RS/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/sv_SE/mrp.lang b/htdocs/langs/sv_SE/mrp.lang index 2535d0f33b8..a23523aa2bc 100644 --- a/htdocs/langs/sv_SE/mrp.lang +++ b/htdocs/langs/sv_SE/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP-område MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/sw_SW/mrp.lang b/htdocs/langs/sw_SW/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/sw_SW/mrp.lang +++ b/htdocs/langs/sw_SW/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/th_TH/mrp.lang b/htdocs/langs/th_TH/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/th_TH/mrp.lang +++ b/htdocs/langs/th_TH/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/tr_TR/mrp.lang b/htdocs/langs/tr_TR/mrp.lang index 1e19e033ca7..f3a1e62c65a 100644 --- a/htdocs/langs/tr_TR/mrp.lang +++ b/htdocs/langs/tr_TR/mrp.lang @@ -1,5 +1,5 @@ Mrp=Üretim Emirleri -MO=Üretim Emri +ManufacturingOrder=Üretim Emri MRPDescription=Üretim ve Üretim Siparişlerini (MO) yönetmek için modül. MRPArea=MRP Alanı MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/uk_UA/mrp.lang b/htdocs/langs/uk_UA/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/uk_UA/mrp.lang +++ b/htdocs/langs/uk_UA/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/uz_UZ/mrp.lang b/htdocs/langs/uz_UZ/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/uz_UZ/mrp.lang +++ b/htdocs/langs/uz_UZ/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/vi_VN/mrp.lang b/htdocs/langs/vi_VN/mrp.lang index d7cbd41eb33..90231a9a2a8 100644 --- a/htdocs/langs/vi_VN/mrp.lang +++ b/htdocs/langs/vi_VN/mrp.lang @@ -1,5 +1,5 @@ Mrp=Đơn đặt hàng sản xuất -MO=Đơn hàng sản xuất +ManufacturingOrder=Đơn hàng sản xuất MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=Khu vực MRP MrpSetupPage=Thiết lập mô-đun MRP diff --git a/htdocs/langs/zh_CN/mrp.lang b/htdocs/langs/zh_CN/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/zh_CN/mrp.lang +++ b/htdocs/langs/zh_CN/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/zh_HK/mrp.lang b/htdocs/langs/zh_HK/mrp.lang index ab5f6d81fad..681972c7d1c 100644 --- a/htdocs/langs/zh_HK/mrp.lang +++ b/htdocs/langs/zh_HK/mrp.lang @@ -1,5 +1,5 @@ Mrp=Manufacturing Orders -MO=Manufacturing Order +ManufacturingOrder=Manufacturing Order MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP diff --git a/htdocs/langs/zh_TW/mrp.lang b/htdocs/langs/zh_TW/mrp.lang index 0d9de31ce83..0fa034d47b1 100644 --- a/htdocs/langs/zh_TW/mrp.lang +++ b/htdocs/langs/zh_TW/mrp.lang @@ -1,5 +1,5 @@ Mrp=製造訂單 -MO=製造訂單 +ManufacturingOrder=製造訂單 MRPDescription=管理生產和製造訂單(MO)的模組。 MRPArea=MRP區域 MrpSetupPage=MRP模組設定 From 214cd2c99b640aa5fd35157be8f55f1e02b82483 Mon Sep 17 00:00:00 2001 From: Alfredo Altamirano Date: Mon, 26 Oct 2020 15:44:26 -0600 Subject: [PATCH 46/79] Update references of MO translation string --- htdocs/core/lib/product.lib.php | 2 +- htdocs/mrp/class/mo.class.php | 2 +- htdocs/mrp/index.php | 2 +- htdocs/mrp/lib/mrp_mo.lib.php | 2 +- htdocs/mrp/mo_agenda.php | 2 +- htdocs/mrp/mo_card.php | 4 ++-- htdocs/mrp/mo_document.php | 2 +- htdocs/mrp/mo_movements.php | 2 +- htdocs/mrp/mo_note.php | 2 +- htdocs/mrp/mo_production.php | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index a8567cd420c..9e82fcbc0a6 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -364,7 +364,7 @@ function show_stats_for_company($product, $socid) if ($ret < 0) dol_print_error($db); $langs->load("orders"); print ''; - print ''.img_object('', 'mrp').' '.$langs->trans("MO").''; + print '' . img_object('', 'mrp') . ' ' . $langs->trans("ManufacturingOrder") . ''; print ''; print $product->stats_mo['suppliers']; print ''; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 89e9b25abef..f8ff5751221 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1000,7 +1000,7 @@ class Mo extends CommonObject $result = ''; - $label = ''.$langs->trans("MO").''; + $label = '' . $langs->trans("ManufacturingOrder") . ''; $label .= '
    '; $label .= ''.$langs->trans('Ref').': '.$this->ref; if (isset($this->status)) { diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index f0bdc8ba62d..2618353f982 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -96,7 +96,7 @@ if ($conf->use_javascript_ajax) print '
    '; print ''; - print ''."\n"; + print '' . "\n"; $listofstatus = array(0, 1, 2, 3, 9); foreach ($listofstatus as $status) { diff --git a/htdocs/mrp/lib/mrp_mo.lib.php b/htdocs/mrp/lib/mrp_mo.lib.php index f203633584e..eb61c42e83d 100644 --- a/htdocs/mrp/lib/mrp_mo.lib.php +++ b/htdocs/mrp/lib/mrp_mo.lib.php @@ -37,7 +37,7 @@ function moPrepareHead($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/mrp/mo_card.php?id='.$object->id; - $head[$h][1] = $langs->trans("MO"); + $head[$h][1] = $langs->trans("ManufacturingOrder"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index 20c2cbfe290..8d5ea97dc43 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -133,7 +133,7 @@ if ($object->id > 0) $head = moPrepareHead($object); - dol_fiche_head($head, 'agenda', $langs->trans("MO"), -1, $object->picto); + dol_fiche_head($head, 'agenda', $langs->trans("ManufacturingOrder"), -1, $object->picto); // Object card // ------------------------------------------------------------ diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 17799f7cbd1..7745918d3d9 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -336,7 +336,7 @@ if ($action == 'create') // Part to edit record if (($id || $ref) && $action == 'edit') { - print load_fiche_titre($langs->trans("MO"), '', 'mrp'); + print load_fiche_titre($langs->trans("ManufacturingOrder"), '', 'mrp'); print ''; print ''; @@ -375,7 +375,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $res = $object->fetch_optionals(); $head = moPrepareHead($object); - dol_fiche_head($head, 'card', $langs->trans("MO"), -1, $object->picto); + dol_fiche_head($head, 'card', $langs->trans("ManufacturingOrder"), -1, $object->picto); $formconfirm = ''; diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index afc7ef58819..2878f5e7c43 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -103,7 +103,7 @@ if ($object->id) */ $head = moPrepareHead($object); - dol_fiche_head($head, 'document', $langs->trans("MO"), -1, $object->picto); + dol_fiche_head($head, 'document', $langs->trans("ManufacturingOrder"), -1, $object->picto); // Build file list diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index 25d78c8c8e1..87acc7a0032 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -256,7 +256,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $res = $object->fetch_optionals(); $head = moPrepareHead($object); - dol_fiche_head($head, 'stockmovement', $langs->trans("MO"), -1, $object->picto); + dol_fiche_head($head, 'stockmovement', $langs->trans("ManufacturingOrder"), -1, $object->picto); $formconfirm = ''; diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php index 7d0fe785c58..bc4ba863b5e 100644 --- a/htdocs/mrp/mo_note.php +++ b/htdocs/mrp/mo_note.php @@ -87,7 +87,7 @@ if ($id > 0 || !empty($ref)) $head = moPrepareHead($object); - dol_fiche_head($head, 'note', $langs->trans("MO"), -1, $object->picto); + dol_fiche_head($head, 'note', $langs->trans("ManufacturingOrder"), -1, $object->picto); // Object card // ------------------------------------------------------------ diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 2f8f2ce1d8e..def52ed4a32 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -436,7 +436,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $res = $object->fetch_optionals(); $head = moPrepareHead($object); - dol_fiche_head($head, 'production', $langs->trans("MO"), -1, $object->picto); + dol_fiche_head($head, 'production', $langs->trans("ManufacturingOrder"), -1, $object->picto); $formconfirm = ''; From 32ff76178e923c4f9119570973c0914be7153e9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 01:44:00 +0100 Subject: [PATCH 47/79] FIX #15168 --- scripts/accountancy/export-thirdpartyaccount.php | 4 ++++ scripts/bank/export-bank-receipts.php | 3 +++ scripts/company/export-contacts-xls-example.php | 3 +++ scripts/company/sync_contacts_dolibarr2ldap.php | 3 +++ scripts/contracts/email_expire_services_to_customers.php | 3 +++ .../contracts/email_expire_services_to_representatives.php | 3 +++ scripts/cron/cron_run_jobs.php | 2 +- scripts/emailings/mailing-send.php | 3 +++ scripts/invoices/email_unpaid_invoices_to_customers.php | 3 +++ .../invoices/email_unpaid_invoices_to_representatives.php | 3 +++ scripts/invoices/rebuild_merge_pdf.php | 3 +++ scripts/members/sync_members_dolibarr2ldap.php | 5 ++++- scripts/members/sync_members_ldap2dolibarr.php | 5 ++++- scripts/members/sync_members_types_dolibarr2ldap.php | 6 +++++- scripts/members/sync_members_types_ldap2dolibarr.php | 5 ++++- scripts/product/migrate_picture_path.php | 3 +++ scripts/product/regenerate_thumbs.php | 3 +++ scripts/user/migrate_picture_path.php | 3 +++ scripts/user/sync_groups_dolibarr2ldap.php | 3 +++ scripts/user/sync_groups_ldap2dolibarr.php | 3 +++ scripts/user/sync_users_dolibarr2ldap.php | 3 +++ scripts/user/sync_users_ldap2dolibarr.php | 3 +++ scripts/website/migrate-news-joomla2dolibarr.php | 2 ++ scripts/website/regenerate-pages.php | 2 ++ scripts/withdrawals/build_withdrawal_file.php | 5 ++++- 25 files changed, 78 insertions(+), 6 deletions(-) diff --git a/scripts/accountancy/export-thirdpartyaccount.php b/scripts/accountancy/export-thirdpartyaccount.php index ba4fe922ab9..4dc22193262 100755 --- a/scripts/accountancy/export-thirdpartyaccount.php +++ b/scripts/accountancy/export-thirdpartyaccount.php @@ -25,6 +25,10 @@ * \brief Page to detect empty accounting account */ +if (!defined('NOSESSION')) define('NOSESSION', '1'); + +$path = __DIR__.'/'; + require_once $path."../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php index 4f2a256275a..609791232ad 100755 --- a/scripts/bank/export-bank-receipts.php +++ b/scripts/bank/export-bank-receipts.php @@ -22,6 +22,9 @@ * \ingroup bank * \brief Script file to export bank receipts into Excel files */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/company/export-contacts-xls-example.php b/scripts/company/export-contacts-xls-example.php index 07262b83c0e..445a17a7d30 100755 --- a/scripts/company/export-contacts-xls-example.php +++ b/scripts/company/export-contacts-xls-example.php @@ -23,6 +23,9 @@ * \ingroup company * \brief Script file to export contacts into an Excel file */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/company/sync_contacts_dolibarr2ldap.php b/scripts/company/sync_contacts_dolibarr2ldap.php index caaa762dea5..8e5274fb69a 100755 --- a/scripts/company/sync_contacts_dolibarr2ldap.php +++ b/scripts/company/sync_contacts_dolibarr2ldap.php @@ -23,6 +23,9 @@ * \ingroup ldap company * \brief Script to update all contacts from Dolibarr into a LDAP database */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php index ae449484e7b..5c98dc2913b 100755 --- a/scripts/contracts/email_expire_services_to_customers.php +++ b/scripts/contracts/email_expire_services_to_customers.php @@ -24,6 +24,9 @@ * \ingroup facture * \brief Script to send a mail to customers with services to expire */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php index 06cb67c99e9..eec151376ee 100755 --- a/scripts/contracts/email_expire_services_to_representatives.php +++ b/scripts/contracts/email_expire_services_to_representatives.php @@ -24,6 +24,9 @@ * \ingroup contracts * \brief Script to send a mail to dolibarr users linked to companies with services to expire */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 9058577aa21..e7b830c5ae6 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -30,7 +30,7 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); if (!defined('NOLOGIN')) define('NOLOGIN', '1'); - +if (!defined('NOSESSION')) define('NOSESSION', '1'); $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 7cde66db687..6719fb2164f 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -25,6 +25,9 @@ * \ingroup mailing * \brief Script d'envoi d'un mailing prepare et valide */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index 5617751b58b..9b59fcab6f7 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -24,6 +24,9 @@ * \ingroup facture * \brief Script to send a mail to customers with unpaid invoices */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 9bdd37ca599..d401894363d 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -24,6 +24,9 @@ * \ingroup facture * \brief Script to send a mail to dolibarr users linked to companies with unpaid invoices */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index fa54bac9da8..22c55eeeb99 100755 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -22,6 +22,9 @@ * \ingroup facture * \brief Script to rebuild PDF and merge PDF files into one */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/members/sync_members_dolibarr2ldap.php b/scripts/members/sync_members_dolibarr2ldap.php index 7b91a651b34..f0edb2fb8f3 100755 --- a/scripts/members/sync_members_dolibarr2ldap.php +++ b/scripts/members/sync_members_dolibarr2ldap.php @@ -23,6 +23,9 @@ * \ingroup ldap member * \brief Script de mise a jour des adherents dans LDAP depuis base Dolibarr */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; @@ -40,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"; $langs->load("main"); // Global variables -$version = DOL_VERSION; +$version = constant('DOL_VERSION'); $error = 0; $confirmed = 0; diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index 4166772cb10..21a5075326c 100755 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -23,6 +23,9 @@ * \ingroup ldap member * \brief Script de mise a jour des adherents dans Dolibarr depuis LDAP */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; @@ -42,7 +45,7 @@ require_once DOL_DOCUMENT_ROOT."/adherents/class/subscription.class.php"; $langs->loadLangs(array("main", "errors")); // Global variables -$version = DOL_VERSION; +$version = constant('DOL_VERSION'); $error = 0; $forcecommit = 0; $confirmed = 0; diff --git a/scripts/members/sync_members_types_dolibarr2ldap.php b/scripts/members/sync_members_types_dolibarr2ldap.php index a07ec0a1ff3..0a22469ec80 100755 --- a/scripts/members/sync_members_types_dolibarr2ldap.php +++ b/scripts/members/sync_members_types_dolibarr2ldap.php @@ -24,6 +24,9 @@ * \ingroup ldap core * \brief Script de mise a jour des types de membres dans LDAP depuis base Dolibarr */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; @@ -38,6 +41,7 @@ if (!isset($argv[1]) || !$argv[1]) { print "Usage: ".$script_file." now\n"; exit(-1); } + $now = $argv[1]; require_once $path."../../htdocs/master.inc.php"; @@ -45,7 +49,7 @@ require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"; require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php"; // Global variables -$version = DOL_VERSION; +$version = constant('DOL_VERSION'); $error = 0; /* diff --git a/scripts/members/sync_members_types_ldap2dolibarr.php b/scripts/members/sync_members_types_ldap2dolibarr.php index 547b2664070..f24faf9b76a 100755 --- a/scripts/members/sync_members_types_ldap2dolibarr.php +++ b/scripts/members/sync_members_types_ldap2dolibarr.php @@ -25,6 +25,9 @@ * \ingroup ldap member * \brief Script to update members types into Dolibarr from LDAP */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; @@ -43,7 +46,7 @@ require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php"; $langs->loadLangs(array("main", "errors")); // Global variables -$version = DOL_VERSION; +$version = constant('DOL_VERSION'); $error = 0; $forcecommit = 0; $confirmed = 0; diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php index 8e452ba13b2..849eca44514 100755 --- a/scripts/product/migrate_picture_path.php +++ b/scripts/product/migrate_picture_path.php @@ -23,6 +23,9 @@ * \ingroup scripts * \brief Migrate pictures from old system prior to 3.7 to new path for 3.7+ */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/product/regenerate_thumbs.php b/scripts/product/regenerate_thumbs.php index 8434bdd9097..0d8c6380eb3 100755 --- a/scripts/product/regenerate_thumbs.php +++ b/scripts/product/regenerate_thumbs.php @@ -23,6 +23,9 @@ * \ingroup scripts * \brief Migrate pictures from old system prior to 3.7 to new path for 3.7+ */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/user/migrate_picture_path.php b/scripts/user/migrate_picture_path.php index c80097bb36b..795d03b710d 100755 --- a/scripts/user/migrate_picture_path.php +++ b/scripts/user/migrate_picture_path.php @@ -23,6 +23,9 @@ * \ingroup scripts * \brief Migrate pictures from old system prior to 3.7 to new path for 3.7+ */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/user/sync_groups_dolibarr2ldap.php b/scripts/user/sync_groups_dolibarr2ldap.php index c52a0151887..eb229c3d4ed 100755 --- a/scripts/user/sync_groups_dolibarr2ldap.php +++ b/scripts/user/sync_groups_dolibarr2ldap.php @@ -23,6 +23,9 @@ * \ingroup ldap core * \brief Script de mise a jour des groupes dans LDAP depuis base Dolibarr */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index 28c580dce63..5432ded78ee 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -24,6 +24,9 @@ * \ingroup ldap member * \brief Script to update groups into Dolibarr from LDAP */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/user/sync_users_dolibarr2ldap.php b/scripts/user/sync_users_dolibarr2ldap.php index 5d36bcf44be..4f6fd00d1c7 100755 --- a/scripts/user/sync_users_dolibarr2ldap.php +++ b/scripts/user/sync_users_dolibarr2ldap.php @@ -23,6 +23,9 @@ * \ingroup ldap core * \brief Script de mise a jour des users dans LDAP depuis base Dolibarr */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index c8502cd1f14..375cb2f43ba 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -23,6 +23,9 @@ * \ingroup ldap member * \brief Script to update users into Dolibarr from LDAP */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/website/migrate-news-joomla2dolibarr.php b/scripts/website/migrate-news-joomla2dolibarr.php index b4399ba0885..dfd92a19acf 100755 --- a/scripts/website/migrate-news-joomla2dolibarr.php +++ b/scripts/website/migrate-news-joomla2dolibarr.php @@ -22,6 +22,8 @@ * \brief Migrate news from a Joomla databse into a Dolibarr website */ +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/website/regenerate-pages.php b/scripts/website/regenerate-pages.php index dfd49c1fe29..a50db09708d 100755 --- a/scripts/website/regenerate-pages.php +++ b/scripts/website/regenerate-pages.php @@ -22,6 +22,8 @@ * \brief Regenerate all pages of a web site */ +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; diff --git a/scripts/withdrawals/build_withdrawal_file.php b/scripts/withdrawals/build_withdrawal_file.php index d6ffe710a90..5ae7ba70bf4 100755 --- a/scripts/withdrawals/build_withdrawal_file.php +++ b/scripts/withdrawals/build_withdrawal_file.php @@ -23,6 +23,9 @@ * \ingroup prelevement * \brief Script de prelevement */ + +if (!defined('NOSESSION')) define('NOSESSION', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = __DIR__.'/'; @@ -40,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; require_once DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php"; // Global variables -$version = DOL_VERSION; +$version = constant('DOL_VERSION'); $error = 0; /* From 3f0a9cfce90bd1d5a340d636ce522e4603a48930 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 02:03:13 +0100 Subject: [PATCH 48/79] Fix var not defined --- htdocs/compta/stats/cabyuser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 8b6caa89a8f..33e69c3cf4c 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -281,7 +281,7 @@ if ($modecompta != 'CREANCES-DETTES') { } } -$morefilter = ''; +$moreforfilter = ''; print '
    '; print '
    '.$langs->trans("Statistics").' - '.$langs->trans("MO").'
    ' . $langs->trans("Statistics") . ' - ' . $langs->trans("ManufacturingOrder") . '
    '."\n"; From 313273f4621988b7f7d3409cab7e104a9ecea08d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 02:19:43 +0100 Subject: [PATCH 49/79] Doc --- htdocs/core/lib/functions.lib.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e25a7374f6d..1f54af58ff0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8994,8 +8994,7 @@ function addSummaryTableLine($tableColumnCount, $num, $nbofloop = 0, $total = 0, } /** - * Return a file on output using a lo memory. - * It can return very large files with no need of memory. + * Return a file on output using a low memory. It can return very large files with no need of memory. * WARNING: This close output buffers. * * @param string $fullpath_original_file_osencoded Full path of file to return. From e637b60b4bdd012808f1c65e241c155d2692f32c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 03:04:53 +0100 Subject: [PATCH 50/79] Fix regression in language files --- htdocs/langs/am_ET/mrp.lang | 1 + htdocs/langs/ar_EG/propal.lang | 1 - htdocs/langs/ar_SA/mrp.lang | 1 + htdocs/langs/az_AZ/mrp.lang | 1 + htdocs/langs/bg_BG/mrp.lang | 1 + htdocs/langs/bn_BD/mrp.lang | 1 + htdocs/langs/bn_IN/mrp.lang | 1 + htdocs/langs/bs_BA/mrp.lang | 1 + htdocs/langs/ca_ES/mrp.lang | 15 ++++++++------- htdocs/langs/cs_CZ/mrp.lang | 1 + htdocs/langs/da_DK/mrp.lang | 3 ++- htdocs/langs/de_AT/members.lang | 1 - htdocs/langs/de_CH/admin.lang | 1 - htdocs/langs/de_CH/paybox.lang | 1 - htdocs/langs/de_DE/mrp.lang | 3 ++- htdocs/langs/el_GR/mrp.lang | 3 ++- htdocs/langs/en_US/mrp.lang | 5 ----- htdocs/langs/es_AR/accountancy.lang | 1 - htdocs/langs/es_AR/members.lang | 1 - htdocs/langs/es_AR/paybox.lang | 1 - htdocs/langs/es_CL/accountancy.lang | 1 - htdocs/langs/es_CL/admin.lang | 2 -- htdocs/langs/es_CL/members.lang | 2 -- htdocs/langs/es_CL/stocks.lang | 2 -- htdocs/langs/es_CO/accountancy.lang | 1 - htdocs/langs/es_CO/admin.lang | 2 -- htdocs/langs/es_EC/accountancy.lang | 1 - htdocs/langs/es_EC/admin.lang | 1 - htdocs/langs/es_EC/members.lang | 2 -- htdocs/langs/es_EC/propal.lang | 1 - htdocs/langs/es_EC/stocks.lang | 2 -- htdocs/langs/es_ES/mrp.lang | 3 ++- htdocs/langs/es_MX/ticket.lang | 1 - htdocs/langs/es_PE/accountancy.lang | 1 - htdocs/langs/es_PE/mrp.lang | 1 + htdocs/langs/et_EE/mrp.lang | 1 + htdocs/langs/eu_ES/mrp.lang | 5 +---- htdocs/langs/fa_IR/mrp.lang | 5 +---- htdocs/langs/fi_FI/mrp.lang | 5 +---- htdocs/langs/fr_CA/members.lang | 2 -- htdocs/langs/fr_CA/other.lang | 1 - htdocs/langs/fr_CA/propal.lang | 1 - htdocs/langs/fr_CA/stocks.lang | 1 - htdocs/langs/fr_FR/mrp.lang | 7 ++----- htdocs/langs/gl_ES/mrp.lang | 5 +---- htdocs/langs/he_IL/mrp.lang | 5 +---- htdocs/langs/hi_IN/mrp.lang | 5 +---- htdocs/langs/hr_HR/mrp.lang | 5 +---- htdocs/langs/hu_HU/mrp.lang | 9 +++------ htdocs/langs/id_ID/mrp.lang | 7 ++----- htdocs/langs/is_IS/mrp.lang | 5 +---- htdocs/langs/it_IT/mrp.lang | 5 +---- htdocs/langs/ja_JP/mrp.lang | 5 +---- htdocs/langs/ka_GE/mrp.lang | 5 +---- htdocs/langs/km_KH/mrp.lang | 5 +---- htdocs/langs/kn_IN/mrp.lang | 5 +---- htdocs/langs/ko_KR/mrp.lang | 5 +---- htdocs/langs/lo_LA/mrp.lang | 5 +---- htdocs/langs/lt_LT/mrp.lang | 5 +---- htdocs/langs/lv_LV/mrp.lang | 9 +++------ htdocs/langs/mk_MK/mrp.lang | 5 +---- htdocs/langs/mn_MN/mrp.lang | 5 +---- htdocs/langs/nb_NO/mrp.lang | 5 +---- htdocs/langs/ne_NP/mrp.lang | 5 +---- htdocs/langs/nl_BE/accountancy.lang | 1 - htdocs/langs/nl_BE/propal.lang | 1 - htdocs/langs/nl_BE/ticket.lang | 2 -- htdocs/langs/nl_NL/mrp.lang | 7 ++----- htdocs/langs/pl_PL/mrp.lang | 5 +---- htdocs/langs/pt_BR/admin.lang | 2 -- htdocs/langs/pt_BR/members.lang | 2 -- htdocs/langs/pt_BR/other.lang | 1 - htdocs/langs/pt_BR/paybox.lang | 1 - htdocs/langs/pt_BR/propal.lang | 1 - htdocs/langs/pt_BR/stocks.lang | 1 - htdocs/langs/pt_BR/ticket.lang | 1 - htdocs/langs/pt_PT/mrp.lang | 20 ++------------------ htdocs/langs/ro_RO/mrp.lang | 18 +++--------------- htdocs/langs/ru_RU/mrp.lang | 5 +---- htdocs/langs/sk_SK/mrp.lang | 5 +---- htdocs/langs/sl_SI/mrp.lang | 5 +---- htdocs/langs/sq_AL/mrp.lang | 5 +---- htdocs/langs/sr_RS/mrp.lang | 5 +---- htdocs/langs/sv_SE/mrp.lang | 5 +---- htdocs/langs/sw_SW/mrp.lang | 5 +---- htdocs/langs/th_TH/mrp.lang | 5 +---- htdocs/langs/tr_TR/mrp.lang | 5 +---- htdocs/langs/uk_UA/mrp.lang | 5 +---- htdocs/langs/uz_UZ/mrp.lang | 5 +---- htdocs/langs/vi_VN/mrp.lang | 5 +---- htdocs/langs/zh_CN/mrp.lang | 5 +---- htdocs/langs/zh_HK/mrp.lang | 5 +---- htdocs/langs/zh_TW/mrp.lang | 7 ++----- 93 files changed, 80 insertions(+), 265 deletions(-) diff --git a/htdocs/langs/am_ET/mrp.lang b/htdocs/langs/am_ET/mrp.lang index ce25a3d236b..863793063a0 100644 --- a/htdocs/langs/am_ET/mrp.lang +++ b/htdocs/langs/am_ET/mrp.lang @@ -76,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/ar_EG/propal.lang b/htdocs/langs/ar_EG/propal.lang index 4037a3b428b..bd57090dbd4 100644 --- a/htdocs/langs/ar_EG/propal.lang +++ b/htdocs/langs/ar_EG/propal.lang @@ -44,7 +44,6 @@ RefProposal=مرجع العرض تجاري SendPropalByMail=إرسال عرض تجاري عن طريق البريد DatePropal=تاريخ العرض ValidityDuration=مدة الصلاحية -CloseAs=اضبط الحالة على SetAcceptedRefused=مقبول / مرفوض ErrorPropalNotFound=العرض %s غير موجود AddToDraftProposals=أضف إلى مسودة العرض diff --git a/htdocs/langs/ar_SA/mrp.lang b/htdocs/langs/ar_SA/mrp.lang index ce25a3d236b..863793063a0 100644 --- a/htdocs/langs/ar_SA/mrp.lang +++ b/htdocs/langs/ar_SA/mrp.lang @@ -76,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/az_AZ/mrp.lang b/htdocs/langs/az_AZ/mrp.lang index ce25a3d236b..863793063a0 100644 --- a/htdocs/langs/az_AZ/mrp.lang +++ b/htdocs/langs/az_AZ/mrp.lang @@ -76,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/bg_BG/mrp.lang b/htdocs/langs/bg_BG/mrp.lang index f05b0cef519..16e4d94208c 100644 --- a/htdocs/langs/bg_BG/mrp.lang +++ b/htdocs/langs/bg_BG/mrp.lang @@ -76,3 +76,4 @@ ProductsToProduce=Продукти за производство UnitCost=Единична цена TotalCost=Обща цена BOMTotalCost=Разходите за производство на този списък с материали въз основа на разходите за всяко количество и продукт, които ще се използват (използвайте себестойност, ако е дефинирана, иначе средно претеглена цена, ако е определена, или най-добра покупна цена). +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/bn_BD/mrp.lang b/htdocs/langs/bn_BD/mrp.lang index ce25a3d236b..863793063a0 100644 --- a/htdocs/langs/bn_BD/mrp.lang +++ b/htdocs/langs/bn_BD/mrp.lang @@ -76,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/bn_IN/mrp.lang b/htdocs/langs/bn_IN/mrp.lang index ce25a3d236b..863793063a0 100644 --- a/htdocs/langs/bn_IN/mrp.lang +++ b/htdocs/langs/bn_IN/mrp.lang @@ -76,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/bs_BA/mrp.lang b/htdocs/langs/bs_BA/mrp.lang index ce25a3d236b..863793063a0 100644 --- a/htdocs/langs/bs_BA/mrp.lang +++ b/htdocs/langs/bs_BA/mrp.lang @@ -76,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/ca_ES/mrp.lang b/htdocs/langs/ca_ES/mrp.lang index c533fae10f5..f2ab1773092 100644 --- a/htdocs/langs/ca_ES/mrp.lang +++ b/htdocs/langs/ca_ES/mrp.lang @@ -1,7 +1,7 @@ -Mrp=Comandes de Fabricació -MOs=Manufacturing orders -ManufacturingOrder=Comanda de fabricació -MRPDescription=Mòdul per gestionar ordres de producció i fabricació (MO). +Mrp=Ordres de fabricació +MOs=Ordres de fabricació +ManufacturingOrder=Ordre de fabricació +MRPDescription=Mòdul per gestionar Ordres de Fabricació o producció (OF). MRPArea=Àrea MRP MrpSetupPage=Configuració del mòdul MRP MenuBOM=Llistes de material @@ -11,7 +11,7 @@ Bom=Llista de materials BillOfMaterials=Llista de material BOMsSetup=Configuració del mòdul BOM ListOfBOMs=Llista de factures de material - BOM -ListOfManufacturingOrders=Llista de comandes de fabricació +ListOfManufacturingOrders=Llista d'ordres de fabricació NewBOM=Nova llista de material ProductBOMHelp=Producte a crear amb aquest BOM.
    Nota: els productes amb la propietat "Natura del producte" = "Matèria primera" no són visibles a aquesta llista. BOMsNumberingModules=Plantilles de numeració BOM @@ -32,8 +32,8 @@ DeleteBillOfMaterials=Suprimeix la llista de materials DeleteMo=Eliminar Ordre de Fabricació ConfirmDeleteBillOfMaterials=Estàs segur que vols suprimir aquesta llista de material? ConfirmDeleteMo=Esteu segur que voleu suprimir aquesta factura de material? -MenuMRP=Comandes de Fabricació -NewMO=Nova comanda de fabricació +MenuMRP=Ordres de fabricació +NewMO=Nova ordre de fabricació QtyToProduce=Quantitat per produir DateStartPlannedMo=Data d’inici prevista DateEndPlannedMo=Data prevista de finalització @@ -76,3 +76,4 @@ ProductsToProduce=Productes a produir UnitCost=Cost unitari TotalCost=Cost total BOMTotalCost=El cost de produir aquesta Llista de materials en funció del cost de cada quantitat i producte a consumir (utilitza el preu de cost si està definit, altrament el preu mitjà ponderat si està definit, altrament el millor preu de compra) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/cs_CZ/mrp.lang b/htdocs/langs/cs_CZ/mrp.lang index 3f4024bbd8b..281911067d5 100644 --- a/htdocs/langs/cs_CZ/mrp.lang +++ b/htdocs/langs/cs_CZ/mrp.lang @@ -76,3 +76,4 @@ ProductsToProduce=Výrobky k výrobě UnitCost=Jednotková cena TotalCost=Celkové náklady BOMTotalCost=Náklady na výrobu tohoto kusovníku na základě nákladů na každé spotřebované množství a produkt (použijte cenu Cena, pokud je definována, jinak průměrná vážená cena, pokud je definována, jinak nejlepší kupní cena) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/da_DK/mrp.lang b/htdocs/langs/da_DK/mrp.lang index b809bb8da13..e53f08f50f7 100644 --- a/htdocs/langs/da_DK/mrp.lang +++ b/htdocs/langs/da_DK/mrp.lang @@ -1,6 +1,6 @@ Mrp=Fremstillingsordrer MOs=Manufacturing orders -ManufacturingOrder=Fremstillingsordre +ManufacturingOrder=Manufacturing Order MRPDescription=Modul til styring af produktions- og produktionsordrer (MO). MRPArea=MRP-område MrpSetupPage=Opsætning af modul MRP @@ -76,3 +76,4 @@ ProductsToProduce=Produkter til at producere UnitCost=Enhedspris TotalCost=Udgifter i alt BOMTotalCost=Omkostningerne til at fremstille denne BOM baseret på prisen for hver mængde og produkt, der skal forbruges (brug Prisen, hvis defineret, ellers Gennemsnit Vægtet pris, hvis defineret, ellers den bedste købspris) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/de_AT/members.lang b/htdocs/langs/de_AT/members.lang index 6686b3d49f0..071f33fcbff 100644 --- a/htdocs/langs/de_AT/members.lang +++ b/htdocs/langs/de_AT/members.lang @@ -1,7 +1,6 @@ # Dolibarr language file - Source file is en_US - members SetLinkToUser=Mit Benutzer verknüpfen SetLinkToThirdParty=Mit Partner verknüpfen -MenuMembersNotUpToDate=Veraltete Mitglieder DateSubscription=Abonnierungsdatum DateEndSubscription=Abonnementauslaufdatum EndSubscription=Abonnementende diff --git a/htdocs/langs/de_CH/admin.lang b/htdocs/langs/de_CH/admin.lang index 07ca78d80ee..8e4d55151c7 100644 --- a/htdocs/langs/de_CH/admin.lang +++ b/htdocs/langs/de_CH/admin.lang @@ -507,7 +507,6 @@ TestGeoIPResult=Test einer Umwandlung IP -> Land TasksNumberingModules=Aufgaben-Nummerierungs-Modul NbMajMin=Mindestanzahl Grossbuchstaben TemplatePDFExpenseReports=Dokumentvorlagen zur Spesenabrechnung Dokument erstellen -ExpenseReportsIkSetup=Modul Spesenabrechnungen (Milles Index) einrichten ExpenseReportsRulesSetup=Modul Spesenabrechnungen (Regeln) einrichten ExpenseReportNumberingModules=Modul Spesenabrechnung (Numerierung) YouMayFindNotificationsFeaturesIntoModuleNotification=Du kannst automatische Benachrichtigungen im Modul "Benachrichtigungen" festlegen und verwalten. diff --git a/htdocs/langs/de_CH/paybox.lang b/htdocs/langs/de_CH/paybox.lang index 0e0d5570c7e..cf8cd91b2e0 100644 --- a/htdocs/langs/de_CH/paybox.lang +++ b/htdocs/langs/de_CH/paybox.lang @@ -6,6 +6,5 @@ SetupPayBoxToHavePaymentCreatedAutomatically=Paybox mit der URL %s einric YourPaymentHasBeenRecorded=Diese Seite bestätigt, dass Ihre Zahlung erfasst wurde. Vielen Dank. YourPaymentHasNotBeenRecorded=Hoppla, deine Zahlung wurde nicht ausgeführt und die Transaktion abgebrochen... PAYBOX_CGI_URL_V2=Url für das Paybox Zahlungsmodul "CGI Modul" -VendorName=Name des Anbieters PAYBOX_PAYONLINE_SENDEMAIL=Email - Adresse für Zahlungsbestätigungen und -fehler PAYBOX_HMAC_KEY=HMAC - Schlüssel diff --git a/htdocs/langs/de_DE/mrp.lang b/htdocs/langs/de_DE/mrp.lang index effcd72420a..79530a8b223 100644 --- a/htdocs/langs/de_DE/mrp.lang +++ b/htdocs/langs/de_DE/mrp.lang @@ -1,5 +1,5 @@ Mrp=Fertigungsaufträge -MOs=Manufacturing orders +MOs=Produktionsaufträge ManufacturingOrder=Fertigungsauftrag MRPDescription=Modul zur Verwaltung von Produktions- und Fertigungsaufträgen (MO). MRPArea=MRP Bereich @@ -76,3 +76,4 @@ ProductsToProduce=Produkte zu produzieren UnitCost=Kosten pro Einheit TotalCost=Gesamtsumme Kosten BOMTotalCost=Die Herstellungskosten dieser Stückliste, basierend auf den Kosten jeder Menge und jeden verbrauchten Produktes (nutzt den Selbstkostenpreis wenn er definiert ist, ansonsten den Durchschnittspreis sofern definiert oder den besten Einkaufspreis) +GoOnTabProductionToProduceFirst=Die Produktion muss begonnen sein, um einen Produktionsauftrag zu schließen (siehe Tab '%s'). Alternativ kann er storniert werden. diff --git a/htdocs/langs/el_GR/mrp.lang b/htdocs/langs/el_GR/mrp.lang index 9dba9248508..d1222e8eff4 100644 --- a/htdocs/langs/el_GR/mrp.lang +++ b/htdocs/langs/el_GR/mrp.lang @@ -1,6 +1,6 @@ Mrp=Παραγγελίες Παραγωγής MOs=Manufacturing orders -ManufacturingOrder=Παραγγελία Παραγωγής +ManufacturingOrder=Manufacturing Order MRPDescription=Ενότητα για τη διαχείριση της παραγωγής και των Παραγγελιών Παραγωγής (MO). MRPArea=Περιοχή MRP MrpSetupPage=Ρύθμιση της μονάδας MRP @@ -76,3 +76,4 @@ ProductsToProduce=Προϊόντα για παραγωγή UnitCost=Κόστος μονάδας TotalCost=Συνολικό κόστος BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index a308035b83d..863793063a0 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -75,10 +75,5 @@ ProductsToConsume=Products to consume ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost -<<<<<<< HEAD BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. - -======= -BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git diff --git a/htdocs/langs/es_AR/accountancy.lang b/htdocs/langs/es_AR/accountancy.lang index 840011bc481..f3fbfaaa853 100644 --- a/htdocs/langs/es_AR/accountancy.lang +++ b/htdocs/langs/es_AR/accountancy.lang @@ -13,7 +13,6 @@ DefaultForProduct=Predeterminado para producto AccountancySetupDoneFromAccountancyMenu=La mayor parte de la configuración de la contabilidad se hace desde el menú %s ConfigAccountingExpert=Experto en la configuración del módulo contabilidad Journalization=Contabilización -Journaux=Diarios Contables JournalFinancial=Diarios Financieros AssignDedicatedAccountingAccount=Nueva cuenta para asignar InvoiceLabel=Etiqueta de la factura diff --git a/htdocs/langs/es_AR/members.lang b/htdocs/langs/es_AR/members.lang index 89e31bb3375..cc7f057f880 100644 --- a/htdocs/langs/es_AR/members.lang +++ b/htdocs/langs/es_AR/members.lang @@ -19,7 +19,6 @@ MembersListResiliated=Lista de miembros terminados MembersListQualified=Lista de miembros calificados MenuMembersToValidate=Miembros en Borrador MenuMembersValidated=Miembros válidos -MenuMembersNotUpToDate=Miembros vencidos MenuMembersResiliated=Miembros terminados MembersWithSubscriptionToReceive=Miembros con suscripción para recibir MembersWithSubscriptionToReceiveShort=Suscripción para recibir diff --git a/htdocs/langs/es_AR/paybox.lang b/htdocs/langs/es_AR/paybox.lang index cfb35349278..54d629f8cee 100644 --- a/htdocs/langs/es_AR/paybox.lang +++ b/htdocs/langs/es_AR/paybox.lang @@ -16,7 +16,6 @@ YourPaymentHasBeenRecorded=Esta página confirma que su pago ha sido registrado. YourPaymentHasNotBeenRecorded=Su pago NO ha sido registrado y la transacción ha sido cancelada. Gracias. InformationToFindParameters=Ayuda para encontrar la información de su cuenta %s PAYBOX_CGI_URL_V2=URL del módulo CGI para pago con Paybox -VendorName=Nombre del proveedor CSSUrlForPaymentForm=URL de hoja de estilo CSS para formulario de pago NewPayboxPaymentReceived=Nuevo pago de Paybox recibido NewPayboxPaymentFailed=Se intentó un nuevo pago de Paybox pero falló diff --git a/htdocs/langs/es_CL/accountancy.lang b/htdocs/langs/es_CL/accountancy.lang index 82fd0408318..4d26e87f67f 100644 --- a/htdocs/langs/es_CL/accountancy.lang +++ b/htdocs/langs/es_CL/accountancy.lang @@ -15,7 +15,6 @@ CantSuggest=No puedo sugerir AccountancySetupDoneFromAccountancyMenu=La mayoría de las configuraciones de la contabilidad se realizan desde el menú %s ConfigAccountingExpert=Configuración del módulo Contabilidad Experta Journalization=Periodización -Journaux=Revistas JournalFinancial=Diarios financieras BackToChartofaccounts=Volver al gráfico de cuentas Chartofaccounts=Gráfico de cuentas diff --git a/htdocs/langs/es_CL/admin.lang b/htdocs/langs/es_CL/admin.lang index c4fae1266ad..b3f6a9eac34 100644 --- a/htdocs/langs/es_CL/admin.lang +++ b/htdocs/langs/es_CL/admin.lang @@ -391,7 +391,6 @@ Module52Desc=Gestion de Stocks Module54Desc=Gestión de contratos (servicios o suscripciones recurrentes). Module55Desc=Gestión del código de barras Module58Desc=Integración de un sistema ClickToDial (Asterisk, ...) -Module59Desc=Agregar función para generar una cuenta de Bookmark4u desde una cuenta de Dolibarr Module70Desc=Gestión de intervención Module75Name=Notas de gastos y viaje Module75Desc=Gestión de gastos y viajes @@ -1277,7 +1276,6 @@ TypePaymentDesc=0: Tipo de pago del cliente, 1: Tipo de pago del proveedor, 2: T IncludePath=Incluir ruta (definida en la variable %s) ExpenseReportsSetup=Configuración del módulo Informes de gastos TemplatePDFExpenseReports=Plantillas de documentos para generar el documento de informe de gastos -ExpenseReportsIkSetup=Configuración del módulo Informes de gastos: índice Milles NoModueToManageStockIncrease=No se ha activado ningún módulo capaz de gestionar el aumento automático de existencias. El aumento de existencias se realizará solo con la entrada manual. YouMayFindNotificationsFeaturesIntoModuleNotification=Puede encontrar opciones para notificaciones por correo electrónico habilitando y configurando el módulo "Notificación". ListOfNotificationsPerUser=Lista de notificaciones automáticas por usuario * diff --git a/htdocs/langs/es_CL/members.lang b/htdocs/langs/es_CL/members.lang index e77bd64bf9b..5e6d5a0a119 100644 --- a/htdocs/langs/es_CL/members.lang +++ b/htdocs/langs/es_CL/members.lang @@ -18,8 +18,6 @@ MembersListUpToDate=Lista de miembros válidos con suscripción actualizada MembersListNotUpToDate=Lista de miembros válidos con suscripción fuera de fecha MembersListResiliated=Lista de miembros finalizados MembersListQualified=Lista de miembros calificados -MenuMembersUpToDate=Miembros actualizados -MenuMembersNotUpToDate=Miembros desactualizados MenuMembersResiliated=Miembros finalizados MembersWithSubscriptionToReceive=Miembros con suscripción para recibir MembersWithSubscriptionToReceiveShort=Suscripción para recibir diff --git a/htdocs/langs/es_CL/stocks.lang b/htdocs/langs/es_CL/stocks.lang index 57c3d5885ac..ddfd17cea0d 100644 --- a/htdocs/langs/es_CL/stocks.lang +++ b/htdocs/langs/es_CL/stocks.lang @@ -127,8 +127,6 @@ inventoryErrorQtyAdd=Error: una cantidad es menor que cero inventoryWarningProductAlreadyExists=Este producto ya está en la lista SelectCategory=Filtro de categoría SelectFournisseur=Filtro de proveedor -INVENTORY_DISABLE_VIRTUAL=Producto virtual (kit): no disminuir el stock de un producto infantil -INVENTORY_USE_MIN_PA_IF_NO_LAST_PA=Utilice el precio de compra si no se puede encontrar el último precio de compra inventoryChangePMPPermission=Permitir cambiar el valor de PMP para un producto OnlyProdsInStock=No agregue productos sin stock TheoricalQty=Cantidad teórica diff --git a/htdocs/langs/es_CO/accountancy.lang b/htdocs/langs/es_CO/accountancy.lang index 265a743bee3..b6e0aacc814 100644 --- a/htdocs/langs/es_CO/accountancy.lang +++ b/htdocs/langs/es_CO/accountancy.lang @@ -14,7 +14,6 @@ DefaultForProduct=Predeterminado para producto CantSuggest=No puedo sugerir ConfigAccountingExpert=Configuración del módulo experto en contabilidad. Journalization=Periodización -Journaux=Revistas JournalFinancial=Revistas financieras BackToChartofaccounts=Tabla de retorno de cuentas Chartofaccounts=Catálogo de cuentas diff --git a/htdocs/langs/es_CO/admin.lang b/htdocs/langs/es_CO/admin.lang index 0fbbffc35f6..312781b61fd 100644 --- a/htdocs/langs/es_CO/admin.lang +++ b/htdocs/langs/es_CO/admin.lang @@ -330,7 +330,6 @@ Module54Name=Contratos / Suscripciones Module54Desc=Gestión de contratos (servicios o suscripciones recurrentes). Module55Desc=Gestión de códigos de barras Module58Desc=Integración de un sistema ClickToDial (Asterisco, ...) -Module59Desc=Agregar función para generar una cuenta Bookmark4u desde una cuenta Dolibarr Module70Desc=Gestión de la intervención Module75Name=Gastos y notas de viaje. Module75Desc=Gestión de gastos y notas de viaje. @@ -1037,7 +1036,6 @@ Format=Formato IncludePath=Incluir ruta (definida en la variable %s) ExpenseReportsSetup=Configuración de los informes de gastos del módulo TemplatePDFExpenseReports=Plantillas de documentos para generar documentos de informe de gastos. -ExpenseReportsIkSetup=Configuración de los informes de gastos del módulo - Índice Milles ExpenseReportsRulesSetup=Configuración de los informes de gastos del módulo - Reglas ExpenseReportNumberingModules=Módulo de numeración de informes de gastos. NoModueToManageStockIncrease=No se ha activado ningún módulo capaz de gestionar el aumento automático de stock. El aumento de stock se realizará solo con entrada manual. diff --git a/htdocs/langs/es_EC/accountancy.lang b/htdocs/langs/es_EC/accountancy.lang index 38d192220d7..c67b47aa30f 100644 --- a/htdocs/langs/es_EC/accountancy.lang +++ b/htdocs/langs/es_EC/accountancy.lang @@ -11,7 +11,6 @@ DefaultForService=Predeterminado para servicio CantSuggest=No puedo sugerir AccountancySetupDoneFromAccountancyMenu=La mayoría de la configuración de la contabilidad se realiza desde el menú%s ConfigAccountingExpert=Configuración del experto en contabilidad de módulos -Journaux=Revistas JournalFinancial=Revistas financieras BackToChartofaccounts=Retorno gráfico de cuentas Chartofaccounts=Catálogo de cuentas diff --git a/htdocs/langs/es_EC/admin.lang b/htdocs/langs/es_EC/admin.lang index 130c6ec61a6..1f83b8c5d62 100644 --- a/htdocs/langs/es_EC/admin.lang +++ b/htdocs/langs/es_EC/admin.lang @@ -422,7 +422,6 @@ Module54Name=Contratos / Suscripciones Module54Desc=Gestión de contratos (servicios o suscripciones recurrentes). Module55Desc=Administración de código de barras Module58Desc=Integración de un sistema ClickToDial (Asterisco, ...) -Module59Desc=Añadir función para generar una cuenta Bookmark4u desde una cuenta de Dolibarr Module60Name=Adhesivos Module60Desc=Manejo de adhesivos Module70Desc=Administración de la intervención diff --git a/htdocs/langs/es_EC/members.lang b/htdocs/langs/es_EC/members.lang index 97fc61a0f8d..8f4f1039995 100644 --- a/htdocs/langs/es_EC/members.lang +++ b/htdocs/langs/es_EC/members.lang @@ -19,8 +19,6 @@ MembersListNotUpToDate=Lista de miembros válidos con suscripción desactualizad MembersListResiliated=Lista de miembros terminados MembersListQualified=Lista de miembros calificados MenuMembersToValidate=Miembros del draft -MenuMembersUpToDate=Miembros actualizados -MenuMembersNotUpToDate=Miembros fuera de fecha MenuMembersResiliated=Miembros terminados MembersWithSubscriptionToReceive=Miembros con suscripción para recibir MembersWithSubscriptionToReceiveShort=Suscripción para recibir diff --git a/htdocs/langs/es_EC/propal.lang b/htdocs/langs/es_EC/propal.lang index 552a01bc521..79174992708 100644 --- a/htdocs/langs/es_EC/propal.lang +++ b/htdocs/langs/es_EC/propal.lang @@ -39,7 +39,6 @@ SendPropalByMail=Enviar propuesta comercial por correo DatePropal=Fecha de la propuesta DateEndPropal=Fecha de finalización de la validez ValidityDuration=Duración de la validez -CloseAs=Establecer el estado en ErrorPropalNotFound=Propal%s no encontrado AddToDraftProposals=Añadir a proyecto de propuesta NoDraftProposals=Ningún proyecto de propuesta diff --git a/htdocs/langs/es_EC/stocks.lang b/htdocs/langs/es_EC/stocks.lang index 00cba31ae26..0619c9366b7 100644 --- a/htdocs/langs/es_EC/stocks.lang +++ b/htdocs/langs/es_EC/stocks.lang @@ -139,8 +139,6 @@ inventoryErrorQtyAdd=Error: una cantidad es menor que cero inventoryWarningProductAlreadyExists=Este producto ya está en la lista SelectCategory=Filtro de categoría SelectFournisseur=Filtro de proveedores -INVENTORY_DISABLE_VIRTUAL=Producto virtual (kit): no disminuya el stock de un producto hijo -INVENTORY_USE_MIN_PA_IF_NO_LAST_PA=Utilice el precio de compra si no se puede encontrar el último precio de compra inventoryChangePMPPermission=Permitir cambiar el valor PMP de un producto OnlyProdsInStock=No añada producto sin inventario TheoricalQty=Cantidad teórica diff --git a/htdocs/langs/es_ES/mrp.lang b/htdocs/langs/es_ES/mrp.lang index 5c55b55c5e0..1893c410479 100644 --- a/htdocs/langs/es_ES/mrp.lang +++ b/htdocs/langs/es_ES/mrp.lang @@ -1,5 +1,5 @@ Mrp=Órdenes de fabricación -MOs=Manufacturing orders +MOs=Órdenes de fabricación ManufacturingOrder=Orden de fabricación MRPDescription=Módulo para gestionar producción y Órdenes de Fabricación (OF). MRPArea=Área MRP @@ -76,3 +76,4 @@ ProductsToProduce=Productos para producir UnitCost=Costo unitario TotalCost=Coste total BOMTotalCost=El costo para producir esta Lista de Materiales en función del costo de cada cantidad y producto a consumir (use el precio de costo si está definido, de lo contrario, el precio promedio ponderado si está definido, o el mejor precio de compra) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/es_MX/ticket.lang b/htdocs/langs/es_MX/ticket.lang index 9ad74f9a47a..59745fa1759 100644 --- a/htdocs/langs/es_MX/ticket.lang +++ b/htdocs/langs/es_MX/ticket.lang @@ -1,5 +1,4 @@ # Dolibarr language file - Source file is en_US - ticket -TicketTypeShortBUGSOFT=Malfuncionamiento del software Closed=Cerrada TicketSettings=Configuraciónes TicketMessageMailIntroText=Hola,
    Se envió una nueva respuesta en un ticket con el que se comunicó. Aquí está el mensaje:
    diff --git a/htdocs/langs/es_PE/accountancy.lang b/htdocs/langs/es_PE/accountancy.lang index d6c4ce35cbc..f36dd1e717a 100644 --- a/htdocs/langs/es_PE/accountancy.lang +++ b/htdocs/langs/es_PE/accountancy.lang @@ -10,7 +10,6 @@ ACCOUNTING_EXPORT_PREFIX_SPEC=Especifique el prefijo del nombre del fichero DefaultForService=Servicio por defecto DefaultForProduct=Producto por defecto ConfigAccountingExpert=Configuración del módulo experto en contabilidad -Journaux=Revistas JournalFinancial=Revistas financieras BackToChartofaccounts=Retornar gráfico de cuentas Selectchartofaccounts=Seleccione el plan de cuentas activo diff --git a/htdocs/langs/es_PE/mrp.lang b/htdocs/langs/es_PE/mrp.lang index 9b371e0293e..a73d6660270 100644 --- a/htdocs/langs/es_PE/mrp.lang +++ b/htdocs/langs/es_PE/mrp.lang @@ -1,5 +1,6 @@ # Dolibarr language file - Source file is en_US - mrp Mrp=Órdenes de Fabricación +MOs=Órdenes de Fabricación ManufacturingOrder=Orden de Fabricación MRPDescription=Modulo para gestionar la producción y órdenes de fabricación (OF). MRPArea=Área PRM diff --git a/htdocs/langs/et_EE/mrp.lang b/htdocs/langs/et_EE/mrp.lang index ce25a3d236b..863793063a0 100644 --- a/htdocs/langs/et_EE/mrp.lang +++ b/htdocs/langs/et_EE/mrp.lang @@ -76,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/eu_ES/mrp.lang b/htdocs/langs/eu_ES/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/eu_ES/mrp.lang +++ b/htdocs/langs/eu_ES/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/fa_IR/mrp.lang b/htdocs/langs/fa_IR/mrp.lang index 1dc4b25c5c8..649b72bc70f 100644 --- a/htdocs/langs/fa_IR/mrp.lang +++ b/htdocs/langs/fa_IR/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=بخش برنامه‌ریزی مواد اولیه MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/fi_FI/mrp.lang b/htdocs/langs/fi_FI/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/fi_FI/mrp.lang +++ b/htdocs/langs/fi_FI/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/fr_CA/members.lang b/htdocs/langs/fr_CA/members.lang index 94325f44baa..2a61425f1ef 100644 --- a/htdocs/langs/fr_CA/members.lang +++ b/htdocs/langs/fr_CA/members.lang @@ -24,8 +24,6 @@ MembersListResiliated=Liste des membres licenciés MembersListQualified=Liste des membres qualifiés MenuMembersToValidate=Ébauche de membres MenuMembersValidated=Membres validés -MenuMembersUpToDate=Membres à jour -MenuMembersNotUpToDate=Membres périmés MenuMembersResiliated=Membres résiliés MembersWithSubscriptionToReceive=Membres avec abonnement à recevoir DateSubscription=Date de souscription diff --git a/htdocs/langs/fr_CA/other.lang b/htdocs/langs/fr_CA/other.lang index ba425feb946..23fbaaa759a 100644 --- a/htdocs/langs/fr_CA/other.lang +++ b/htdocs/langs/fr_CA/other.lang @@ -1,6 +1,5 @@ # Dolibarr language file - Source file is en_US - other NumberingShort=N ° -BirthdayDate=Date d'anniversaire BirthdayAlertOn=Alerte d'anniversaire active BirthdayAlertOff=Alerte d'anniversaire inactive PreviousMonthOfInvoice=Mois précédent (numéro 1-12) de la date de facturation diff --git a/htdocs/langs/fr_CA/propal.lang b/htdocs/langs/fr_CA/propal.lang index 50d06c795c8..62d0f0fdc10 100644 --- a/htdocs/langs/fr_CA/propal.lang +++ b/htdocs/langs/fr_CA/propal.lang @@ -19,7 +19,6 @@ ActionsOnPropal=Événements sur proposition RefProposal=Référence de la proposition commerciale SendPropalByMail=Envoyer proposition commerciale par courriel DateEndPropal=Date de validité se terminant -CloseAs=Définir l'état sur SetAcceptedRefused=Accepté/refusé ErrorPropalNotFound=Pas de proposition %s trouvées AddToDraftProposals=Ajouter un brouillon de proposition diff --git a/htdocs/langs/fr_CA/stocks.lang b/htdocs/langs/fr_CA/stocks.lang index 387c0a20f85..6b319d7251a 100644 --- a/htdocs/langs/fr_CA/stocks.lang +++ b/htdocs/langs/fr_CA/stocks.lang @@ -89,7 +89,6 @@ inventoryValidate=Validée inventoryDraft=Fonctionnement inventorySelectWarehouse=Choix d'entrepôt SelectCategory=Filtre de catégorie -INVENTORY_USE_MIN_PA_IF_NO_LAST_PA=Utilisez le prix d'achat si aucun dernier prix d'achat ne peut être trouvé inventoryChangePMPPermission=Autoriser à modifier la valeur PMP pour un produit OnlyProdsInStock=Ne pas ajouter de produit sans stock TheoricalQty=Quantité théorique diff --git a/htdocs/langs/fr_FR/mrp.lang b/htdocs/langs/fr_FR/mrp.lang index 1c2592068d2..24665aeebef 100644 --- a/htdocs/langs/fr_FR/mrp.lang +++ b/htdocs/langs/fr_FR/mrp.lang @@ -1,10 +1,6 @@ Mrp=Ordres de fabrication -<<<<<<< HEAD -MO=Ordre de fabrication -MOs=Manufacturing orders -======= +MOs=Ordres de fabrication ManufacturingOrder=Ordre de fabrication ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module de gestion de production et Ordres de Fabrication (OF). MRPArea=Espace MRP MrpSetupPage=Configuration du module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Produits à produire UnitCost=Coût unitaire TotalCost=Coût total BOMTotalCost=Le coût de production de cette nomenclature basé sur chaque quantité et produit à consommer (utilise le prix de revient si défini, sinon le PMP si défini, sinon le meilleur prix d'achat) +GoOnTabProductionToProduceFirst=Vous devez avoir la production pour clôturer un Ordre de Fabrication (voir onglet '%s'). Mais vous pouvez l'annuler. diff --git a/htdocs/langs/gl_ES/mrp.lang b/htdocs/langs/gl_ES/mrp.lang index 74e6c5e0154..4320d486c84 100644 --- a/htdocs/langs/gl_ES/mrp.lang +++ b/htdocs/langs/gl_ES/mrp.lang @@ -1,10 +1,6 @@ Mrp=Ordes de fabricación -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/he_IL/mrp.lang b/htdocs/langs/he_IL/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/he_IL/mrp.lang +++ b/htdocs/langs/he_IL/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/hi_IN/mrp.lang b/htdocs/langs/hi_IN/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/hi_IN/mrp.lang +++ b/htdocs/langs/hi_IN/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/hr_HR/mrp.lang b/htdocs/langs/hr_HR/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/hr_HR/mrp.lang +++ b/htdocs/langs/hr_HR/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/hu_HU/mrp.lang b/htdocs/langs/hu_HU/mrp.lang index c27001f9417..549c82f9422 100644 --- a/htdocs/langs/hu_HU/mrp.lang +++ b/htdocs/langs/hu_HU/mrp.lang @@ -1,10 +1,6 @@ -Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order +Mrp=Gyártási rendelések MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -36,7 +32,7 @@ DeleteBillOfMaterials=Delete Bill Of Materials DeleteMo=Delete Manufacturing Order ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Material? ConfirmDeleteMo=Are you sure you want to delete this Bill Of Material? -MenuMRP=Manufacturing Orders +MenuMRP=Gyártási rendelések NewMO=New Manufacturing Order QtyToProduce=Qty to produce DateStartPlannedMo=Date start planned @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/id_ID/mrp.lang b/htdocs/langs/id_ID/mrp.lang index 5956fffdd62..b758778f120 100644 --- a/htdocs/langs/id_ID/mrp.lang +++ b/htdocs/langs/id_ID/mrp.lang @@ -1,10 +1,6 @@ Mrp=Pesanan Manufaktur -<<<<<<< HEAD -MO=Pesanan manufaktur MOs=Manufacturing orders -======= -ManufacturingOrder=Pesanan manufaktur ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git +ManufacturingOrder=Manufacturing Order MRPDescription=Modul untuk mengelola produksi dan Pesanan Manufaktur (MO). MRPArea=Area MRP MrpSetupPage=Pengaturan MRP modul @@ -80,3 +76,4 @@ ProductsToProduce=Produk yang akan diproduksi UnitCost=Biaya satuan TotalCost=Total biaya BOMTotalCost=Biaya untuk menghasilkan BOM ini berdasarkan pada biaya setiap kuantitas dan produk yang akan dikonsumsi (gunakan harga Biaya jika ditentukan, selain itu Harga Rata-rata Tertimbang jika ditentukan, selain itu harga pembelian Terbaik) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/is_IS/mrp.lang b/htdocs/langs/is_IS/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/is_IS/mrp.lang +++ b/htdocs/langs/is_IS/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/it_IT/mrp.lang b/htdocs/langs/it_IT/mrp.lang index b09f3395a10..93f8c25e0cd 100644 --- a/htdocs/langs/it_IT/mrp.lang +++ b/htdocs/langs/it_IT/mrp.lang @@ -1,10 +1,6 @@ Mrp=Ordini di produzione -<<<<<<< HEAD -MO=Ordine di produzione MOs=Manufacturing orders -======= ManufacturingOrder=Ordine di produzione ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Modulo per la gestione degli ordini di produzione (MO). MRPArea=MRP Area MrpSetupPage=Configurazione del modulo MRP @@ -80,3 +76,4 @@ ProductsToProduce=Prodotti da produrre UnitCost=Costo unitario TotalCost=Costo totale BOMTotalCost=Il costo per produrre questa distinta base in base al costo di ciascuna quantità e prodotto da consumare (utilizzare il prezzo di costo se definito, altrimenti il prezzo medio ponderato se definito, altrimenti il miglior prezzo di acquisto) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/ja_JP/mrp.lang b/htdocs/langs/ja_JP/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/ja_JP/mrp.lang +++ b/htdocs/langs/ja_JP/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/ka_GE/mrp.lang b/htdocs/langs/ka_GE/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/ka_GE/mrp.lang +++ b/htdocs/langs/ka_GE/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/km_KH/mrp.lang b/htdocs/langs/km_KH/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/km_KH/mrp.lang +++ b/htdocs/langs/km_KH/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/kn_IN/mrp.lang b/htdocs/langs/kn_IN/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/kn_IN/mrp.lang +++ b/htdocs/langs/kn_IN/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/ko_KR/mrp.lang b/htdocs/langs/ko_KR/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/ko_KR/mrp.lang +++ b/htdocs/langs/ko_KR/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/lo_LA/mrp.lang b/htdocs/langs/lo_LA/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/lo_LA/mrp.lang +++ b/htdocs/langs/lo_LA/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/lt_LT/mrp.lang b/htdocs/langs/lt_LT/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/lt_LT/mrp.lang +++ b/htdocs/langs/lt_LT/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/lv_LV/mrp.lang b/htdocs/langs/lv_LV/mrp.lang index bff9a0eb06e..17d0ce9c453 100644 --- a/htdocs/langs/lv_LV/mrp.lang +++ b/htdocs/langs/lv_LV/mrp.lang @@ -1,10 +1,6 @@ Mrp=Ražošanas pasūtījumi -<<<<<<< HEAD -MO=Ražošanas pasūtījums -MOs=Manufacturing orders -======= -ManufacturingOrder=Ražošanas pasūtījums ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git +MOs=Ražošanas pasūtījumi +ManufacturingOrder=Manufacturing Order MRPDescription=Ražošanas un ražošanas pasūtījumu (MO) pārvaldības modulis. MRPArea=MRP apgabals MrpSetupPage=MRP moduļa iestatīšana @@ -80,3 +76,4 @@ ProductsToProduce=Izgatavojamie produkti UnitCost=Vienības cena TotalCost=Kopējās izmaksas BOMTotalCost=Šīs BOM izgatavošanas izmaksas, pamatojoties uz katra patērētā daudzuma un produkta izmaksām (izmantojiet pašizmaksu, ja tā ir noteikta, cita - vidējā svērtā cena, ja ir noteikta, citur - labākā pirkuma cena). +GoOnTabProductionToProduceFirst=Vispirms jums ir jāsāk ražošana, lai aizvērtu ražošanas pasūtījumu (sk. Cilni '%s'). Bet jūs varat to atcelt. diff --git a/htdocs/langs/mk_MK/mrp.lang b/htdocs/langs/mk_MK/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/mk_MK/mrp.lang +++ b/htdocs/langs/mk_MK/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/mn_MN/mrp.lang b/htdocs/langs/mn_MN/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/mn_MN/mrp.lang +++ b/htdocs/langs/mn_MN/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/nb_NO/mrp.lang b/htdocs/langs/nb_NO/mrp.lang index 875be1c549d..2fc7d7beb94 100644 --- a/htdocs/langs/nb_NO/mrp.lang +++ b/htdocs/langs/nb_NO/mrp.lang @@ -1,10 +1,6 @@ Mrp=Produksjonsordrer -<<<<<<< HEAD -MO=Produksjonsordre MOs=Manufacturing orders -======= ManufacturingOrder=Produksjonsordre ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Modul for å administrere produksjons- og produksjonsordrer (PO). MRPArea=MRP-område MrpSetupPage=Oppsett av MRP-modul @@ -80,3 +76,4 @@ ProductsToProduce=Varer å produsere UnitCost=Enhetskostnad TotalCost=Totalkostnad BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/ne_NP/mrp.lang b/htdocs/langs/ne_NP/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/ne_NP/mrp.lang +++ b/htdocs/langs/ne_NP/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/nl_BE/accountancy.lang b/htdocs/langs/nl_BE/accountancy.lang index ead8a057ebb..df9cdf82ec9 100644 --- a/htdocs/langs/nl_BE/accountancy.lang +++ b/htdocs/langs/nl_BE/accountancy.lang @@ -8,7 +8,6 @@ Selectformat=Selecteer het formaat voor het bestand ACCOUNTING_EXPORT_FORMAT=Selecteer het formaat voor het bestand ACCOUNTING_EXPORT_PREFIX_SPEC=Geef de prefix voor het bestand ConfigAccountingExpert=Configuratie van de module boekhouding expert -Journaux=Dagboeken JournalFinancial=Financiële dagboeken BackToChartofaccounts=Geef kaart van accounts terug Selectchartofaccounts=Selecteer actieve grafieken van accounts diff --git a/htdocs/langs/nl_BE/propal.lang b/htdocs/langs/nl_BE/propal.lang index 972cbd72625..993ba762d6f 100644 --- a/htdocs/langs/nl_BE/propal.lang +++ b/htdocs/langs/nl_BE/propal.lang @@ -3,7 +3,6 @@ ProposalsOpened=Openstaande offertes ConfirmValidateProp=Weet u zeker dat u deze offerte met naam %s wilt valideren? LastModifiedProposals=Laatste %s gewijzigde offertes NoProposal=Geen offerte -CloseAs=Zet de status op SetAcceptedRefused=Zet op goedgekeurd/geweigerd CreateEmptyPropal=Creëer een lege commerciële offerte uit de lijst van producten / diensten ConfirmClonePropal=Weet u zeker dat u deze offerte %s wilt klonen? diff --git a/htdocs/langs/nl_BE/ticket.lang b/htdocs/langs/nl_BE/ticket.lang index 52a0a417fb8..5fdcb01d6ba 100644 --- a/htdocs/langs/nl_BE/ticket.lang +++ b/htdocs/langs/nl_BE/ticket.lang @@ -5,8 +5,6 @@ Permission56003=Tickets verwijderen Permission56005=Bekijk tickets van alle externe partijen (niet effectief voor externe gebruikers, altijd beperkt tot de derde partij waarvan ze afhankelijk zijn) TicketDictCategory=Ticket - Groepen TicketDictSeverity=Ticket - Gradaties -TicketTypeShortBUGSOFT=Software storing -TicketTypeShortBUGHARD=Hardware storing TicketTypeShortISSUE=Probleem, bug of probleem TicketTypeShortREQUEST=Verander- of verbeteringsverzoek TicketTypeShortOTHER=Ander diff --git a/htdocs/langs/nl_NL/mrp.lang b/htdocs/langs/nl_NL/mrp.lang index 74d6c0447de..7852dbe15f2 100644 --- a/htdocs/langs/nl_NL/mrp.lang +++ b/htdocs/langs/nl_NL/mrp.lang @@ -1,10 +1,6 @@ Mrp=Productieorders -<<<<<<< HEAD -MO=Productieorder MOs=Manufacturing orders -======= -ManufacturingOrder=Productieorder ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git +ManufacturingOrder=Manufacturing Order MRPDescription=Module om productie- en productieorders (PO) te beheren. MRPArea=MRP-gebied MrpSetupPage=Installatie van module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Te produceren producten UnitCost=De kosten per eenheid TotalCost=Totale prijs BOMTotalCost=De kosten voor het produceren van deze stuklijst op basis van de kosten van elke hoeveelheid en elk te consumeren product (gebruik kostprijs indien gedefinieerd, anders gemiddelde gewogen prijs indien gedefinieerd, anders de beste aankoopprijs) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/pl_PL/mrp.lang b/htdocs/langs/pl_PL/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/pl_PL/mrp.lang +++ b/htdocs/langs/pl_PL/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/pt_BR/admin.lang b/htdocs/langs/pt_BR/admin.lang index cda7582a8f9..3212a59bba4 100644 --- a/htdocs/langs/pt_BR/admin.lang +++ b/htdocs/langs/pt_BR/admin.lang @@ -420,7 +420,6 @@ Module57Name=Pagamentos por Débito Direto Module57Desc=Gerenciamento de pedidos de Débito Direto. Inclui a geração de arquivo SEPA para países europeus. Module58Name=CliqueParaDiscarl Module58Desc=Integração do Sistema CliqueParaDiscar (Asterisk, etc.) -Module59Desc=Adicione uma função para gerar uma conta Bookmark4u de uma conta Dolibarr Module60Name=Adesivos Module60Desc=Gestão de adesivos Module70Desc=Gestor de Intervenções @@ -1366,7 +1365,6 @@ TypePaymentDesc=0: tipo de pagamento do cliente, 1: tipo de pagamento do fornece IncludePath=Incluir caminho (definido na variável %s) ExpenseReportsSetup=Configuração do módulo de Relatórios de Despesas TemplatePDFExpenseReports=Modelos de documentos para gerar despesa documento de relatório -ExpenseReportsIkSetup=Configuração do módulo Relatórios de Despesas - Índice de quilometragem ExpenseReportsRulesSetup=Configuração do módulo Relatórios de Despesas - Regras ExpenseReportNumberingModules=Módulo de numeração dos relatórios de despesas NoModueToManageStockIncrease=Nenhum módulo disponível foi ativado para gerenciar o aumento automático do estoque. O aumento do estoque será feito apenas de forma manual. diff --git a/htdocs/langs/pt_BR/members.lang b/htdocs/langs/pt_BR/members.lang index f78ff76914b..4db6b21fccf 100644 --- a/htdocs/langs/pt_BR/members.lang +++ b/htdocs/langs/pt_BR/members.lang @@ -15,8 +15,6 @@ MembersCards=Cartões de Membros MembersListUpToDate=Lista dos Membros válidos ao día de adesão MembersListNotUpToDate=Lista dos Membros válidos não ao día de adesão MembersListResiliated=Lista de membros encerrados -MenuMembersUpToDate=Membros ao día -MenuMembersNotUpToDate=Membros não ao día MenuMembersResiliated=Membros encerrados MembersWithSubscriptionToReceiveShort=Assinatura a receber DateSubscription=data filiação diff --git a/htdocs/langs/pt_BR/other.lang b/htdocs/langs/pt_BR/other.lang index 365d053b4c9..2c7d8cbc922 100644 --- a/htdocs/langs/pt_BR/other.lang +++ b/htdocs/langs/pt_BR/other.lang @@ -1,7 +1,6 @@ # Dolibarr language file - Source file is en_US - other Tools=Ferramentas Birthday=Aniversário -DateToBirth=Data de nascimento BirthdayAlertOn=Alerta de aniversário ativo BirthdayAlertOff=Alerta de aniversário desativado PreviousMonthOfInvoice=Mês anterior (número 1-12) da data da fatura diff --git a/htdocs/langs/pt_BR/paybox.lang b/htdocs/langs/pt_BR/paybox.lang index 17e00f4c578..6ca0e914a67 100644 --- a/htdocs/langs/pt_BR/paybox.lang +++ b/htdocs/langs/pt_BR/paybox.lang @@ -15,7 +15,6 @@ AccountParameter=Parametros da conta UsageParameter=Parametros de uso InformationToFindParameters=Ajuda a buscar suas %s informaçoes da conta PAYBOX_CGI_URL_V2=URL do Paybox CGI modulo para pagamento -VendorName=Nome do vendedor CSSUrlForPaymentForm=CSS style sheet URL para modelo de pagamento NewPayboxPaymentReceived=Novo pagamento recebido Paybox NewPayboxPaymentFailed=Novo pagamento Paybox tentou, mas não conseguiu diff --git a/htdocs/langs/pt_BR/propal.lang b/htdocs/langs/pt_BR/propal.lang index fbef3802933..637bc0f1179 100644 --- a/htdocs/langs/pt_BR/propal.lang +++ b/htdocs/langs/pt_BR/propal.lang @@ -34,7 +34,6 @@ RefProposal=Ref. Orçamento SendPropalByMail=Enviar Orçamento por E-mail DatePropal=Data da Proposta ValidityDuration=Validade da proposta -CloseAs=Configurar status para SetAcceptedRefused=Configurar aceito/recusado AddToDraftProposals=Adicionar a projeto de proposta NoDraftProposals=Não há projetos de propostas diff --git a/htdocs/langs/pt_BR/stocks.lang b/htdocs/langs/pt_BR/stocks.lang index b99798f63a0..61b1abfcab4 100644 --- a/htdocs/langs/pt_BR/stocks.lang +++ b/htdocs/langs/pt_BR/stocks.lang @@ -119,7 +119,6 @@ inventoryOfWarehouse=Inventário para depósito: %s inventoryErrorQtyAdd=Erro: a quantidade é menor que zero SelectCategory=Filtro por categoria SelectFournisseur=Filtro de fornecedores -INVENTORY_DISABLE_VIRTUAL=Produto virtual (kit): não diminua o estoque de um produto filho INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT=Os movimentos de estoque terão a data do estoque (em vez da data da validação do estoque) RecordedQty=Quant. gravada inventoryDeleteLine=Apagar linha diff --git a/htdocs/langs/pt_BR/ticket.lang b/htdocs/langs/pt_BR/ticket.lang index 24ce002657a..14a27fd797e 100644 --- a/htdocs/langs/pt_BR/ticket.lang +++ b/htdocs/langs/pt_BR/ticket.lang @@ -7,7 +7,6 @@ TicketDictType=Tickets - Tipos TicketDictCategory=Tickets - Grupos TicketDictSeverity=Tickets - Gravidades TicketDictResolution=Ticket - Resolução -TicketTypeShortBUGHARD=Mau funcionamento do hardware TicketTypeShortHELP=Pedido de ajuda funcional TicketTypeShortISSUE=Questão, bug ou problema TicketTypeShortREQUEST=Solicitação de alteração ou aprimoramento diff --git a/htdocs/langs/pt_PT/mrp.lang b/htdocs/langs/pt_PT/mrp.lang index d89ad769fb5..a21cefc105c 100644 --- a/htdocs/langs/pt_PT/mrp.lang +++ b/htdocs/langs/pt_PT/mrp.lang @@ -1,7 +1,6 @@ -<<<<<<< HEAD Mrp=Encomendas de Manufatura -MO=Encomenda de Manufatura MOs=Manufacturing orders +ManufacturingOrder=Encomenda de Manufatura MRPDescription=Módulo para gerir a produção e as «Encomendas de Manufatura» (EM). MRPArea=Área de MRP MrpSetupPage=Configuração do módulo MRP @@ -14,22 +13,6 @@ BOMsSetup=Configuração do módulo de FM ListOfBOMs=Lista das faturas do material - FM ListOfManufacturingOrders=Lista das Encomendas de Manufaturação NewBOM=Nova fatura de material -======= -Mrp=Manufacturing Orders -ManufacturingOrder=Manufacturing Order -MRPDescription=Module to manage production and Manufacturing Orders (MO). -MRPArea=MRP Area -MrpSetupPage=Setup of module MRP -MenuBOM=Bills of material -LatestBOMModified=Latest %s Bills of materials modified -LatestMOModified=Latest %s Manufacturing Orders modified -Bom=Bills of Material -BillOfMaterials=Bill of Material -BOMsSetup=Setup of module BOM -ListOfBOMs=List of bills of material - BOM -ListOfManufacturingOrders=List of Manufacturing Orders -NewBOM=New bill of material ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git ProductBOMHelp=Product to create with this BOM.
    Note: Products with the property 'Nature of product' = 'Raw material' are not visible into this list. BOMsNumberingModules=Modelos de numeração de FM BOMsModelModule=Modelos de documento de FM @@ -93,3 +76,4 @@ ProductsToProduce=Produtos para produzir UnitCost=Custo unitário TotalCost=Custo total BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/ro_RO/mrp.lang b/htdocs/langs/ro_RO/mrp.lang index 7d528c21be4..a997f75649f 100644 --- a/htdocs/langs/ro_RO/mrp.lang +++ b/htdocs/langs/ro_RO/mrp.lang @@ -1,7 +1,6 @@ -<<<<<<< HEAD Mrp=Comenzi de producţie -MO=Comandă de producţie -MOs=Manufacturing orders +MOs=Comenzi de producţie +ManufacturingOrder=Comandă de producţie MRPDescription=Modulul de gestionare a comenzilor de producție și fabricare (MO). MRPArea=Producţie MrpSetupPage=Configurare modul MRP @@ -10,18 +9,6 @@ LatestBOMModified=Ultimele %s bonuri de consum modificate LatestMOModified=Ultimele %s Comenzi de producţie modificate Bom=Bonuri de consum BillOfMaterials=Bon de consum -======= -Mrp=Manufacturing Orders -ManufacturingOrder=Manufacturing Order -MRPDescription=Module to manage production and Manufacturing Orders (MO). -MRPArea=MRP Area -MrpSetupPage=Setup of module MRP -MenuBOM=Bills of material -LatestBOMModified=Latest %s Bills of materials modified -LatestMOModified=Latest %s Manufacturing Orders modified -Bom=Bills of Material -BillOfMaterials=Bill of Material ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git BOMsSetup=Configurarea modulului BOM ListOfBOMs=Listă bonuri de consum - BOM ListOfManufacturingOrders=Listă comenzi de producţie @@ -89,3 +76,4 @@ ProductsToProduce=Produse de fabricat UnitCost=Cost unitar TotalCost=Cost total BOMTotalCost=Costul pentru fabricaţia acestui Bon de consum în funcție de costul fiecărei cantități și produs de consumat (utilizați Prețul de cost, dacă este definit, altfel Prețul mediu ponderat, dacă este definit, altfel cel mai bun preț de achiziție) +GoOnTabProductionToProduceFirst=Mai întâi trebuie să fi început producția pentru a închide o Comandă de fabricație (Vezi fila '%s'). Puteți anula. diff --git a/htdocs/langs/ru_RU/mrp.lang b/htdocs/langs/ru_RU/mrp.lang index 34a614b5203..712fb5dcb7c 100644 --- a/htdocs/langs/ru_RU/mrp.lang +++ b/htdocs/langs/ru_RU/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/sk_SK/mrp.lang b/htdocs/langs/sk_SK/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/sk_SK/mrp.lang +++ b/htdocs/langs/sk_SK/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/sl_SI/mrp.lang b/htdocs/langs/sl_SI/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/sl_SI/mrp.lang +++ b/htdocs/langs/sl_SI/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/sq_AL/mrp.lang b/htdocs/langs/sq_AL/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/sq_AL/mrp.lang +++ b/htdocs/langs/sq_AL/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/sr_RS/mrp.lang b/htdocs/langs/sr_RS/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/sr_RS/mrp.lang +++ b/htdocs/langs/sr_RS/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/sv_SE/mrp.lang b/htdocs/langs/sv_SE/mrp.lang index 38e27d6fd41..825615ed23b 100644 --- a/htdocs/langs/sv_SE/mrp.lang +++ b/htdocs/langs/sv_SE/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP-område MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/sw_SW/mrp.lang b/htdocs/langs/sw_SW/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/sw_SW/mrp.lang +++ b/htdocs/langs/sw_SW/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/th_TH/mrp.lang b/htdocs/langs/th_TH/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/th_TH/mrp.lang +++ b/htdocs/langs/th_TH/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/tr_TR/mrp.lang b/htdocs/langs/tr_TR/mrp.lang index 7cfe3bfd883..cddec242985 100644 --- a/htdocs/langs/tr_TR/mrp.lang +++ b/htdocs/langs/tr_TR/mrp.lang @@ -1,10 +1,6 @@ Mrp=Üretim Emirleri -<<<<<<< HEAD -MO=Üretim Emri MOs=Manufacturing orders -======= ManufacturingOrder=Üretim Emri ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Üretim ve Üretim Siparişlerini (MO) yönetmek için modül. MRPArea=MRP Alanı MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/uk_UA/mrp.lang b/htdocs/langs/uk_UA/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/uk_UA/mrp.lang +++ b/htdocs/langs/uk_UA/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/uz_UZ/mrp.lang b/htdocs/langs/uz_UZ/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/uz_UZ/mrp.lang +++ b/htdocs/langs/uz_UZ/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/vi_VN/mrp.lang b/htdocs/langs/vi_VN/mrp.lang index 73ea762c332..b0c45503e5b 100644 --- a/htdocs/langs/vi_VN/mrp.lang +++ b/htdocs/langs/vi_VN/mrp.lang @@ -1,10 +1,6 @@ Mrp=Đơn đặt hàng sản xuất -<<<<<<< HEAD -MO=Đơn hàng sản xuất MOs=Manufacturing orders -======= ManufacturingOrder=Đơn hàng sản xuất ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=Khu vực MRP MrpSetupPage=Thiết lập mô-đun MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/zh_CN/mrp.lang b/htdocs/langs/zh_CN/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/zh_CN/mrp.lang +++ b/htdocs/langs/zh_CN/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/zh_HK/mrp.lang b/htdocs/langs/zh_HK/mrp.lang index c27001f9417..863793063a0 100644 --- a/htdocs/langs/zh_HK/mrp.lang +++ b/htdocs/langs/zh_HK/mrp.lang @@ -1,10 +1,6 @@ Mrp=Manufacturing Orders -<<<<<<< HEAD -MO=Manufacturing Order MOs=Manufacturing orders -======= ManufacturingOrder=Manufacturing Order ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=Module to manage production and Manufacturing Orders (MO). MRPArea=MRP Area MrpSetupPage=Setup of module MRP @@ -80,3 +76,4 @@ ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) +GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it. diff --git a/htdocs/langs/zh_TW/mrp.lang b/htdocs/langs/zh_TW/mrp.lang index 433408695b7..c64db7996a6 100644 --- a/htdocs/langs/zh_TW/mrp.lang +++ b/htdocs/langs/zh_TW/mrp.lang @@ -1,10 +1,6 @@ Mrp=製造訂單 -<<<<<<< HEAD -MO=製造訂單 -MOs=Manufacturing orders -======= +MOs=製造訂單 ManufacturingOrder=製造訂單 ->>>>>>> branch '12.0' of git@github.com:Dolibarr/dolibarr.git MRPDescription=管理生產和製造訂單(MO)的模組。 MRPArea=MRP區域 MrpSetupPage=MRP模組設定 @@ -80,3 +76,4 @@ ProductsToProduce=生產的產品 UnitCost=單位成本 TotalCost=總計花費 BOMTotalCost=根據每個要消耗的數量和產品的成本產生此BOM的成本(如果定義則使用“成本價”,如果定義則使用“平均加權價格”,否則使用“最佳採購價”) +GoOnTabProductionToProduceFirst=您必須先開始生產才能關閉生產訂單(請參見分頁“ %s”)。但是您可以取消它。 From c81c3ec71a08649897e5142d89d97574c1e0d57e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 03:20:33 +0100 Subject: [PATCH 51/79] Fix translation --- htdocs/langs/en_US/intracommreport.lang | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/intracommreport.lang b/htdocs/langs/en_US/intracommreport.lang index 73a2a22709d..3060300b974 100644 --- a/htdocs/langs/en_US/intracommreport.lang +++ b/htdocs/langs/en_US/intracommreport.lang @@ -31,10 +31,10 @@ IntracommReportTitle=Preparation of an XML file in ProDouane format # List IntracommReportList=List of generated declarations -IntracommReportNumber=Numéro déclaration -IntracommReportPeriod=Période d'analyse -IntracommReportTypeDeclaration=Type de déclaration -IntracommReportDownload=Télécharger fichier XML +IntracommReportNumber=Numero of declaration +IntracommReportPeriod=Period of nalysis +IntracommReportTypeDeclaration=Type of declaration +IntracommReportDownload=download XML file # Invoice IntracommReportTransportMode=Transport mode From 6fc4b1b839c6008441e46c64742a851f48bf4a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 27 Oct 2020 08:17:12 +0100 Subject: [PATCH 52/79] add small photo in box members --- htdocs/core/boxes/box_members.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 2b2d8418e47..2ca1fb3ae25 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -86,10 +86,10 @@ class box_members extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers", $max)); - if ($user->rights->adherent->lire) - { + if ($user->rights->adherent->lire) { $sql = "SELECT a.rowid, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; $sql .= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,"; + $sql .= ' a.photo, a.email, a.gender, a.morphy,'; $sql .= " t.subscription"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " WHERE a.entity IN (".getEntity('member').")"; @@ -98,13 +98,11 @@ class box_members extends ModeleBoxes $sql .= $this->db->plimit($max, 0); $result = $this->db->query($sql); - if ($result) - { + if ($result) { $num = $this->db->num_rows($result); $line = 0; - while ($line < $num) - { + while ($line < $num) { $objp = $this->db->fetch_object($result); $datec = $this->db->jdate($objp->datec); $datem = $this->db->jdate($objp->tms); @@ -113,6 +111,10 @@ class box_members extends ModeleBoxes $memberstatic->firstname = $objp->firstname; $memberstatic->id = $objp->rowid; $memberstatic->ref = $objp->rowid; + $memberstatic->photo = $objp->photo; + $memberstatic->gender = $objp->gender; + $memberstatic->email = $objp->email; + $memberstatic->morphy = $objp->morphy; $memberstatic->company = $objp->company; if (!empty($objp->fk_soc)) { @@ -125,7 +127,7 @@ class box_members extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', - 'text' => $memberstatic->getNomUrl(1), + 'text' => $memberstatic->getNomUrl(-1), 'asis' => 1, ); From 19b82047f0930baf161f96dd3a5282c480533639 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 10:00:35 +0100 Subject: [PATCH 53/79] Fix sql --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 9957e23e012..e0fd93aa005 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -426,9 +426,9 @@ ALTER TABLE llx_product ADD CONSTRAINT fk_product_finished FOREIGN KEY (finished -- MIGRATION TO DO AFTER RENAMING AN OBJECT -- drop constraint -ALTER TABLE llx_livraison DROP CONSTRAINT fk_livraison_fk_soc; -ALTER TABLE llx_livraison DROP CONSTRAINT fk_livraison_fk_user_author; -ALTER TABLE llx_livraison DROP CONSTRAINT fk_livraison_fk_user_valid; +ALTER TABLE llx_livraison DROP FOREIGN KEY fk_livraison_fk_soc; +ALTER TABLE llx_livraison DROP FOREIGN KEY fk_livraison_fk_user_author; +ALTER TABLE llx_livraison DROP FOREIGN KEY fk_livraison_fk_user_valid; -- rename Table ALTER TABLE llx_livraison RENAME TO llx_delivery; @@ -447,16 +447,16 @@ ALTER TABLE llx_delivery DROP INDEX idx_livraison_fk_user_valid; ALTER TABLE llx_delivery ADD INDEX idx_delivery_fk_user_valid (fk_user_valid); -- drop constraint -ALTER TABLE llx_delivery DROP CONSTRAINT fk_livraison_fk_soc; -ALTER TABLE llx_delivery DROP CONSTRAINT fk_livraison_fk_user_author; -ALTER TABLE llx_delivery DROP CONSTRAINT fk_livraison_fk_user_valid; +ALTER TABLE llx_delivery DROP FOREIGN KEY fk_livraison_fk_soc; +ALTER TABLE llx_delivery DROP FOREIGN KEY fk_livraison_fk_user_author; +ALTER TABLE llx_delivery DROP FOREIGN KEY fk_livraison_fk_user_valid; -- add constraint ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); -ALTER TABLE llx_deliverydet DROP CONSTRAINT fk_livraisondet_fk_livraison; +ALTER TABLE llx_deliverydet DROP FOREIGN KEY fk_livraisondet_fk_livraison; ALTER TABLE llx_deliverydet DROP INDEX idx_livraisondet_fk_expedition; ALTER TABLE llx_deliverydet CHANGE COLUMN fk_livraison fk_delivery integer; ALTER TABLE llx_deliverydet ADD INDEX idx_deliverydet_fk_delivery (fk_delivery); From ffc961599c2f74d15c96cf66b20d3c1dc5883ce9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 10:19:00 +0100 Subject: [PATCH 54/79] FIX error 500 on cash fence --- htdocs/compta/cashcontrol/cashcontrol_card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 3780fbc1afe..d27f87cbc23 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -28,6 +28,7 @@ */ require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php'; From 00b49dba180cec2c9f23dc8e89fce6188c4d4418 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 10:26:30 +0100 Subject: [PATCH 55/79] Fix label --- htdocs/compta/cashcontrol/report.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 1ea06eba9e9..ef1d20c5efc 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -127,8 +127,10 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; + print ""; print "

    "; - if ($cashcontrol->status == 2) print $langs->trans("CashControl")." ".$cashcontrol->id; + var_dump($cashcontrol->status); + if ($cashcontrol->status != $cashcontrol::STATUS_DRAFT) print $langs->trans("CashControl")." ".$cashcontrol->id; else print $langs->trans("CashControl")." - ".$langs->trans("Draft"); print "
    ".$langs->trans("DateCreationShort").": ".dol_print_date($cashcontrol->date_creation, 'dayhour')."

    "; From 5943e784ec57afe9b59d7a248a2909d2da45e039 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 10:27:44 +0100 Subject: [PATCH 56/79] Remove var_dump --- htdocs/compta/cashcontrol/report.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index ef1d20c5efc..51438b3be6e 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -127,9 +127,8 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; - print ""; + print "\n"; print "

    "; - var_dump($cashcontrol->status); if ($cashcontrol->status != $cashcontrol::STATUS_DRAFT) print $langs->trans("CashControl")." ".$cashcontrol->id; else print $langs->trans("CashControl")." - ".$langs->trans("Draft"); print "
    ".$langs->trans("DateCreationShort").": ".dol_print_date($cashcontrol->date_creation, 'dayhour')."

    "; From 8bcd704d9b5a988890f8ad901d40afdf29c8a73f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 10:32:25 +0100 Subject: [PATCH 57/79] Disable notif as it is used as a frame --- htdocs/compta/cashcontrol/report.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 02299788794..caf6712d94f 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2012 Vinícius Nogueira * Copyright (C) 2014 Florian Henry @@ -29,6 +29,9 @@ * \brief List of bank transactions */ +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu +if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; From 56903d3677d8d6dec0692955833dd05b5ca546cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 10:35:22 +0100 Subject: [PATCH 58/79] Fix trans --- htdocs/compta/cashcontrol/report.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 5538dfa8979..5df55ab7849 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php'; -$langs->load("bills"); +$langs->loadLangs(array("bills", "banks")); $id = GETPOST('id', 'int'); From fe357e17e8a9cddb7a53ad7c750aa8454e14b4d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 11:00:50 +0100 Subject: [PATCH 59/79] Fix for ja --- htdocs/core/class/translate.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 184724c0319..6bfe5cdc195 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -113,7 +113,7 @@ class Translate } else $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]); } else { // If it's for a codetouse that is a short code xx // Array to convert short lang code into long code. - $longforshort = array('ar'=>'ar_SA', 'el'=>'el_GR', 'ca'=>'ca_ES', 'en'=>'en_US', 'nb'=>'nb_NO', 'no'=>'nb_NO'); + $longforshort = array('ar'=>'ar_SA', 'el'=>'el_GR', 'ca'=>'ca_ES', 'en'=>'en_US', 'ja'=>'ja_JP', 'nb'=>'nb_NO', 'no'=>'nb_NO'); if (isset($longforshort[strtolower($langpart[0])])) $srclang = $longforshort[strtolower($langpart[0])]; elseif (!empty($langpart[0])) $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]); else $srclang = 'en_US'; From 4adaf67d4742b3a78f7252c635430329d06a8dbb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 11:40:30 +0100 Subject: [PATCH 60/79] Hide setup we don't need if email are disabled globally CSS --- htdocs/admin/mails.php | 378 +++++++++++++++-------------- htdocs/core/lib/functions.lib.php | 5 +- htdocs/index.php | 2 +- htdocs/theme/eldy/info-box.inc.php | 10 +- htdocs/theme/md/info-box.inc.php | 15 +- 5 files changed, 216 insertions(+), 194 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 17846b05452..c3792812210 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -529,209 +529,213 @@ if ($action == 'edit') if (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) print img_warning($langs->trans("Disabled")); print ''; - // Force e-mail recipient - print '
    '; } - print ''; print '
    '.$langs->trans("MAIN_MAIL_FORCE_SENDTO").''.$conf->global->MAIN_MAIL_FORCE_SENDTO; - if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) - { - if (!isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail")); - else print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue")); + if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { + // Force e-mail recipient + print '
    '.$langs->trans("MAIN_MAIL_FORCE_SENDTO").''.$conf->global->MAIN_MAIL_FORCE_SENDTO; + if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) + { + if (!isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail")); + else print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue")); + } + print '
    '; - print '
    '; + if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { + print '
    '; - print ''; - print ''; + print '
    '.$langs->trans("MAIN_MAIL_SENDMODE").'
    '; + print ''; - // Method - print ''; + print ''; - // Host server - if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) - { - print ''; - } else { - print ''; - } - - // Port - if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) - { - print ''; - } else { - print ''; - } - - // SMTPS ID - if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) - { - print ''; - } - - // SMTPS PW - if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) - { - print ''; - } - - // TLS - print ''; + print ''; + } else { + print ''; + } - // STARTTLS - print ''; + print ''; + } else { + print ''; + } - // SMTP_ALLOW_SELF_SIGNED - print ''; + print ''; + } + // SMTPS PW + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) + { + print ''; + } - if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer') - { - // DKIM - print ''; - // Domain - print ''; - print ''; - - // Selector - print ''; - print ''; - - // PRIVATE KEY - print ''; - print ''; - } - - print '
    '.$langs->trans("MAIN_MAIL_SENDMODE").'
    '.$langs->trans("MAIN_MAIL_SENDMODE").''; - $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE]; - if (empty($text)) $text = $langs->trans("Undefined").img_warning(); - print $text; + // Method + print '
    '.$langs->trans("MAIN_MAIL_SENDMODE").''; + $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE]; + if (empty($text)) $text = $langs->trans("Undefined").img_warning(); + print $text; - if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { - print $form->textwithpicto('', $langs->trans("WarningPHPMail").'
    '.$langs->trans("WarningPHPMailA").'
    '.$langs->trans("WarningPHPMailB").'
    '.$langs->trans("WarningPHPMailC").'

    '.$langs->trans("WarningPHPMailD"), 1, 'warning'); - } + if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { + print $form->textwithpicto('', $langs->trans("WarningPHPMail").'
    '.$langs->trans("WarningPHPMailA").'
    '.$langs->trans("WarningPHPMailB").'
    '.$langs->trans("WarningPHPMailC").'

    '.$langs->trans("WarningPHPMailD"), 1, 'warning'); + } - print '
    '.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
    '.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'
    '.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
    '.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'
    '.$langs->trans("MAIN_MAIL_SMTPS_ID").''.$conf->global->MAIN_MAIL_SMTPS_ID.'
    '.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).'
    '.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) - { - if (function_exists('openssl_open')) + // Host server + if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) { - print yn($conf->global->MAIN_MAIL_EMAIL_TLS); - } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } else print ''.yn(0).' ('.$langs->trans("NotSupported").')'; - print '
    '.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
    '.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'
    '.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) - { - if (function_exists('openssl_open')) + // Port + if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) { - print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS); - } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } else print ''.yn(0).' ('.$langs->trans("NotSupported").')'; - print '
    '.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
    '.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'
    '.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) - { - if (function_exists('openssl_open')) + // SMTPS ID + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { - print yn($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED); - } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } else print ''.yn(0).' ('.$langs->trans("NotSupported").')'; - print '
    '.$langs->trans("MAIN_MAIL_SMTPS_ID").''.$conf->global->MAIN_MAIL_SMTPS_ID.'
    '.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).'
    '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))) + // TLS + print '
    '.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print yn($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED); + print yn($conf->global->MAIN_MAIL_EMAIL_TLS); } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } else print yn(0).' ('.$langs->trans("NotSupported").')'; + } else print ''.yn(0).' ('.$langs->trans("NotSupported").')'; print '
    '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").''.$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN; - print '
    '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").''.$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR; - print '
    '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").''.$conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY; - print '
    '; - - if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { - print info_admin($langs->trans("WarningPHPMail").'
    '.$langs->trans("WarningPHPMailA").'
    '.$langs->trans("WarningPHPMailB").'
    '.$langs->trans("WarningPHPMailC").'

    '.$langs->trans("WarningPHPMailD"), 0, 0, 'warning'); - } - - print '
    '; - - print ''; - print ''; - - // From - print ''; - print ''; - - // Default from type - $liste = array(); - $liste['user'] = $langs->trans('UserEmail'); - $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')'; - $sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile'; - $sql .= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')'; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) + // STARTTLS + print ''; - print ''; - print ''; + + + if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer') + { + // DKIM + print ''; + + // Domain + print ''; + print ''; + + // Selector + print ''; + print ''; + + // PRIVATE KEY + print ''; + print ''; } + + print '
    '.$langs->trans("OtherOptions").'
    '.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).''.$conf->global->MAIN_MAIL_EMAIL_FROM; - if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && !isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail")); - print '
    '.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { - $obj = $db->fetch_object($resql); - if ($obj) + if (function_exists('openssl_open')) { - $liste['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>'; - } - $i++; - } - } else dol_print_error($db); + print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS); + } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } else print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + print '
    '.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; - if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot') - { - print $langs->trans('RobotEmail'); - } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user') - { - print $langs->trans('UserEmail'); - } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company') - { - print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); - } else { - $id = preg_replace('/senderprofile_/', '', $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE); - if ($id > 0) + // SMTP_ALLOW_SELF_SIGNED + print '
    '.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { - include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php'; - $emailsenderprofile = new EmailSenderProfile($db); - $emailsenderprofile->fetch($id); - print $emailsenderprofile->label.' '.dol_escape_htmltag('<'.$emailsenderprofile->email.'>'); + if (function_exists('openssl_open')) + { + print yn($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED); + } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } else print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + print '
    '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").''; + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))) + { + if (function_exists('openssl_open')) + { + print yn($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED); + } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } else print yn(0).' ('.$langs->trans("NotSupported").')'; + print '
    '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").''.$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN; + print '
    '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").''.$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR; + print '
    '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").''.$conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY; + print '
    '; + + if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { + print info_admin($langs->trans("WarningPHPMail").'
    '.$langs->trans("WarningPHPMailA").'
    '.$langs->trans("WarningPHPMailB").'
    '.$langs->trans("WarningPHPMailC").'

    '.$langs->trans("WarningPHPMailD"), 0, 0, 'warning'); + } + + print '
    '; + + print ''; + print ''; + + // From + print ''; + print ''; + + // Default from type + $liste = array(); + $liste['user'] = $langs->trans('UserEmail'); + $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')'; + $sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile'; + $sql .= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')'; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + if ($obj) + { + $liste['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>'; + } + $i++; + } + } else dol_print_error($db); + + print ''; + print ''; + + // Errors To + print ''; + print ''; + + // Autocopy to + print ''; + print ''; + + //Add user to select destinaries list + print ''; + + print '
    '.$langs->trans("OtherOptions").'
    '.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).''.$conf->global->MAIN_MAIL_EMAIL_FROM; + if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && !isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail")); + print '
    '.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; + if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot') + { + print $langs->trans('RobotEmail'); + } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user') + { + print $langs->trans('UserEmail'); + } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company') + { + print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); + } else { + $id = preg_replace('/senderprofile_/', '', $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE); + if ($id > 0) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php'; + $emailsenderprofile = new EmailSenderProfile($db); + $emailsenderprofile->fetch($id); + print $emailsenderprofile->label.' '.dol_escape_htmltag('<'.$emailsenderprofile->email.'>'); + } + } + print '
    '.$langs->trans("MAIN_MAIL_ERRORS_TO").''.$conf->global->MAIN_MAIL_ERRORS_TO; + if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) print img_warning($langs->trans("ErrorBadEMail")); + print '
    '.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").''; + if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) + { + print $conf->global->MAIN_MAIL_AUTOCOPY_TO; + if (!isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail")); + } else { + print ' '; + } + print '
    '.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").''.yn($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT).'
    '; } - print ''; - - // Errors To - print ''.$langs->trans("MAIN_MAIL_ERRORS_TO").''; - print ''.$conf->global->MAIN_MAIL_ERRORS_TO; - if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) print img_warning($langs->trans("ErrorBadEMail")); - print ''; - - // Autocopy to - print ''.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").''; - print ''; - if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) - { - print $conf->global->MAIN_MAIL_AUTOCOPY_TO; - if (!isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail")); - } else { - print ' '; - } - print ''; - - //Add user to select destinaries list - print ''.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").''.yn($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT).''; - - print ''; dol_fiche_end(); @@ -741,21 +745,23 @@ if ($action == 'edit') print ''.$langs->trans("Modify").''; - if ($conf->global->MAIN_MAIL_SENDMODE != 'mail' || !$linuxlike) - { - if (function_exists('fsockopen') && $port && $server) + if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { + if ($conf->global->MAIN_MAIL_SENDMODE != 'mail' || !$linuxlike) { - print ''.$langs->trans("DoTestServerAvailability").''; + if (function_exists('fsockopen') && $port && $server) + { + print ''.$langs->trans("DoTestServerAvailability").''; + } + } else { + print ''.$langs->trans("DoTestServerAvailability").''; } - } else { - print ''.$langs->trans("DoTestServerAvailability").''; - } - print ''.$langs->trans("DoTestSend").''; + print ''.$langs->trans("DoTestSend").''; - if (!empty($conf->fckeditor->enabled)) - { - print ''.$langs->trans("DoTestSendHTML").''; + if (!empty($conf->fckeditor->enabled)) + { + print ''.$langs->trans("DoTestSendHTML").''; + } } print '
    '; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1f54af58ff0..a3eb00a38ec 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1456,6 +1456,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab * * @param int $notab -1 or 0=Add tab footer, 1=no tab footer * @return void + * @deprecated Use print dol_get_fiche_end() instead */ function dol_fiche_end($notab = 0) { @@ -3316,9 +3317,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $enabledisablehtml = ''; - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + /*if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $enabledisablehtml .= $titlealt; - } + }*/ $enabledisablehtml .= ''; return $enabledisablehtml; diff --git a/htdocs/index.php b/htdocs/index.php index 492dd7b0ec2..ebc343b5e8d 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -916,7 +916,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) $boxstat .= '
    '; $boxstat .= ''; $boxstat .= ''; - $boxstat .= ''; $boxstat .= ''; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 9bbc4101065..811a3cac853 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -435,19 +435,20 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = min-width: 350px; max-width: 350px; } + @media only screen and (max-width: 1740px) { .info-box-module { min-width: 315px; max-width: 315px; } } + @media only screen and (max-width: 767px) { .info-box-module { min-width: 260px; } } - .info-box-module .info-box-content { height: 98px; } @@ -463,9 +464,14 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = margin: 0 0 0 0px !important; width: 100% !important; } - .info-box-module { width: 100%; max-width: unset; } + .info-box-sm .info-box-icon { + width: 60px; + } + .info-box-sm .info-box-content { + margin-left: 60px; + } } diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index 9b4b0618dd9..a784a1ec7d9 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -473,6 +473,12 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = min-width: 350px; max-width: 350px; } + +.info-box-module .info-box-content { + height: 6.3em; +} + + @media only screen and (max-width: 1740px) { .info-box-module { min-width: 315px; @@ -483,8 +489,11 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = .info-box-module { min-width: 260px; } + .info-box-sm .info-box-icon { + width: 60px; + } + .info-box-sm .info-box-content { + margin-left: 60px; + } } -.info-box-module .info-box-content { - height: 6.3em; -} From c6216eddd15d9a2e4eb186d01ba753087216e5db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 12:49:14 +0100 Subject: [PATCH 61/79] CSS --- htdocs/theme/eldy/info-box.inc.php | 4 ++++ htdocs/theme/md/style.css.php | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 811a3cac853..b037cfdc851 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -474,4 +474,8 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = .info-box-sm .info-box-content { margin-left: 60px; } + .info-box { + border: 1px solid #e0e0e0; + } +} } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 0be0b85bbbc..295eccc4e17 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1299,6 +1299,7 @@ table[summary="list_of_modules"] .fa-cog { body { font-size: ; } + div.refidno { font-size: !important; } @@ -1306,6 +1307,17 @@ table[summary="list_of_modules"] .fa-cog { .login_vertical_align { padding-left: 0; } + .login_table input#username, .login_table input#password, .login_table input#securitycode { + margin-left: 5px !important; + } + div#login_left, div#login_right { + min-width: 150px !important; + padding-left: 5px !important; + padding-right: 5px !important; + } + .login_table div#login_right .tdinputlogin, .login_table div#login_right .tdinputlogin input { + min-width: 150px !important; + } .divmainbodylarge { margin-left: 20px; margin-right: 20px; } @@ -2335,10 +2347,12 @@ form#login { } .login_table .tdinputlogin { background-color: #fff; - border: 2px solid #ccc; min-width: 220px; border-radius: 2px; } +.login_table .tdinputlogin { + border-bottom: 1px solid #ccc; +} .login_table .tdinputlogin .fa { padding-left: 10px; width: 14px; From d750dc48a127f9e502f3b665603b87b8f9111808 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 15:06:16 +0100 Subject: [PATCH 62/79] More secured getURLContent method. Add PHPUnit on getURLContent --- htdocs/admin/system/security.php | 15 ++++-- htdocs/core/lib/geturl.lib.php | 89 ++++++++++++++++++++++---------- test/phpunit/SecurityTest.php | 30 +++++++++++ 3 files changed, 103 insertions(+), 31 deletions(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 0cf70f2bbaa..05cf9dd1b8e 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -50,15 +50,21 @@ llxHeader(); print load_fiche_titre($langs->trans("Security"), '', 'title_setup'); print ''.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').' ('.$langs->trans("Reload").')
    '; +print '
    '; -// Recupere la version de PHP +print load_fiche_titre($langs->trans("PHPSetup"), '', ''); + +// Get version of PHP $phpversion = version_php(); -print "
    PHP - ".$langs->trans("Version").": ".$phpversion."
    \n"; +print "PHP - ".$langs->trans("Version").": ".$phpversion."
    \n"; -// Recupere la version du serveur web +// Get versionof web server print "
    Web server - ".$langs->trans("Version").": ".$_SERVER["SERVER_SOFTWARE"]."
    \n"; print '
    '; +print "PHP safe_mode = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0))."
    \n"; +print "PHP open_basedir = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0))."
    \n"; +print '
    '; print load_fiche_titre($langs->trans("ConfigFile"), '', ''); @@ -73,6 +79,7 @@ print load_fiche_titre($langs->trans("PermissionsOnFiles"), '', ''); print ''.$langs->trans("PermissionOnFileInWebRoot").': '; // TODO +print 'TODO'; print '
    '; @@ -126,6 +133,8 @@ print ''.$langs->trans("AntivirusEnabledOnUpload").': '; // TODO print '
    '; +print '
    '; + print ''.$langs->trans("SecurityAudit").': '; // TODO Disabled or enabled ? print '
    '; diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index e6e20692317..908884ee059 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2020 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,12 +26,14 @@ * * @param string $url URL to call. * @param string $postorget 'POST', 'GET', 'HEAD', 'PUT', 'PUTALREADYFORMATED', 'POSTALREADYFORMATED', 'DELETE' - * @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with PUTALREADYFORMATED - * @param integer $followlocation 1=Follow location, 0=Do not follow + * @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with $postorget='PUTALREADYFORMATED' + * @param integer $followlocation 0=Do not follow, 1=Follow location. * @param string[] $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....) + * @param string[] $allowedschemes List of schemes that are allowed ('http' + 'https' only by default) + * @param int $localurl 0=Only external URL are possible, 1=Only local URL, 2=Both external and local URL are allowed. * @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) */ -function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = 1, $addheaders = array()) +function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = 1, $addheaders = array(), $allowedschemes = array('http', 'https'), $localurl = 0) { //declaring of global variables global $conf; @@ -50,13 +52,14 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = print $USE_PROXY."-".$gv_ApiErrorURL."
    "; print $nvpStr; exit;*/ - curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function'); - @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation ?true:false)); // We use @ here because this may return warning if safe mode is on or open_basedir is on + // We use @ here because this may return warning if safe mode is on or open_basedir is on (following location is forbidden when safe mode is on). + // We force value to false so we will manage redirection ourself later. + @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); - if (count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders); + if (is_array($addheaders) && count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders); curl_setopt($ch, CURLINFO_HEADER_OUT, true); // To be able to retrieve request header and log it // By default use tls decied by PHP. @@ -64,25 +67,33 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = if (!empty($conf->global->MAIN_CURL_SSLVERSION)) curl_setopt($ch, CURLOPT_SSLVERSION, $conf->global->MAIN_CURL_SSLVERSION); //curl_setopt($ch, CURLOPT_SSLVERSION, 6); for tls 1.2 - //turning off the server and peer verification(TrustManager Concept). + // Turning off the server and peer verification(TrustManager Concept). curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + // Restrict use to some protocols only + $protocols = 0; + if (is_array($allowedschemes)) { + foreach($allowedschemes as $allowedscheme) { + if ($allowedscheme == 'http') $protocols |= CURLPROTO_HTTP; + if ($allowedscheme == 'https') $protocols |= CURLPROTO_HTTPS; + } + curl_setopt($ch, CURLOPT_PROTOCOLS, $protocols); + curl_setopt($ch, CURLOPT_REDIR_PROTOCOLS, $protocols); + } + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); //curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); // PHP 5.5 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // We want response - if ($postorget == 'POST') - { + if ($postorget == 'POST') { curl_setopt($ch, CURLOPT_POST, 1); // POST curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields - } elseif ($postorget == 'POSTALREADYFORMATED') - { + } elseif ($postorget == 'POSTALREADYFORMATED') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); // HTTP request is 'POST' but param string is taken as it is curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string - } elseif ($postorget == 'PUT') - { + } elseif ($postorget == 'PUT') { $array_param = null; curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' if (!is_array($param)) parse_str($param, $array_param); @@ -91,32 +102,54 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = $array_param = $param; } curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields - } elseif ($postorget == 'PUTALREADYFORMATED') - { + } elseif ($postorget == 'PUTALREADYFORMATED') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string - } elseif ($postorget == 'HEAD') - { + } elseif ($postorget == 'HEAD') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD' curl_setopt($ch, CURLOPT_NOBODY, true); - } elseif ($postorget == 'DELETE') - { + } elseif ($postorget == 'DELETE') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); // POST } else { curl_setopt($ch, CURLOPT_POST, 0); // GET } //if USE_PROXY constant set at begin of this method. - if ($USE_PROXY) - { + if ($USE_PROXY) { dol_syslog("getURLContent set proxy to ".$PROXY_HOST.":".$PROXY_PORT." - ".$PROXY_USER.":".$PROXY_PASS); //curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); // Curl 7.10 curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST.":".$PROXY_PORT); if ($PROXY_USER) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $PROXY_USER.":".$PROXY_PASS); } - //getting response from server - $response = curl_exec($ch); + $newUrl = $url; + $maxRedirection = 5; + $info = array(); + + do + { + if ($maxRedirection < 1) break; + + curl_setopt($ch, CURLOPT_URL, $newUrl); + + // TODO Test for $localurl on $newUrl + // Parse $newUrl, check server address, then set parsed value with CURLOPT_CONNECT_TO + + // Getting response from server + $response = curl_exec($ch); + + $info = curl_getinfo($ch); // Reading of request must be done after sending request + $http_code = $info['http_code']; + if ($followlocation && ($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307)) { + $newUrl = $info['redirect_url']; + $maxRedirection--; + // TODO Use $info['local_ip'] and $info['primary_ip'] ? + continue; + } else { + $http_code = 0; + } + } + while($http_code); $request = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request @@ -136,7 +169,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = dol_syslog("getURLContent response array is ".join(',', $rep)); } else { - $info = curl_getinfo($ch); + //$info = curl_getinfo($ch); // Ad keys to $rep $rep = $info; @@ -148,11 +181,11 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = $rep['content'] = $response; $rep['curl_error_no'] = ''; $rep['curl_error_msg'] = ''; - - //closing the curl - curl_close($ch); } + //closing the curl + curl_close($ch); + return $rep; } diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 4430b377b26..b4bdf1d89ab 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -383,4 +383,34 @@ class SecurityTest extends PHPUnit\Framework\TestCase $result=restrictedArea($user, 'societe'); $this->assertEquals(1, $result); } + + + /** + * testGetRandomPassword + * + * @return number + */ + public function testGetURLContent() + { + global $conf; + include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + + $url = 'ftp://aaaa'; + $tmp = getURLContent($url); + print __METHOD__." url=".$url."\n"; + $this->assertGreaterThan(0, strpos($tmp['curl_error_msg'], 'not supported')); // Test error if return does not contains 'not supported' + + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page + $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow + print __METHOD__." url=".$url."\n"; + $this->assertEquals(301, $tmp['http_code'], 'GET url 301 without following -> 301'); + + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page + $tmp = getURLContent($url); // We DO follow + print __METHOD__." url=".$url."\n"; + //var_dump($tmp); + $this->assertEquals(200, $tmp['http_code'], 'GET url 301 with following -> 200'); // Test error if return does not contains 'not supported' + + return 0; + } } From 80d13e711ce54d6133f5cd843afe22f89f0822a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 18:02:05 +0100 Subject: [PATCH 63/79] More secured getURLContent method. Add PHPUnit on getURLContent --- htdocs/admin/system/filecheck.php | 2 +- htdocs/admin/system/perf.php | 1 - htdocs/admin/tools/update.php | 2 +- htdocs/api/class/api_setup.class.php | 2 +- htdocs/core/lib/geturl.lib.php | 46 +++++++++++++++++-- htdocs/core/tpl/login.tpl.php | 4 +- .../class/multicurrency.class.php | 2 +- test/phpunit/SecurityTest.php | 29 +++++++++++- 8 files changed, 75 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index a3d54104a02..c8878b6b69f 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -147,7 +147,7 @@ if (GETPOST('target') == 'remote') $xmlarray = getURLContent($xmlremote); // Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) - if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '404') + if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') { $xmlfile = $xmlarray['content']; //print "xmlfilestart".$xmlfile."xmlfileend"; diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 7857773924f..d9901818c92 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -431,7 +431,6 @@ print '
    '; print ''; print $form->textwithpicto($langs->trans("CompressionOfResources"), $langs->trans("CompressionOfResourcesDesc")); print ': '; -//$tmp=getURLContent(DOL_URL_ROOT.'/index.php','GET');var_dump($tmp); print '
    '; // on PHP print '
    '.img_picto('', 'tick.png').' '.$langs->trans("FilesOfTypeCompressed", 'php (.php)').'
    '; diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index 27b53e8266e..f39766818f3 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -54,7 +54,7 @@ $version = '0.0'; if ($action == 'getlastversion') { - $result = getURLContent('http://sourceforge.net/projects/dolibarr/rss'); + $result = getURLContent('https://sourceforge.net/projects/dolibarr/rss'); //var_dump($result['content']); $sfurl = simplexml_load_string($result['content']); } diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 8177fbf7e1e..8e632fa0032 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1634,7 +1634,7 @@ class Setup extends DolibarrApi $xmlarray = getURLContent($xmlremote); // Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) - if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '404') + if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') { $xmlfile = $xmlarray['content']; //print "xmlfilestart".$xmlfile."endxmlfile"; diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 908884ee059..9a4ac16e2f2 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -18,11 +18,13 @@ /** * \file htdocs/core/lib/geturl.lib.php - * \brief This file contains functions dedicated to get URL. + * \brief This file contains functions dedicated to get URLs. */ /** - * Function to get a content from an URL (use proxy if proxy defined) + * Function to get a content from an URL (use proxy if proxy defined). + * Support Dolibarr setup for timeout and proxy. + * Enhancement of CURL to add an anti SSRF protection. * * @param string $url URL to call. * @param string $postorget 'POST', 'GET', 'HEAD', 'PUT', 'PUTALREADYFORMATED', 'POSTALREADYFORMATED', 'DELETE' @@ -125,6 +127,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = $newUrl = $url; $maxRedirection = 5; $info = array(); + $response = ''; do { @@ -132,8 +135,43 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = curl_setopt($ch, CURLOPT_URL, $newUrl); - // TODO Test for $localurl on $newUrl - // Parse $newUrl, check server address, then set parsed value with CURLOPT_CONNECT_TO + // Parse $newUrl + $newUrlArray = parse_url($newUrl); + $hosttocheck = $newUrlArray['host']; + $hosttocheck = str_replace(array('[', ']'), '', $hosttocheck); // Remove brackets of IPv6 + + if (in_array($hosttocheck, array('localhost', 'localhost.domain'))) { + $iptocheck = '127.0.0.1'; + } else { + // TODO Resolve $iptocheck to get an IP and set CURLOPT_CONNECT_TO to use this ip + $iptocheck = $hosttocheck; + } + + if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6)) { // This is not an IP + $iptocheck = 0; // + } + + if ($iptocheck) { + if ($localurl == 0) { // Only external url allowed (dangerous, may allow to get malware) + if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { + $info['http_code'] = 400; + $info['content'] = 'Error bad hostname IP (private or reserved range). Must be an external URL.'; + break; + } + if (in_array($iptocheck, array('100.100.100.200'))) { + $info['http_code'] = 400; + $info['content'] = 'Error bad hostname IP (Used by Alibaba metadata). Must be an external URL.'; + break; + } + } + if ($localurl == 1) { // Only local url allowed (dangerous, may allow to get metadata on server or make internal port scanning) + if (filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { + $info['http_code'] = 400; + $info['content'] = 'Error bad hostname. Must be a local URL.'; + break; + } + } + } // Getting response from server $response = curl_exec($ch); diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 07229bcfed8..0eb3aa94c24 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -297,9 +297,9 @@ if (!empty($_SESSION['dol_loginmesg'])) if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; if (substr($langs->defaultlang, 0, 2) == 'fr') { - $resgetcommitstrip = getURLContent("http://www.commitstrip.com/fr/feed/"); + $resgetcommitstrip = getURLContent("https://www.commitstrip.com/fr/feed/"); } else { - $resgetcommitstrip = getURLContent("http://www.commitstrip.com/en/feed/"); + $resgetcommitstrip = getURLContent("https://www.commitstrip.com/en/feed/"); } if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200') { diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 2ce3277ae89..7a646386452 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -634,7 +634,7 @@ class MultiCurrency extends CommonObject dol_syslog("Call url endpoint ".$urlendpoint); - // TODO Use getURLContent() function instead. + // FIXME Use getURLContent() function instead. $ch = curl_init($urlendpoint); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index b4bdf1d89ab..bc3595a8cfa 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -395,7 +395,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase global $conf; include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; - $url = 'ftp://aaaa'; + $url = 'ftp://mydomain.com'; $tmp = getURLContent($url); print __METHOD__." url=".$url."\n"; $this->assertGreaterThan(0, strpos($tmp['curl_error_msg'], 'not supported')); // Test error if return does not contains 'not supported' @@ -408,9 +408,34 @@ class SecurityTest extends PHPUnit\Framework\TestCase $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page $tmp = getURLContent($url); // We DO follow print __METHOD__." url=".$url."\n"; - //var_dump($tmp); $this->assertEquals(200, $tmp['http_code'], 'GET url 301 with following -> 200'); // Test error if return does not contains 'not supported' + $url = 'http://localhost'; + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL + print __METHOD__." url=".$url."\n"; + $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL + + $url = 'http://127.0.0.1'; + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL + print __METHOD__." url=".$url."\n"; + $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because localtest.me is not an external URL + + $url = 'https://169.254.0.1'; + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL + print __METHOD__." url=".$url."\n"; + $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because localtest.me is not an external URL + + $url = 'http://[::1]'; + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL + print __METHOD__." url=".$url."\n"; + $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because localtest.me is not an external URL + + /*$url = 'localtest.me'; + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL + print __METHOD__." url=".$url."\n"; + $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL + */ + return 0; } } From 5a3780e062391022bcfdf1fab1dc2170eeb5ae41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 27 Oct 2020 18:19:31 +0100 Subject: [PATCH 64/79] end of dol_fiche_end --- htdocs/accountancy/admin/card.php | 6 +++--- htdocs/accountancy/admin/categories.php | 2 +- htdocs/accountancy/admin/fiscalyear_card.php | 6 +++--- htdocs/accountancy/bookkeeping/card.php | 6 +++--- .../bookkeeping/thirdparty_lettering_customer.php | 2 +- .../bookkeeping/thirdparty_lettering_supplier.php | 2 +- htdocs/accountancy/customer/card.php | 2 +- htdocs/accountancy/expensereport/card.php | 2 +- htdocs/accountancy/supplier/card.php | 2 +- htdocs/adherents/admin/adherent.php | 2 +- htdocs/adherents/admin/adherent_emails.php | 2 +- htdocs/adherents/admin/adherent_extrafields.php | 2 +- htdocs/adherents/admin/adherent_type_extrafields.php | 2 +- htdocs/adherents/admin/website.php | 2 +- htdocs/adherents/agenda.php | 2 +- htdocs/adherents/card.php | 6 +++--- htdocs/adherents/document.php | 2 +- htdocs/adherents/ldap.php | 2 +- htdocs/adherents/note.php | 2 +- htdocs/adherents/stats/byproperties.php | 2 +- htdocs/adherents/stats/geo.php | 2 +- htdocs/adherents/stats/index.php | 2 +- htdocs/adherents/subscription.php | 4 ++-- htdocs/adherents/subscription/card.php | 4 ++-- htdocs/adherents/subscription/info.php | 2 +- htdocs/adherents/type.php | 6 +++--- htdocs/adherents/type_ldap.php | 2 +- htdocs/adherents/type_translation.php | 4 ++-- htdocs/admin/agenda.php | 2 +- htdocs/admin/agenda_extrafields.php | 2 +- htdocs/admin/agenda_extsites.php | 2 +- htdocs/admin/agenda_other.php | 2 +- htdocs/admin/agenda_reminder.php | 2 +- htdocs/admin/agenda_xcal.php | 2 +- htdocs/admin/bank.php | 2 +- htdocs/admin/bank_extrafields.php | 2 +- htdocs/admin/bom_extrafields.php | 2 +- htdocs/admin/chequereceipts.php | 2 +- .../commande_fournisseur_dispatch_extrafields.php | 2 +- htdocs/admin/contract.php | 2 +- htdocs/admin/dav.php | 2 +- htdocs/admin/defaultvalues.php | 2 +- htdocs/admin/delivery_extrafields.php | 2 +- htdocs/admin/deliverydet_extrafields.php | 2 +- htdocs/admin/ecm_directories_extrafields.php | 2 +- htdocs/admin/ecm_files_extrafields.php | 2 +- htdocs/admin/emailcollector_card.php | 6 +++--- htdocs/admin/events.php | 2 +- htdocs/admin/expedition_extrafields.php | 2 +- htdocs/admin/expeditiondet_extrafields.php | 2 +- htdocs/admin/expensereport.php | 2 +- htdocs/admin/expensereport_extrafields.php | 2 +- htdocs/admin/expensereport_ik.php | 2 +- htdocs/admin/expensereport_rules.php | 2 +- htdocs/admin/export.php | 2 +- htdocs/admin/facture.php | 2 +- htdocs/admin/facture_situation.php | 2 +- htdocs/admin/holiday.php | 4 ++-- htdocs/admin/holiday_extrafields.php | 2 +- htdocs/admin/import.php | 2 +- htdocs/admin/ldap.php | 2 +- htdocs/admin/ldap_contacts.php | 2 +- htdocs/admin/ldap_groups.php | 2 +- htdocs/admin/ldap_members.php | 2 +- htdocs/admin/ldap_members_types.php | 2 +- htdocs/admin/ldap_users.php | 2 +- htdocs/admin/limits.php | 2 +- htdocs/admin/mailman.php | 4 ++-- htdocs/admin/mails.php | 6 +++--- htdocs/admin/mails_emailing.php | 6 +++--- htdocs/admin/mails_senderprofile_list.php | 2 +- htdocs/admin/mails_templates.php | 2 +- htdocs/admin/mails_ticket.php | 6 +++--- htdocs/admin/menus.php | 2 +- htdocs/admin/menus/edit.php | 4 ++-- htdocs/admin/modulehelp.php | 2 +- htdocs/admin/modules.php | 8 ++++---- htdocs/admin/mrp_extrafields.php | 2 +- htdocs/admin/oauth.php | 2 +- htdocs/admin/oauthlogintokens.php | 2 +- htdocs/admin/order_extrafields.php | 2 +- htdocs/admin/orderdet_extrafields.php | 2 +- htdocs/admin/payment.php | 2 +- htdocs/admin/paymentbybanktransfer.php | 2 +- htdocs/admin/perms.php | 2 +- htdocs/admin/prelevement.php | 2 +- htdocs/admin/proxy.php | 2 +- htdocs/admin/receiptprinter.php | 4 ++-- htdocs/admin/reception_extrafields.php | 2 +- htdocs/admin/resource.php | 2 +- htdocs/admin/resource_extrafields.php | 2 +- htdocs/admin/security_file.php | 2 +- htdocs/admin/security_other.php | 2 +- htdocs/admin/socialnetworks.php | 2 +- htdocs/admin/spip.php | 4 ++-- htdocs/admin/supplier_payment.php | 2 +- htdocs/admin/supplierinvoice_extrafields.php | 2 +- htdocs/admin/supplierinvoicedet_extrafields.php | 2 +- htdocs/admin/supplierorder_extrafields.php | 2 +- htdocs/admin/supplierorderdet_extrafields.php | 2 +- htdocs/admin/ticket.php | 2 +- htdocs/admin/ticket_extrafields.php | 2 +- htdocs/admin/ticket_public.php | 2 +- htdocs/admin/translation.php | 2 +- htdocs/admin/user.php | 2 +- htdocs/admin/usergroup.php | 2 +- htdocs/admin/website.php | 2 +- htdocs/admin/website_options.php | 2 +- htdocs/asset/admin/assets_extrafields.php | 2 +- htdocs/asset/admin/assets_type_extrafields.php | 2 +- htdocs/asset/admin/setup.php | 2 +- htdocs/asset/card.php | 6 +++--- htdocs/asset/document.php | 2 +- htdocs/asset/info.php | 2 +- htdocs/asset/note.php | 2 +- htdocs/asset/type.php | 6 +++--- htdocs/blockedlog/admin/blockedlog.php | 2 +- htdocs/blockedlog/admin/blockedlog_list.php | 2 +- htdocs/bom/bom_agenda.php | 2 +- htdocs/bom/bom_card.php | 6 +++--- htdocs/bom/bom_document.php | 2 +- htdocs/bom/bom_note.php | 2 +- htdocs/bookmarks/card.php | 4 ++-- htdocs/categories/admin/categorie_extrafields.php | 2 +- htdocs/categories/card.php | 2 +- htdocs/categories/edit.php | 2 +- htdocs/categories/info.php | 2 +- htdocs/categories/photos.php | 2 +- htdocs/categories/traduction.php | 2 +- htdocs/categories/viewcat.php | 2 +- htdocs/comm/action/card.php | 6 +++--- htdocs/comm/action/document.php | 2 +- htdocs/comm/action/index.php | 2 +- htdocs/comm/action/info.php | 2 +- htdocs/comm/action/list.php | 2 +- htdocs/comm/admin/propal_extrafields.php | 2 +- htdocs/comm/admin/propaldet_extrafields.php | 2 +- htdocs/comm/card.php | 2 +- htdocs/comm/mailing/card.php | 12 ++++++------ htdocs/comm/mailing/cibles.php | 2 +- htdocs/comm/mailing/info.php | 2 +- htdocs/comm/multiprix.php | 2 +- htdocs/comm/propal/card.php | 4 ++-- htdocs/comm/propal/contact.php | 2 +- htdocs/comm/propal/document.php | 2 +- htdocs/comm/propal/info.php | 2 +- htdocs/comm/propal/note.php | 2 +- htdocs/comm/propal/stats/index.php | 2 +- htdocs/comm/remise.php | 4 ++-- htdocs/comm/remx.php | 6 +++--- htdocs/commande/card.php | 4 ++-- htdocs/commande/contact.php | 2 +- htdocs/commande/document.php | 2 +- htdocs/commande/info.php | 2 +- htdocs/commande/note.php | 2 +- htdocs/commande/stats/index.php | 2 +- htdocs/compta/accounting-files.php | 2 +- htdocs/compta/bank/account_statement_document.php | 2 +- htdocs/compta/bank/annuel.php | 2 +- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/bank/card.php | 6 +++--- htdocs/compta/bank/document.php | 2 +- htdocs/compta/bank/graph.php | 2 +- htdocs/compta/bank/line.php | 2 +- htdocs/compta/bank/releve.php | 2 +- htdocs/compta/bank/treso.php | 2 +- htdocs/compta/bank/various_payment/card.php | 4 ++-- htdocs/compta/bank/various_payment/document.php | 2 +- htdocs/compta/cashcontrol/cashcontrol_card.php | 2 +- htdocs/compta/deplacement/stats/index.php | 2 +- .../facture/admin/facture_cust_extrafields.php | 2 +- .../facture/admin/facture_rec_cust_extrafields.php | 2 +- .../facture/admin/facturedet_cust_extrafields.php | 2 +- .../admin/facturedet_rec_cust_extrafields.php | 2 +- htdocs/compta/facture/card-rec.php | 6 +++--- htdocs/compta/facture/card.php | 4 ++-- htdocs/compta/facture/contact.php | 2 +- htdocs/compta/facture/document.php | 2 +- htdocs/compta/facture/info.php | 2 +- htdocs/compta/facture/note.php | 2 +- htdocs/compta/facture/prelevement.php | 2 +- htdocs/compta/facture/stats/index.php | 2 +- htdocs/compta/localtax/card.php | 4 ++-- htdocs/compta/paiement.php | 2 +- htdocs/compta/paiement/card.php | 2 +- htdocs/compta/paiement/cheque/card.php | 4 ++-- htdocs/compta/paiement/info.php | 2 +- htdocs/compta/paiement_charge.php | 2 +- htdocs/compta/payment_sc/card.php | 2 +- htdocs/compta/prelevement/card.php | 2 +- htdocs/compta/prelevement/factures.php | 2 +- htdocs/compta/prelevement/fiche-rejet.php | 2 +- htdocs/compta/prelevement/fiche-stat.php | 2 +- htdocs/compta/prelevement/line.php | 2 +- htdocs/compta/recap-compta.php | 2 +- htdocs/compta/sociales/card.php | 4 ++-- htdocs/compta/sociales/document.php | 2 +- htdocs/compta/tva/card.php | 4 ++-- htdocs/compta/tva/document.php | 2 +- htdocs/compta/tva/info.php | 2 +- htdocs/contact/agenda.php | 2 +- htdocs/contact/card.php | 6 +++--- htdocs/contact/consumption.php | 2 +- htdocs/contact/document.php | 2 +- htdocs/contact/info.php | 2 +- htdocs/contact/ldap.php | 2 +- htdocs/contact/note.php | 2 +- htdocs/contact/perso.php | 4 ++-- htdocs/contrat/admin/contract_extrafields.php | 2 +- htdocs/contrat/admin/contractdet_extrafields.php | 2 +- htdocs/contrat/agenda.php | 2 +- htdocs/contrat/card.php | 4 ++-- htdocs/contrat/contact.php | 2 +- htdocs/contrat/document.php | 2 +- htdocs/contrat/note.php | 2 +- htdocs/core/class/html.formticket.class.php | 2 +- htdocs/core/customreports.php | 2 +- htdocs/core/lib/accounting.lib.php | 2 +- htdocs/core/lib/functions.lib.php | 4 ++-- htdocs/core/lib/report.lib.php | 2 +- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 +- htdocs/core/tpl/admin_extrafields_edit.tpl.php | 2 +- htdocs/core/tpl/card_presend.tpl.php | 2 +- htdocs/core/tpl/massactions_pre.tpl.php | 2 +- htdocs/cron/admin/cron.php | 2 +- htdocs/cron/card.php | 4 ++-- htdocs/datapolicy/admin/setup.php | 2 +- htdocs/datapolicy/admin/setupmail.php | 2 +- htdocs/delivery/card.php | 2 +- htdocs/don/admin/donation_extrafields.php | 2 +- htdocs/don/card.php | 6 +++--- htdocs/don/document.php | 2 +- htdocs/don/info.php | 2 +- htdocs/don/note.php | 2 +- htdocs/don/payment/card.php | 2 +- htdocs/don/payment/payment.php | 2 +- htdocs/don/stats/index.php | 2 +- htdocs/ecm/dir_add_card.php | 2 +- htdocs/ecm/dir_card.php | 2 +- htdocs/ecm/file_card.php | 2 +- htdocs/ecm/index.php | 2 +- htdocs/ecm/index_auto.php | 2 +- htdocs/expedition/card.php | 4 ++-- htdocs/expedition/contact.php | 2 +- htdocs/expedition/document.php | 2 +- htdocs/expedition/note.php | 2 +- htdocs/expedition/stats/index.php | 2 +- htdocs/expensereport/card.php | 6 +++--- htdocs/expensereport/document.php | 2 +- htdocs/expensereport/info.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/expensereport/note.php | 2 +- htdocs/expensereport/payment/card.php | 2 +- htdocs/expensereport/payment/info.php | 2 +- htdocs/expensereport/payment/payment.php | 4 ++-- htdocs/expensereport/stats/index.php | 2 +- htdocs/exports/export.php | 2 +- htdocs/fichinter/admin/fichinter_extrafields.php | 2 +- htdocs/fichinter/admin/fichinterdet_extrafields.php | 2 +- htdocs/fichinter/card-rec.php | 4 ++-- htdocs/fichinter/card.php | 6 +++--- htdocs/fichinter/contact.php | 2 +- htdocs/fichinter/document.php | 2 +- htdocs/fichinter/info.php | 2 +- htdocs/fichinter/note.php | 2 +- htdocs/fichinter/stats/index.php | 2 +- htdocs/fourn/card.php | 2 +- htdocs/fourn/commande/card.php | 4 ++-- htdocs/fourn/commande/contact.php | 2 +- htdocs/fourn/commande/dispatch.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/fourn/commande/info.php | 2 +- htdocs/fourn/commande/note.php | 2 +- htdocs/fourn/facture/card.php | 4 ++-- htdocs/fourn/facture/contact.php | 2 +- htdocs/fourn/facture/document.php | 2 +- htdocs/fourn/facture/note.php | 2 +- htdocs/fourn/facture/paiement.php | 2 +- htdocs/fourn/paiement/card.php | 2 +- htdocs/fourn/paiement/info.php | 2 +- htdocs/fourn/recap-fourn.php | 2 +- htdocs/holiday/card.php | 6 +++--- htdocs/holiday/document.php | 2 +- htdocs/holiday/list.php | 2 +- htdocs/hrm/admin/admin_establishment.php | 2 +- htdocs/hrm/admin/admin_hrm.php | 2 +- htdocs/hrm/establishment/card.php | 6 +++--- htdocs/hrm/establishment/info.php | 2 +- htdocs/imports/import.php | 12 ++++++------ htdocs/intracommreport/admin/intracommreport.php | 2 +- htdocs/intracommreport/card.php | 4 ++-- htdocs/loan/card.php | 4 ++-- htdocs/loan/document.php | 2 +- htdocs/loan/note.php | 2 +- htdocs/loan/payment/payment.php | 2 +- htdocs/margin/admin/margin.php | 2 +- htdocs/margin/agentMargins.php | 2 +- htdocs/margin/checkMargins.php | 2 +- htdocs/margin/customerMargins.php | 2 +- htdocs/margin/productMargins.php | 2 +- htdocs/margin/tabs/productMargins.php | 2 +- htdocs/margin/tabs/thirdpartyMargins.php | 2 +- htdocs/modulebuilder/admin/setup.php | 2 +- htdocs/modulebuilder/index.php | 10 +++++----- htdocs/modulebuilder/template/admin/about.php | 2 +- .../template/admin/myobject_extrafields.php | 2 +- htdocs/modulebuilder/template/admin/setup.php | 2 +- htdocs/modulebuilder/template/myobject_agenda.php | 2 +- htdocs/modulebuilder/template/myobject_card.php | 6 +++--- htdocs/modulebuilder/template/myobject_document.php | 2 +- htdocs/modulebuilder/template/myobject_note.php | 2 +- htdocs/mrp/mo_agenda.php | 2 +- htdocs/mrp/mo_card.php | 6 +++--- htdocs/mrp/mo_document.php | 2 +- htdocs/mrp/mo_movements.php | 2 +- htdocs/mrp/mo_note.php | 2 +- htdocs/mrp/mo_production.php | 2 +- htdocs/opensurvey/card.php | 2 +- htdocs/opensurvey/results.php | 2 +- htdocs/opensurvey/wizard/create_survey.php | 2 +- htdocs/paybox/admin/paybox.php | 2 +- htdocs/paypal/admin/paypal.php | 2 +- htdocs/printing/admin/printing.php | 8 ++++---- htdocs/product/admin/price_rules.php | 2 +- htdocs/product/admin/product_extrafields.php | 2 +- htdocs/product/admin/product_lot_extrafields.php | 2 +- .../product/admin/product_supplier_extrafields.php | 2 +- htdocs/product/admin/stock_extrafields.php | 2 +- htdocs/product/agenda.php | 2 +- htdocs/product/card.php | 8 ++++---- htdocs/product/composition/card.php | 2 +- htdocs/product/document.php | 2 +- htdocs/product/dynamic_price/editor.php | 2 +- htdocs/product/fournisseurs.php | 4 ++-- htdocs/product/inventory/card.php | 6 +++--- htdocs/product/inventory/inventory.php | 2 +- htdocs/product/note.php | 2 +- htdocs/product/popuprop.php | 2 +- htdocs/product/price.php | 12 ++++++------ htdocs/product/stats/bom.php | 2 +- htdocs/product/stats/card.php | 4 ++-- htdocs/product/stats/commande.php | 2 +- htdocs/product/stats/commande_fournisseur.php | 2 +- htdocs/product/stats/contrat.php | 2 +- htdocs/product/stats/facture.php | 2 +- htdocs/product/stats/facture_fournisseur.php | 2 +- htdocs/product/stats/mo.php | 2 +- htdocs/product/stats/propal.php | 2 +- htdocs/product/stats/supplier_proposal.php | 2 +- htdocs/product/stock/card.php | 6 +++--- htdocs/product/stock/movement_card.php | 2 +- htdocs/product/stock/movement_list.php | 2 +- htdocs/product/stock/product.php | 2 +- htdocs/product/stock/productlot_card.php | 4 ++-- htdocs/product/stock/productlot_document.php | 2 +- htdocs/product/stock/replenish.php | 2 +- htdocs/product/stock/replenishorders.php | 2 +- htdocs/product/stock/stockatdate.php | 2 +- htdocs/product/stock/tpl/stockcorrection.tpl.php | 2 +- htdocs/product/stock/tpl/stocktransfer.tpl.php | 2 +- htdocs/product/traduction.php | 4 ++-- htdocs/projet/activity/perday.php | 2 +- htdocs/projet/activity/permonth.php | 2 +- htdocs/projet/activity/perweek.php | 2 +- htdocs/projet/admin/project_extrafields.php | 2 +- htdocs/projet/admin/project_task_extrafields.php | 2 +- htdocs/projet/card.php | 4 ++-- htdocs/projet/comment.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/info.php | 2 +- htdocs/projet/note.php | 2 +- htdocs/projet/tasks.php | 4 ++-- htdocs/projet/tasks/comment.php | 4 ++-- htdocs/projet/tasks/contact.php | 4 ++-- htdocs/projet/tasks/document.php | 4 ++-- htdocs/projet/tasks/note.php | 4 ++-- htdocs/projet/tasks/task.php | 6 +++--- htdocs/projet/tasks/time.php | 4 ++-- htdocs/public/members/new.php | 2 +- htdocs/reception/card.php | 6 +++--- htdocs/reception/contact.php | 2 +- htdocs/reception/note.php | 2 +- htdocs/reception/stats/index.php | 2 +- htdocs/recruitment/admin/candidature_extrafields.php | 2 +- htdocs/recruitment/admin/jobposition_extrafields.php | 2 +- htdocs/recruitment/admin/public_interface.php | 2 +- htdocs/recruitment/admin/setup.php | 2 +- htdocs/recruitment/admin/setup_candidatures.php | 2 +- htdocs/recruitment/recruitmentcandidature_agenda.php | 2 +- htdocs/recruitment/recruitmentcandidature_card.php | 6 +++--- .../recruitment/recruitmentcandidature_document.php | 2 +- htdocs/recruitment/recruitmentcandidature_note.php | 2 +- htdocs/recruitment/recruitmentjobposition_agenda.php | 2 +- .../recruitmentjobposition_candidature.php | 6 +++--- htdocs/recruitment/recruitmentjobposition_card.php | 6 +++--- .../recruitment/recruitmentjobposition_document.php | 2 +- htdocs/recruitment/recruitmentjobposition_note.php | 2 +- htdocs/resource/agenda.php | 2 +- htdocs/resource/card.php | 4 ++-- htdocs/resource/contact.php | 2 +- htdocs/resource/document.php | 2 +- htdocs/resource/element_resource.php | 8 ++++---- htdocs/resource/note.php | 2 +- htdocs/salaries/admin/salaries.php | 2 +- htdocs/salaries/admin/salaries_extrafields.php | 2 +- htdocs/salaries/card.php | 4 ++-- htdocs/salaries/document.php | 2 +- htdocs/salaries/info.php | 2 +- htdocs/salaries/stats/index.php | 2 +- htdocs/societe/admin/contact_extrafields.php | 2 +- htdocs/societe/admin/societe.php | 2 +- htdocs/societe/admin/societe_extrafields.php | 2 +- htdocs/societe/agenda.php | 2 +- htdocs/societe/canvas/company/tpl/card_view.tpl.php | 2 +- .../societe/canvas/individual/tpl/card_view.tpl.php | 2 +- htdocs/societe/card.php | 6 +++--- htdocs/societe/consumption.php | 2 +- htdocs/societe/contact.php | 2 +- htdocs/societe/document.php | 2 +- htdocs/societe/note.php | 2 +- htdocs/societe/notify/card.php | 2 +- htdocs/societe/paymentmodes.php | 10 +++++----- htdocs/societe/price.php | 2 +- htdocs/societe/project.php | 2 +- htdocs/societe/website.php | 2 +- htdocs/stripe/admin/stripe.php | 2 +- .../admin/supplier_proposal_extrafields.php | 2 +- .../admin/supplier_proposaldet_extrafields.php | 2 +- htdocs/supplier_proposal/card.php | 4 ++-- htdocs/supplier_proposal/contact.php | 2 +- htdocs/supplier_proposal/document.php | 2 +- htdocs/supplier_proposal/info.php | 2 +- htdocs/supplier_proposal/note.php | 2 +- htdocs/ticket/agenda.php | 4 ++-- htdocs/ticket/card.php | 6 +++--- htdocs/ticket/contact.php | 4 ++-- htdocs/ticket/document.php | 4 ++-- htdocs/ticket/list.php | 4 ++-- htdocs/ticket/messaging.php | 4 ++-- htdocs/ticket/stats/index.php | 2 +- htdocs/user/admin/group_extrafields.php | 2 +- htdocs/user/admin/user_extrafields.php | 2 +- htdocs/user/agenda_extsites.php | 2 +- htdocs/user/bank.php | 4 ++-- htdocs/user/card.php | 6 +++--- htdocs/user/clicktodial.php | 2 +- htdocs/user/document.php | 2 +- htdocs/user/group/card.php | 6 +++--- htdocs/user/group/ldap.php | 2 +- htdocs/user/group/perms.php | 2 +- htdocs/user/info.php | 2 +- htdocs/user/ldap.php | 2 +- htdocs/user/note.php | 2 +- htdocs/user/notify/card.php | 2 +- htdocs/user/param_ihm.php | 4 ++-- htdocs/user/perms.php | 2 +- htdocs/variants/card.php | 2 +- htdocs/variants/combinations.php | 6 +++--- htdocs/variants/create.php | 2 +- htdocs/variants/create_val.php | 4 ++-- htdocs/variants/generator.php | 2 +- htdocs/website/index.php | 8 ++++---- htdocs/website/websiteaccount_card.php | 6 +++--- htdocs/zapier/admin/about.php | 2 +- htdocs/zapier/admin/setup.php | 2 +- htdocs/zapier/hook_agenda.php | 2 +- htdocs/zapier/hook_card.php | 6 +++--- htdocs/zapier/hook_document.php | 2 +- htdocs/zapier/hook_note.php | 2 +- 472 files changed, 637 insertions(+), 637 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index fdbb86d1a62..d015d8f07b5 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -252,7 +252,7 @@ if ($action == 'create') { print '
    '; + $boxstat .= ''; $boxstat .= '
    '.$langs->trans("DolibarrStateBoard").'
    '; $boxstat .= '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -314,7 +314,7 @@ if ($action == 'create') { print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -364,7 +364,7 @@ if ($action == 'create') { print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); /* * Actions buttons diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index db17be68e1e..eefe62a47a4 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -146,7 +146,7 @@ if (!empty($cat_id)) print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print ''; diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 97b92bdd172..aa10c0101c1 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -187,7 +187,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -248,7 +248,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } else { /* * Confirm delete @@ -296,7 +296,7 @@ if ($action == 'create') print ""; - dol_fiche_end(); + print dol_get_fiche_end(); if (!empty($user->rights->accounting->fiscalyear->write)) { diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 6a9fdcbffff..ef9ebe3f9b9 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -386,7 +386,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -573,7 +573,7 @@ if ($action == 'create') print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; @@ -719,7 +719,7 @@ if ($action == 'create') } } -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index 9e21a712e7e..8e6387d4608 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -141,7 +141,7 @@ $linkback = 'socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); -dol_fiche_end(); +print dol_get_fiche_end(); $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 4343946a85e..1a37bb1019b 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -137,7 +137,7 @@ if (!empty($id)) { print ''; print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php index 153717d05e4..67c790a9c36 100644 --- a/htdocs/accountancy/expensereport/card.php +++ b/htdocs/accountancy/expensereport/card.php @@ -146,7 +146,7 @@ if (!empty($id)) { print ''; print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index bee34f291f5..d6b289a76c8 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -141,7 +141,7 @@ if (!empty($id)) { print ''; print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 07d4454feae..17d5f51d6eb 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -246,7 +246,7 @@ $helptext .= '__YEAR__, __MONTH__, __DAY__'; form_constantes($constantes, 0, $helptext); -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php index e5b612e3d86..4374d281895 100644 --- a/htdocs/adherents/admin/adherent_emails.php +++ b/htdocs/adherents/admin/adherent_emails.php @@ -136,7 +136,7 @@ form_constantes($constantes, 0, $helptext); //print '
    '; //print ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php index 689e7c11be3..ae4f1989114 100644 --- a/htdocs/adherents/admin/adherent_extrafields.php +++ b/htdocs/adherents/admin/adherent_extrafields.php @@ -74,7 +74,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("Members"), -1, 'use require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php index 9fef3ad5c21..92b5ed990e3 100644 --- a/htdocs/adherents/admin/adherent_type_extrafields.php +++ b/htdocs/adherents/admin/adherent_type_extrafields.php @@ -77,7 +77,7 @@ print dol_get_fiche_head($head, 'attributes_type', $langs->trans("Members"), -1, require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index beaf05ce3fa..330568c20bf 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -208,7 +208,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { } -dol_fiche_end(); +print dol_get_fiche_end(); print ''; diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index c0b5998f035..3af330f0066 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -133,7 +133,7 @@ if ($object->id > 0) { print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); //print '
    '; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 128b915ef0f..4bffb8bc0db 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -969,7 +969,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -1229,7 +1229,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -1608,7 +1608,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print "
    \n"; print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); /* diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 0f6e6250796..cb6384cfb63 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -145,7 +145,7 @@ if ($id > 0) { print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'member'; $permission = $user->rights->adherent->creer; diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index 80fdfc99479..14d886b6cc4 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -128,7 +128,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); /* * Barre d'actions diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 4026dded2a2..1ce2da4751b 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -112,7 +112,7 @@ if ($id) { include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - dol_fiche_end(); + print dol_get_fiche_end(); } // End of page diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index 0a5bee034c2..cd0f90d27c6 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -173,7 +173,7 @@ foreach ($data as $val) { print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 44da065d888..7d05678263a 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -299,7 +299,7 @@ if ($mode) { } -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index a3c77e1c64a..472a93cfce7 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -219,7 +219,7 @@ print '
    '; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 9c9589eaec2..915a3e77176 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -555,7 +555,7 @@ if ($rowid > 0) { print "
    \n"; print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); print ''; @@ -1020,7 +1020,7 @@ if ($rowid > 0) { print ''; print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 7dd6f3f0e66..6479b5c479f 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -232,7 +232,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') { print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -335,7 +335,7 @@ if ($rowid && $action != 'edit') { print ''; - dol_fiche_end(); + print dol_get_fiche_end(); /* * Barre d'actions diff --git a/htdocs/adherents/subscription/info.php b/htdocs/adherents/subscription/info.php index cbc659df766..a7a4a897505 100644 --- a/htdocs/adherents/subscription/info.php +++ b/htdocs/adherents/subscription/info.php @@ -72,7 +72,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 3d9dc7ace60..d1573f316f9 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -358,7 +358,7 @@ if ($action == 'create') { print ''; print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -433,7 +433,7 @@ if ($rowid > 0) { print ''; print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); /* * Buttons @@ -759,7 +759,7 @@ if ($rowid > 0) { print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/adherents/type_ldap.php b/htdocs/adherents/type_ldap.php index f743de5421a..d8deebba9ba 100644 --- a/htdocs/adherents/type_ldap.php +++ b/htdocs/adherents/type_ldap.php @@ -114,7 +114,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); /* * Action bar diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 971d8411640..6cf349270e8 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -166,7 +166,7 @@ $linkback = '
    '.$langs->tra dol_banner_tab($object, 'rowid', $linkback); -dol_fiche_end(); +print dol_get_fiche_end(); @@ -272,7 +272,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) { print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index fa459ceb926..0cd9dd52648 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -197,7 +197,7 @@ if (!empty($triggers)) print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php index 476bad8ce75..0c46e84dff6 100644 --- a/htdocs/admin/agenda_extrafields.php +++ b/htdocs/admin/agenda_extrafields.php @@ -78,7 +78,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("Agenda"), -1, 'acti require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index d29ba6c4830..c743ed06e55 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -224,7 +224,7 @@ while ($i <= $MAXAGENDA) print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index e6f0885a6cb..a31c4ed1dbe 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -376,7 +376,7 @@ print ''."\n"; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 0f8b64c48b1..51a9d4f327b 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -229,7 +229,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL == 2) print ''; -dol_fiche_end(); +print dol_get_fiche_end(); //print '
    '; diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 83fc2155236..fd80a545aa5 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -135,7 +135,7 @@ print ""; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; print "trans("Save")."\">"; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 71891c9c08d..c8157a40d81 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -495,7 +495,7 @@ if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) { print "\n"; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/admin/bank_extrafields.php b/htdocs/admin/bank_extrafields.php index a554aa4a3cf..7ad9e1d0f23 100644 --- a/htdocs/admin/bank_extrafields.php +++ b/htdocs/admin/bank_extrafields.php @@ -75,7 +75,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("BankSetupModule"), require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/bom_extrafields.php b/htdocs/admin/bom_extrafields.php index a1dd1cde985..8ae26587ebd 100644 --- a/htdocs/admin/bom_extrafields.php +++ b/htdocs/admin/bom_extrafields.php @@ -74,7 +74,7 @@ print dol_get_fiche_head($head, 'bom_extrafields', $langs->trans("ExtraFields"), require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index c5cf9b2eee9..4fee30d274e 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -266,7 +266,7 @@ print "
    "; print ''."\n"; -dol_fiche_end(); +print dol_get_fiche_end(); print ''; diff --git a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php b/htdocs/admin/commande_fournisseur_dispatch_extrafields.php index 3642205e158..98a98a7ec2c 100644 --- a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php +++ b/htdocs/admin/commande_fournisseur_dispatch_extrafields.php @@ -83,7 +83,7 @@ print dol_get_fiche_head($head, 'attributeslines_reception', $langs->trans("Rece require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 6ba10068c4c..b7065a230bd 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -488,7 +488,7 @@ print '
    '; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index 2dd5af492aa..2e8d29500ed 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -148,7 +148,7 @@ if ($action == 'edit') } -dol_fiche_end(); +print dol_get_fiche_end(); /*print '
    '; print "trans("Save")."\">"; diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 3d2bc3121d3..e3006635b39 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -401,7 +401,7 @@ if ($result) print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); print "\n"; diff --git a/htdocs/admin/delivery_extrafields.php b/htdocs/admin/delivery_extrafields.php index 38628fa171b..c0ed636abac 100644 --- a/htdocs/admin/delivery_extrafields.php +++ b/htdocs/admin/delivery_extrafields.php @@ -80,7 +80,7 @@ print dol_get_fiche_head($head, 'attributes_receivings', $langs->trans("Receivin require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/deliverydet_extrafields.php b/htdocs/admin/deliverydet_extrafields.php index 50dea86c2a5..50032e8f793 100644 --- a/htdocs/admin/deliverydet_extrafields.php +++ b/htdocs/admin/deliverydet_extrafields.php @@ -81,7 +81,7 @@ print dol_get_fiche_head($head, 'attributeslines_receivings', $langs->trans("Rec require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/ecm_directories_extrafields.php b/htdocs/admin/ecm_directories_extrafields.php index da1fcdbfae5..3179c01960c 100644 --- a/htdocs/admin/ecm_directories_extrafields.php +++ b/htdocs/admin/ecm_directories_extrafields.php @@ -84,7 +84,7 @@ print dol_get_fiche_head($head, 'attributes_ecm_directories', $langs->trans("ECM require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/ecm_files_extrafields.php b/htdocs/admin/ecm_files_extrafields.php index 20c379532b8..9fc297fd37a 100644 --- a/htdocs/admin/ecm_files_extrafields.php +++ b/htdocs/admin/ecm_files_extrafields.php @@ -84,7 +84,7 @@ print dol_get_fiche_head($head, 'attributes_ecm_files', $langs->trans("ECM"), -1 require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 71b25dde669..7a48883fd55 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -261,7 +261,7 @@ if ($action == 'create') { print ''."\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -295,7 +295,7 @@ if (($id || $ref) && $action == 'edit') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print '   '; @@ -655,7 +655,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '

    '; - dol_fiche_end(); + print dol_get_fiche_end(); // Buttons for actions if ($action != 'presend' && $action != 'editline') { diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 37e19acc13b..b75606f739c 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -125,7 +125,7 @@ foreach ($eventstolog as $key => $arr) } print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; print "trans("Save")."\">"; diff --git a/htdocs/admin/expedition_extrafields.php b/htdocs/admin/expedition_extrafields.php index bd46148175a..901caf58c00 100644 --- a/htdocs/admin/expedition_extrafields.php +++ b/htdocs/admin/expedition_extrafields.php @@ -80,7 +80,7 @@ print dol_get_fiche_head($head, 'attributes_shipment', $langs->trans("Sendings") require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/expeditiondet_extrafields.php b/htdocs/admin/expeditiondet_extrafields.php index 669b4c56a64..a61581ce18a 100644 --- a/htdocs/admin/expeditiondet_extrafields.php +++ b/htdocs/admin/expeditiondet_extrafields.php @@ -81,7 +81,7 @@ print dol_get_fiche_head($head, 'attributeslines_shipment', $langs->trans("Sendi require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 2466fbe7cab..fb2782d3aa7 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -480,7 +480,7 @@ print '
    '; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/expensereport_extrafields.php b/htdocs/admin/expensereport_extrafields.php index 51b82e64d4f..ac88ec78912 100644 --- a/htdocs/admin/expensereport_extrafields.php +++ b/htdocs/admin/expensereport_extrafields.php @@ -74,7 +74,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("ExpenseReports"), - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/expensereport_ik.php b/htdocs/admin/expensereport_ik.php index f798aaf2c60..2e00d0d8ff9 100644 --- a/htdocs/admin/expensereport_ik.php +++ b/htdocs/admin/expensereport_ik.php @@ -180,7 +180,7 @@ foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) echo ''; echo ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 52f690801cc..9a4bf2804b2 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -338,7 +338,7 @@ echo ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php index bf1a514df90..5dd541b34b5 100644 --- a/htdocs/admin/export.php +++ b/htdocs/admin/export.php @@ -103,7 +103,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index ff3953822f4..35dd1002b12 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -802,7 +802,7 @@ print ''; print "
    \n"; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index e4f87bbd4be..7ef9e216ad9 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -140,7 +140,7 @@ _updateBtn(); print ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 87319d7b5dd..44b7034064b 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -282,7 +282,7 @@ print '
    '; if ($conf->global->MAIN_FEATURES_LEVEL < 2) { - dol_fiche_end(); + print dol_get_fiche_end(); // End of page llxFooter(); $db->close(); @@ -501,7 +501,7 @@ print ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/holiday_extrafields.php b/htdocs/admin/holiday_extrafields.php index 4c7ef209e21..1205b592e5f 100644 --- a/htdocs/admin/holiday_extrafields.php +++ b/htdocs/admin/holiday_extrafields.php @@ -74,7 +74,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("Holidays"), -1, 'ho require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/import.php b/htdocs/admin/import.php index 598bab92c10..e70d8eadbba 100644 --- a/htdocs/admin/import.php +++ b/htdocs/admin/import.php @@ -93,7 +93,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 8bab5c4e968..b8c207644c6 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -251,7 +251,7 @@ print ''.$langs->trans('Password').' (ex: secret)'; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 8923bb26d20..b29fa00e49e 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -246,7 +246,7 @@ print ''; print info_admin($langs->trans("LDAPDescValues")); -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 9a3aa4c706a..9de9c195f8f 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -180,7 +180,7 @@ print ''; print info_admin($langs->trans("LDAPDescValues")); -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index 3bcd6c27dbc..214a4f2cb9b 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -366,7 +366,7 @@ print ''; print info_admin($langs->trans("LDAPDescValues")); -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/ldap_members_types.php b/htdocs/admin/ldap_members_types.php index 3641947d6d1..489e6047f9b 100644 --- a/htdocs/admin/ldap_members_types.php +++ b/htdocs/admin/ldap_members_types.php @@ -162,7 +162,7 @@ print ''; print info_admin($langs->trans("LDAPDescValues")); -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index a46c98645e1..efb34cca413 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -336,7 +336,7 @@ print ''; print info_admin($langs->trans("LDAPDescValues")); -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 89d0c58e4df..82e28f3cf73 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -201,7 +201,7 @@ if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY { if (!empty($aCurrencies) && count($aCurrencies) > 1) { - dol_fiche_end(); + print dol_get_fiche_end(); } } diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index 977d27c0866..58e904f02ce 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -198,7 +198,7 @@ if (!empty($conf->global->ADHERENT_USE_MAILMAN)) print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
    '; print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL%
    '; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; @@ -212,7 +212,7 @@ if (!empty($conf->global->ADHERENT_USE_MAILMAN)) $link .= '
    '; print load_fiche_titre($langs->trans('MailmanTitle'), $link, ''); - dol_fiche_end(); + print dol_get_fiche_end(); } diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index c3792812210..cc81c78255d 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -506,7 +506,7 @@ if ($action == 'edit') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -737,7 +737,7 @@ if ($action == 'edit') print ''; } - dol_fiche_end(); + print dol_get_fiche_end(); // Actions button @@ -892,7 +892,7 @@ if ($action == 'edit') print $formmail->get_form('addfile', 'removefile'); - dol_fiche_end(); + print dol_get_fiche_end(); // References print ''.$langs->trans("EMailsWillHaveMessageID").': '; diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index ebc3201dcdf..a464c0fca8e 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -384,7 +384,7 @@ if ($action == 'edit') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -475,7 +475,7 @@ if ($action == 'edit') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) @@ -599,7 +599,7 @@ if ($action == 'edit') print $formmail->get_form('addfile', 'removefile'); - dol_fiche_end(); + print dol_get_fiche_end(); } } diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 6f80706276e..4556ec80bff 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -645,7 +645,7 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n print $formfile->showdocuments('massfilesarea_emailsenderprofile', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 4dfdc413af5..8cbd9675160 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -953,7 +953,7 @@ print '
    '; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/mails_ticket.php b/htdocs/admin/mails_ticket.php index 0be41dce273..e0a42ee3a2d 100644 --- a/htdocs/admin/mails_ticket.php +++ b/htdocs/admin/mails_ticket.php @@ -361,7 +361,7 @@ if ($action == 'edit') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -441,7 +441,7 @@ if ($action == 'edit') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); if ($conf->global->MAIN_MAIL_SENDMODE_TICKET == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) @@ -565,7 +565,7 @@ if ($action == 'edit') print $formmail->get_form('addfile', 'removefile'); - dol_fiche_end(); + print dol_get_fiche_end(); } } diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index a62385bf2ca..9bdc497c776 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -206,7 +206,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index f56bf284fc9..70d2f4bcda6 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -398,7 +398,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -507,7 +507,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); // Bouton print '
    '; diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 065146489a7..9aec5ef0c29 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -554,7 +554,7 @@ if ($mode == 'changelog') print $text; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index db4a2d85d8e..e281cb21155 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -883,7 +883,7 @@ if ($mode == 'common' || $mode == 'commonkanban') } } - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; @@ -916,7 +916,7 @@ if ($mode == 'marketplace') print "\n"; print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; @@ -1136,7 +1136,7 @@ if ($mode == 'deploy') } } - dol_fiche_end(); + print dol_get_fiche_end(); } if ($mode == 'develop') @@ -1170,7 +1170,7 @@ if ($mode == 'develop') print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); } // End of page diff --git a/htdocs/admin/mrp_extrafields.php b/htdocs/admin/mrp_extrafields.php index 4078043c001..e81c7f1cf75 100644 --- a/htdocs/admin/mrp_extrafields.php +++ b/htdocs/admin/mrp_extrafields.php @@ -74,7 +74,7 @@ print dol_get_fiche_head($head, 'mrp_extrafields', $langs->trans("ExtraFields"), require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index cfd93b195b3..af352558a71 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -141,7 +141,7 @@ foreach ($list as $key) print ''."\n"; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index f0fdeb28760..99510f4b7c8 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -402,7 +402,7 @@ if ($mode == 'userconf' && $user->admin) print ''; } -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index 8435e801902..81d0312ab69 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -77,7 +77,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("Orders"), -1, 'orde require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index 3d228baeb57..734d617f564 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -78,7 +78,7 @@ print dol_get_fiche_head($head, 'attributeslines', $langs->trans("Orders"), -1, require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 35e738754bf..8edf851f49e 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -262,7 +262,7 @@ print "\n"; print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; print '
    '; diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index 718e64e6446..6a419d39e53 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -361,7 +361,7 @@ foreach ($dirmodels as $reldir) */ -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 41b0cc75ab1..3677daa38a5 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -260,7 +260,7 @@ if ($result) print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 50d01924364..c16b5c30c47 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -368,7 +368,7 @@ foreach ($dirmodels as $reldir) */ -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index a9205cb9e5f..71bd50ef5ce 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -197,7 +197,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 0e3008c57cd..3f66d04ca01 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -354,7 +354,7 @@ if ($mode == 'config' && $user->admin) { print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print ''; @@ -460,7 +460,7 @@ if ($mode == 'template' && $user->admin) { } print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/reception_extrafields.php b/htdocs/admin/reception_extrafields.php index 27f33be8157..605b8cf465e 100644 --- a/htdocs/admin/reception_extrafields.php +++ b/htdocs/admin/reception_extrafields.php @@ -83,7 +83,7 @@ print dol_get_fiche_head($head, 'attributes_reception', $langs->trans("Reception require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php index 286e6d15565..ecf72df9b37 100644 --- a/htdocs/admin/resource.php +++ b/htdocs/admin/resource.php @@ -142,7 +142,7 @@ print ''; //RESOURCE_HIDE_ADD_CONTACT_USER //RESOURCE_HIDE_ADD_CONTACT_THIPARTY -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/resource_extrafields.php b/htdocs/admin/resource_extrafields.php index d0e2a3e5b0a..d7287b53019 100644 --- a/htdocs/admin/resource_extrafields.php +++ b/htdocs/admin/resource_extrafields.php @@ -77,7 +77,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("ResourceSingular"), require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index fba88d768c4..fc2c4e141d5 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -177,7 +177,7 @@ print ''; print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index ff0ca0006af..2e4f1f05229 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -184,7 +184,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/admin/socialnetworks.php b/htdocs/admin/socialnetworks.php index 3d959b04b83..faf8897126f 100644 --- a/htdocs/admin/socialnetworks.php +++ b/htdocs/admin/socialnetworks.php @@ -108,7 +108,7 @@ foreach ($arrayofsocialnetworks as $snkey => $snlabel) { } -dol_fiche_end(); +print dol_get_fiche_end(); print ''; diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index 772d4e32707..fe98d4bfe9e 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -146,7 +146,7 @@ if (!empty($conf->global->ADHERENT_USE_SPIP)) form_constantes($constantes, 2); - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; @@ -160,7 +160,7 @@ if (!empty($conf->global->ADHERENT_USE_SPIP)) $link .= ''; print load_fiche_titre($langs->trans('SPIPTitle'), $link, ''); - dol_fiche_end(); + print dol_get_fiche_end(); } // End of page diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index bda90d0ac74..c0c04eb9430 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -454,7 +454,7 @@ print "\n"; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; print '
    '; diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index 10de9a09735..d84779c7477 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -78,7 +78,7 @@ print dol_get_fiche_head($head, 'supplierinvoice', $langs->trans("Suppliers"), - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/supplierinvoicedet_extrafields.php b/htdocs/admin/supplierinvoicedet_extrafields.php index 576e3f7b3b3..ac40ef66e09 100644 --- a/htdocs/admin/supplierinvoicedet_extrafields.php +++ b/htdocs/admin/supplierinvoicedet_extrafields.php @@ -80,7 +80,7 @@ print dol_get_fiche_head($head, 'supplierinvoicedet', $langs->trans("Suppliers") require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php index a35820806fb..c46eebfb037 100644 --- a/htdocs/admin/supplierorder_extrafields.php +++ b/htdocs/admin/supplierorder_extrafields.php @@ -78,7 +78,7 @@ print dol_get_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), -1, require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/supplierorderdet_extrafields.php b/htdocs/admin/supplierorderdet_extrafields.php index 8043c56bcd2..7017bebf61f 100644 --- a/htdocs/admin/supplierorderdet_extrafields.php +++ b/htdocs/admin/supplierorderdet_extrafields.php @@ -79,7 +79,7 @@ print dol_get_fiche_head($head, 'supplierorderdet', $langs->trans("Suppliers"), require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 03b590a318c..e8da4a8d736 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -186,7 +186,7 @@ print dol_get_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1 print ''.$langs->trans("TicketSetupDictionaries").' : '.$langs->trans("ClickHereToGoTo", $langs->transnoentitiesnoconv("DictionarySetup")).'
    '; -dol_fiche_end(); +print dol_get_fiche_end(); /* diff --git a/htdocs/admin/ticket_extrafields.php b/htdocs/admin/ticket_extrafields.php index ad88e5adbf8..4a50beaa32e 100644 --- a/htdocs/admin/ticket_extrafields.php +++ b/htdocs/admin/ticket_extrafields.php @@ -75,7 +75,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("Module56000Name"), require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 8de245ab8db..50ff514c6a7 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -175,7 +175,7 @@ print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, print ''.$langs->trans("TicketPublicAccess").' : '.dol_buildpath('/public/ticket/index.php', 2).''; -dol_fiche_end(); +print dol_get_fiche_end(); $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' '; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index e6f667a169b..edd5ca95026 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -547,7 +547,7 @@ if ($mode == 'searchkey') print '
    '; } -dol_fiche_end(); +print dol_get_fiche_end(); print "\n"; diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index b6fc6f43ae9..a22e585f972 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -328,7 +328,7 @@ foreach ($dirmodels as $reldir) print ''; print "
    "; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index e9cdcaf09b6..e73e01ccbdf 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -260,7 +260,7 @@ foreach ($dirmodels as $reldir) print ''; print "
    "; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 01ef915d137..208caf85666 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -621,7 +621,7 @@ if ($id) } } -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/website_options.php b/htdocs/admin/website_options.php index 479bbdbe7b9..738fd5bc998 100644 --- a/htdocs/admin/website_options.php +++ b/htdocs/admin/website_options.php @@ -140,7 +140,7 @@ if ($action == 'edit') } -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/asset/admin/assets_extrafields.php b/htdocs/asset/admin/assets_extrafields.php index 393f028f950..3334610b927 100644 --- a/htdocs/asset/admin/assets_extrafields.php +++ b/htdocs/asset/admin/assets_extrafields.php @@ -70,7 +70,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("Assets"), -1, 'gene require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/asset/admin/assets_type_extrafields.php b/htdocs/asset/admin/assets_type_extrafields.php index 2b67be78e2b..25d7df8e1a7 100644 --- a/htdocs/asset/admin/assets_type_extrafields.php +++ b/htdocs/asset/admin/assets_type_extrafields.php @@ -69,7 +69,7 @@ print dol_get_fiche_head($head, 'attributes_type', $langs->trans("Assets"), -1, require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 6cda5f6eaa7..6fec16ef0a0 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -105,7 +105,7 @@ if ($action == 'edit') print '
    '; } -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 8b087297b79..0fa78edf9ce 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -180,7 +180,7 @@ if ($action == 'create') print ''."\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -218,7 +218,7 @@ if (($id || $ref) && $action == 'edit') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print '   '; @@ -297,7 +297,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); // Buttons for actions diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 021f54a1ad2..4c2e36aed9a 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -135,7 +135,7 @@ if ($object->id) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'asset'; //$permission = $user->rights->asset->create; diff --git a/htdocs/asset/info.php b/htdocs/asset/info.php index 0cca7015573..d211cf0dbad 100644 --- a/htdocs/asset/info.php +++ b/htdocs/asset/info.php @@ -82,7 +82,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php index b1665d7fcc4..514e05bff72 100644 --- a/htdocs/asset/note.php +++ b/htdocs/asset/note.php @@ -146,7 +146,7 @@ if ($id > 0 || !empty($ref)) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); } // End of page diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index 3c6773f5992..28f2ce59df0 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -382,7 +382,7 @@ if ($action == 'create') print ''; print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -490,7 +490,7 @@ if ($rowid > 0) print ''; print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); /* * Buttons @@ -595,7 +595,7 @@ if ($rowid > 0) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print '   '; diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 674c5b771d0..b6ce9cda1bc 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -170,7 +170,7 @@ print ''; if (GETPOST('withtab', 'alpha')) { - dol_fiche_end(); + print dol_get_fiche_end(); } print '

    '; diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index b4e26337c50..0a77c6ddf3b 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -582,7 +582,7 @@ if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->glob if (GETPOST('withtab', 'alpha')) { - dol_fiche_end(); + print dol_get_fiche_end(); } print '

    '; diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index d5e929796e5..317fd6f9032 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -185,7 +185,7 @@ if ($object->id > 0) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 37db34f283c..7970911d84d 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -275,7 +275,7 @@ if ($action == 'create') print ''."\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -311,7 +311,7 @@ if (($id || $ref) && $action == 'edit') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print '   '; @@ -535,7 +535,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 0f2a88366aa..f6a34a9c25d 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -130,7 +130,7 @@ if ($object->id) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'bom'; $permission = $user->rights->bom->write; diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php index e69be248a1d..78b38732f7f 100644 --- a/htdocs/bom/bom_note.php +++ b/htdocs/bom/bom_note.php @@ -144,7 +144,7 @@ if ($id > 0 || !empty($ref)) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); } // End of page diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 1506dd70269..30ccc6cdd75 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -177,7 +177,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print '   '; @@ -295,7 +295,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); if ($action == 'edit') { diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php index 404d35d6065..9bc1dd685ff 100644 --- a/htdocs/categories/admin/categorie_extrafields.php +++ b/htdocs/categories/admin/categorie_extrafields.php @@ -72,7 +72,7 @@ print dol_get_fiche_head($head, 'attributes_categories', $langs->trans("Categori require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index 8949ba25ef4..4c17c56c9d0 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -270,7 +270,7 @@ if ($user->rights->categorie->creer) print ''; - dol_fiche_end(''); + print dol_get_fiche_end(''); print '
    '; print ''; diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 9f7aebf7fec..a06517c8cda 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -170,7 +170,7 @@ if (empty($reshook)) { print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print '
     
    '; diff --git a/htdocs/categories/info.php b/htdocs/categories/info.php index 0011b4c1f5f..5bd8f6c9d24 100644 --- a/htdocs/categories/info.php +++ b/htdocs/categories/info.php @@ -95,7 +95,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 0c7c35da1fe..73c7664f6c2 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -161,7 +161,7 @@ if ($object->id) print "\n"; print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index c690cfcab84..660dbf9317d 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -223,7 +223,7 @@ print ''; print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 1985e756d45..280b278657c 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -267,7 +267,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); /* diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 7e9e63895aa..a46e302bd4b 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1291,7 +1291,7 @@ if ($action == 'create') print ''."\n"; } - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -1782,7 +1782,7 @@ if ($id > 0) print ''."\n"; } - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -2095,7 +2095,7 @@ if ($id > 0) print '
    '; print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 0c3ff22801a..613ac76380e 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -254,7 +254,7 @@ if ($object->id > 0) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'actions'; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 65123586e89..e62f411d786 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -417,7 +417,7 @@ print ''; //print dol_get_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); //print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup, '', $resourceid); -//dol_fiche_end(); +//print dol_get_fiche_end(); $viewmode = ''; $viewmode .= ''; diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 813e3240b7a..292c0ea94ce 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -112,7 +112,7 @@ print '
    '; dol_print_object_info($object); print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index ed96a3a2d4f..582f1c538f0 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -454,7 +454,7 @@ if ($resql) //print dol_get_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); //print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); - //dol_fiche_end(); + //print dol_get_fiche_end(); // Add link to show birthdays $link = ''; diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php index f926afb56a9..79836087775 100644 --- a/htdocs/comm/admin/propal_extrafields.php +++ b/htdocs/comm/admin/propal_extrafields.php @@ -72,7 +72,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("Proposals"), -1, 'p require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/comm/admin/propaldet_extrafields.php b/htdocs/comm/admin/propaldet_extrafields.php index aa6dac82910..fa12fe9b555 100644 --- a/htdocs/comm/admin/propaldet_extrafields.php +++ b/htdocs/comm/admin/propaldet_extrafields.php @@ -79,7 +79,7 @@ print dol_get_fiche_head($head, 'attributeslines', $langs->trans("Proposals"), - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 63a6a24aeaa..df7e96fc742 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1256,7 +1256,7 @@ if ($object->id > 0) print '
    '; print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); /* diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 812dea03f43..bb74fb686aa 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -741,7 +741,7 @@ if ($action == 'create') $doleditor->Create(); print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; @@ -923,7 +923,7 @@ if ($action == 'create') print ""; - dol_fiche_end(); + print dol_get_fiche_end(); // Clone confirmation @@ -1064,7 +1064,7 @@ if ($action == 'create') print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); print dol_set_focus('#sendto'); } @@ -1122,7 +1122,7 @@ if ($action == 'create') } else print dol_htmlentitiesbr($object->body); print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } else { /* * Edition mode mailing (CKeditor or HTML source) @@ -1195,7 +1195,7 @@ if ($action == 'create') print ''; print ''; - dol_fiche_end(); + print dol_get_fiche_end(); @@ -1289,7 +1289,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 2b59550cf2b..7c219cc448a 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -305,7 +305,7 @@ if ($object->fetch($id) >= 0) print "
    "; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index 05ae0885ba8..199a5caad8b 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -81,7 +81,7 @@ if ($object->fetch($id) >= 0) //print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } // End of page diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 6bd1fe715e3..bd4c16f89ca 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -105,7 +105,7 @@ if ($_socid > 0) print ""; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 1f813b6c6ad..7190168b513 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1771,7 +1771,7 @@ if ($action == 'create') print ''; } - dol_fiche_end(); + print dol_get_fiche_end(); $langs->load("bills"); print '
    '; @@ -2382,7 +2382,7 @@ if ($action == 'create') print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); /* diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 7d1cd05c706..9c491c7227c 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -188,7 +188,7 @@ if ($object->id > 0) dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - dol_fiche_end(); + print dol_get_fiche_end(); // Contacts lines (modules that overwrite templates must declare this into descriptor) diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index f1eef2164a0..309c2a44ad4 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -172,7 +172,7 @@ if ($object->id > 0) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'propal'; $permission = $user->rights->propal->creer; diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index fd9595f3579..e56a5129c5c 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -126,7 +126,7 @@ dol_print_object_info($object); print ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 1435d7f7f30..80b991a2526 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -140,7 +140,7 @@ if ($id > 0 || !empty($ref)) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } } } diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index fe847f6ff64..e439056de5f 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -355,7 +355,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index 753e22a5ce8..21f06e7bc1d 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -121,7 +121,7 @@ if ($socid > 0) if (!$isCustomer && !$isSupplier) { print '

    '.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').'

    '; - dol_fiche_end(); + print dol_get_fiche_end(); print ''; @@ -189,7 +189,7 @@ if ($socid > 0) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 1ee05562bf7..922e384af4d 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -261,7 +261,7 @@ if ($socid > 0) if (!$isCustomer && !$isSupplier) { print '

    '.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').'

    '; - dol_fiche_end(); + print dol_get_fiche_end(); print ''; @@ -336,7 +336,7 @@ if ($socid > 0) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); if ($user->rights->societe->creer) @@ -375,7 +375,7 @@ if ($socid > 0) print ""; - dol_fiche_end(); + print dol_get_fiche_end(); } if ($user->rights->societe->creer) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 795a120cee6..eb93a125fb5 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1828,7 +1828,7 @@ if ($action == 'create' && $usercancreate) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); // Button "Create Draft" print '
    '; @@ -2474,7 +2474,7 @@ if ($action == 'create' && $usercancreate) print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); /* * Buttons for actions diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 51b94d82d23..84c4eb5626a 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -188,7 +188,7 @@ if ($id > 0 || !empty($ref)) dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 20f49195e10..c3afff9e00d 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -175,7 +175,7 @@ if ($id > 0 || !empty($ref)) print "
    \n"; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'commande'; $permission = $user->rights->commande->creer; diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 9001a3ffb51..dd31e547569 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -127,7 +127,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 9542e432d7e..c996aea7601 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -139,7 +139,7 @@ if ($id > 0 || !empty($ref)) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 13657c61553..1da32f13e80 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -388,7 +388,7 @@ print ''; print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 221299fe8b7..ac31d091833 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -567,7 +567,7 @@ print ' 0 || !empty($ref)) { print ''; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'bank'; diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 6db4714db3d..f190ddb1471 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -166,7 +166,7 @@ if (!empty($id)) print $langs->trans("AllAccounts"); } -dol_fiche_end(); +print dol_get_fiche_end(); // Affiche tableau diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index e4bed6376f1..5d0df32cd3e 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -436,7 +436,7 @@ if ($id > 0 || !empty($ref)) dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - dol_fiche_end(); + print dol_get_fiche_end(); /* diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 7bddd7915cb..8b086516351 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -544,7 +544,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -752,7 +752,7 @@ if ($action == 'create') print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); /* * Barre d'actions @@ -1028,7 +1028,7 @@ if ($action == 'create') print ''; } - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 1369a629d2f..896b91545db 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -123,7 +123,7 @@ if ($id > 0 || !empty($ref)) { print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'bank'; diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 496988ba74a..9350e211284 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -762,7 +762,7 @@ if ($account) print $langs->trans("AllAccounts"); } -dol_fiche_end(); +print dol_get_fiche_end(); print ''; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index eab2c1ad182..7ae7c995935 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -566,7 +566,7 @@ if ($result) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '

    '; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 137712d5cec..166d69fdd30 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -251,7 +251,7 @@ if (empty($numref)) dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index f59723436d2..03844897a15 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -96,7 +96,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 7218a191d1c..8a7f5415339 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -454,7 +454,7 @@ if ($action == 'create') print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -603,7 +603,7 @@ if ($id) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); /* diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 32351e5fe3b..14187bf51e3 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -143,7 +143,7 @@ if ($object->id) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'banque'; $permission = $user->rights->banque->modifier; diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 4b61b446045..96299886070 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -660,7 +660,7 @@ if (empty($action) || $action == "view" || $action == "close") print '
    '; print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); if ($action != 'close') { print '
    '; diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index b17c3f4f9a4..e9a2a3a93a7 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -306,7 +306,7 @@ print '
    '; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/compta/facture/admin/facture_cust_extrafields.php b/htdocs/compta/facture/admin/facture_cust_extrafields.php index 16327c8b348..54234b4a10c 100644 --- a/htdocs/compta/facture/admin/facture_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facture_cust_extrafields.php @@ -73,7 +73,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("Invoices"), -1, 'in require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/compta/facture/admin/facture_rec_cust_extrafields.php b/htdocs/compta/facture/admin/facture_rec_cust_extrafields.php index 50a7fd18586..3f85d7ba074 100644 --- a/htdocs/compta/facture/admin/facture_rec_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facture_rec_cust_extrafields.php @@ -74,7 +74,7 @@ print dol_get_fiche_head($head, 'attributesrec', $langs->trans("Invoices"), -1, require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php index 2b9e37e43c6..5b1daff5913 100644 --- a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php @@ -74,7 +74,7 @@ print dol_get_fiche_head($head, 'attributeslines', $langs->trans("Invoices"), -1 require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php b/htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php index 58fd39e33fe..539fb89e675 100644 --- a/htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php @@ -74,7 +74,7 @@ print dol_get_fiche_head($head, 'attributeslinesrec', $langs->trans("Invoices"), require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 4a9a0a197b3..0d483665e40 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1056,7 +1056,7 @@ if ($action == 'create') print ""; - dol_fiche_end(); + print dol_get_fiche_end(); // Autogeneration @@ -1102,7 +1102,7 @@ if ($action == 'create') print ""; - dol_fiche_end(); + print dol_get_fiche_end(); $title = $langs->trans("ProductsAndServices"); @@ -1641,7 +1641,7 @@ if ($action == 'create') print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); /** diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 401a2fdd37a..74947b7c591 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3618,7 +3618,7 @@ if ($action == 'create') print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); // Button "Create Draft" print '
    '; @@ -5030,7 +5030,7 @@ if ($action == 'create') print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); // Actions buttons diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index f50f6b85a55..fc66715dd3d 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -185,7 +185,7 @@ if ($id > 0 || !empty($ref)) dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 548fefab0fa..e001b203296 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -174,7 +174,7 @@ if ($id > 0 || !empty($ref)) print "
    \n"; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'facture'; $permission = $user->rights->facture->creer; diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index a7af3893883..f26f4ea0255 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -120,7 +120,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 76c6833c07b..a2343171d66 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -139,7 +139,7 @@ if ($id > 0 || !empty($ref)) $cssclass = "titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - dol_fiche_end(); + print dol_get_fiche_end(); } // End of page diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 2f44b0b2437..eea3b29aa36 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -573,7 +573,7 @@ if ($object->id > 0) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $numopen = 0; $pending = 0; $numclosed = 0; diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index afbe4528b14..fb1002d45a5 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -381,7 +381,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index b787878f31d..b99e4c35d1c 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -198,7 +198,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -271,7 +271,7 @@ if ($id) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); /* diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 21e9fba85bc..d1da6de0c3e 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -528,7 +528,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; - dol_fiche_end(); + print dol_get_fiche_end(); /* diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 9d0758b48bf..db942328d13 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -299,7 +299,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); /* diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 21b7ac83f58..49a8cf5d61b 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -370,7 +370,7 @@ if ($action == 'new') print ''; print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -719,7 +719,7 @@ if ($action == 'new') dol_print_error($db); } - dol_fiche_end(); + print dol_get_fiche_end(); } diff --git a/htdocs/compta/paiement/info.php b/htdocs/compta/paiement/info.php index a1640f08496..208d74a316f 100644 --- a/htdocs/compta/paiement/info.php +++ b/htdocs/compta/paiement/info.php @@ -74,7 +74,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 17970037b4a..e5941624910 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -252,7 +252,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); /* * Other unpaid charges diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index 6dfa4e3be7a..5ee71863dd2 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -158,7 +158,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); /* diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 69968503a5d..5d87303236a 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -250,7 +250,7 @@ if ($id > 0 || $ref) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); $formconfirm = ''; diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index b1a15a766f6..1f8ecdaeced 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -150,7 +150,7 @@ if ($id > 0 || $ref) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 9135616d915..fb1a9451aed 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -144,7 +144,7 @@ if ($prev_id > 0 || $ref) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 151e53e4a59..81e854ef5a0 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -143,7 +143,7 @@ if ($prev_id > 0 || $ref) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 71f39f6c98d..ccb60486c76 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -179,7 +179,7 @@ if ($id) } print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } else { dol_print_error($db); } diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 8e8521e4026..3930d711a1c 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -97,7 +97,7 @@ if ($id > 0) print dol_get_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company'); dol_banner_tab($object, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 1); - dol_fiche_end(); + print dol_get_fiche_end(); if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 98131687cb1..8af8c54752b 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -376,7 +376,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -681,7 +681,7 @@ if ($id > 0) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); if ($action == 'edit') { diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index dd07afd416f..eea97c13a1d 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -156,7 +156,7 @@ if ($object->id) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'tax'; $permission = $user->rights->tax->charges->creer; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 1f20bcd28e3..7e7f236b3ab 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -293,7 +293,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -369,7 +369,7 @@ if ($id) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); /* * Action buttons diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index 8d097e6aad5..10efd84288c 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -142,7 +142,7 @@ if ($object->id) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $permission = $user->rights->tax->charges->creer; $permtoedit = $user->rights->fournisseur->facture->creer; diff --git a/htdocs/compta/tva/info.php b/htdocs/compta/tva/info.php index 71ff7b14844..ddabf6e2b49 100644 --- a/htdocs/compta/tva/info.php +++ b/htdocs/compta/tva/info.php @@ -89,7 +89,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); llxFooter(); diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 1d42d638bc8..95ec50be24f 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -227,7 +227,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); // Actions buttons diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 746d2222c39..b4406207977 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -873,7 +873,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ""; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -1237,7 +1237,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -1482,7 +1482,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print '
    '; print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); // Barre d'actions print '
    '; diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index f2eb1e4cfaf..d3992296aec 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -158,7 +158,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index d2979081189..8a70ec6e2df 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -162,7 +162,7 @@ if ($object->id) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'contact'; $permission = $user->rights->societe->contact->creer; diff --git a/htdocs/contact/info.php b/htdocs/contact/info.php index fbe56cb9587..c39c20d3d25 100644 --- a/htdocs/contact/info.php +++ b/htdocs/contact/info.php @@ -77,7 +77,7 @@ if ($id > 0) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } llxFooter(); diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 2a24d7ab518..68d810967ad 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -130,7 +130,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); /* diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index 2e2eefb2995..478288046e1 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -114,7 +114,7 @@ if ($id > 0) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } llxFooter(); diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 8df4dca28d4..bbaf013efa1 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -204,7 +204,7 @@ if ($action == 'edit') print ""; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -296,7 +296,7 @@ if ($action == 'edit') print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); } diff --git a/htdocs/contrat/admin/contract_extrafields.php b/htdocs/contrat/admin/contract_extrafields.php index b221aa55398..8571856362a 100644 --- a/htdocs/contrat/admin/contract_extrafields.php +++ b/htdocs/contrat/admin/contract_extrafields.php @@ -74,7 +74,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("Contracts"), -1, 'c require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/contrat/admin/contractdet_extrafields.php b/htdocs/contrat/admin/contractdet_extrafields.php index fba9843eea0..4b3f03ffedf 100644 --- a/htdocs/contrat/admin/contractdet_extrafields.php +++ b/htdocs/contrat/admin/contractdet_extrafields.php @@ -74,7 +74,7 @@ print dol_get_fiche_head($head, 'attributeslines', $langs->trans("Contracts"), - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 48238496721..f88b470215c 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -204,7 +204,7 @@ if ($id > 0) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 64b3275379a..1187571d2d0 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1197,7 +1197,7 @@ if ($action == 'create') print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -2015,7 +2015,7 @@ if ($action == 'create') print ''; } - dol_fiche_end(); + print dol_get_fiche_end(); /* diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 32c3dd67ada..4f69d5a2c56 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -230,7 +230,7 @@ if ($id > 0 || !empty($ref)) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index fb7291c5d6b..759c2080930 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -186,7 +186,7 @@ if ($object->id) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'contract'; $permission = $user->rights->contrat->creer; diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index d2f7a7e71fa..0368340bffd 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -176,7 +176,7 @@ if ($id > 0 || !empty($ref)) include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - dol_fiche_end(); + print dol_get_fiche_end(); } diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index d83aa3cc19a..8b1618c8da9 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -422,7 +422,7 @@ class FormTicket print ''; - if ($withdolfichehead) dol_fiche_end(); + if ($withdolfichehead) print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 859f6e5cac1..433ec4969ca 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -758,7 +758,7 @@ if ($sql) { print '
    '; if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE')) { - dol_fiche_end(); + print dol_get_fiche_end(); } // End of page diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index f380152abdb..20ffa3f52b6 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -235,7 +235,7 @@ function journalHead($nom, $variante, $period, $periodlink, $description, $build print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a3eb00a38ec..7cdf83f9961 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1258,7 +1258,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di * @param array $links Array of tabs. Currently initialized by calling a function xxx_admin_prepare_head * @param string $active Active tab name (document', 'info', 'ldap', ....) * @param string $title Title - * @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using dol_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after) + * @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after) * @param string $picto Add a picto on tab title * @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto. * @param string $morehtmlright Add more html content on right of tabs title @@ -1279,7 +1279,7 @@ function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0 * @param array $links Array of tabs * @param string $active Active tab name * @param string $title Title - * @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using dol_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after) + * @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after) * @param string $picto Add a picto on tab title * @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto. * @param string $morehtmlright Add more html content on right of tabs title diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index 385c22146b9..b23acd76a5b 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -115,7 +115,7 @@ function report_header($reportname, $notused, $period, $periodlink, $description print ''."\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 69bf77262c8..4bc2bbe8d7a 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -211,7 +211,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
    Contact:con - +
    ">      ">
    diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 396406932e7..19b5322ace5 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -298,7 +298,7 @@ if (in_array($type, array_keys($typewecanchangeinto))) - +
    ">      ">
    diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index ea72f29607b..ef288f97589 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -292,5 +292,5 @@ if ($action == 'presend') // Show form print $formmail->get_form(); - dol_fiche_end(); + print dol_get_fiche_end(); } diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index d81a79d7b80..68f45284582 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -160,7 +160,7 @@ if ($massaction == 'presend') print $formmail->get_form(); } - dol_fiche_end(); + print dol_get_fiche_end(); } // Allow Pre-Mass-Action hook (eg for confirmation dialog) $parameters = array( diff --git a/htdocs/cron/admin/cron.php b/htdocs/cron/admin/cron.php index 5f87e640bce..8c2d42adfaa 100644 --- a/htdocs/cron/admin/cron.php +++ b/htdocs/cron/admin/cron.php @@ -105,7 +105,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index bdb776a7100..dbe159f32d3 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -510,7 +510,7 @@ if (($action == "create") || ($action == "edit")) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -693,7 +693,7 @@ if (($action == "create") || ($action == "edit")) print ''; print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); print "\n\n
    \n"; diff --git a/htdocs/datapolicy/admin/setup.php b/htdocs/datapolicy/admin/setup.php index f8c38bf5b6b..2d89bb09e3a 100644 --- a/htdocs/datapolicy/admin/setup.php +++ b/htdocs/datapolicy/admin/setup.php @@ -164,7 +164,7 @@ if ($action == 'edit') // Page end -dol_fiche_end(); +print dol_get_fiche_end(); llxFooter(); $db->close(); diff --git a/htdocs/datapolicy/admin/setupmail.php b/htdocs/datapolicy/admin/setupmail.php index 241dd9dace5..7076608898e 100644 --- a/htdocs/datapolicy/admin/setupmail.php +++ b/htdocs/datapolicy/admin/setupmail.php @@ -153,7 +153,7 @@ print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); print '

    '; diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 440de00499e..e3c28a86dac 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -629,7 +629,7 @@ if ($action == 'create') // Create. Seems to no be used print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); //if ($object->statut == 0) // only if draft // print '
    '; diff --git a/htdocs/don/admin/donation_extrafields.php b/htdocs/don/admin/donation_extrafields.php index d210f4399bc..6062d4fca26 100644 --- a/htdocs/don/admin/donation_extrafields.php +++ b/htdocs/don/admin/donation_extrafields.php @@ -70,7 +70,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("Donations"), -1, 'p require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 48af083a5fb..51252e480da 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -452,7 +452,7 @@ if ($action == 'create') print ''; print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -583,7 +583,7 @@ if (!empty($id) && $action == 'edit') print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
       
    '; @@ -775,7 +775,7 @@ if (!empty($id) && $action != 'edit') print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $remaintopay = $object->amount - $totalpaid; diff --git a/htdocs/don/document.php b/htdocs/don/document.php index 4b7a7f052dc..4067c9a0500 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -179,7 +179,7 @@ if ($object->id) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'don'; $permission = $user->rights->don->lire; diff --git a/htdocs/don/info.php b/htdocs/don/info.php index ead0f354646..f60b8380939 100644 --- a/htdocs/don/info.php +++ b/htdocs/don/info.php @@ -120,7 +120,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); llxFooter(); $db->close(); diff --git a/htdocs/don/note.php b/htdocs/don/note.php index ff25b704dd3..1e5e2667b31 100644 --- a/htdocs/don/note.php +++ b/htdocs/don/note.php @@ -131,7 +131,7 @@ if ($id > 0 || !empty($ref)) $cssclass = "titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - dol_fiche_end(); + print dol_get_fiche_end(); } llxFooter(); diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index 15146932055..fa97965ca4d 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -203,7 +203,7 @@ if ($resql) print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); /* diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index d8f373cbd37..e7985ded1ff 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -231,7 +231,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); /* * List of payments on donation diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index 998de2b7793..eed3108c3db 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -296,7 +296,7 @@ print ''; print '
    '; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php index d63ef0397fe..53f02cede7a 100644 --- a/htdocs/ecm/dir_add_card.php +++ b/htdocs/ecm/dir_add_card.php @@ -251,7 +251,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index 9a084da6cc9..8c1c0162692 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -448,7 +448,7 @@ if ($action == 'edit') print ''; } -dol_fiche_end(); +print dol_get_fiche_end(); diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php index 69cac4d1449..145e28c5e59 100644 --- a/htdocs/ecm/file_card.php +++ b/htdocs/ecm/file_card.php @@ -388,7 +388,7 @@ print '
    '; print ajax_autoselect('downloadinternallink'); print ajax_autoselect('downloadlink'); -dol_fiche_end(); +print dol_get_fiche_end(); if ($action == 'edit') { diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index eb65d9a997b..f1716c5020e 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -335,7 +335,7 @@ $module = 'ecm'; include DOL_DOCUMENT_ROOT.'/core/tpl/filemanager.tpl.php'; // End of page -dol_fiche_end(); +print dol_get_fiche_end(); llxFooter(); diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index f3708fbe6df..4ee3c1fcc82 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -466,7 +466,7 @@ if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_ } -dol_fiche_end(); +print dol_get_fiche_end(); llxFooter(); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index d89d08bc1b2..77e25704a6b 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1030,7 +1030,7 @@ if ($action == 'create') print ""; - dol_fiche_end(); + print dol_get_fiche_end(); // Shipment lines @@ -2403,7 +2403,7 @@ if ($action == 'create') } - dol_fiche_end(); + print dol_get_fiche_end(); $object->fetchObjectLinked($object->id, $object->element); diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index d2adaadf484..536f0a239ef 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -250,7 +250,7 @@ if ($id > 0 || !empty($ref)) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); // Lines of contacts echo '
    '; diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index ede667279e6..fffad537b6e 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -169,7 +169,7 @@ if ($id > 0 || !empty($ref)) { print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'expedition'; $permission = $user->rights->expedition->creer; diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 64aa415c4ce..71de26fa3cf 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -148,7 +148,7 @@ if ($id > 0 || !empty($ref)) $cssclass = 'titlefield'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - dol_fiche_end(); + print dol_get_fiche_end(); } // End of page diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index d500a97ab71..8fa04c27c25 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -305,7 +305,7 @@ print ''; print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index c0896151284..63b2977336c 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1483,7 +1483,7 @@ if ($action == 'create') print ''; print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -1616,7 +1616,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -2543,7 +2543,7 @@ if ($action == 'create') print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } // end edit or not edit } // end of if result else { diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php index 531140e1b2a..c61c55a04fd 100644 --- a/htdocs/expensereport/document.php +++ b/htdocs/expensereport/document.php @@ -142,7 +142,7 @@ if ($object->id) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'expensereport'; diff --git a/htdocs/expensereport/info.php b/htdocs/expensereport/info.php index 00510e4e5fd..53d1531f4b9 100644 --- a/htdocs/expensereport/info.php +++ b/htdocs/expensereport/info.php @@ -98,7 +98,7 @@ if ($id > 0 || !empty($ref)) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); } // End of page diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 0186bd08103..574a0382fcb 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -345,7 +345,7 @@ if ($resql) dol_banner_tab($fuser, 'id', $linkback, $user->rights->user->user->lire || $user->admin); - dol_fiche_end(); + print dol_get_fiche_end(); if ($action != 'edit') { diff --git a/htdocs/expensereport/note.php b/htdocs/expensereport/note.php index 31667d74a4e..ebb66ce42fd 100644 --- a/htdocs/expensereport/note.php +++ b/htdocs/expensereport/note.php @@ -108,7 +108,7 @@ if ($id > 0 || !empty($ref)) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); } // End of page diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index 4a5099cc03a..6662b1054f4 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.php @@ -152,7 +152,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); /* diff --git a/htdocs/expensereport/payment/info.php b/htdocs/expensereport/payment/info.php index 281e760684d..a654c77b6cd 100644 --- a/htdocs/expensereport/payment/info.php +++ b/htdocs/expensereport/payment/info.php @@ -75,7 +75,7 @@ print ''; print ''; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index 68c43a99ad1..a01eb50981d 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -239,7 +239,7 @@ if ($action == 'create' || empty($action)) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print dol_get_fiche_head(); @@ -279,7 +279,7 @@ if ($action == 'create' || empty($action)) print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index b789fc57345..de6c0b961d6 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -301,7 +301,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 412167c55f2..64d94eda3b9 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -516,7 +516,7 @@ if ($step == 2 && $datatoexport) print ''; print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/fichinter/admin/fichinter_extrafields.php b/htdocs/fichinter/admin/fichinter_extrafields.php index 84dfeb7cfd3..0fa5a930f05 100644 --- a/htdocs/fichinter/admin/fichinter_extrafields.php +++ b/htdocs/fichinter/admin/fichinter_extrafields.php @@ -73,7 +73,7 @@ print dol_get_fiche_head($head, 'attributes', $langs->trans("Interventions"), -1 require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/fichinter/admin/fichinterdet_extrafields.php b/htdocs/fichinter/admin/fichinterdet_extrafields.php index 5a13bdb4b32..4593de914e3 100644 --- a/htdocs/fichinter/admin/fichinterdet_extrafields.php +++ b/htdocs/fichinter/admin/fichinterdet_extrafields.php @@ -74,7 +74,7 @@ print dol_get_fiche_head($head, 'attributesdet', $langs->trans("Interventions"), require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; -dol_fiche_end(); +print dol_get_fiche_end(); // Buttons diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 0a4bbfe922f..31f65be4263 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -417,7 +417,7 @@ if ($action == 'create') { print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print '     '; @@ -438,7 +438,7 @@ if ($action == 'create') { print ''; print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 720e6fe71f3..da1de06cc16 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1012,7 +1012,7 @@ if ($action == 'create') print ''; } - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -1053,7 +1053,7 @@ if ($action == 'create') print ''; print ''; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -1588,7 +1588,7 @@ if ($action == 'create') print ''."\n"; } - dol_fiche_end(); + print dol_get_fiche_end(); print "\n"; diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index 8dd498d5242..3f0b965b094 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -169,7 +169,7 @@ if ($id > 0 || !empty($ref)) dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index e28345534d7..8da827132a2 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -163,7 +163,7 @@ if ($object->id) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'ficheinter'; $permission = $user->rights->ficheinter->creer; diff --git a/htdocs/fichinter/info.php b/htdocs/fichinter/info.php index 320a29f4171..a53c69b77bd 100644 --- a/htdocs/fichinter/info.php +++ b/htdocs/fichinter/info.php @@ -124,7 +124,7 @@ print ''; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); llxFooter(); $db->close(); diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php index fd18040d037..b634d7092bf 100644 --- a/htdocs/fichinter/note.php +++ b/htdocs/fichinter/note.php @@ -125,7 +125,7 @@ if ($id > 0 || !empty($ref)) print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); } llxFooter(); diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 45d4c2c2c7d..0e4872637b8 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -320,7 +320,7 @@ print ''; print '
    '; print '
    '; -dol_fiche_end(); +print dol_get_fiche_end(); llxFooter(); diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index e6a1a6a5a8c..563f46329f5 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -767,7 +767,7 @@ if ($object->id > 0) print ''; print '
    '; - dol_fiche_end(); + print dol_get_fiche_end(); /* diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 524d67e55b9..46b3d372dfd 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1765,7 +1765,7 @@ if ($action == 'create') // Bouton "Create Draft" print "\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
    '; print ''; @@ -2339,7 +2339,7 @@ if ($action == 'create') print '
    '; print ''; - dol_fiche_end(); + print dol_get_fiche_end(); /** * Boutons actions diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 45178a656ba..3dc9a68d814 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -182,7 +182,7 @@ if ($id > 0 || !empty($ref)) dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - dol_fiche_end(); + print dol_get_fiche_end(); // Contacts lines include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php'; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 6f6678b57de..8b735f6b6d8 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -1080,7 +1080,7 @@ if ($id > 0 || !empty($ref)) { print ''; } - dol_fiche_end(); + print dol_get_fiche_end(); // traitement entrepot par défaut print ''."\n"; - } + if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").prop("checked",true);'; + print '});'; + print ''."\n"; + } // Confirm create third party @@ -778,16 +778,16 @@ if ($rowid > 0) { if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) { $tmpcompany = new Societe($db); $tmpcompany->name = $companyname; - $tmpcompany->get_codeclient($tmpcompany, 0); + $tmpcompany->get_codeclient($tmpcompany, 0); $customercode = $tmpcompany->code_client; $formquestion[] = array( - 'label' => $langs->trans("CustomerCode"), - 'type' => 'text', - 'name' => 'customercode', - 'value' => $customercode, - 'morecss' => 'minwidth300', - 'moreattr' => 'maxlength="128"', - ); + 'label' => $langs->trans("CustomerCode"), + 'type' => 'text', + 'name' => 'customercode', + 'value' => $customercode, + 'morecss' => 'minwidth300', + 'moreattr' => 'maxlength="128"', + ); } // @todo Add other extrafields mandatory for thirdparty creation @@ -795,99 +795,99 @@ if ($rowid > 0) { } - print '
    '; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print dol_get_fiche_head(''); print "\n"; - print ''; + print ''; $today = dol_now(); - $datefrom = 0; - $dateto = 0; - $paymentdate = -1; + $datefrom = 0; + $dateto = 0; + $paymentdate = -1; - // Date payment - if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) { - $paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear')); - } + // Date payment + if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) { + $paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear')); + } - print ''; - // Date start subscription - print '"; + print ''; + // Date start subscription + print '"; - // Date end subscription - if (GETPOST('endday')) { - $dateto = dol_mktime(0, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); - } - if (!$dateto) { - $dateto = -1; // By default, no date is suggested - } - print '"; + // Date end subscription + if (GETPOST('endday')) { + $dateto = dol_mktime(0, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); + } + if (!$dateto) { + $dateto = -1; // By default, no date is suggested + } + print '"; - if ($adht->subscription) { - // Amount - print ''; + if ($adht->subscription) { + // Amount + print ''; - // Label - print ''; - print ''; + // Label + print ''; + print ''; - // Complementary action - if ((!empty($conf->banque->enabled) || !empty($conf->facture->enabled)) && empty($conf->global->ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS)) { - $company = new Societe($db); - if ($object->fk_soc) { - $result = $company->fetch($object->fk_soc); - } + // Complementary action + if ((!empty($conf->banque->enabled) || !empty($conf->facture->enabled)) && empty($conf->global->ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS)) { + $company = new Societe($db); + if ($object->fk_soc) { + $result = $company->fetch($object->fk_soc); + } - // Title payments - //print ''; + // Title payments + //print ''; - // No more action - print ''; - print ''; + print ''; + print ''; } } @@ -189,7 +189,7 @@ if ($result || empty($id)) { print ''."\n"; + $langs->load("members"); + $reg = array(); + if (preg_match('/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) $text .= $langs->trans($reg[1])."
    \n"; + else $text .= $conf->global->ONLINE_SIGN_NEWFORM_TEXT."
    \n"; + $text = ''."\n"; } if (empty($text)) { - $text .= ''."\n"; - $text .= ''."\n"; + $text .= ''."\n"; + $text .= ''."\n"; } print $text; @@ -237,9 +237,9 @@ if ($source == 'proposal') // Creditor print ''."\n"; + print ''."\n"; // Debitor @@ -266,13 +266,13 @@ print '
    '.$langs->trans("DateSubscription").''; - if (GETPOST('reday')) { - $datefrom = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - } - if (!$datefrom) { - $datefrom = $object->datevalid; - if ($object->datefin > 0) { - $datefrom = dol_time_plus_duree($object->datefin, 1, 'd'); - } - } - print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1); - print "
    '.$langs->trans("DateSubscription").''; + if (GETPOST('reday')) { + $datefrom = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + } + if (!$datefrom) { + $datefrom = $object->datevalid; + if ($object->datefin > 0) { + $datefrom = dol_time_plus_duree($object->datefin, 1, 'd'); + } + } + print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1); + print "
    '.$langs->trans("DateEndSubscription").''; - print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0); - print "
    '.$langs->trans("DateEndSubscription").''; + print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0); + print "
    '.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).'
    '.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).'
    '.$langs->trans("Label").'
    '.$langs->trans("Label").'
    '.$langs->trans("Payment").'
    '.$langs->trans("Payment").'
    '.$langs->trans('MoreActions'); - print ''; - print ' '.$langs->trans("None").'
    '; - // Add entry into bank accoun - if (!empty($conf->banque->enabled)) { - print ' '.$langs->trans("MoreActionBankDirect").'
    '; - } - // Add invoice with no payments - if (!empty($conf->societe->enabled) && !empty($conf->facture->enabled)) { - print 'fk_soc)) print ' disabled'; - print '> '.$langs->trans("MoreActionInvoiceOnly"); - if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')'; - else { - print ' ('; - if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember")); - print $langs->trans("NoThirdPartyAssociatedToMember"); - print ' - '; - print $langs->trans("CreateDolibarrThirdParty"); - print ')'; - } - if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0).''; + // No more action + print '
    '.$langs->trans('MoreActions'); + print ''; + print ' '.$langs->trans("None").'
    '; + // Add entry into bank accoun + if (!empty($conf->banque->enabled)) { + print ' '.$langs->trans("MoreActionBankDirect").'
    '; + } + // Add invoice with no payments + if (!empty($conf->societe->enabled) && !empty($conf->facture->enabled)) { + print 'fk_soc)) print ' disabled'; + print '> '.$langs->trans("MoreActionInvoiceOnly"); + if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')'; + else { + print ' ('; + if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember")); + print $langs->trans("NoThirdPartyAssociatedToMember"); + print ' - '; + print $langs->trans("CreateDolibarrThirdParty"); + print ')'; + } + if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0).''; if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) { $prodtmp = new Product($db); $result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); @@ -896,23 +896,23 @@ if ($rowid > 0) { } print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product } - print '
    '; - } - // Add invoice with payments - if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) { - print 'fk_soc)) print ' disabled'; - print '> '.$langs->trans("MoreActionBankViaInvoice"); - if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')'; - else { - print ' ('; - if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember")); - print $langs->trans("NoThirdPartyAssociatedToMember"); - print ' - '; - print $langs->trans("CreateDolibarrThirdParty"); - print ')'; - } - if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0).''; + print '
    '; + } + // Add invoice with payments + if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) { + print 'fk_soc)) print ' disabled'; + print '> '.$langs->trans("MoreActionBankViaInvoice"); + if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')'; + else { + print ' ('; + if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember")); + print $langs->trans("NoThirdPartyAssociatedToMember"); + print ' - '; + print $langs->trans("CreateDolibarrThirdParty"); + print ')'; + } + if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0).''; if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) { $prodtmp = new Product($db); $result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 2eb2c0edad1..2705ede5540 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -88,9 +88,9 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) dolibarr_del_const($db, "MAIN_INFO_SOCIETE_STATE", $conf->entity); } - $db->begin(); + $db->begin(); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alphanohtml'), 'chaine', 0, '', $conf->entity); @@ -141,8 +141,8 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) // Create thumbs of logo (Note that PDF use original file and not thumbs) if ($isimage > 0) { - // Create thumbs - //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retrieve value with get... + // Create thumbs + //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retrieve value with get... // Create small thumb, Used on logon for example $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); @@ -269,7 +269,7 @@ if ($action == 'addthumb' || $action == 'addthumbsquarred') // Regenerate thumb $reg = array(); - // Create thumbs + // Create thumbs //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retrieve value with get... // Create small thumb. Used on logon for example @@ -777,8 +777,8 @@ if ($mysoc->useLocalTax(2)) $tooltiphelp = ($tooltiphelp != "LocalTax2IsUsedExample" ? "".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."\n" : ""); if (!isOnlyOneLocalTax(2)) { - print '
    : '; - $formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2"); + print '
    : '; + $formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2"); } print '
    : '; print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 987d7a256af..43ce69f6e02 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -881,7 +881,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if (in_array($rowidcol, array('code', 'code_iso'))) { $sql .= " WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; } else { - $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); + $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); } if (in_array('entity', $listfieldmodify)) $sql .= " AND entity = '".getEntity($tabname[$id])."'"; diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 036f31a99d7..05782b8ec67 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -113,17 +113,17 @@ class Asset extends CommonObject */ public $entity; - /** - * @var string Asset label - */ - public $label; + /** + * @var string Asset label + */ + public $label; public $amount; /** * @var int Thirdparty ID */ - public $fk_soc; + public $fk_soc; /** * @var string description @@ -134,21 +134,21 @@ class Asset extends CommonObject public $note_private; /** - * @var integer|string date_creation - */ + * @var integer|string date_creation + */ public $date_creation; public $tms; /** - * @var int ID - */ + * @var int ID + */ public $fk_user_creat; /** - * @var int ID - */ + * @var int ID + */ public $fk_user_modif; public $import_key; @@ -381,7 +381,7 @@ class Asset extends CommonObject return $this->LibStatut($this->status, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return the status * @@ -391,14 +391,14 @@ class Asset extends CommonObject */ public static function LibStatut($status, $mode = 0) { - // phpcs:enable + // phpcs:enable global $langs; $langs->load("contracts"); - $labelStatus = array(); + $labelStatus = array(); $labelStatus[self::STATUS_DRAFT] = $langs->trans('Disabled'); $labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); - $labelStatusShort = array(); + $labelStatusShort = array(); $labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Disabled'); $labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled'); diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 8aeaa2a9fe8..5771ead70f1 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -97,7 +97,7 @@ class FactureRec extends CommonInvoice */ public $frequency; - /** + /** * @var string Unit frequency */ public $unit_frequency; @@ -317,46 +317,46 @@ class FactureRec extends CommonInvoice $tva_tx = $facsrc->lines[$i]->tva_tx; if (!empty($facsrc->lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$facsrc->lines[$i]->vat_src_code.')'; - $result_insert = $this->addline( - $facsrc->lines[$i]->desc, - $facsrc->lines[$i]->subprice, - $facsrc->lines[$i]->qty, + $result_insert = $this->addline( + $facsrc->lines[$i]->desc, + $facsrc->lines[$i]->subprice, + $facsrc->lines[$i]->qty, $tva_tx, - $facsrc->lines[$i]->localtax1_tx, - $facsrc->lines[$i]->localtax2_tx, - $facsrc->lines[$i]->fk_product, - $facsrc->lines[$i]->remise_percent, - 'HT', + $facsrc->lines[$i]->localtax1_tx, + $facsrc->lines[$i]->localtax2_tx, + $facsrc->lines[$i]->fk_product, + $facsrc->lines[$i]->remise_percent, + 'HT', $facsrc->lines[$i]->info_bits, - '', - 0, - $facsrc->lines[$i]->product_type, - $facsrc->lines[$i]->rang, - $facsrc->lines[$i]->special_code, - $facsrc->lines[$i]->label, + '', + 0, + $facsrc->lines[$i]->product_type, + $facsrc->lines[$i]->rang, + $facsrc->lines[$i]->special_code, + $facsrc->lines[$i]->label, $facsrc->lines[$i]->fk_unit, $facsrc->lines[$i]->multicurrency_subprice - ); + ); if ($result_insert < 0) { $error++; } else { - $objectline = new FactureLigneRec($this->db); - if ($objectline->fetch($result_insert)) - { - // Extrafields - if (method_exists($facsrc->lines[$i], 'fetch_optionals')) { - $facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid); - $objectline->array_options = $facsrc->lines[$i]->array_options; - } + $objectline = new FactureLigneRec($this->db); + if ($objectline->fetch($result_insert)) + { + // Extrafields + if (method_exists($facsrc->lines[$i], 'fetch_optionals')) { + $facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid); + $objectline->array_options = $facsrc->lines[$i]->array_options; + } - $result = $objectline->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } + $result = $objectline->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } } } @@ -370,27 +370,27 @@ class FactureRec extends CommonInvoice { foreach ($this->linked_objects as $origin => $tmp_origin_id) { - if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) - { - foreach ($tmp_origin_id as $origin_id) - { - $ret = $this->add_object_linked($origin, $origin_id); - if (!$ret) - { - $this->error = $this->db->lasterror(); - $error++; - } - } - } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) - { - $origin_id = $tmp_origin_id; - $ret = $this->add_object_linked($origin, $origin_id); - if (!$ret) - { - $this->error = $this->db->lasterror(); - $error++; - } - } + if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) + { + foreach ($tmp_origin_id as $origin_id) + { + $ret = $this->add_object_linked($origin, $origin_id); + if (!$ret) + { + $this->error = $this->db->lasterror(); + $error++; + } + } + } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + { + $origin_id = $tmp_origin_id; + $ret = $this->add_object_linked($origin, $origin_id); + if (!$ret) + { + $this->error = $this->db->lasterror(); + $error++; + } + } } } @@ -422,7 +422,7 @@ class FactureRec extends CommonInvoice return $this->id; } } else { - $this->error = $this->db->lasterror(); + $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; } @@ -442,46 +442,46 @@ class FactureRec extends CommonInvoice */ public function update(User $user, $notrigger = 0) { - global $conf; + global $conf; - $error = 0; + $error = 0; - $sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET"; - $sql .= " fk_soc = ".$this->fk_soc; - // TODO Add missing fields - $sql .= " WHERE rowid = ".$this->id; + $sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET"; + $sql .= " fk_soc = ".$this->fk_soc; + // TODO Add missing fields + $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - if (!$error) - { - $result = $this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } + dol_syslog(get_class($this)."::update", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + if (!$error) + { + $result = $this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } - if (!$error && !$notrigger) - { - // Call trigger - $result = $this->call_trigger('BILLREC_UPDATE', $user); - if ($result < 0) - { - $this->db->rollback(); - return -2; - } - // End call triggers - } - $this->db->commit(); - return 1; - } else { - $this->error = $this->db->lasterror(); - $this->db->rollback(); - return -2; - } + if (!$error && !$notrigger) + { + // Call trigger + $result = $this->call_trigger('BILLREC_UPDATE', $user); + if ($result < 0) + { + $this->db->rollback(); + return -2; + } + // End call triggers + } + $this->db->commit(); + return 1; + } else { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return -2; + } } /** @@ -498,13 +498,13 @@ class FactureRec extends CommonInvoice $sql .= ', f.remise_percent, f.remise_absolue, f.remise'; $sql .= ', f.date_lim_reglement as dlr'; $sql .= ', f.note_private, f.note_public, f.fk_user_author'; - $sql .= ', f.modelpdf'; + $sql .= ', f.modelpdf'; $sql .= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project'; $sql .= ', f.fk_account'; $sql .= ', f.frequency, f.unit_frequency, f.date_when, f.date_last_gen, f.nb_gen_done, f.nb_gen_max, f.usenewprice, f.auto_validate'; - $sql .= ', f.generate_pdf'; - $sql .= ", f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc"; - $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; + $sql .= ', f.generate_pdf'; + $sql .= ", f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc"; + $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql .= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc'; //$sql.= ', el.fk_source'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f'; @@ -618,21 +618,21 @@ class FactureRec extends CommonInvoice */ public function getLinesArray() { - return $this->fetch_lines(); + return $this->fetch_lines(); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Get lines of template invoices into this->lines * * @return int 1 if OK, < 0 if KO - */ + */ public function fetch_lines() { global $extrafields; - // phpcs:enable + // phpcs:enable $this->lines = array(); // Retrieve all extrafield for line @@ -710,7 +710,7 @@ class FactureRec extends CommonInvoice $line->rang = $objp->rang; $line->special_code = $objp->special_code; $line->fk_unit = $objp->fk_unit; - $line->fk_contract_line = $objp->fk_contract_line; + $line->fk_contract_line = $objp->fk_contract_line; // Ne plus utiliser $line->price = $objp->price; @@ -750,17 +750,17 @@ class FactureRec extends CommonInvoice */ public function delete(User $user, $notrigger = 0, $idwarehouse = -1) { - $rowid = $this->id; + $rowid = $this->id; - dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG); + dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG); - $error = 0; + $error = 0; $this->db->begin(); $main = MAIN_DB_PREFIX.'facturedet_rec'; - $ef = $main."_extrafields"; - $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture = $rowid)"; - dol_syslog($sqlef); + $ef = $main."_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture = $rowid)"; + dol_syslog($sqlef); $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = ".$rowid; dol_syslog($sql); if ($this->db->query($sqlef) && $this->db->query($sql)) @@ -773,8 +773,8 @@ class FactureRec extends CommonInvoice $res = $this->deleteObjectLinked(); if ($res < 0) $error = -3; // Delete extrafields - $res = $this->deleteExtraFields(); - if ($res < 0) $error = -4; + $res = $this->deleteExtraFields(); + if ($res < 0) $error = -4; } else { $this->error = $this->db->lasterror(); $error = -1; @@ -786,11 +786,11 @@ class FactureRec extends CommonInvoice if (!$error) { - $this->db->commit(); - return 1; + $this->db->commit(); + return 1; } else { - $this->db->rollback(); - return $error; + $this->db->rollback(); + return $error; } } @@ -798,33 +798,33 @@ class FactureRec extends CommonInvoice /** * Add a line to invoice * - * @param string $desc Description de la ligne - * @param double $pu_ht Prix unitaire HT (> 0 even for credit note) - * @param double $qty Quantite - * @param double $txtva Taux de tva force, sinon -1 + * @param string $desc Description de la ligne + * @param double $pu_ht Prix unitaire HT (> 0 even for credit note) + * @param double $qty Quantite + * @param double $txtva Taux de tva force, sinon -1 * @param double $txlocaltax1 Local tax 1 rate (deprecated) * @param double $txlocaltax2 Local tax 2 rate (deprecated) - * @param int $fk_product Product/Service ID predefined - * @param double $remise_percent Percentage discount of the line - * @param string $price_base_type HT or TTC - * @param int $info_bits VAT npr or not ? - * @param int $fk_remise_except Id remise - * @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note) - * @param int $type Type of line (0=product, 1=service) - * @param int $rang Position of line - * @param int $special_code Special code - * @param string $label Label of the line - * @param string $fk_unit Unit + * @param int $fk_product Product/Service ID predefined + * @param double $remise_percent Percentage discount of the line + * @param string $price_base_type HT or TTC + * @param int $info_bits VAT npr or not ? + * @param int $fk_remise_except Id remise + * @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note) + * @param int $type Type of line (0=product, 1=service) + * @param int $rang Position of line + * @param int $special_code Special code + * @param string $label Label of the line + * @param string $fk_unit Unit * @param double $pu_ht_devise Unit price in currency * @param int $date_start_fill 1=Flag to fill start date when generating invoice * @param int $date_end_fill 1=Flag to fill end date when generating invoice * @param int $fk_fournprice Supplier price id (to calculate margin) or '' * @param int $pa_ht Buying price of line (to calculate margin) or '' - * @return int <0 if KO, Id of line if OK + * @return int <0 if KO, Id of line if OK */ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0) { - global $mysoc; + global $mysoc; $facid = $this->id; @@ -1008,131 +1008,131 @@ class FactureRec extends CommonInvoice */ public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0) { - global $mysoc; + global $mysoc; - $facid = $this->id; + $facid = $this->id; - dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG); - include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG); + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; - // Clean parameters - if (empty($remise_percent)) $remise_percent = 0; + // Clean parameters + if (empty($remise_percent)) $remise_percent = 0; - // Check parameters - if ($type < 0) return -1; + // Check parameters + if ($type < 0) return -1; - if ($this->brouillon) - { - // Clean parameters - $remise_percent = price2num($remise_percent); - $qty = price2num($qty); - if (empty($info_bits)) $info_bits = 0; - $pu_ht = price2num($pu_ht); - $pu_ttc = price2num($pu_ttc); - $pu_ht_devise = price2num($pu_ht_devise); - $txtva = price2num($txtva); - $txlocaltax1 = price2num($txlocaltax1); - $txlocaltax2 = price2num($txlocaltax2); - if (empty($txlocaltax1)) $txlocaltax1 = 0; - if (empty($txlocaltax2)) $txlocaltax2 = 0; + if ($this->brouillon) + { + // Clean parameters + $remise_percent = price2num($remise_percent); + $qty = price2num($qty); + if (empty($info_bits)) $info_bits = 0; + $pu_ht = price2num($pu_ht); + $pu_ttc = price2num($pu_ttc); + $pu_ht_devise = price2num($pu_ht_devise); + $txtva = price2num($txtva); + $txlocaltax1 = price2num($txlocaltax1); + $txlocaltax2 = price2num($txlocaltax2); + if (empty($txlocaltax1)) $txlocaltax1 = 0; + if (empty($txlocaltax2)) $txlocaltax2 = 0; - if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice = 0; - if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht = 0; - if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva = 0; - if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc = 0; + if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice = 0; + if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht = 0; + if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva = 0; + if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc = 0; - if ($price_base_type == 'HT') - { - $pu = $pu_ht; - } else { - $pu = $pu_ttc; - } + if ($price_base_type == 'HT') + { + $pu = $pu_ht; + } else { + $pu = $pu_ttc; + } - // Calculate total with, without tax and tax from qty, pu, remise_percent and txtva - // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker - // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. + // Calculate total with, without tax and tax from qty, pu, remise_percent and txtva + // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker + // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); + $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); - // Clean vat code - $vat_src_code = ''; - if (preg_match('/\((.*)\)/', $txtva, $reg)) - { - $vat_src_code = $reg[1]; - $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. - } + // Clean vat code + $vat_src_code = ''; + if (preg_match('/\((.*)\)/', $txtva, $reg)) + { + $vat_src_code = $reg[1]; + $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + } - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); - $total_ht = $tabprice[0]; - $total_tva = $tabprice[1]; - $total_ttc = $tabprice[2]; - $total_localtax1 = $tabprice[9]; - $total_localtax2 = $tabprice[10]; - $pu_ht = $tabprice[3]; - $pu_tva = $tabprice[4]; - $pu_ttc = $tabprice[5]; + $total_ht = $tabprice[0]; + $total_tva = $tabprice[1]; + $total_ttc = $tabprice[2]; + $total_localtax1 = $tabprice[9]; + $total_localtax2 = $tabprice[10]; + $pu_ht = $tabprice[3]; + $pu_tva = $tabprice[4]; + $pu_ttc = $tabprice[5]; - // MultiCurrency - $multicurrency_total_ht = $tabprice[16]; - $multicurrency_total_tva = $tabprice[17]; - $multicurrency_total_ttc = $tabprice[18]; - $pu_ht_devise = $tabprice[19]; + // MultiCurrency + $multicurrency_total_ht = $tabprice[16]; + $multicurrency_total_tva = $tabprice[17]; + $multicurrency_total_ttc = $tabprice[18]; + $pu_ht_devise = $tabprice[19]; - $product_type = $type; - if ($fk_product) - { - $product = new Product($this->db); - $result = $product->fetch($fk_product); - $product_type = $product->type; - } + $product_type = $type; + if ($fk_product) + { + $product = new Product($this->db); + $result = $product->fetch($fk_product); + $product_type = $product->type; + } - $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET "; - $sql .= "fk_facture = ".((int) $facid); - $sql .= ", label=".(!empty($label) ? "'".$this->db->escape($label)."'" : "null"); - $sql .= ", description='".$this->db->escape($desc)."'"; - $sql .= ", price=".price2num($pu_ht); - $sql .= ", qty=".price2num($qty); - $sql .= ", tva_tx=".price2num($txtva); - $sql .= ", vat_src_code='".$this->db->escape($vat_src_code)."'"; - $sql .= ", localtax1_tx=".$txlocaltax1; - $sql .= ", localtax1_type='".$this->db->escape($localtaxes_type[0])."'"; - $sql .= ", localtax2_tx=".$txlocaltax2; - $sql .= ", localtax2_type='".$this->db->escape($localtaxes_type[2])."'"; - $sql .= ", fk_product=".(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : "null"); - $sql .= ", product_type=".$product_type; - $sql .= ", remise_percent='".price2num($remise_percent)."'"; - $sql .= ", subprice='".price2num($pu_ht)."'"; - $sql .= ", total_ht='".price2num($total_ht)."'"; - $sql .= ", total_tva='".price2num($total_tva)."'"; - $sql .= ", total_localtax1='".price2num($total_localtax1)."'"; - $sql .= ", total_localtax2='".price2num($total_localtax2)."'"; - $sql .= ", total_ttc='".price2num($total_ttc)."'"; - $sql .= ", date_start_fill=".((int) $date_start_fill); - $sql .= ", date_end_fill=".((int) $date_end_fill); - $sql .= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : 'null'); - $sql .= ", buy_price_ht=".($pa_ht ? price2num($pa_ht) : 0); - $sql .= ", info_bits=".$info_bits; - $sql .= ", rang=".$rang; - $sql .= ", special_code=".$special_code; - $sql .= ", fk_unit=".($fk_unit ? "'".$this->db->escape($fk_unit)."'" : "null"); - $sql .= ', multicurrency_subprice = '.$pu_ht_devise; - $sql .= ', multicurrency_total_ht = '.$multicurrency_total_ht; - $sql .= ', multicurrency_total_tva = '.$multicurrency_total_tva; - $sql .= ', multicurrency_total_ttc = '.$multicurrency_total_ttc; - $sql .= " WHERE rowid = ".$rowid; + $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET "; + $sql .= "fk_facture = ".((int) $facid); + $sql .= ", label=".(!empty($label) ? "'".$this->db->escape($label)."'" : "null"); + $sql .= ", description='".$this->db->escape($desc)."'"; + $sql .= ", price=".price2num($pu_ht); + $sql .= ", qty=".price2num($qty); + $sql .= ", tva_tx=".price2num($txtva); + $sql .= ", vat_src_code='".$this->db->escape($vat_src_code)."'"; + $sql .= ", localtax1_tx=".$txlocaltax1; + $sql .= ", localtax1_type='".$this->db->escape($localtaxes_type[0])."'"; + $sql .= ", localtax2_tx=".$txlocaltax2; + $sql .= ", localtax2_type='".$this->db->escape($localtaxes_type[2])."'"; + $sql .= ", fk_product=".(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : "null"); + $sql .= ", product_type=".$product_type; + $sql .= ", remise_percent='".price2num($remise_percent)."'"; + $sql .= ", subprice='".price2num($pu_ht)."'"; + $sql .= ", total_ht='".price2num($total_ht)."'"; + $sql .= ", total_tva='".price2num($total_tva)."'"; + $sql .= ", total_localtax1='".price2num($total_localtax1)."'"; + $sql .= ", total_localtax2='".price2num($total_localtax2)."'"; + $sql .= ", total_ttc='".price2num($total_ttc)."'"; + $sql .= ", date_start_fill=".((int) $date_start_fill); + $sql .= ", date_end_fill=".((int) $date_end_fill); + $sql .= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : 'null'); + $sql .= ", buy_price_ht=".($pa_ht ? price2num($pa_ht) : 0); + $sql .= ", info_bits=".$info_bits; + $sql .= ", rang=".$rang; + $sql .= ", special_code=".$special_code; + $sql .= ", fk_unit=".($fk_unit ? "'".$this->db->escape($fk_unit)."'" : "null"); + $sql .= ', multicurrency_subprice = '.$pu_ht_devise; + $sql .= ', multicurrency_total_ht = '.$multicurrency_total_ht; + $sql .= ', multicurrency_total_tva = '.$multicurrency_total_tva; + $sql .= ', multicurrency_total_ttc = '.$multicurrency_total_ttc; + $sql .= " WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::updateline", LOG_DEBUG); - if ($this->db->query($sql)) - { - $this->id = $facid; - $this->update_price(); - return 1; - } else { - $this->error = $this->db->lasterror(); - return -1; - } - } + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); + if ($this->db->query($sql)) + { + $this->id = $facid; + $this->update_price(); + return 1; + } else { + $this->error = $this->db->lasterror(); + return -1; + } + } } @@ -1328,8 +1328,8 @@ class FactureRec extends CommonInvoice * @param int $max Maxlength of ref * @param int $short 1=Return just URL * @param string $moretitle Add more text to title tooltip - * @param int $notooltip 1=Disable tooltip - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $notooltip 1=Disable tooltip + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = '', $save_lastsearch_value = -1) @@ -1356,17 +1356,17 @@ class FactureRec extends CommonInvoice } } - $url = DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$this->id; + $url = DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$this->id; - if ($short) return $url; + if ($short) return $url; - if ($option != 'nolink') - { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; - } + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; + } $linkstart = ''; $linkend = ''; @@ -1391,7 +1391,7 @@ class FactureRec extends CommonInvoice return $this->LibStatut($this->frequency ? 1 : 0, $this->suspended, $mode, $alreadypaid, empty($this->type) ? 0 : $this->type); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return label of a status * @@ -1404,7 +1404,7 @@ class FactureRec extends CommonInvoice */ public function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0) { - // phpcs:enable + // phpcs:enable global $langs; $langs->load('bills'); @@ -1553,7 +1553,7 @@ class FactureRec extends CommonInvoice $arraynow = dol_getdate($now); $nownotime = dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); - // Load array of products prodids + // Load array of products prodids $num_prods = 0; $prodids = array(); @@ -1690,190 +1690,190 @@ class FactureRec extends CommonInvoice } /** - * Update frequency and unit - * - * @param int $frequency value of frequency - * @param string $unit unit of frequency (d, m, y) - * @return int <0 if KO, >0 if OK - */ - public function setFrequencyAndUnit($frequency, $unit) - { - if (!$this->table_element) { - dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with property table_element not defined", LOG_ERR); - return -1; - } - - if (!empty($frequency) && empty($unit)) { - dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined", LOG_ERR); - return -2; - } - - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' SET frequency = '.($frequency ? $this->db->escape($frequency) : 'null'); - if (!empty($unit)) { - $sql .= ', unit_frequency = \''.$this->db->escape($unit).'\''; + * Update frequency and unit + * + * @param int $frequency value of frequency + * @param string $unit unit of frequency (d, m, y) + * @return int <0 if KO, >0 if OK + */ + public function setFrequencyAndUnit($frequency, $unit) + { + if (!$this->table_element) { + dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with property table_element not defined", LOG_ERR); + return -1; } - $sql .= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::setFrequencyAndUnit", LOG_DEBUG); - if ($this->db->query($sql)) { - $this->frequency = $frequency; - if (!empty($unit)) $this->unit_frequency = $unit; - return 1; - } else { - dol_print_error($this->db); - return -1; - } - } + if (!empty($frequency) && empty($unit)) { + dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined", LOG_ERR); + return -2; + } + + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; + $sql .= ' SET frequency = '.($frequency ? $this->db->escape($frequency) : 'null'); + if (!empty($unit)) { + $sql .= ', unit_frequency = \''.$this->db->escape($unit).'\''; + } + $sql .= ' WHERE rowid = '.$this->id; + + dol_syslog(get_class($this)."::setFrequencyAndUnit", LOG_DEBUG); + if ($this->db->query($sql)) { + $this->frequency = $frequency; + if (!empty($unit)) $this->unit_frequency = $unit; + return 1; + } else { + dol_print_error($this->db); + return -1; + } + } /** - * Update the next date of execution - * - * @param datetime $date date of execution - * @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done - * @return int <0 if KO, >0 if OK - */ - public function setNextDate($date, $increment_nb_gen_done = 0) - { - if (!$this->table_element) - { - dol_syslog(get_class($this)."::setNextDate was called on objet with property table_element not defined", LOG_ERR); - return -1; - } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "null"); - if ($increment_nb_gen_done > 0) $sql .= ', nb_gen_done = nb_gen_done + 1'; - $sql .= ' WHERE rowid = '.$this->id; + * Update the next date of execution + * + * @param datetime $date date of execution + * @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done + * @return int <0 if KO, >0 if OK + */ + public function setNextDate($date, $increment_nb_gen_done = 0) + { + if (!$this->table_element) + { + dol_syslog(get_class($this)."::setNextDate was called on objet with property table_element not defined", LOG_ERR); + return -1; + } + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; + $sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "null"); + if ($increment_nb_gen_done > 0) $sql .= ', nb_gen_done = nb_gen_done + 1'; + $sql .= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::setNextDate", LOG_DEBUG); - if ($this->db->query($sql)) - { - $this->date_when = $date; - if ($increment_nb_gen_done > 0) $this->nb_gen_done++; - return 1; - } else { - dol_print_error($this->db); - return -1; - } - } + dol_syslog(get_class($this)."::setNextDate", LOG_DEBUG); + if ($this->db->query($sql)) + { + $this->date_when = $date; + if ($increment_nb_gen_done > 0) $this->nb_gen_done++; + return 1; + } else { + dol_print_error($this->db); + return -1; + } + } /** - * Update the maximum period - * - * @param int $nb number of maximum period - * @return int <0 if KO, >0 if OK - */ - public function setMaxPeriod($nb) - { - if (!$this->table_element) - { - dol_syslog(get_class($this)."::setMaxPeriod was called on objet with property table_element not defined", LOG_ERR); - return -1; - } + * Update the maximum period + * + * @param int $nb number of maximum period + * @return int <0 if KO, >0 if OK + */ + public function setMaxPeriod($nb) + { + if (!$this->table_element) + { + dol_syslog(get_class($this)."::setMaxPeriod was called on objet with property table_element not defined", LOG_ERR); + return -1; + } - if (empty($nb)) $nb = 0; + if (empty($nb)) $nb = 0; - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' SET nb_gen_max = '.$nb; - $sql .= ' WHERE rowid = '.$this->id; + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; + $sql .= ' SET nb_gen_max = '.$nb; + $sql .= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::setMaxPeriod", LOG_DEBUG); - if ($this->db->query($sql)) - { - $this->nb_gen_max = $nb; - return 1; - } else { - dol_print_error($this->db); - return -1; - } - } + dol_syslog(get_class($this)."::setMaxPeriod", LOG_DEBUG); + if ($this->db->query($sql)) + { + $this->nb_gen_max = $nb; + return 1; + } else { + dol_print_error($this->db); + return -1; + } + } /** - * Update the auto validate flag of invoice - * - * @param int $validate 0 to create in draft, 1 to create and validate invoice - * @return int <0 if KO, >0 if OK - */ - public function setAutoValidate($validate) - { - if (!$this->table_element) - { - dol_syslog(get_class($this)."::setAutoValidate was called on objet with property table_element not defined", LOG_ERR); - return -1; - } + * Update the auto validate flag of invoice + * + * @param int $validate 0 to create in draft, 1 to create and validate invoice + * @return int <0 if KO, >0 if OK + */ + public function setAutoValidate($validate) + { + if (!$this->table_element) + { + dol_syslog(get_class($this)."::setAutoValidate was called on objet with property table_element not defined", LOG_ERR); + return -1; + } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' SET auto_validate = '.$validate; - $sql .= ' WHERE rowid = '.$this->id; + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; + $sql .= ' SET auto_validate = '.$validate; + $sql .= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::setAutoValidate", LOG_DEBUG); - if ($this->db->query($sql)) - { - $this->auto_validate = $validate; - return 1; - } else { - dol_print_error($this->db); - return -1; - } - } + dol_syslog(get_class($this)."::setAutoValidate", LOG_DEBUG); + if ($this->db->query($sql)) + { + $this->auto_validate = $validate; + return 1; + } else { + dol_print_error($this->db); + return -1; + } + } - /** - * Update the auto generate documents - * - * @param int $validate 0 no document, 1 to generate document - * @return int <0 if KO, >0 if OK - */ - public function setGeneratePdf($validate) - { - if (!$this->table_element) - { - dol_syslog(get_class($this)."::setGeneratePdf was called on objet with property table_element not defined", LOG_ERR); - return -1; - } + /** + * Update the auto generate documents + * + * @param int $validate 0 no document, 1 to generate document + * @return int <0 if KO, >0 if OK + */ + public function setGeneratePdf($validate) + { + if (!$this->table_element) + { + dol_syslog(get_class($this)."::setGeneratePdf was called on objet with property table_element not defined", LOG_ERR); + return -1; + } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' SET generate_pdf = '.$validate; - $sql .= ' WHERE rowid = '.$this->id; + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; + $sql .= ' SET generate_pdf = '.$validate; + $sql .= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::setGeneratePdf", LOG_DEBUG); - if ($this->db->query($sql)) - { - $this->generate_pdf = $validate; - return 1; - } else { - dol_print_error($this->db); - return -1; - } - } + dol_syslog(get_class($this)."::setGeneratePdf", LOG_DEBUG); + if ($this->db->query($sql)) + { + $this->generate_pdf = $validate; + return 1; + } else { + dol_print_error($this->db); + return -1; + } + } - /** - * Update the model for documents - * - * @param string $model model of document generator - * @return int <0 if KO, >0 if OK - */ - public function setModelPdf($model) - { - if (!$this->table_element) - { - dol_syslog(get_class($this)."::setModelPdf was called on objet with property table_element not defined", LOG_ERR); - return -1; - } + /** + * Update the model for documents + * + * @param string $model model of document generator + * @return int <0 if KO, >0 if OK + */ + public function setModelPdf($model) + { + if (!$this->table_element) + { + dol_syslog(get_class($this)."::setModelPdf was called on objet with property table_element not defined", LOG_ERR); + return -1; + } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' SET modelpdf = "'.$model.'"'; - $sql .= ' WHERE rowid = '.$this->id; + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; + $sql .= ' SET modelpdf = "'.$model.'"'; + $sql .= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::setModelPdf", LOG_DEBUG); - if ($this->db->query($sql)) - { - $this->modelpdf = $model; - return 1; - } else { - dol_print_error($this->db); - return -1; - } - } + dol_syslog(get_class($this)."::setModelPdf", LOG_DEBUG); + if ($this->db->query($sql)) + { + $this->modelpdf = $model; + return 1; + } else { + dol_print_error($this->db); + return -1; + } + } } @@ -1898,206 +1898,206 @@ class FactureLigneRec extends CommonInvoiceLine public $date_end_fill; - /** - * Delete line in database - * - * @param User $user Object user - * @param int $notrigger Disable triggers - * @return int <0 if KO, >0 if OK - */ - public function delete(User $user, $notrigger = false) - { - $error = 0; + /** + * Delete line in database + * + * @param User $user Object user + * @param int $notrigger Disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + $error = 0; - $this->db->begin(); + $this->db->begin(); - if (!$error) { - if (!$notrigger) { - // Call triggers - $result = $this->call_trigger('LINEBILLREC_DELETE', $user); - if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail - // End call triggers - } - } + if (!$error) { + if (!$notrigger) { + // Call triggers + $result = $this->call_trigger('LINEBILLREC_DELETE', $user); + if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail + // End call triggers + } + } if (!$error) - { - $result = $this->deleteExtraFields(); - if ($result < 0) { - $error++; - } - } - - if (!$error) - { - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id; - - $res = $this->db->query($sql); - if ($res === false) { - $error++; - $this->errors[] = $this->db->lasterror(); - } - } - - // Commit or rollback - if ($error) { - $this->db->rollback(); - return -1; - } else { - $this->db->commit(); - return 1; + { + $result = $this->deleteExtraFields(); + if ($result < 0) { + $error++; + } } - } + + if (!$error) + { + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id; + + $res = $this->db->query($sql); + if ($res === false) { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + return -1; + } else { + $this->db->commit(); + return 1; + } + } - /** - * Get line of template invoice - * - * @param int $rowid Id of invoice - * @return int 1 if OK, < 0 if KO - */ - public function fetch($rowid) - { - $sql = 'SELECT l.rowid, l.fk_facture ,l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,'; - $sql .= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,'; - $sql .= ' l.date_start_fill, l.date_end_fill, l.info_bits, l.total_ht, l.total_tva, l.total_ttc,'; - $sql .= ' l.rang, l.special_code,'; - $sql .= ' l.fk_unit, l.fk_contract_line,'; - $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet_rec as l'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; - $sql .= ' WHERE l.rowid = '.$rowid; - $sql .= ' ORDER BY l.rang'; + /** + * Get line of template invoice + * + * @param int $rowid Id of invoice + * @return int 1 if OK, < 0 if KO + */ + public function fetch($rowid) + { + $sql = 'SELECT l.rowid, l.fk_facture ,l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,'; + $sql .= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,'; + $sql .= ' l.date_start_fill, l.date_end_fill, l.info_bits, l.total_ht, l.total_tva, l.total_ttc,'; + $sql .= ' l.rang, l.special_code,'; + $sql .= ' l.fk_unit, l.fk_contract_line,'; + $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet_rec as l'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; + $sql .= ' WHERE l.rowid = '.$rowid; + $sql .= ' ORDER BY l.rang'; - dol_syslog('FactureRec::fetch', LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) - { - $objp = $this->db->fetch_object($result); + dol_syslog('FactureRec::fetch', LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + $objp = $this->db->fetch_object($result); - $this->id = $objp->rowid; - $this->label = $objp->custom_label; // Label line - $this->desc = $objp->description; // Description line - $this->description = $objp->description; // Description line - $this->product_type = $objp->product_type; // Type of line - $this->ref = $objp->product_ref; // Ref product - $this->product_ref = $objp->product_ref; // Ref product - $this->libelle = $objp->product_label; // deprecated - $this->product_label = $objp->product_label; // Label product - $this->product_desc = $objp->product_desc; // Description product - $this->fk_product_type = $objp->fk_product_type; // Type of product - $this->qty = $objp->qty; - $this->price = $objp->price; - $this->subprice = $objp->subprice; - $this->fk_facture = $objp->fk_facture; - $this->vat_src_code = $objp->vat_src_code; - $this->tva_tx = $objp->tva_tx; - $this->localtax1_tx = $objp->localtax1_tx; - $this->localtax2_tx = $objp->localtax2_tx; - $this->localtax1_type = $objp->localtax1_type; - $this->localtax2_type = $objp->localtax2_type; - $this->remise_percent = $objp->remise_percent; - $this->fk_remise_except = $objp->fk_remise_except; - $this->fk_product = $objp->fk_product; - $this->date_start_fill = $objp->date_start_fill; - $this->date_end_fill = $objp->date_end_fill; - $this->info_bits = $objp->info_bits; - $this->total_ht = $objp->total_ht; - $this->total_tva = $objp->total_tva; - $this->total_ttc = $objp->total_ttc; - $this->code_ventilation = $objp->fk_code_ventilation; - $this->rang = $objp->rang; - $this->special_code = $objp->special_code; - $this->fk_unit = $objp->fk_unit; - $this->fk_contract_line = $objp->fk_contract_line; + $this->id = $objp->rowid; + $this->label = $objp->custom_label; // Label line + $this->desc = $objp->description; // Description line + $this->description = $objp->description; // Description line + $this->product_type = $objp->product_type; // Type of line + $this->ref = $objp->product_ref; // Ref product + $this->product_ref = $objp->product_ref; // Ref product + $this->libelle = $objp->product_label; // deprecated + $this->product_label = $objp->product_label; // Label product + $this->product_desc = $objp->product_desc; // Description product + $this->fk_product_type = $objp->fk_product_type; // Type of product + $this->qty = $objp->qty; + $this->price = $objp->price; + $this->subprice = $objp->subprice; + $this->fk_facture = $objp->fk_facture; + $this->vat_src_code = $objp->vat_src_code; + $this->tva_tx = $objp->tva_tx; + $this->localtax1_tx = $objp->localtax1_tx; + $this->localtax2_tx = $objp->localtax2_tx; + $this->localtax1_type = $objp->localtax1_type; + $this->localtax2_type = $objp->localtax2_type; + $this->remise_percent = $objp->remise_percent; + $this->fk_remise_except = $objp->fk_remise_except; + $this->fk_product = $objp->fk_product; + $this->date_start_fill = $objp->date_start_fill; + $this->date_end_fill = $objp->date_end_fill; + $this->info_bits = $objp->info_bits; + $this->total_ht = $objp->total_ht; + $this->total_tva = $objp->total_tva; + $this->total_ttc = $objp->total_ttc; + $this->code_ventilation = $objp->fk_code_ventilation; + $this->rang = $objp->rang; + $this->special_code = $objp->special_code; + $this->fk_unit = $objp->fk_unit; + $this->fk_contract_line = $objp->fk_contract_line; - $this->db->free($result); - return 1; - } else { - $this->error = $this->db->lasterror(); - return -3; - } - } + $this->db->free($result); + return 1; + } else { + $this->error = $this->db->lasterror(); + return -3; + } + } - /** - * Update a line to invoice_rec. - * - * @param User $user User - * @param int $notrigger No trigger - * @return int <0 if KO, Id of line if OK - */ - public function update(User $user, $notrigger = 0) - { - global $conf; + /** + * Update a line to invoice_rec. + * + * @param User $user User + * @param int $notrigger No trigger + * @return int <0 if KO, Id of line if OK + */ + public function update(User $user, $notrigger = 0) + { + global $conf; - $error = 0; + $error = 0; - include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; - $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET"; - $sql .= " fk_facture = ".$this->fk_facture; - $sql .= ", label=".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null"); - $sql .= ", description='".$this->db->escape($this->desc)."'"; - $sql .= ", price=".price2num($this->price); - $sql .= ", qty=".price2num($this->qty); - $sql .= ", tva_tx=".price2num($this->tva_tx); - $sql .= ", vat_src_code='".$this->db->escape($this->vat_src_code)."'"; - $sql .= ", localtax1_tx=".price2num($this->localtax1_tx); - $sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'"; - $sql .= ", localtax2_tx=".price2num($this->localtax2_tx); - $sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'"; - $sql .= ", fk_product=".($this->fk_product > 0 ? $this->fk_product : "null"); - $sql .= ", product_type=".$this->product_type; - $sql .= ", remise_percent='".price2num($this->remise_percent)."'"; - $sql .= ", subprice='".price2num($this->subprice)."'"; - $sql .= ", info_bits='".price2num($this->info_bits)."'"; - $sql .= ", date_start_fill=".(int) $this->date_start_fill; - $sql .= ", date_end_fill=".(int) $this->date_end_fill; - if (empty($this->skip_update_total)) { - $sql .= ", total_ht=".price2num($this->total_ht); - $sql .= ", total_tva=".price2num($this->total_tva); - $sql .= ", total_localtax1=".price2num($this->total_localtax1); - $sql .= ", total_localtax2=".price2num($this->total_localtax2); - $sql .= ", total_ttc=".price2num($this->total_ttc); - } - $sql .= ", rang=".$this->rang; - $sql .= ", special_code=".$this->special_code; - $sql .= ", fk_unit=".($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : "null"); - $sql .= ", fk_contract_line=".($this->fk_contract_line ? $this->fk_contract_line : "null"); - $sql .= " WHERE rowid = ".$this->id; + $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET"; + $sql .= " fk_facture = ".$this->fk_facture; + $sql .= ", label=".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null"); + $sql .= ", description='".$this->db->escape($this->desc)."'"; + $sql .= ", price=".price2num($this->price); + $sql .= ", qty=".price2num($this->qty); + $sql .= ", tva_tx=".price2num($this->tva_tx); + $sql .= ", vat_src_code='".$this->db->escape($this->vat_src_code)."'"; + $sql .= ", localtax1_tx=".price2num($this->localtax1_tx); + $sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'"; + $sql .= ", localtax2_tx=".price2num($this->localtax2_tx); + $sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'"; + $sql .= ", fk_product=".($this->fk_product > 0 ? $this->fk_product : "null"); + $sql .= ", product_type=".$this->product_type; + $sql .= ", remise_percent='".price2num($this->remise_percent)."'"; + $sql .= ", subprice='".price2num($this->subprice)."'"; + $sql .= ", info_bits='".price2num($this->info_bits)."'"; + $sql .= ", date_start_fill=".(int) $this->date_start_fill; + $sql .= ", date_end_fill=".(int) $this->date_end_fill; + if (empty($this->skip_update_total)) { + $sql .= ", total_ht=".price2num($this->total_ht); + $sql .= ", total_tva=".price2num($this->total_tva); + $sql .= ", total_localtax1=".price2num($this->total_localtax1); + $sql .= ", total_localtax2=".price2num($this->total_localtax2); + $sql .= ", total_ttc=".price2num($this->total_ttc); + } + $sql .= ", rang=".$this->rang; + $sql .= ", special_code=".$this->special_code; + $sql .= ", fk_unit=".($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : "null"); + $sql .= ", fk_contract_line=".($this->fk_contract_line ? $this->fk_contract_line : "null"); + $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::updateline", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - if (!$error) - { - $result = $this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + if (!$error) + { + $result = $this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } - if (!$error && !$notrigger) - { - // Call trigger - $result = $this->call_trigger('LINEBILLREC_UPDATE', $user); - if ($result < 0) - { - $this->db->rollback(); - return -2; - } - // End call triggers - } - $this->db->commit(); - return 1; - } else { - $this->error = $this->db->lasterror(); - $this->db->rollback(); - return -2; - } - } + if (!$error && !$notrigger) + { + // Call trigger + $result = $this->call_trigger('LINEBILLREC_UPDATE', $user); + if ($result < 0) + { + $this->db->rollback(); + return -2; + } + // End call triggers + } + $this->db->commit(); + return 1; + } else { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return -2; + } + } } diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index b99e4c35d1c..c3700d9e994 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -61,44 +61,44 @@ if ($_POST["cancel"] == $langs->trans("Cancel") && !$id) if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) { - $db->begin(); + $db->begin(); - $datev = dol_mktime(12, 0, 0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]); - $datep = dol_mktime(12, 0, 0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]); + $datev = dol_mktime(12, 0, 0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]); + $datep = dol_mktime(12, 0, 0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]); - $object->accountid = GETPOST("accountid"); - $object->paymenttype = GETPOST("paiementtype"); - $object->datev = $datev; - $object->datep = $datep; - $object->amount = price2num(GETPOST("amount")); + $object->accountid = GETPOST("accountid"); + $object->paymenttype = GETPOST("paiementtype"); + $object->datev = $datev; + $object->datep = $datep; + $object->amount = price2num(GETPOST("amount")); $object->label = GETPOST("label"); $object->ltt = $lttype; - $ret = $object->addPayment($user); - if ($ret > 0) - { - $db->commit(); - header("Location: list.php?localTaxType=".$lttype); - exit; - } else { - $db->rollback(); - setEventMessages($object->error, $object->errors, 'errors'); - $_GET["action"] = "create"; - } + $ret = $object->addPayment($user); + if ($ret > 0) + { + $db->commit(); + header("Location: list.php?localTaxType=".$lttype); + exit; + } else { + $db->rollback(); + setEventMessages($object->error, $object->errors, 'errors'); + $_GET["action"] = "create"; + } } //delete payment of localtax if ($action == 'delete') { - $result = $object->fetch($id); + $result = $object->fetch($id); if ($object->rappro == 0) { - $db->begin(); + $db->begin(); - $ret = $object->delete($user); - if ($ret > 0) - { + $ret = $object->delete($user); + if ($ret > 0) + { if ($object->fk_bank) { $accountline = new AccountLine($db); @@ -116,13 +116,13 @@ if ($action == 'delete') $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } else { - $db->rollback(); - setEventMessages($object->error, $object->errors, 'errors'); - } + } else { + $db->rollback(); + setEventMessages($object->error, $object->errors, 'errors'); + } } else { - $mesg = 'Error try do delete a line linked to a conciliated bank transaction'; - setEventMessages($mesg, null, 'errors'); + $mesg = 'Error try do delete a line linked to a conciliated bank transaction'; + setEventMessages($mesg, null, 'errors'); } } @@ -149,25 +149,25 @@ llxHeader("", $title, $helpurl); if ($action == 'create') { - print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code)); + print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code)); - print ''."\n"; - print ''; - print ''; - print ''; + print ''."\n"; + print ''; + print ''; + print ''; - print dol_get_fiche_head(); + print dol_get_fiche_head(); - print ''; + print '
    '; - print ""; - print ''; + print ""; + print ''; - print ''; + print ''; // Label print ''; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 11b225d0896..6e018e0bb84 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -32,79 +32,79 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; */ class ChargeSociales extends CommonObject { - /** + /** * @var string ID to identify managed object */ public $element = 'chargesociales'; - public $table = 'chargesociales'; + public $table = 'chargesociales'; - /** + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'chargesociales'; - /** - * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png - */ - public $picto = 'bill'; - - /** - * {@inheritdoc} - */ - protected $table_ref_field = 'ref'; - - /** - * @var integer|string $date_ech - */ - public $date_ech; - - - public $label; - public $type; - public $type_label; - public $amount; - public $paye; - public $periode; - - /** - * @var integer|string date_creation - */ - public $date_creation; - - /** - * @var integer|string $date_modification - */ - public $date_modification; - - /** - * @var integer|string $date_validation - */ - public $date_validation; - - /** - * @deprecated Use label instead - */ - public $lib; - - /** - * @var int account ID - */ - public $fk_account; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'bill'; /** - * @var int account ID (identical to fk_account) - */ - public $accountid; + * {@inheritdoc} + */ + protected $table_ref_field = 'ref'; - /** - * @var int payment type (identical to mode_reglement_id in commonobject class) - */ - public $paiementtype; + /** + * @var integer|string $date_ech + */ + public $date_ech; - /** - * @var int ID - */ + + public $label; + public $type; + public $type_label; + public $amount; + public $paye; + public $periode; + + /** + * @var integer|string date_creation + */ + public $date_creation; + + /** + * @var integer|string $date_modification + */ + public $date_modification; + + /** + * @var integer|string $date_validation + */ + public $date_validation; + + /** + * @deprecated Use label instead + */ + public $lib; + + /** + * @var int account ID + */ + public $fk_account; + + /** + * @var int account ID (identical to fk_account) + */ + public $accountid; + + /** + * @var int payment type (identical to mode_reglement_id in commonobject class) + */ + public $paiementtype; + + /** + * @var int ID + */ public $fk_project; @@ -112,73 +112,73 @@ class ChargeSociales extends CommonObject const STATUS_PAID = 1; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - } + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + } - /** - * Retrouve et charge une charge sociale - * - * @param int $id Id - * @param string $ref Ref - * @return int <0 KO >0 OK - */ - public function fetch($id, $ref = '') - { - $sql = "SELECT cs.rowid, cs.date_ech"; - $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; - $sql .= ", cs.fk_account, cs.fk_mode_reglement"; - $sql .= ", c.libelle"; - $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; - $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id"; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id'; - $sql .= ' WHERE cs.entity IN ('.getEntity('tax').')'; - if ($ref) $sql .= " AND cs.rowid = ".$ref; - else $sql .= " AND cs.rowid = ".$id; + /** + * Retrouve et charge une charge sociale + * + * @param int $id Id + * @param string $ref Ref + * @return int <0 KO >0 OK + */ + public function fetch($id, $ref = '') + { + $sql = "SELECT cs.rowid, cs.date_ech"; + $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; + $sql .= ", cs.fk_account, cs.fk_mode_reglement"; + $sql .= ", c.libelle"; + $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; + $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id"; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id'; + $sql .= ' WHERE cs.entity IN ('.getEntity('tax').')'; + if ($ref) $sql .= " AND cs.rowid = ".$ref; + else $sql .= " AND cs.rowid = ".$id; - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->ref = $obj->rowid; - $this->date_ech = $this->db->jdate($obj->date_ech); - $this->lib = $obj->label; - $this->label = $obj->label; - $this->type = $obj->fk_type; - $this->type_label = $obj->libelle; - $this->fk_account = $obj->fk_account; - $this->mode_reglement_id = $obj->fk_mode_reglement; - $this->mode_reglement_code = $obj->mode_reglement_code; - $this->mode_reglement = $obj->mode_reglement_libelle; - $this->amount = $obj->amount; + $this->id = $obj->rowid; + $this->ref = $obj->rowid; + $this->date_ech = $this->db->jdate($obj->date_ech); + $this->lib = $obj->label; + $this->label = $obj->label; + $this->type = $obj->fk_type; + $this->type_label = $obj->libelle; + $this->fk_account = $obj->fk_account; + $this->mode_reglement_id = $obj->fk_mode_reglement; + $this->mode_reglement_code = $obj->mode_reglement_code; + $this->mode_reglement = $obj->mode_reglement_libelle; + $this->amount = $obj->amount; $this->fk_project = $obj->fk_project; - $this->paye = $obj->paye; - $this->periode = $this->db->jdate($obj->periode); - $this->import_key = $this->import_key; + $this->paye = $obj->paye; + $this->periode = $this->db->jdate($obj->periode); + $this->import_key = $this->import_key; - $this->db->free($resql); + $this->db->free($resql); - return 1; - } else { - return 0; - } - } else { - $this->error = $this->db->lasterror(); - return -1; - } - } + return 1; + } else { + return 0; + } + } else { + $this->error = $this->db->lasterror(); + return -1; + } + } /** * Check if a social contribution can be created into database @@ -189,59 +189,59 @@ class ChargeSociales extends CommonObject { $newamount = price2num($this->amount, 'MT'); - // Validation parametres - if (!$newamount > 0 || empty($this->date_ech) || empty($this->periode)) - { - return false; - } + // Validation parametres + if (!$newamount > 0 || empty($this->date_ech) || empty($this->periode)) + { + return false; + } return true; } - /** - * Create a social contribution into database - * - * @param User $user User making creation - * @return int <0 if KO, id if OK - */ - public function create($user) - { - global $conf; + /** + * Create a social contribution into database + * + * @param User $user User making creation + * @return int <0 if KO, id if OK + */ + public function create($user) + { + global $conf; $error = 0; - $now = dol_now(); + $now = dol_now(); - // Nettoyage parametres - $newamount = price2num($this->amount, 'MT'); + // Nettoyage parametres + $newamount = price2num($this->amount, 'MT'); if (!$this->check()) { $this->error = "ErrorBadParameter"; return -2; } - $this->db->begin(); + $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, date_creation)"; - $sql .= " VALUES (".$this->type; - $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); - $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "NULL"); - $sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'"; - $sql .= ", '".$this->db->idate($this->date_ech)."'"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, date_creation)"; + $sql .= " VALUES (".$this->type; + $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); + $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "NULL"); + $sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'"; + $sql .= ", '".$this->db->idate($this->date_ech)."'"; $sql .= ", '".$this->db->idate($this->periode)."'"; - $sql .= ", '".price2num($newamount)."'"; + $sql .= ", '".price2num($newamount)."'"; $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 'NULL'); - $sql .= ", ".$conf->entity; - $sql .= ", ".$user->id; - $sql .= ", '".$this->db->idate($now)."'"; - $sql .= ")"; + $sql .= ", ".$conf->entity; + $sql .= ", ".$user->id; + $sql .= ", '".$this->db->idate($now)."'"; + $sql .= ")"; - dol_syslog(get_class($this)."::create", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales"); + dol_syslog(get_class($this)."::create", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales"); - //dol_syslog("ChargesSociales::create this->id=".$this->id); + //dol_syslog("ChargesSociales::create this->id=".$this->id); $result = $this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user); if ($result < 0) $error++; @@ -252,429 +252,429 @@ class ChargeSociales extends CommonObject $this->db->rollback(); return -1 * $error; } - } else { - $this->error = $this->db->error(); - $this->db->rollback(); - return -1; - } - } + } else { + $this->error = $this->db->error(); + $this->db->rollback(); + return -1; + } + } - /** - * Delete a social contribution - * - * @param User $user Object user making delete - * @return int <0 if KO, >0 if OK - */ - public function delete($user) - { - $error = 0; + /** + * Delete a social contribution + * + * @param User $user Object user making delete + * @return int <0 if KO, >0 if OK + */ + public function delete($user) + { + $error = 0; - $this->db->begin(); + $this->db->begin(); - // Get bank transaction lines for this social contributions - include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - $account = new Account($this->db); - $lines_url = $account->get_url('', $this->id, 'sc'); + // Get bank transaction lines for this social contributions + include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + $account = new Account($this->db); + $lines_url = $account->get_url('', $this->id, 'sc'); - // Delete bank urls - foreach ($lines_url as $line_url) - { - if (!$error) - { - $accountline = new AccountLine($this->db); - $accountline->fetch($line_url['fk_bank']); - $result = $accountline->delete_urls($user); - if ($result < 0) - { - $error++; - } - } - } + // Delete bank urls + foreach ($lines_url as $line_url) + { + if (!$error) + { + $accountline = new AccountLine($this->db); + $accountline->fetch($line_url['fk_bank']); + $result = $accountline->delete_urls($user); + if ($result < 0) + { + $error++; + } + } + } - // Delete payments - if (!$error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge=".$this->id; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) - { - $error++; - $this->error = $this->db->lasterror(); - } - } + // Delete payments + if (!$error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge=".$this->id; + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) + { + $error++; + $this->error = $this->db->lasterror(); + } + } - if (!$error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) - { - $error++; - $this->error = $this->db->lasterror(); - } - } + if (!$error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".$this->id; + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) + { + $error++; + $this->error = $this->db->lasterror(); + } + } - if (!$error) - { - $this->db->commit(); - return 1; - } else { - $this->db->rollback(); - return -1; - } - } + if (!$error) + { + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + return -1; + } + } - /** - * Update social or fiscal contribution - * - * @param User $user User that modify - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK - */ - public function update($user, $notrigger = 0) - { - $error = 0; - $this->db->begin(); + /** + * Update social or fiscal contribution + * + * @param User $user User that modify + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update($user, $notrigger = 0) + { + $error = 0; + $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales"; - $sql .= " SET libelle='".$this->db->escape($this->label ? $this->label : $this->lib)."'"; - $sql .= ", date_ech='".$this->db->idate($this->date_ech)."'"; - $sql .= ", periode='".$this->db->idate($this->periode)."'"; - $sql .= ", amount='".price2num($this->amount, 'MT')."'"; - $sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL"); - $sql .= ", fk_user_modif=".$user->id; - $sql .= " WHERE rowid=".$this->id; + $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales"; + $sql .= " SET libelle='".$this->db->escape($this->label ? $this->label : $this->lib)."'"; + $sql .= ", date_ech='".$this->db->idate($this->date_ech)."'"; + $sql .= ", periode='".$this->db->idate($this->periode)."'"; + $sql .= ", amount='".price2num($this->amount, 'MT')."'"; + $sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL"); + $sql .= ", fk_user_modif=".$user->id; + $sql .= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update", LOG_DEBUG); - $resql = $this->db->query($sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); + $resql = $this->db->query($sql); - if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); - } + if (!$resql) { + $error++; $this->errors[] = "Error ".$this->db->lasterror(); + } - if (!$error) - { - if (!$notrigger) - { - // Call trigger - $result = $this->call_trigger('SOCIALCHARGES_MODIFY', $user); - if ($result < 0) $error++; - // End call triggers - } - } + if (!$error) + { + if (!$notrigger) + { + // Call trigger + $result = $this->call_trigger('SOCIALCHARGES_MODIFY', $user); + if ($result < 0) $error++; + // End call triggers + } + } - // Commit or rollback - if ($error) - { - foreach ($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } else { - $this->db->commit(); - return 1; - } - } + // Commit or rollback + if ($error) + { + foreach ($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; + } else { + $this->db->commit(); + return 1; + } + } - /** - * Calculate amount remaining to pay by year - * - * @param int $year Year - * @return number - */ - public function solde($year = 0) - { - global $conf; + /** + * Calculate amount remaining to pay by year + * + * @param int $year Year + * @return number + */ + public function solde($year = 0) + { + global $conf; - $sql = "SELECT SUM(f.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f"; - $sql .= " WHERE f.entity = ".$conf->entity; - $sql .= " AND paye = 0"; + $sql = "SELECT SUM(f.amount) as amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f"; + $sql .= " WHERE f.entity = ".$conf->entity; + $sql .= " AND paye = 0"; - if ($year) { - $sql .= " AND f.datev >= '".((int) $year)."-01-01' AND f.datev <= '".((int) $year)."-12-31' "; - } + if ($year) { + $sql .= " AND f.datev >= '".((int) $year)."-01-01' AND f.datev <= '".((int) $year)."-12-31' "; + } - $result = $this->db->query($sql); - if ($result) - { - if ($this->db->num_rows($result)) - { - $obj = $this->db->fetch_object($result); - $this->db->free($result); - return $obj->amount; - } else { - return 0; - } - } else { - print $this->db->error(); - return -1; - } - } + $result = $this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->db->free($result); + return $obj->amount; + } else { + return 0; + } + } else { + print $this->db->error(); + return -1; + } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Tag social contribution as payed completely - * - * @param User $user Object user making change - * @return int <0 if KO, >0 if OK - */ - public function set_paid($user) - { - // phpcs:enable - $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; - $sql .= " paye = 1"; - $sql .= " WHERE rowid = ".$this->id; - $return = $this->db->query($sql); - if ($return) return 1; - else return -1; - } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Tag social contribution as payed completely + * + * @param User $user Object user making change + * @return int <0 if KO, >0 if OK + */ + public function set_paid($user) + { + // phpcs:enable + $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; + $sql .= " paye = 1"; + $sql .= " WHERE rowid = ".$this->id; + $return = $this->db->query($sql); + if ($return) return 1; + else return -1; + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Remove tag payed on social contribution - * - * @param User $user Object user making change - * @return int <0 if KO, >0 if OK - */ - public function set_unpaid($user) - { - // phpcs:enable - $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; - $sql .= " paye = 0"; - $sql .= " WHERE rowid = ".$this->id; - $return = $this->db->query($sql); - if ($return) return 1; - else return -1; - } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Remove tag payed on social contribution + * + * @param User $user Object user making change + * @return int <0 if KO, >0 if OK + */ + public function set_unpaid($user) + { + // phpcs:enable + $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; + $sql .= " paye = 0"; + $sql .= " WHERE rowid = ".$this->id; + $return = $this->db->query($sql); + if ($return) return 1; + else return -1; + } - /** - * Retourne le libelle du statut d'une charge (impaye, payee) - * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto + /** + * Retourne le libelle du statut d'une charge (impaye, payee) + * + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) - * @return string Label - */ - public function getLibStatut($mode = 0, $alreadypaid = -1) - { - return $this->LibStatut($this->paye, $mode, $alreadypaid); - } + * @return string Label + */ + public function getLibStatut($mode = 0, $alreadypaid = -1) + { + return $this->LibStatut($this->paye, $mode, $alreadypaid); + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Renvoi le libelle d'un statut donne - * - * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Renvoi le libelle d'un statut donne + * + * @param int $status Id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) - * @return string Label - */ - public function LibStatut($status, $mode = 0, $alreadypaid = -1) - { - // phpcs:enable - global $langs; + * @return string Label + */ + public function LibStatut($status, $mode = 0, $alreadypaid = -1) + { + // phpcs:enable + global $langs; - // Load translation files required by the page - $langs->loadLangs(array("customers", "bills")); + // Load translation files required by the page + $langs->loadLangs(array("customers", "bills")); - // We reinit status array to force to redefine them because label may change according to properties values. - $this->labelStatus = array(); - $this->labelStatusShort = array(); + // We reinit status array to force to redefine them because label may change according to properties values. + $this->labelStatus = array(); + $this->labelStatusShort = array(); - if (empty($this->labelStatus) || empty($this->labelStatusShort)) - { - global $langs; - //$langs->load("mymodule"); - $this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid'); - $this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid'); - if ($status == self::STATUS_UNPAID && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); - $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Unpaid'); - $this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Paid'); - if ($status == self::STATUS_UNPAID && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); - } + if (empty($this->labelStatus) || empty($this->labelStatusShort)) + { + global $langs; + //$langs->load("mymodule"); + $this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid'); + $this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid'); + if ($status == self::STATUS_UNPAID && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); + $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Unpaid'); + $this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Paid'); + if ($status == self::STATUS_UNPAID && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); + } - $statusType = 'status1'; - if ($status == 0 && $alreadypaid > 0) $statusType = 'status3'; - if ($status == 1) $statusType = 'status6'; + $statusType = 'status1'; + if ($status == 0 && $alreadypaid > 0) $statusType = 'status3'; + if ($status == 1) $statusType = 'status6'; - return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); - } + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); + } - /** + /** * Return a link to the object card (with optionaly the picto) * * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) - * @param int $maxlen Max length of label - * @param int $notooltip 1=Disable tooltip + * @param int $maxlen Max length of label + * @param int $notooltip 1=Disable tooltip * @param int $short 1=Return just URL - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @return string String with link - */ - public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $short = 0, $save_lastsearch_value = -1) - { - global $langs, $conf, $user, $form; + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with link + */ + public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $short = 0, $save_lastsearch_value = -1) + { + global $langs, $conf, $user, $form; - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips + if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips - $result = ''; + $result = ''; - $url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id; + $url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id; - if ($short) return $url; + if ($short) return $url; - if ($option !== 'nolink') - { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; - } + if ($option !== 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; + } - if (empty($this->ref)) $this->ref = $this->label; + if (empty($this->ref)) $this->ref = $this->label; - $label = ''.$langs->trans("SocialContribution").''; - if (!empty($this->ref)) - $label .= '
    '.$langs->trans('Ref').': '.$this->ref; - if (!empty($this->label)) - $label .= '
    '.$langs->trans('Label').': '.$this->label; - if (!empty($this->type_label)) - $label .= '
    '.$langs->trans('Type').': '.$this->type_label; + $label = ''.$langs->trans("SocialContribution").''; + if (!empty($this->ref)) + $label .= '
    '.$langs->trans('Ref').': '.$this->ref; + if (!empty($this->label)) + $label .= '
    '.$langs->trans('Label').': '.$this->label; + if (!empty($this->type_label)) + $label .= '
    '.$langs->trans('Type').': '.$this->type_label; - $linkclose = ''; - if (empty($notooltip) && $user->rights->facture->lire) - { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label = $langs->trans("SocialContribution"); - $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; - } + $linkclose = ''; + if (empty($notooltip) && $user->rights->facture->lire) + { + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label = $langs->trans("SocialContribution"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip"'; + } - $linkstart = ''; - $linkend = ''; + $linkstart = ''; + $linkend = ''; - $result .= $linkstart; - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); - if ($withpicto != 2) $result .= ($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref); - $result .= $linkend; + $result .= $linkstart; + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto != 2) $result .= ($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref); + $result .= $linkend; - return $result; - } + return $result; + } - /** - * Return amount of payments already done - * - * @return int Amount of payment already done, <0 if KO - */ - public function getSommePaiement() - { - $table = 'paiementcharge'; - $field = 'fk_charge'; + /** + * Return amount of payments already done + * + * @return int Amount of payment already done, <0 if KO + */ + public function getSommePaiement() + { + $table = 'paiementcharge'; + $field = 'fk_charge'; - $sql = 'SELECT sum(amount) as amount'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$table; - $sql .= ' WHERE '.$field.' = '.$this->id; + $sql = 'SELECT sum(amount) as amount'; + $sql .= ' FROM '.MAIN_DB_PREFIX.$table; + $sql .= ' WHERE '.$field.' = '.$this->id; - dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $amount = 0; + dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $amount = 0; - $obj = $this->db->fetch_object($resql); - if ($obj) $amount = $obj->amount ? $obj->amount : 0; + $obj = $this->db->fetch_object($resql); + if ($obj) $amount = $obj->amount ? $obj->amount : 0; - $this->db->free($resql); - return $amount; - } else { - return -1; - } - } + $this->db->free($resql); + return $amount; + } else { + return -1; + } + } - /** - * Charge les informations d'ordre info dans l'objet entrepot - * - * @param int $id Id of social contribution - * @return int <0 if KO, >0 if OK - */ - public function info($id) - { - $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,"; - $sql .= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid"; + /** + * Charge les informations d'ordre info dans l'objet entrepot + * + * @param int $id Id of social contribution + * @return int <0 if KO, >0 if OK + */ + public function info($id) + { + $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,"; + $sql .= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid"; $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as e"; - $sql .= " WHERE e.rowid = ".$id; + $sql .= " WHERE e.rowid = ".$id; - dol_syslog(get_class($this)."::info", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) - { - if ($this->db->num_rows($result)) - { - $obj = $this->db->fetch_object($result); + dol_syslog(get_class($this)."::info", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); - $this->id = $obj->rowid; + $this->id = $obj->rowid; - if ($obj->fk_user_author) { - $cuser = new User($this->db); - $cuser->fetch($obj->fk_user_author); - $this->user_creation = $cuser; - } + if ($obj->fk_user_author) { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } - if ($obj->fk_user_modif) { - $muser = new User($this->db); - $muser->fetch($obj->fk_user_modif); - $this->user_modification = $muser; - } + if ($obj->fk_user_modif) { + $muser = new User($this->db); + $muser->fetch($obj->fk_user_modif); + $this->user_modification = $muser; + } - if ($obj->fk_user_valid) { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; - } + if ($obj->fk_user_valid) { + $vuser = new User($this->db); + $vuser->fetch($obj->fk_user_valid); + $this->user_validation = $vuser; + } - $this->date_creation = $this->db->jdate($obj->datec); - $this->date_modification = $this->db->jdate($obj->datem); - $this->date_validation = $this->db->jdate($obj->datev); - $this->import_key = $obj->import_key; - } + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->datem); + $this->date_validation = $this->db->jdate($obj->datev); + $this->import_key = $obj->import_key; + } - $this->db->free($result); - } else { - dol_print_error($this->db); - } - } + $this->db->free($result); + } else { + dol_print_error($this->db); + } + } - /** - * Initialise an instance with random values. - * Used to build previews or test instances. - * id must be 0 if object instance is a specimen. - * - * @return void - */ - public function initAsSpecimen() - { - // Initialize parameters - $this->id = 0; - $this->ref = 'SPECIMEN'; - $this->specimen = 1; - $this->paye = 0; - $this->date = dol_now(); - $this->date_ech = $this->date + 3600 * 24 * 30; - $this->periode = $this->date + 3600 * 24 * 30; - $this->amount = 100; - $this->label = 'Social contribution label'; - $this->type = 1; - $this->type_label = 'Type of social contribution'; - } + /** + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void + */ + public function initAsSpecimen() + { + // Initialize parameters + $this->id = 0; + $this->ref = 'SPECIMEN'; + $this->specimen = 1; + $this->paye = 0; + $this->date = dol_now(); + $this->date_ech = $this->date + 3600 * 24 * 30; + $this->periode = $this->date + 3600 * 24 * 30; + $this->amount = 100; + $this->label = 'Social contribution label'; + $this->type = 1; + $this->type_label = 'Type of social contribution'; + } } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 034e436a612..c278eaeedb7 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -33,36 +33,36 @@ abstract class CommonInvoice extends CommonObject { use CommonIncoterm; - /** - * Standard invoice - */ - const TYPE_STANDARD = 0; + /** + * Standard invoice + */ + const TYPE_STANDARD = 0; - /** - * Replacement invoice - */ - const TYPE_REPLACEMENT = 1; + /** + * Replacement invoice + */ + const TYPE_REPLACEMENT = 1; - /** - * Credit note invoice - */ - const TYPE_CREDIT_NOTE = 2; + /** + * Credit note invoice + */ + const TYPE_CREDIT_NOTE = 2; - /** - * Deposit invoice - */ - const TYPE_DEPOSIT = 3; + /** + * Deposit invoice + */ + const TYPE_DEPOSIT = 3; - /** - * Proforma invoice. - * @deprectad Remove this. A "proforma invoice" is an order with a look of invoice, not an invoice ! - */ - const TYPE_PROFORMA = 4; + /** + * Proforma invoice. + * @deprectad Remove this. A "proforma invoice" is an order with a look of invoice, not an invoice ! + */ + const TYPE_PROFORMA = 4; - /** - * Situation invoice - */ - const TYPE_SITUATION = 5; + /** + * Situation invoice + */ + const TYPE_SITUATION = 5; /** * Draft status @@ -102,16 +102,16 @@ abstract class CommonInvoice extends CommonObject */ public function getRemainToPay($multicurrency = 0) { - $alreadypaid = 0.0; - $alreadypaid += $this->getSommePaiement($multicurrency); - $alreadypaid += $this->getSumDepositsUsed($multicurrency); - $alreadypaid += $this->getSumCreditNotesUsed($multicurrency); + $alreadypaid = 0.0; + $alreadypaid += $this->getSommePaiement($multicurrency); + $alreadypaid += $this->getSumDepositsUsed($multicurrency); + $alreadypaid += $this->getSumCreditNotesUsed($multicurrency); - $remaintopay = price2num($this->total_ttc - $alreadypaid, 'MT'); - if ($this->statut == self::STATUS_CLOSED && $this->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment - $remaintopay = 0.0; - } - return $remaintopay; + $remaintopay = price2num($this->total_ttc - $alreadypaid, 'MT'); + if ($this->statut == self::STATUS_CLOSED && $this->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment + $remaintopay = 0.0; + } + return $remaintopay; } /** @@ -151,7 +151,7 @@ abstract class CommonInvoice extends CommonObject /** * Return amount (with tax) of all deposits invoices used by invoice. - * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended). + * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended). * * @param int $multicurrency Return multicurrency_amount instead of amount * @return float <0 if KO, Sum of deposits amount otherwise @@ -159,21 +159,21 @@ abstract class CommonInvoice extends CommonObject public function getSumDepositsUsed($multicurrency = 0) { if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') - { - // TODO - return 0.0; - } + { + // TODO + return 0.0; + } - require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; - $discountstatic = new DiscountAbsolute($this->db); - $result = $discountstatic->getSumDepositsUsed($this, $multicurrency); - if ($result >= 0) { - return $result; - } else { - $this->error = $discountstatic->error; - return -1; - } + $discountstatic = new DiscountAbsolute($this->db); + $result = $discountstatic->getSumDepositsUsed($this, $multicurrency); + if ($result >= 0) { + return $result; + } else { + $this->error = $discountstatic->error; + return -1; + } } /** @@ -184,16 +184,16 @@ abstract class CommonInvoice extends CommonObject */ public function getSumCreditNotesUsed($multicurrency = 0) { - require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; - $discountstatic = new DiscountAbsolute($this->db); - $result = $discountstatic->getSumCreditNotesUsed($this, $multicurrency); - if ($result >= 0) { - return $result; - } else { - $this->error = $discountstatic->error; - return -1; - } + $discountstatic = new DiscountAbsolute($this->db); + $result = $discountstatic->getSumCreditNotesUsed($this, $multicurrency); + if ($result >= 0) { + return $result; + } else { + $this->error = $discountstatic->error; + return -1; + } } /** @@ -204,16 +204,16 @@ abstract class CommonInvoice extends CommonObject */ public function getSumFromThisCreditNotesNotUsed($multicurrency = 0) { - require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; - $discountstatic = new DiscountAbsolute($this->db); - $result = $discountstatic->getSumFromThisCreditNotesNotUsed($this, $multicurrency); - if ($result >= 0) { - return $result; - } else { - $this->error = $discountstatic->error; - return -1; - } + $discountstatic = new DiscountAbsolute($this->db); + $result = $discountstatic->getSumFromThisCreditNotesNotUsed($this, $multicurrency); + if ($result >= 0) { + return $result; + } else { + $this->error = $discountstatic->error; + return -1; + } } /** @@ -329,7 +329,7 @@ abstract class CommonInvoice extends CommonObject $obj = $this->db->fetch_object($resql); $tmp = array('amount'=>$obj->amount,'type'=>$obj->code, 'date'=>$obj->datep, 'num'=>$obj->num, 'ref'=>$obj->ref); if (!empty($field3)) { - $tmp['ref_ext'] = $obj->ref_ext; + $tmp['ref_ext'] = $obj->ref_ext; } $retarray[]=$tmp; $i++; @@ -385,7 +385,7 @@ abstract class CommonInvoice extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return if an invoice can be deleted * Rule is: @@ -399,9 +399,9 @@ abstract class CommonInvoice extends CommonObject * * @return int <=0 if no, >0 if yes */ - public function is_erasable() - { - // phpcs:enable + public function is_erasable() + { + // phpcs:enable global $conf; // We check if invoice is a temporary number (PROVxxxx) @@ -486,15 +486,15 @@ abstract class CommonInvoice extends CommonObject * * @return string Label of type of invoice */ - public function getLibType() + public function getLibType() { global $langs; - if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard"); - elseif ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); - elseif ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); - elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); - elseif ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used. - elseif ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); + if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard"); + elseif ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); + elseif ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); + elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); + elseif ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used. + elseif ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); return $langs->trans("Unknown"); } @@ -510,7 +510,7 @@ abstract class CommonInvoice extends CommonObject return $this->LibStatut($this->paye, $this->statut, $mode, $alreadypaid, $this->type); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return label of a status * @@ -523,52 +523,52 @@ abstract class CommonInvoice extends CommonObject */ public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = 0) { - // phpcs:enable + // phpcs:enable global $langs; $langs->load('bills'); $statusType = 'status0'; $prefix = 'Short'; if (!$paye) { - if ($status == 0) { - $labelStatus = $langs->transnoentitiesnoconv('BillStatusDraft'); - $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusDraft'); - } elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) { - $labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedUnpaid'); - $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedUnpaid'); - $statusType = 'status5'; - } elseif (($status == 3 || $status == 2) && $alreadypaid > 0) { - $labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedPaidPartially'); - $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedPaidPartially'); - $statusType = 'status9'; - } elseif ($alreadypaid == 0) { - $labelStatus = $langs->transnoentitiesnoconv('BillStatusNotPaid'); - $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusNotPaid'); - $statusType = 'status1'; - } else { - $labelStatus = $langs->transnoentitiesnoconv('BillStatusStarted'); - $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusStarted'); - $statusType = 'status3'; - } + if ($status == 0) { + $labelStatus = $langs->transnoentitiesnoconv('BillStatusDraft'); + $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusDraft'); + } elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) { + $labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedUnpaid'); + $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedUnpaid'); + $statusType = 'status5'; + } elseif (($status == 3 || $status == 2) && $alreadypaid > 0) { + $labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedPaidPartially'); + $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedPaidPartially'); + $statusType = 'status9'; + } elseif ($alreadypaid == 0) { + $labelStatus = $langs->transnoentitiesnoconv('BillStatusNotPaid'); + $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusNotPaid'); + $statusType = 'status1'; + } else { + $labelStatus = $langs->transnoentitiesnoconv('BillStatusStarted'); + $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusStarted'); + $statusType = 'status3'; + } } else { - $statusType = 'status6'; + $statusType = 'status6'; - if ($type == self::TYPE_CREDIT_NOTE) { - $labelStatus = $langs->transnoentitiesnoconv('BillStatusPaidBackOrConverted'); // credit note - $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note - } elseif ($type == self::TYPE_DEPOSIT) { - $labelStatus = $langs->transnoentitiesnoconv('BillStatusConverted'); // deposit invoice - $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusConverted'); // deposit invoice - } else { - $labelStatus = $langs->transnoentitiesnoconv('BillStatusPaid'); - $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusPaid'); - } + if ($type == self::TYPE_CREDIT_NOTE) { + $labelStatus = $langs->transnoentitiesnoconv('BillStatusPaidBackOrConverted'); // credit note + $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note + } elseif ($type == self::TYPE_DEPOSIT) { + $labelStatus = $langs->transnoentitiesnoconv('BillStatusConverted'); // deposit invoice + $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusConverted'); // deposit invoice + } else { + $labelStatus = $langs->transnoentitiesnoconv('BillStatusPaid'); + $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusPaid'); + } } return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns an invoice payment deadline based on the invoice settlement * conditions and billing date. @@ -576,15 +576,15 @@ abstract class CommonInvoice extends CommonObject * @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. * @return integer Date limite de reglement si ok, <0 si ko */ - public function calculate_date_lim_reglement($cond_reglement = 0) + public function calculate_date_lim_reglement($cond_reglement = 0) { - // phpcs:enable + // phpcs:enable if (!$cond_reglement) $cond_reglement = $this->cond_reglement_code; if (!$cond_reglement) $cond_reglement = $this->cond_reglement_id; $cdr_nbjour = 0; - $cdr_type = 0; - $cdr_decalage = 0; + $cdr_type = 0; + $cdr_decalage = 0; $sqltemp = 'SELECT c.type_cdr, c.nbjour, c.decalage'; $sqltemp .= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c'; @@ -643,7 +643,7 @@ abstract class CommonInvoice extends CommonObject // 2 : application of the rule, the N of the current or next month elseif ($cdr_type == 2 && !empty($cdr_decalage)) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $datelim = $this->date + ($cdr_nbjour * 3600 * 24); $date_piece = dol_mktime(0, 0, 0, date('m', $datelim), date('d', $datelim), date('Y', $datelim)); // Sans les heures minutes et secondes diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7cdf83f9961..6b76148d350 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6701,10 +6701,10 @@ function setEventMessage($mesgs, $style = 'mesgs') { //dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function if (!is_array($mesgs)) { - // If mesgs is a string + // If mesgs is a string if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs; } else { - // If mesgs is an array + // If mesgs is an array foreach ($mesgs as $mesg) { if ($mesg) $_SESSION['dol_events'][$style][] = $mesg; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 8f06c0958c0..8b37604ce20 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1641,7 +1641,7 @@ function getListOfModels($db, $type, $maxfilenamelength = 0) $liste[$obj->id.':'.$key] = ($obj->label ? $obj->label : $obj->doc_template_name).' '.$val['name']; } } else { - // Common usage + // Common usage $liste[$obj->id] = $obj->label ? $obj->label : $obj->doc_template_name; } } diff --git a/htdocs/core/lib/loan.lib.php b/htdocs/core/lib/loan.lib.php index 638eb83b9cd..3a34d3e57c4 100644 --- a/htdocs/core/lib/loan.lib.php +++ b/htdocs/core/lib/loan.lib.php @@ -32,10 +32,10 @@ */ function loan_prepare_head($object) { - global $db, $langs, $conf; + global $db, $langs, $conf; - $tab = 0; - $head = array(); + $tab = 0; + $head = array(); $head[$tab][0] = DOL_URL_ROOT.'/loan/card.php?id='.$object->id; $head[$tab][1] = $langs->trans('Card'); @@ -47,17 +47,17 @@ function loan_prepare_head($object) $head[$tab][2] = 'FinancialCommitment'; $tab++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab - // $this->tabs = array('entity:-tabname); to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan'); + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan'); require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->loan->dir_output."/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); - $nbLinks = Link::count($db, $object->element, $object->id); + $nbLinks = Link::count($db, $object->element, $object->id); $head[$tab][0] = DOL_URL_ROOT.'/loan/document.php?id='.$object->id; $head[$tab][1] = $langs->trans("Documents"); if (($nbFiles + $nbLinks) > 0) $head[$tab][1] .= ''.($nbFiles + $nbLinks).''; @@ -73,14 +73,14 @@ function loan_prepare_head($object) $tab++; } - $head[$tab][0] = DOL_URL_ROOT.'/loan/info.php?id='.$object->id; - $head[$tab][1] = $langs->trans("Info"); - $head[$tab][2] = 'info'; - $tab++; + $head[$tab][0] = DOL_URL_ROOT.'/loan/info.php?id='.$object->id; + $head[$tab][1] = $langs->trans("Info"); + $head[$tab][2] = 'info'; + $tab++; - complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan', 'remove'); + complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan', 'remove'); - return $head; + return $head; } /** @@ -95,42 +95,42 @@ function loan_prepare_head($object) */ function loanCalcMonthlyPayment($mens, $capital, $rate, $echance, $nbterm) { - global $conf, $db; - require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php'; - $object = new LoanSchedule($db); - $output = array(); + global $conf, $db; + require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php'; + $object = new LoanSchedule($db); + $output = array(); - // If mensuality is 0 we don't pay interests and remaining capital not modified - if ($mens == 0) { - $int = 0; - $cap_rest = $capital; - } else { - $int = ($capital * ($rate / 12)); - $int = round($int, 2, PHP_ROUND_HALF_UP); - $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP); - } - $output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens); + // If mensuality is 0 we don't pay interests and remaining capital not modified + if ($mens == 0) { + $int = 0; + $cap_rest = $capital; + } else { + $int = ($capital * ($rate / 12)); + $int = round($int, 2, PHP_ROUND_HALF_UP); + $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP); + } + $output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens); - $echance++; - $capital = $cap_rest; - while ($echance <= $nbterm) { - $mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $echance + 1), 2, PHP_ROUND_HALF_UP); + $echance++; + $capital = $cap_rest; + while ($echance <= $nbterm) { + $mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $echance + 1), 2, PHP_ROUND_HALF_UP); - $int = ($capital * ($rate / 12)); - $int = round($int, 2, PHP_ROUND_HALF_UP); - $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP); + $int = ($capital * ($rate / 12)); + $int = round($int, 2, PHP_ROUND_HALF_UP); + $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP); - $output[$echance] = array( - 'cap_rest' => $cap_rest, - 'cap_rest_str' => price($cap_rest, 0, '', 1, -1, -1, $conf->currency), - 'interet' => $int, - 'interet_str' => price($int, 0, '', 1, -1, -1, $conf->currency), - 'mens' => $mens, - ); + $output[$echance] = array( + 'cap_rest' => $cap_rest, + 'cap_rest_str' => price($cap_rest, 0, '', 1, -1, -1, $conf->currency), + 'interet' => $int, + 'interet_str' => price($int, 0, '', 1, -1, -1, $conf->currency), + 'mens' => $mens, + ); - $capital = $cap_rest; - $echance++; - } + $capital = $cap_rest; + $echance++; + } - return $output; + return $output; } diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index 0a15a99dfc0..011ac381254 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -31,15 +31,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/project/task/modules_task.php'; class mod_task_universal extends ModeleNumRefTask { /** - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' /** - * @var string Error code (or message) - */ - public $error = ''; + * @var string Error code (or message) + */ + public $error = ''; /** * @var string @@ -54,17 +54,17 @@ class mod_task_universal extends ModeleNumRefTask public $name = 'Universal'; - /** - * Returns the description of the numbering model - * - * @return string Texte descripif - */ - public function info() - { - global $conf, $langs, $db; + /** + * Returns the description of the numbering model + * + * @return string Texte descripif + */ + public function info() + { + global $conf, $langs, $db; // Load translation files required by the page - $langs->loadLangs(array("projects", "admin")); + $langs->loadLangs(array("projects", "admin")); $form = new Form($db); @@ -93,37 +93,37 @@ class mod_task_universal extends ModeleNumRefTask $texte .= ''; return $texte; - } + } - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $conf, $langs, $mysoc; + /** + * Return an example of numbering + * + * @return string Example + */ + public function getExample() + { + global $conf, $langs, $mysoc; - $old_code_client = $mysoc->code_client; - $mysoc->code_client = 'CCCCCCCCCC'; - $numExample = $this->getNextValue($mysoc, ''); + $old_code_client = $mysoc->code_client; + $mysoc->code_client = 'CCCCCCCCCC'; + $numExample = $this->getNextValue($mysoc, ''); $mysoc->code_client = $old_code_client; if (!$numExample) { $numExample = $langs->trans('NotConfigured'); } return $numExample; - } + } - /** - * Return next value - * - * @param Societe $objsoc Object third party - * @param Task $object Object task - * @return string Value if OK, 0 if KO - */ - public function getNextValue($objsoc, $object) - { + /** + * Return next value + * + * @param Societe $objsoc Object third party + * @param Task $object Object task + * @return string Value if OK, 0 if KO + */ + public function getNextValue($objsoc, $object) + { global $db, $conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @@ -143,17 +143,17 @@ class mod_task_universal extends ModeleNumRefTask } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next reference not yet used as a reference - * - * @param Societe $objsoc Object third party - * @param Task $object Object task - * @return string Next not used reference - */ - public function project_get_num($objsoc = 0, $object = '') - { - // phpcs:enable - return $this->getNextValue($objsoc, $object); - } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return next reference not yet used as a reference + * + * @param Societe $objsoc Object third party + * @param Task $object Object task + * @return string Next not used reference + */ + public function project_get_num($objsoc = 0, $object = '') + { + // phpcs:enable + return $this->getNextValue($objsoc, $object); + } } diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index a6fa9fa987d..8d5d22482b8 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -685,7 +685,7 @@ class Don extends CommonObject $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->model_pdf = $obj->model_pdf; - $this->modelpdf = $obj->model_pdf; // deprecated + $this->modelpdf = $obj->model_pdf; // deprecated // Retrieve all extrafield // fetch optionals attributes and labels diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index a01eb50981d..19f979d0f16 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -80,11 +80,11 @@ if ($action == 'add_payment') setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors'); $error++; } - if (!empty($conf->banque->enabled) && !($accountid > 0)) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToDebit")), null, 'errors'); - $error++; - } + if (!empty($conf->banque->enabled) && !($accountid > 0)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToDebit")), null, 'errors'); + $error++; + } if (!$error) { @@ -101,67 +101,67 @@ if ($action == 'add_payment') } } - if (count($amounts) <= 0) - { - $error++; - $errmsg = 'ErrorNoPaymentDefined'; - } + if (count($amounts) <= 0) + { + $error++; + $errmsg = 'ErrorNoPaymentDefined'; + } - if (!$error) - { - $db->begin(); + if (!$error) + { + $db->begin(); - // Create a line of payments - $payment = new PaymentExpenseReport($db); - $payment->fk_expensereport = $expensereport->id; - $payment->datepaid = $datepaid; - $payment->amounts = $amounts; // Tableau de montant - $payment->total = $total; - $payment->fk_typepayment = GETPOST("fk_typepayment", 'int'); - $payment->num_payment = GETPOST("num_payment", 'alphanothtml'); - $payment->note_public = GETPOST("note_public", 'restricthtml'); + // Create a line of payments + $payment = new PaymentExpenseReport($db); + $payment->fk_expensereport = $expensereport->id; + $payment->datepaid = $datepaid; + $payment->amounts = $amounts; // Tableau de montant + $payment->total = $total; + $payment->fk_typepayment = GETPOST("fk_typepayment", 'int'); + $payment->num_payment = GETPOST("num_payment", 'alphanothtml'); + $payment->note_public = GETPOST("note_public", 'restricthtml'); - if (!$error) - { - $paymentid = $payment->create($user); - if ($paymentid < 0) - { - setEventMessages($payment->error, $payment->errors, 'errors'); - $error++; - } - } + if (!$error) + { + $paymentid = $payment->create($user); + if ($paymentid < 0) + { + setEventMessages($payment->error, $payment->errors, 'errors'); + $error++; + } + } - if (!$error) - { - $result = $payment->addPaymentToBank($user, 'payment_expensereport', '(ExpenseReportPayment)', $accountid, '', ''); - if (!$result > 0) - { - setEventMessages($payment->error, $payment->errors, 'errors'); - $error++; - } - } + if (!$error) + { + $result = $payment->addPaymentToBank($user, 'payment_expensereport', '(ExpenseReportPayment)', $accountid, '', ''); + if (!$result > 0) + { + setEventMessages($payment->error, $payment->errors, 'errors'); + $error++; + } + } - if (!$error) { - $payment->fetch($paymentid); - if ($expensereport->total_ttc - $payment->amount == 0) { - $result = $expensereport->set_paid($expensereport->id, $user); - if (!$result > 0) { - setEventMessages($payment->error, $payment->errors, 'errors'); - $error++; - } - } - } + if (!$error) { + $payment->fetch($paymentid); + if ($expensereport->total_ttc - $payment->amount == 0) { + $result = $expensereport->set_paid($expensereport->id, $user); + if (!$result > 0) { + setEventMessages($payment->error, $payment->errors, 'errors'); + $error++; + } + } + } - if (!$error) - { - $db->commit(); - $loc = DOL_URL_ROOT.'/expensereport/card.php?id='.$id; - header('Location: '.$loc); - exit; - } else { - $db->rollback(); - } - } + if (!$error) + { + $db->commit(); + $loc = DOL_URL_ROOT.'/expensereport/card.php?id='.$id; + header('Location: '.$loc); + exit; + } else { + $db->rollback(); + } + } } $action = 'create'; @@ -194,9 +194,9 @@ if ($action == 'create' || empty($action)) var amount = $(this).data("value"); document.getElementById($(this).data(\'rowid\')).value = amount ; });'; - print "\t});\n"; - print "\n"; - } + print "\t});\n"; + print "\n"; + } print load_fiche_titre($langs->trans("DoPayment")); @@ -206,17 +206,17 @@ if ($action == 'create' || empty($action)) print ''; print ''; - print dol_get_fiche_head(null, '0', '', -1); + print dol_get_fiche_head(null, '0', '', -1); - $linkback = ''; - // $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = ''; + // $linkback = '' . $langs->trans("BackToList") . ''; - dol_banner_tab($expensereport, 'ref', $linkback, 1, 'ref', 'ref', ''); + dol_banner_tab($expensereport, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
    '; - print '
    '; + print '
    '; + print '
    '; - print '
    '.$langs->trans("DatePayment").''; - print $form->selectDate($datep, "datep", '', '', '', 'add', 1, 1); - print '
    '.$langs->trans("DatePayment").''; + print $form->selectDate($datep, "datep", '', '', '', 'add', 1, 1); + print '
    '.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).''; - print $form->selectDate($datev, "datev", '', '', '', 'add', 1, 1); - print '
    '.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).''; + print $form->selectDate($datev, "datev", '', '', '', 'add', 1, 1); + print '
    '.$langs->trans("Label").'transcountry(($lttype == 2 ? "LT2Payment" : "LT1Payment"), $mysoc->country_code)).'">
    '."\n"; + print '
    '."\n"; print ''; print ''; @@ -224,7 +224,7 @@ if ($action == 'create' || empty($action)) $sql = "SELECT sum(p.amount) as total"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p, ".MAIN_DB_PREFIX."expensereport as e"; $sql .= " WHERE p.fk_expensereport = e.rowid AND p.fk_expensereport = ".$id; - $sql .= ' AND e.entity IN ('.getEntity('expensereport').')'; + $sql .= ' AND e.entity IN ('.getEntity('expensereport').')'; $resql = $db->query($sql); if ($resql) { @@ -259,11 +259,11 @@ if ($action == 'create' || empty($action)) if (!empty($conf->banque->enabled)) { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } // Number diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 06cfa6edfac..2d28ac799d7 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -61,13 +61,13 @@ function testSqlAndScriptInject($val, $type) // Decode string first // So debugbar->enabled) && !GETPOST('dol_use_jmobile') && empty($_SESSION['dol_use_jmobile'])) { - global $debugbar; - include_once DOL_DOCUMENT_ROOT.'/debugbar/class/DebugBar.php'; - $debugbar = new DolibarrDebugBar(); - $renderer = $debugbar->getRenderer(); - $conf->global->MAIN_HTML_HEADER .= $renderer->renderHead(); + global $debugbar; + include_once DOL_DOCUMENT_ROOT.'/debugbar/class/DebugBar.php'; + $debugbar = new DolibarrDebugBar(); + $renderer = $debugbar->getRenderer(); + $conf->global->MAIN_HTML_HEADER .= $renderer->renderHead(); - $debugbar['time']->startMeasure('pageaftermaster', 'Page generation (after environment init)'); + $debugbar['time']->startMeasure('pageaftermaster', 'Page generation (after environment init)'); } // Detection browser @@ -420,7 +420,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl if (GETPOSTISSET('disablemodules')) $_SESSION["disablemodules"] = GETPOST('disablemodules', 'alpha'); if (!empty($_SESSION["disablemodules"])) { - $modulepartkeys = array('css', 'js', 'tabs', 'triggers', 'login', 'substitutions', 'menus', 'theme', 'sms', 'tpl', 'barcode', 'models', 'societe', 'hooks', 'dir', 'syslog', 'tpllinkable', 'contactelement', 'moduleforexternal'); + $modulepartkeys = array('css', 'js', 'tabs', 'triggers', 'login', 'substitutions', 'menus', 'theme', 'sms', 'tpl', 'barcode', 'models', 'societe', 'hooks', 'dir', 'syslog', 'tpllinkable', 'contactelement', 'moduleforexternal'); $disabled_modules = explode(',', $_SESSION["disablemodules"]); foreach ($disabled_modules as $module) @@ -431,7 +431,7 @@ if (!empty($_SESSION["disablemodules"])) $conf->$module->enabled = false; foreach ($modulepartkeys as $modulepartkey) { - unset($conf->modules_parts[$modulepartkey][$module]); + unset($conf->modules_parts[$modulepartkey][$module]); } if ($module == 'fournisseur') // Special case { @@ -451,7 +451,7 @@ if (is_array($modulepart) && count($modulepart) > 0) if (in_array($module, $modulepart)) { $conf->modulepart = $module; - break; + break; } } } @@ -649,14 +649,14 @@ if (!defined('NOLOGIN')) if (defined('NOREDIRECTBYMAINTOLOGIN')) return 'ERROR_NOT_LOGGED'; else { if ($_SERVER["HTTP_USER_AGENT"] == 'securitytest') { - http_response_code(401); // It makes easier to understand if session was broken during security tests + http_response_code(401); // It makes easier to understand if session was broken during security tests } dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : '')); } exit; } - $resultFetchUser = $user->fetch('', $login, '', 1, ($entitytotest > 0 ? $entitytotest : -1)); // login was retrieved previously when checking password. + $resultFetchUser = $user->fetch('', $login, '', 1, ($entitytotest > 0 ? $entitytotest : -1)); // login was retrieved previously when checking password. if ($resultFetchUser <= 0) { dol_syslog('User not found, connexion refused'); @@ -757,48 +757,48 @@ if (!defined('NOLOGIN')) header('Location: '.DOL_URL_ROOT.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : '')); exit; } else { - // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context - $hookmanager->initHooks(array('main')); + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context + $hookmanager->initHooks(array('main')); - // Code for search criteria persistence. - if (!empty($_GET['save_lastsearch_values'])) // We must use $_GET here - { - $relativepathstring = preg_replace('/\?.*$/', '', $_SERVER["HTTP_REFERER"]); - $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring); // Get full path except host server - // Clean $relativepathstring - if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring); - $relativepathstring = preg_replace('/^\//', '', $relativepathstring); - $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); - //var_dump($relativepathstring); + // Code for search criteria persistence. + if (!empty($_GET['save_lastsearch_values'])) // We must use $_GET here + { + $relativepathstring = preg_replace('/\?.*$/', '', $_SERVER["HTTP_REFERER"]); + $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring); // Get full path except host server + // Clean $relativepathstring + if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring); + $relativepathstring = preg_replace('/^\//', '', $relativepathstring); + $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); + //var_dump($relativepathstring); - // We click on a link that leave a page we have to save search criteria, contextpage, limit and page. We save them from tmp to no tmp - if (!empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) - { - $_SESSION['lastsearch_values_'.$relativepathstring] = $_SESSION['lastsearch_values_tmp_'.$relativepathstring]; - unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); - } - if (!empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) - { - $_SESSION['lastsearch_contextpage_'.$relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]; - unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); - } - if (!empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 0) - { - $_SESSION['lastsearch_page_'.$relativepathstring] = $_SESSION['lastsearch_page_tmp_'.$relativepathstring]; - unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]); - } - if (!empty($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit) - { - $_SESSION['lastsearch_limit_'.$relativepathstring] = $_SESSION['lastsearch_limit_tmp_'.$relativepathstring]; - unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]); - } - } + // We click on a link that leave a page we have to save search criteria, contextpage, limit and page. We save them from tmp to no tmp + if (!empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) + { + $_SESSION['lastsearch_values_'.$relativepathstring] = $_SESSION['lastsearch_values_tmp_'.$relativepathstring]; + unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); + } + if (!empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) + { + $_SESSION['lastsearch_contextpage_'.$relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]; + unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); + } + if (!empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 0) + { + $_SESSION['lastsearch_page_'.$relativepathstring] = $_SESSION['lastsearch_page_tmp_'.$relativepathstring]; + unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]); + } + if (!empty($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit) + { + $_SESSION['lastsearch_limit_'.$relativepathstring] = $_SESSION['lastsearch_limit_tmp_'.$relativepathstring]; + unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]); + } + } - $action = ''; - $reshook = $hookmanager->executeHooks('updateSession', array(), $user, $action); - if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } + $action = ''; + $reshook = $hookmanager->executeHooks('updateSession', array(), $user, $action); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } } } @@ -1104,8 +1104,8 @@ if (!function_exists("llxHeader")) // If theme MD and classic layer, we open the menulayer by default. if ($conf->theme == 'md' && !in_array($conf->browser->layout, array('phone', 'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - global $mainmenu; - if ($mainmenu != 'website') $tmpcsstouse = $morecssonbody; // We do not use sidebar-collpase by default to have menuhider open by default. + global $mainmenu; + if ($mainmenu != 'website') $tmpcsstouse = $morecssonbody; // We do not use sidebar-collpase by default to have menuhider open by default. } if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) { @@ -1224,10 +1224,10 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr //print ''."\n"; if (empty($disablehead)) { - if (!is_object($hookmanager)) $hookmanager = new HookManager($db); - $hookmanager->initHooks(array("main")); + if (!is_object($hookmanager)) $hookmanager = new HookManager($db); + $hookmanager->initHooks(array("main")); - $ext = 'layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); + $ext = 'layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); print "\n"; @@ -1249,16 +1249,16 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; - // Mobile appli like icon - $manifest = DOL_URL_ROOT.'/theme/'.$conf->theme.'/manifest.json.php'; - if (!empty($manifest)) { - print ''."\n"; - } + // Mobile appli like icon + $manifest = DOL_URL_ROOT.'/theme/'.$conf->theme.'/manifest.json.php'; + if (!empty($manifest)) { + print ''."\n"; + } - if (!empty($conf->global->THEME_ELDY_TOPMENU_BACK1)) { - // TODO: use auto theme color switch - print ''."\n"; - } + if (!empty($conf->global->THEME_ELDY_TOPMENU_BACK1)) { + // TODO: use auto theme color switch + print ''."\n"; + } // Auto refresh page if (GETPOST('autorefresh', 'int') > 0) print ''; @@ -1314,8 +1314,8 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (!defined('DISABLE_FONT_AWSOME')) { print ''."\n"; - print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; } print ''."\n"; @@ -1362,12 +1362,12 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr { foreach ($arrayofcss as $cssfile) { - if (preg_match('/^(http|\/\/)/i', $cssfile)) - { - $urltofile = $cssfile; - } else { - $urltofile = dol_buildpath($cssfile, 1); - } + if (preg_match('/^(http|\/\/)/i', $cssfile)) + { + $urltofile = $cssfile; + } else { + $urltofile = dol_buildpath($cssfile, 1); + } print ''."\n".''."\n"; print ''."\n"; } - // jQuery Timepicker - if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) { - print ''."\n"; - print ''."\n"; - } - if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) { - // jQuery plugin "mutiselect", "multiple-select", "select2", ... - $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ?constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; - print ''."\n"; // We include full because we need the support of containerCssClass - } - if (! defined('DISABLE_MULTISELECT')) // jQuery plugin "mutiselect" to select with checkboxes. Can be removed once we have an enhanced search tool - { - print ''."\n"; - } + // jQuery Timepicker + if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) { + print ''."\n"; + print ''."\n"; + } + if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) { + // jQuery plugin "mutiselect", "multiple-select", "select2", ... + $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ?constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; + print ''."\n"; // We include full because we need the support of containerCssClass + } + if (! defined('DISABLE_MULTISELECT')) // jQuery plugin "mutiselect" to select with checkboxes. Can be removed once we have an enhanced search tool + { + print ''."\n"; + } } - if (!$disablejs && !empty($conf->use_javascript_ajax)) { - // CKEditor - if ((!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) || defined('FORCE_CKEDITOR')) - { - print ''."\n"; - $pathckeditor = DOL_URL_ROOT.'/includes/ckeditor/ckeditor/'; - $jsckeditor = 'ckeditor.js'; - if (constant('JS_CKEDITOR')) { - // To use external ckeditor 4 js lib - $pathckeditor = constant('JS_CKEDITOR'); - } - print ''."\n"; - print ''."\n"; - print ''."\n"; - } + if (!$disablejs && !empty($conf->use_javascript_ajax)) { + // CKEditor + if ((!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) || defined('FORCE_CKEDITOR')) + { + print ''."\n"; + $pathckeditor = DOL_URL_ROOT.'/includes/ckeditor/ckeditor/'; + $jsckeditor = 'ckeditor.js'; + if (constant('JS_CKEDITOR')) { + // To use external ckeditor 4 js lib + $pathckeditor = constant('JS_CKEDITOR'); + } + print ''."\n"; + print ''."\n"; + print ''."\n"; + } - // Browser notifications (if NOREQUIREMENU is on, it is mostly a page for popup, so we do not enable notif too. We hide also for public pages). - if (!defined('NOBROWSERNOTIF') && !defined('NOREQUIREMENU') && !defined('NOLOGIN')) - { - $enablebrowsernotif = false; - if (!empty($conf->agenda->enabled) && !empty($conf->global->AGENDA_REMINDER_BROWSER)) $enablebrowsernotif = true; - if ($conf->browser->layout == 'phone') $enablebrowsernotif = false; - if ($enablebrowsernotif) - { - print ''."\n"; - print ''."\n"; - } - } + // Browser notifications (if NOREQUIREMENU is on, it is mostly a page for popup, so we do not enable notif too. We hide also for public pages). + if (!defined('NOBROWSERNOTIF') && !defined('NOREQUIREMENU') && !defined('NOLOGIN')) + { + $enablebrowsernotif = false; + if (!empty($conf->agenda->enabled) && !empty($conf->global->AGENDA_REMINDER_BROWSER)) $enablebrowsernotif = true; + if ($conf->browser->layout == 'phone') $enablebrowsernotif = false; + if ($enablebrowsernotif) + { + print ''."\n"; + print ''."\n"; + } + } - // Global js function - print ''."\n"; - print ''."\n"; + // Global js function + print ''."\n"; + print ''."\n"; - // JS forced by modules (relative url starting with /) - if (!empty($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2')) - { - $arrayjs = (array) $conf->modules_parts['js']; - foreach ($arrayjs as $modjs => $filesjs) - { - $filesjs = (array) $filesjs; // To be sure filejs is an array - foreach ($filesjs as $jsfile) - { - // jsfile is a relative path - print ''."\n".''."\n"; - } - } - } - // JS forced by page in top_htmlhead (relative url starting with /) - if (is_array($arrayofjs)) - { - print ''."\n"; - foreach ($arrayofjs as $jsfile) - { - if (preg_match('/^(http|\/\/)/i', $jsfile)) - { - print ''."\n"; - } else { - print ''."\n"; - } - } - } - } + // JS forced by modules (relative url starting with /) + if (!empty($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2')) + { + $arrayjs = (array) $conf->modules_parts['js']; + foreach ($arrayjs as $modjs => $filesjs) + { + $filesjs = (array) $filesjs; // To be sure filejs is an array + foreach ($filesjs as $jsfile) + { + // jsfile is a relative path + print ''."\n".''."\n"; + } + } + } + // JS forced by page in top_htmlhead (relative url starting with /) + if (is_array($arrayofjs)) + { + print ''."\n"; + foreach ($arrayofjs as $jsfile) + { + if (preg_match('/^(http|\/\/)/i', $jsfile)) + { + print ''."\n"; + } else { + print ''."\n"; + } + } + } + } - if (!empty($head)) print $head."\n"; - if (!empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER."\n"; + if (!empty($head)) print $head."\n"; + if (!empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER."\n"; - $parameters = array(); - $result = $hookmanager->executeHooks('addHtmlHeader', $parameters); // Note that $action and $object may have been modified by some hooks - print $hookmanager->resPrint; // Replace Title to show + $parameters = array(); + $result = $hookmanager->executeHooks('addHtmlHeader', $parameters); // Note that $action and $object may have been modified by some hooks + print $hookmanager->resPrint; // Replace Title to show - print "\n\n"; - } + print "\n\n"; + } - $conf->headerdone = 1; // To tell header was output + $conf->headerdone = 1; // To tell header was output } @@ -1759,99 +1759,99 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead */ function top_menu_user($hideloginname = 0, $urllogout = '') { - global $langs, $conf, $db, $hookmanager, $user; - global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; + global $langs, $conf, $db, $hookmanager, $user; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; - $userImage = $userDropDownImage = ''; - if (!empty($user->photo)) - { - $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); - $userDropDownImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1); - } else { - $nophoto = '/public/theme/common/user_anonymous.png'; - if ($user->gender == 'man') $nophoto = '/public/theme/common/user_man.png'; - if ($user->gender == 'woman') $nophoto = '/public/theme/common/user_woman.png'; + $userImage = $userDropDownImage = ''; + if (!empty($user->photo)) + { + $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); + $userDropDownImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1); + } else { + $nophoto = '/public/theme/common/user_anonymous.png'; + if ($user->gender == 'man') $nophoto = '/public/theme/common/user_man.png'; + if ($user->gender == 'woman') $nophoto = '/public/theme/common/user_woman.png'; - $userImage = 'No photo'; - $userDropDownImage = 'No photo'; - } + $userImage = 'No photo'; + $userDropDownImage = 'No photo'; + } - $dropdownBody = ''; - $dropdownBody .= ' '.$langs->trans("ShowMoreInfos").''; - $dropdownBody .= '
    '; + $dropdownBody = ''; + $dropdownBody .= ' '.$langs->trans("ShowMoreInfos").''; + $dropdownBody .= '
    '; - // login infos - if (!empty($user->admin)) { - $dropdownBody .= '
    '.$langs->trans("Administrator").': '.yn($user->admin); - } - if (!empty($user->socid)) // Add thirdparty for external users - { - $thirdpartystatic = new Societe($db); - $thirdpartystatic->fetch($user->socid); - $companylink = ' '.$thirdpartystatic->getNomUrl(2); // picto only of company - $company = ' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; - } - $type = ($user->socid ? $langs->trans("External").$company : $langs->trans("Internal")); - $dropdownBody .= '
    '.$langs->trans("Type").': '.$type; - $dropdownBody .= '
    '.$langs->trans("Status").': '.$user->getLibStatut(0); - $dropdownBody .= '
    '; + // login infos + if (!empty($user->admin)) { + $dropdownBody .= '
    '.$langs->trans("Administrator").': '.yn($user->admin); + } + if (!empty($user->socid)) // Add thirdparty for external users + { + $thirdpartystatic = new Societe($db); + $thirdpartystatic->fetch($user->socid); + $companylink = ' '.$thirdpartystatic->getNomUrl(2); // picto only of company + $company = ' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; + } + $type = ($user->socid ? $langs->trans("External").$company : $langs->trans("Internal")); + $dropdownBody .= '
    '.$langs->trans("Type").': '.$type; + $dropdownBody .= '
    '.$langs->trans("Status").': '.$user->getLibStatut(0); + $dropdownBody .= '
    '; - $dropdownBody .= '
    '.$langs->trans("Session").''; - $dropdownBody .= '
    '.$langs->trans("IPAddress").': '.dol_escape_htmltag($_SERVER["REMOTE_ADDR"]); - if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $dropdownBody .= '
    '.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$user->entity.')'; - $dropdownBody .= '
    '.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)'); - $dropdownBody .= '
    '.$langs->trans("ConnectedSince").': '.dol_print_date($user->datelastlogin, "dayhour", 'tzuser'); - $dropdownBody .= '
    '.$langs->trans("PreviousConnexion").': '.dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser'); - $dropdownBody .= '
    '.$langs->trans("CurrentTheme").': '.$conf->theme; - $dropdownBody .= '
    '.$langs->trans("CurrentMenuManager").': '.$menumanager->name; - $langFlag = picto_from_langcode($langs->getDefaultLang()); - $dropdownBody .= '
    '.$langs->trans("CurrentUserLanguage").': '.($langFlag ? $langFlag.' ' : '').$langs->getDefaultLang(); - $dropdownBody .= '
    '.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.dol_escape_htmltag($_SERVER['HTTP_USER_AGENT']).')'; - $dropdownBody .= '
    '.$langs->trans("Layout").': '.$conf->browser->layout; - $dropdownBody .= '
    '.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; - if ($conf->browser->layout == 'phone') $dropdownBody .= '
    '.$langs->trans("Phone").': '.$langs->trans("Yes"); - if (!empty($_SESSION["disablemodules"])) $dropdownBody .= '
    '.$langs->trans("DisabledModules").':
    '.join(', ', explode(',', $_SESSION["disablemodules"])); - $dropdownBody .= '
    '; + $dropdownBody .= '
    '.$langs->trans("Session").''; + $dropdownBody .= '
    '.$langs->trans("IPAddress").': '.dol_escape_htmltag($_SERVER["REMOTE_ADDR"]); + if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $dropdownBody .= '
    '.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$user->entity.')'; + $dropdownBody .= '
    '.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)'); + $dropdownBody .= '
    '.$langs->trans("ConnectedSince").': '.dol_print_date($user->datelastlogin, "dayhour", 'tzuser'); + $dropdownBody .= '
    '.$langs->trans("PreviousConnexion").': '.dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser'); + $dropdownBody .= '
    '.$langs->trans("CurrentTheme").': '.$conf->theme; + $dropdownBody .= '
    '.$langs->trans("CurrentMenuManager").': '.$menumanager->name; + $langFlag = picto_from_langcode($langs->getDefaultLang()); + $dropdownBody .= '
    '.$langs->trans("CurrentUserLanguage").': '.($langFlag ? $langFlag.' ' : '').$langs->getDefaultLang(); + $dropdownBody .= '
    '.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.dol_escape_htmltag($_SERVER['HTTP_USER_AGENT']).')'; + $dropdownBody .= '
    '.$langs->trans("Layout").': '.$conf->browser->layout; + $dropdownBody .= '
    '.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; + if ($conf->browser->layout == 'phone') $dropdownBody .= '
    '.$langs->trans("Phone").': '.$langs->trans("Yes"); + if (!empty($_SESSION["disablemodules"])) $dropdownBody .= '
    '.$langs->trans("DisabledModules").':
    '.join(', ', explode(',', $_SESSION["disablemodules"])); + $dropdownBody .= '
    '; - // Execute hook - $parameters = array('user'=>$user, 'langs' => $langs); - $result = $hookmanager->executeHooks('printTopRightMenuLoginDropdownBody', $parameters); // Note that $action and $object may have been modified by some hooks - if (is_numeric($result)) - { - if ($result == 0) { - $dropdownBody .= $hookmanager->resPrint; // add - } else { - $dropdownBody = $hookmanager->resPrint; // replace - } - } + // Execute hook + $parameters = array('user'=>$user, 'langs' => $langs); + $result = $hookmanager->executeHooks('printTopRightMenuLoginDropdownBody', $parameters); // Note that $action and $object may have been modified by some hooks + if (is_numeric($result)) + { + if ($result == 0) { + $dropdownBody .= $hookmanager->resPrint; // add + } else { + $dropdownBody = $hookmanager->resPrint; // replace + } + } - if (empty($urllogout)) { - $urllogout = DOL_URL_ROOT.'/user/logout.php'; - } - $logoutLink = ' '.$langs->trans("Logout").''; - $profilLink = ' '.$langs->trans("Card").''; + if (empty($urllogout)) { + $urllogout = DOL_URL_ROOT.'/user/logout.php'; + } + $logoutLink = ' '.$langs->trans("Logout").''; + $profilLink = ' '.$langs->trans("Card").''; - $profilName = $user->getFullName($langs).' ('.$user->login.')'; + $profilName = $user->getFullName($langs).' ('.$user->login.')'; - if (!empty($user->admin)) { - $profilName = ' '.$profilName; - } + if (!empty($user->admin)) { + $profilName = ' '.$profilName; + } - // Define version to show - $appli = constant('DOL_APPLICATION_TITLE'); - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) - { - $appli = $conf->global->MAIN_APPLICATION_TITLE; - if (preg_match('/\d\.\d/', $appli)) - { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } else $appli .= " ".DOL_VERSION; - } else $appli .= " ".DOL_VERSION; + // Define version to show + $appli = constant('DOL_APPLICATION_TITLE'); + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) + { + $appli = $conf->global->MAIN_APPLICATION_TITLE; + if (preg_match('/\d\.\d/', $appli)) + { + if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core + } else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $btnUser = ' + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + $btnUser = ''; - } + } - if (!defined('JS_JQUERY_DISABLE_DROPDOWN') && !empty($conf->use_javascript_ajax)) // This may be set by some pages that use different jquery version to avoid errors - { - $btnUser .= ' + if (!defined('JS_JQUERY_DISABLE_DROPDOWN') && !empty($conf->use_javascript_ajax)) // This may be set by some pages that use different jquery version to avoid errors + { + $btnUser .= ' '; - } + } - return $btnUser; + return $btnUser; } /** @@ -2160,24 +2160,24 @@ function top_menu_quickadd() */ function top_menu_bookmark() { - global $langs, $conf, $db, $user; + global $langs, $conf, $db, $user; $html = ''; - // Define $bookmarks + // Define $bookmarks if (empty($conf->bookmark->enabled) || empty($user->rights->bookmark->lire)) return $html; if (!defined('JS_JQUERY_DISABLE_DROPDOWN') && !empty($conf->use_javascript_ajax)) // This may be set by some pages that use different jquery version to avoid errors - { - include_once DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php'; - $langs->load("bookmarks"); + { + include_once DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php'; + $langs->load("bookmarks"); - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $html .= ''; - } else { - $html .= ' + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + $html .= ''; + } else { + $html .= ''; - } elseif ($conf->use_javascript_ajax && !empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) { - $searchform = '
    '; - $searchform .= '' . "\n"; - $searchform .= '
    '; - } - } + $searchform .= ''; + } + } // Left column print ''."\n"; @@ -2474,37 +2474,37 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new?labels=Bug'; + $bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new?labels=Bug'; $bugbaseurl .= '&title='; $bugbaseurl .= urlencode("Bug: "); - $bugbaseurl .= '&body='; - $bugbaseurl .= urlencode("# Instructions\n"); - $bugbaseurl .= urlencode("*This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.*\n"); - $bugbaseurl .= urlencode("*Please:*\n"); - $bugbaseurl .= urlencode("- *replace the bracket enclosed texts with meaningful information*\n"); - $bugbaseurl .= urlencode("- *remove any unused sub-section*\n"); - $bugbaseurl .= urlencode("\n"); - $bugbaseurl .= urlencode("\n"); - $bugbaseurl .= urlencode("# Bug\n"); - $bugbaseurl .= urlencode("[*Short description*]\n"); - $bugbaseurl .= urlencode("\n"); - $bugbaseurl .= urlencode("## Environment\n"); - $bugbaseurl .= urlencode("- **Version**: ".DOL_VERSION."\n"); - $bugbaseurl .= urlencode("- **OS**: ".php_uname('s')."\n"); - $bugbaseurl .= urlencode("- **Web server**: ".$_SERVER["SERVER_SOFTWARE"]."\n"); - $bugbaseurl .= urlencode("- **PHP**: ".php_sapi_name().' '.phpversion()."\n"); - $bugbaseurl .= urlencode("- **Database**: ".$db::LABEL.' '.$db->getVersion()."\n"); - $bugbaseurl .= urlencode("- **URL(s)**: ".$_SERVER["REQUEST_URI"]."\n"); - $bugbaseurl .= urlencode("\n"); - $bugbaseurl .= urlencode("## Expected and actual behavior\n"); - $bugbaseurl .= urlencode("[*Verbose description*]\n"); - $bugbaseurl .= urlencode("\n"); - $bugbaseurl .= urlencode("## Steps to reproduce the behavior\n"); - $bugbaseurl .= urlencode("[*Verbose description*]\n"); - $bugbaseurl .= urlencode("\n"); - $bugbaseurl .= urlencode("## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…)\n"); - $bugbaseurl .= urlencode("[*Files*]\n"); - $bugbaseurl .= urlencode("\n"); + $bugbaseurl .= '&body='; + $bugbaseurl .= urlencode("# Instructions\n"); + $bugbaseurl .= urlencode("*This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.*\n"); + $bugbaseurl .= urlencode("*Please:*\n"); + $bugbaseurl .= urlencode("- *replace the bracket enclosed texts with meaningful information*\n"); + $bugbaseurl .= urlencode("- *remove any unused sub-section*\n"); + $bugbaseurl .= urlencode("\n"); + $bugbaseurl .= urlencode("\n"); + $bugbaseurl .= urlencode("# Bug\n"); + $bugbaseurl .= urlencode("[*Short description*]\n"); + $bugbaseurl .= urlencode("\n"); + $bugbaseurl .= urlencode("## Environment\n"); + $bugbaseurl .= urlencode("- **Version**: ".DOL_VERSION."\n"); + $bugbaseurl .= urlencode("- **OS**: ".php_uname('s')."\n"); + $bugbaseurl .= urlencode("- **Web server**: ".$_SERVER["SERVER_SOFTWARE"]."\n"); + $bugbaseurl .= urlencode("- **PHP**: ".php_sapi_name().' '.phpversion()."\n"); + $bugbaseurl .= urlencode("- **Database**: ".$db::LABEL.' '.$db->getVersion()."\n"); + $bugbaseurl .= urlencode("- **URL(s)**: ".$_SERVER["REQUEST_URI"]."\n"); + $bugbaseurl .= urlencode("\n"); + $bugbaseurl .= urlencode("## Expected and actual behavior\n"); + $bugbaseurl .= urlencode("[*Verbose description*]\n"); + $bugbaseurl .= urlencode("\n"); + $bugbaseurl .= urlencode("## Steps to reproduce the behavior\n"); + $bugbaseurl .= urlencode("[*Verbose description*]\n"); + $bugbaseurl .= urlencode("\n"); + $bugbaseurl .= urlencode("## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…)\n"); + $bugbaseurl .= urlencode("[*Files*]\n"); + $bugbaseurl .= urlencode("\n"); // Execute hook printBugtrackInfo @@ -2563,35 +2563,35 @@ function main_area($title = '') if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED)); - // Permit to add user company information on each printed document by set SHOW_SOCINFO_ON_PRINT - if (!empty($conf->global->SHOW_SOCINFO_ON_PRINT) && GETPOST('optioncss', 'aZ09') == 'print' && empty(GETPOST('disable_show_socinfo_on_print', 'az09'))) - { - global $hookmanager; - $hookmanager->initHooks(array('showsocinfoonprint')); - $parameters = array(); - $reshook = $hookmanager->executeHooks('showSocinfoOnPrint', $parameters); - if (empty($reshook)) - { - print ''."\n"; - print '
    '."\n"; - print '
    '.$langs->trans("Period").''.get_date_range($expensereport->date_debut, $expensereport->date_fin, "", $langs, 0).'
    '.$langs->trans("Amount").''.price($expensereport->total_ttc, 0, $outputlangs, 1, -1, -1, $conf->currency).'
    '.$langs->trans('AccountToDebit').''; - $form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", "int") : $expensereport->accountid, "accountid", 0, '', 2); // Show open bank account list - print '
    '.$langs->trans('AccountToDebit').''; + $form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", "int") : $expensereport->accountid, "accountid", 0, '', 2); // Show open bank account list + print '
    '."\n"; - print ''; - print ''."\n"; - print ''."\n"; - print ''."\n"; - if (!empty($conf->global->MAIN_INFO_SOCIETE_TEL)) print ''; - if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL)) print ''; - if (!empty($conf->global->MAIN_INFO_SOCIETE_WEB)) print ''; - print ''; - print '
    '; - if ($conf->global->MAIN_SHOW_LOGO && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($conf->global->MAIN_INFO_SOCIETE_LOGO)) { - print ''; - } - print '
    '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM).'
    '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ADDRESS).'
    '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP).' '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN).'
    '.$langs->trans("Phone").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).'
    '.$langs->trans("Email").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).'
    '.$langs->trans("Web").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB).'
    '."\n"; - print ''."\n"; - print ''."\n"; - } - } + // Permit to add user company information on each printed document by set SHOW_SOCINFO_ON_PRINT + if (!empty($conf->global->SHOW_SOCINFO_ON_PRINT) && GETPOST('optioncss', 'aZ09') == 'print' && empty(GETPOST('disable_show_socinfo_on_print', 'az09'))) + { + global $hookmanager; + $hookmanager->initHooks(array('showsocinfoonprint')); + $parameters = array(); + $reshook = $hookmanager->executeHooks('showSocinfoOnPrint', $parameters); + if (empty($reshook)) + { + print ''."\n"; + print '
    '."\n"; + print ''."\n"; + print ''; + print ''."\n"; + print ''."\n"; + print ''."\n"; + if (!empty($conf->global->MAIN_INFO_SOCIETE_TEL)) print ''; + if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL)) print ''; + if (!empty($conf->global->MAIN_INFO_SOCIETE_WEB)) print ''; + print ''; + print '
    '; + if ($conf->global->MAIN_SHOW_LOGO && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($conf->global->MAIN_INFO_SOCIETE_LOGO)) { + print ''; + } + print '
    '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM).'
    '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ADDRESS).'
    '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP).' '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN).'
    '.$langs->trans("Phone").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).'
    '.$langs->trans("Email").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).'
    '.$langs->trans("Web").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB).'
    '."\n"; + print '
    '."\n"; + print ''."\n"; + } + } } @@ -2906,5 +2906,5 @@ if (!function_exists("llxFooter")) print "\n"; print "\n"; - } + } } diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index f0833fd5f3e..00db8797a1f 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -42,15 +42,15 @@ function paypaladmin_prepare_head() $object = new stdClass(); - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab - // $this->tabs = array('entity:-tabname); to remove a tab + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'paypaladmin'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'paypaladmin', 'remove'); - return $head; + return $head; } @@ -67,14 +67,14 @@ function showPaypalPaymentUrl($type, $ref) global $conf, $langs; $langs->load("paypal"); - $langs->load("paybox"); - $servicename = 'PayPal'; - $out = '

    '; - $out .= img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'
    '; - $url = getPaypalPaymentUrl(0, $type, $ref); - $out .= ''; - $out .= ajax_autoselect("paypalurl", 0); - return $out; + $langs->load("paybox"); + $servicename = 'PayPal'; + $out = '

    '; + $out .= img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'
    '; + $url = getPaypalPaymentUrl(0, $type, $ref); + $out .= ''; + $out .= ajax_autoselect("paypalurl", 0); + return $out; } @@ -94,88 +94,88 @@ function getPaypalPaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag $ref = str_replace(' ', '', $ref); - if ($type == 'free') - { - $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?amount='.($mode ? '' : '').$amount.($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : ''); - if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) - { - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; - else $out .= '&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); - } - } - if ($type == 'order') - { - $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=order&ref='.($mode ? '' : ''); - if ($mode == 1) $out .= 'order_ref'; - if ($mode == 0) $out .= urlencode($ref); - $out .= ($mode ? '' : ''); - if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) - { - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; - else { - $out .= '&securekey='.($mode ? '' : ''); - if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + order_ref)"; - if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2); - $out .= ($mode ? '' : ''); - } - } - } - if ($type == 'invoice') - { - $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=invoice&ref='.($mode ? '' : ''); - if ($mode == 1) $out .= 'invoice_ref'; - if ($mode == 0) $out .= urlencode($ref); - $out .= ($mode ? '' : ''); - if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) - { - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; - else { - $out .= '&securekey='.($mode ? '' : ''); - if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; - if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2); - $out .= ($mode ? '' : ''); - } - } - } - if ($type == 'contractline') - { - $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=contractline&ref='.($mode ? '' : ''); - if ($mode == 1) $out .= 'contractline_ref'; - if ($mode == 0) $out .= urlencode($ref); - $out .= ($mode ? '' : ''); - if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) - { - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; - else { - $out .= '&securekey='.($mode ? '' : ''); - if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; - if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2); - $out .= ($mode ? '' : ''); - } - } - } - if ($type == 'membersubscription') - { - $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=membersubscription&ref='.($mode ? '' : ''); - if ($mode == 1) $out .= 'member_ref'; - if ($mode == 0) $out .= urlencode($ref); - $out .= ($mode ? '' : ''); - if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) - { - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; - else { - $out .= '&securekey='.($mode ? '' : ''); - if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + member_ref)"; - if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2); - $out .= ($mode ? '' : ''); - } - } - } + if ($type == 'free') + { + $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?amount='.($mode ? '' : '').$amount.($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : ''); + if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) + { + if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; + else $out .= '&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); + } + } + if ($type == 'order') + { + $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=order&ref='.($mode ? '' : ''); + if ($mode == 1) $out .= 'order_ref'; + if ($mode == 0) $out .= urlencode($ref); + $out .= ($mode ? '' : ''); + if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) + { + if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; + else { + $out .= '&securekey='.($mode ? '' : ''); + if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + order_ref)"; + if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2); + $out .= ($mode ? '' : ''); + } + } + } + if ($type == 'invoice') + { + $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=invoice&ref='.($mode ? '' : ''); + if ($mode == 1) $out .= 'invoice_ref'; + if ($mode == 0) $out .= urlencode($ref); + $out .= ($mode ? '' : ''); + if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) + { + if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; + else { + $out .= '&securekey='.($mode ? '' : ''); + if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; + if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2); + $out .= ($mode ? '' : ''); + } + } + } + if ($type == 'contractline') + { + $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=contractline&ref='.($mode ? '' : ''); + if ($mode == 1) $out .= 'contractline_ref'; + if ($mode == 0) $out .= urlencode($ref); + $out .= ($mode ? '' : ''); + if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) + { + if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; + else { + $out .= '&securekey='.($mode ? '' : ''); + if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; + if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2); + $out .= ($mode ? '' : ''); + } + } + } + if ($type == 'membersubscription') + { + $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=membersubscription&ref='.($mode ? '' : ''); + if ($mode == 1) $out .= 'member_ref'; + if ($mode == 0) $out .= urlencode($ref); + $out .= ($mode ? '' : ''); + if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) + { + if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; + else { + $out .= '&securekey='.($mode ? '' : ''); + if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + member_ref)"; + if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2); + $out .= ($mode ? '' : ''); + } + } + } - // For multicompany - $out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities + // For multicompany + $out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities - return $out; + return $out; } @@ -192,93 +192,93 @@ function getPaypalPaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag */ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag) { - //declaring of global variables - global $conf, $langs; - global $API_Endpoint, $API_Url, $API_version, $USE_PROXY, $PROXY_HOST, $PROXY_PORT; - global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; + //declaring of global variables + global $conf, $langs; + global $API_Endpoint, $API_Url, $API_version, $USE_PROXY, $PROXY_HOST, $PROXY_PORT; + global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; - global $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum; - global $email, $desc; + global $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum; + global $email, $desc; - //'------------------------------------ - //' Calls the SetExpressCheckout API call - //' - //'------------------------------------------------- + //'------------------------------------ + //' Calls the SetExpressCheckout API call + //' + //'------------------------------------------------- - if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY = 'integral'; + if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY = 'integral'; - $solutionType = 'Sole'; - $landingPage = 'Billing'; - // For payment with Paypal only - if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly') - { - $solutionType = 'Mark'; - $landingPage = 'Login'; - } - // For payment with Credit card or Paypal - if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral') - { - $solutionType = 'Sole'; - $landingPage = 'Billing'; - } - // For payment with Credit card - if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'cconly') - { - $solutionType = 'Sole'; - $landingPage = 'Billing'; - } + $solutionType = 'Sole'; + $landingPage = 'Billing'; + // For payment with Paypal only + if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly') + { + $solutionType = 'Mark'; + $landingPage = 'Login'; + } + // For payment with Credit card or Paypal + if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral') + { + $solutionType = 'Sole'; + $landingPage = 'Billing'; + } + // For payment with Credit card + if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'cconly') + { + $solutionType = 'Sole'; + $landingPage = 'Billing'; + } - dol_syslog("expresscheckout redirect with callSetExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum"); - $resArray = callSetExpressCheckout( - $paymentAmount, - $currencyCodeType, - $paymentType, - $returnURL, - $cancelURL, - $tag, - $solutionType, - $landingPage, - $shipToName, - $shipToStreet, - $shipToCity, - $shipToState, - $shipToCountryCode, - $shipToZip, - $shipToStreet2, - $phoneNum, - $email, - $desc - ); + dol_syslog("expresscheckout redirect with callSetExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum"); + $resArray = callSetExpressCheckout( + $paymentAmount, + $currencyCodeType, + $paymentType, + $returnURL, + $cancelURL, + $tag, + $solutionType, + $landingPage, + $shipToName, + $shipToStreet, + $shipToCity, + $shipToState, + $shipToCountryCode, + $shipToZip, + $shipToStreet2, + $phoneNum, + $email, + $desc + ); - $ack = strtoupper($resArray["ACK"]); - if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") - { - $token = $resArray["TOKEN"]; + $ack = strtoupper($resArray["ACK"]); + if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") + { + $token = $resArray["TOKEN"]; - // Redirect to paypal.com here - $payPalURL = $API_Url.$token; - header("Location: ".$payPalURL); - exit; - } else { - //Display a user friendly Error on the page using any of the following error information returned by PayPal - $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); - $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); - $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]); - $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]); + // Redirect to paypal.com here + $payPalURL = $API_Url.$token; + header("Location: ".$payPalURL); + exit; + } else { + //Display a user friendly Error on the page using any of the following error information returned by PayPal + $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); + $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); + $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]); + $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]); - if ($ErrorCode == 10729) - { - $mesg .= "PayPal can't accept payments for this thirdparty. An address is defined but is not complete (missing State).
    Ask system administrator to fix address or to setup Paypal module to accept payments even on not complete addresses (remove option PAYPAL_REQUIRE_VALID_SHIPPING_ADDRESS).
    \n"; - } else { - $mesg = $langs->trans('SetExpressCheckoutAPICallFailed')."
    \n"; - $mesg .= $langs->trans('DetailedErrorMessage').": ".$ErrorLongMsg."
    \n"; - $mesg .= $langs->trans('ShortErrorMessage').": ".$ErrorShortMsg."
    \n"; - $mesg .= $langs->trans('ErrorCode').": ".$ErrorCode."
    \n"; - $mesg .= $langs->trans('ErrorSeverityCode').": ".$ErrorSeverityCode."
    \n"; - } + if ($ErrorCode == 10729) + { + $mesg .= "PayPal can't accept payments for this thirdparty. An address is defined but is not complete (missing State).
    Ask system administrator to fix address or to setup Paypal module to accept payments even on not complete addresses (remove option PAYPAL_REQUIRE_VALID_SHIPPING_ADDRESS).
    \n"; + } else { + $mesg = $langs->trans('SetExpressCheckoutAPICallFailed')."
    \n"; + $mesg .= $langs->trans('DetailedErrorMessage').": ".$ErrorLongMsg."
    \n"; + $mesg .= $langs->trans('ShortErrorMessage').": ".$ErrorShortMsg."
    \n"; + $mesg .= $langs->trans('ErrorCode').": ".$ErrorCode."
    \n"; + $mesg .= $langs->trans('ErrorSeverityCode').": ".$ErrorSeverityCode."
    \n"; + } - return $mesg; - } + return $mesg; + } } /** @@ -324,103 +324,103 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType, */ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum, $email = '', $desc = '') { - //------------------------------------------------------------------------------------------------------------------------------------ - // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation + //------------------------------------------------------------------------------------------------------------------------------------ + // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation - //declaring of global variables - global $conf, $langs, $mysoc; - global $API_Endpoint, $API_Url, $API_version, $USE_PROXY, $PROXY_HOST, $PROXY_PORT; - global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; + //declaring of global variables + global $conf, $langs, $mysoc; + global $API_Endpoint, $API_Url, $API_version, $USE_PROXY, $PROXY_HOST, $PROXY_PORT; + global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; - $nvpstr = ''; - //$nvpstr = $nvpstr . "&VERSION=".$API_version; // Already added by hash_call - $nvpstr = $nvpstr."&RETURNURL=".urlencode($returnURL); - $nvpstr = $nvpstr."&CANCELURL=".urlencode($cancelURL); - if (!empty($conf->global->PAYPAL_ALLOW_NOTES)) - { - $nvpstr = $nvpstr."&ALLOWNOTE=0"; - } - if (empty($conf->global->PAYPAL_REQUIRE_VALID_SHIPPING_ADDRESS)) - { - $nvpstr = $nvpstr."&NOSHIPPING=1"; // An empty or not complete shipping address will be accepted - } else { - $nvpstr = $nvpstr."&NOSHIPPING=0"; // A valid shipping address is required (full required fields mandatory) - } - $nvpstr = $nvpstr."&SOLUTIONTYPE=".urlencode($solutionType); - $nvpstr = $nvpstr."&LANDINGPAGE=".urlencode($landingPage); - if (!empty($conf->global->PAYPAL_CUSTOMER_SERVICE_NUMBER)) - { - $nvpstr = $nvpstr."&CUSTOMERSERVICENUMBER=".urlencode($conf->global->PAYPAL_CUSTOMER_SERVICE_NUMBER); // Hotline phone number - } + $nvpstr = ''; + //$nvpstr = $nvpstr . "&VERSION=".$API_version; // Already added by hash_call + $nvpstr = $nvpstr."&RETURNURL=".urlencode($returnURL); + $nvpstr = $nvpstr."&CANCELURL=".urlencode($cancelURL); + if (!empty($conf->global->PAYPAL_ALLOW_NOTES)) + { + $nvpstr = $nvpstr."&ALLOWNOTE=0"; + } + if (empty($conf->global->PAYPAL_REQUIRE_VALID_SHIPPING_ADDRESS)) + { + $nvpstr = $nvpstr."&NOSHIPPING=1"; // An empty or not complete shipping address will be accepted + } else { + $nvpstr = $nvpstr."&NOSHIPPING=0"; // A valid shipping address is required (full required fields mandatory) + } + $nvpstr = $nvpstr."&SOLUTIONTYPE=".urlencode($solutionType); + $nvpstr = $nvpstr."&LANDINGPAGE=".urlencode($landingPage); + if (!empty($conf->global->PAYPAL_CUSTOMER_SERVICE_NUMBER)) + { + $nvpstr = $nvpstr."&CUSTOMERSERVICENUMBER=".urlencode($conf->global->PAYPAL_CUSTOMER_SERVICE_NUMBER); // Hotline phone number + } - $paypalprefix = 'PAYMENTREQUEST_0_'; - //$paypalprefix = ''; + $paypalprefix = 'PAYMENTREQUEST_0_'; + //$paypalprefix = ''; if (!empty($paypalprefix) && $paymentType == 'Sole') $paymentType = 'Sale'; $nvpstr = $nvpstr."&AMT=".urlencode($paymentAmount); // Total for all elements - $nvpstr = $nvpstr."&".$paypalprefix."INVNUM=".urlencode($tag); - $nvpstr = $nvpstr."&".$paypalprefix."AMT=".urlencode($paymentAmount); // AMT deprecated by paypal -> PAYMENTREQUEST_n_AMT - $nvpstr = $nvpstr."&".$paypalprefix."ITEMAMT=".urlencode($paymentAmount); // AMT deprecated by paypal -> PAYMENTREQUEST_n_AMT - $nvpstr = $nvpstr."&".$paypalprefix."PAYMENTACTION=".urlencode($paymentType); // PAYMENTACTION deprecated by paypal -> PAYMENTREQUEST_n_PAYMENTACTION - $nvpstr = $nvpstr."&".$paypalprefix."CURRENCYCODE=".urlencode($currencyCodeType); // CURRENCYCODE deprecated by paypal -> PAYMENTREQUEST_n_CURRENCYCODE + $nvpstr = $nvpstr."&".$paypalprefix."INVNUM=".urlencode($tag); + $nvpstr = $nvpstr."&".$paypalprefix."AMT=".urlencode($paymentAmount); // AMT deprecated by paypal -> PAYMENTREQUEST_n_AMT + $nvpstr = $nvpstr."&".$paypalprefix."ITEMAMT=".urlencode($paymentAmount); // AMT deprecated by paypal -> PAYMENTREQUEST_n_AMT + $nvpstr = $nvpstr."&".$paypalprefix."PAYMENTACTION=".urlencode($paymentType); // PAYMENTACTION deprecated by paypal -> PAYMENTREQUEST_n_PAYMENTACTION + $nvpstr = $nvpstr."&".$paypalprefix."CURRENCYCODE=".urlencode($currencyCodeType); // CURRENCYCODE deprecated by paypal -> PAYMENTREQUEST_n_CURRENCYCODE - $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_QTY0=1"; - $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_AMT0=".urlencode($paymentAmount); - $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_NAME0=".urlencode($desc); - $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_NUMBER0=0"; + $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_QTY0=1"; + $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_AMT0=".urlencode($paymentAmount); + $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_NAME0=".urlencode($desc); + $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_NUMBER0=0"; - $nvpstr = $nvpstr."&".$paypalprefix."SHIPTONAME=".urlencode($shipToName); // SHIPTONAME deprecated by paypal -> PAYMENTREQUEST_n_SHIPTONAME - $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOSTREET=".urlencode($shipToStreet); // - $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOSTREET2=".urlencode($shipToStreet2); - $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOCITY=".urlencode($shipToCity); - $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOSTATE=".urlencode($shipToState); - $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOCOUNTRYCODE=".urlencode($shipToCountryCode); - $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOZIP=".urlencode($shipToZip); - $nvpstr = $nvpstr."&".$paypalprefix."PHONENUM=".urlencode($phoneNum); - if (!empty($email)) $nvpstr = $nvpstr."&".$paypalprefix."EMAIL=".urlencode($email); // EMAIL deprecated by paypal -> PAYMENTREQUEST_n_EMAIL - if (!empty($desc)) $nvpstr = $nvpstr."&".$paypalprefix."DESC=".urlencode($desc); // DESC deprecated by paypal -> PAYMENTREQUEST_n_DESC + $nvpstr = $nvpstr."&".$paypalprefix."SHIPTONAME=".urlencode($shipToName); // SHIPTONAME deprecated by paypal -> PAYMENTREQUEST_n_SHIPTONAME + $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOSTREET=".urlencode($shipToStreet); // + $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOSTREET2=".urlencode($shipToStreet2); + $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOCITY=".urlencode($shipToCity); + $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOSTATE=".urlencode($shipToState); + $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOCOUNTRYCODE=".urlencode($shipToCountryCode); + $nvpstr = $nvpstr."&".$paypalprefix."SHIPTOZIP=".urlencode($shipToZip); + $nvpstr = $nvpstr."&".$paypalprefix."PHONENUM=".urlencode($phoneNum); + if (!empty($email)) $nvpstr = $nvpstr."&".$paypalprefix."EMAIL=".urlencode($email); // EMAIL deprecated by paypal -> PAYMENTREQUEST_n_EMAIL + if (!empty($desc)) $nvpstr = $nvpstr."&".$paypalprefix."DESC=".urlencode($desc); // DESC deprecated by paypal -> PAYMENTREQUEST_n_DESC - if (!empty($conf->global->PAYPAL_LOGOIMG) && $mysoc->logo) - { - global $dolibarr_main_url_root; + if (!empty($conf->global->PAYPAL_LOGOIMG) && $mysoc->logo) + { + global $dolibarr_main_url_root; - // Define $urlwithroot - $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - $urllogo = $urlwithroot."/viewimage.php?modulepart=mycompany&file=".urlencode('logos/'.$mysoc->logo); - $nvpstr = $nvpstr."&LOGOIMG=".urlencode($urllogo); - } - if (!empty($conf->global->PAYPAL_BRANDNAME)) - { - $nvpstr = $nvpstr."&BRANDNAME=".urlencode($conf->global->PAYPAL_BRANDNAME); // BRANDNAME - } - if (!empty($conf->global->PAYPAL_NOTETOBUYER)) - { - $nvpstr = $nvpstr."&NOTETOBUYER=".urlencode($conf->global->PAYPAL_NOTETOBUYER); // PAYPAL_NOTETOBUYER - } + $urllogo = $urlwithroot."/viewimage.php?modulepart=mycompany&file=".urlencode('logos/'.$mysoc->logo); + $nvpstr = $nvpstr."&LOGOIMG=".urlencode($urllogo); + } + if (!empty($conf->global->PAYPAL_BRANDNAME)) + { + $nvpstr = $nvpstr."&BRANDNAME=".urlencode($conf->global->PAYPAL_BRANDNAME); // BRANDNAME + } + if (!empty($conf->global->PAYPAL_NOTETOBUYER)) + { + $nvpstr = $nvpstr."&NOTETOBUYER=".urlencode($conf->global->PAYPAL_NOTETOBUYER); // PAYPAL_NOTETOBUYER + } $_SESSION["FinalPaymentAmt"] = $paymentAmount; - $_SESSION["currencyCodeType"] = $currencyCodeType; - $_SESSION["PaymentType"] = $paymentType; // 'Mark', 'Sole' - $_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip + $_SESSION["currencyCodeType"] = $currencyCodeType; + $_SESSION["PaymentType"] = $paymentType; // 'Mark', 'Sole' + $_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip - //'--------------------------------------------------------------------------------------------------------------- - //' Make the API call to PayPal - //' If the API call succeded, then redirect the buyer to PayPal to begin to authorize payment. - //' If an error occured, show the resulting errors - //'--------------------------------------------------------------------------------------------------------------- - $resArray = hash_call("SetExpressCheckout", $nvpstr); - $ack = strtoupper($resArray["ACK"]); - if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") - { - $token = urldecode($resArray["TOKEN"]); - $_SESSION['TOKEN'] = $token; - } + //'--------------------------------------------------------------------------------------------------------------- + //' Make the API call to PayPal + //' If the API call succeded, then redirect the buyer to PayPal to begin to authorize payment. + //' If an error occured, show the resulting errors + //'--------------------------------------------------------------------------------------------------------------- + $resArray = hash_call("SetExpressCheckout", $nvpstr); + $ack = strtoupper($resArray["ACK"]); + if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") + { + $token = urldecode($resArray["TOKEN"]); + $_SESSION['TOKEN'] = $token; + } - return $resArray; + return $resArray; } /** @@ -431,39 +431,39 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, */ function getDetails($token) { - //'-------------------------------------------------------------- - //' At this point, the buyer has completed authorizing the payment - //' at PayPal. The function will call PayPal to obtain the details - //' of the authorization, incuding any shipping information of the - //' buyer. Remember, the authorization is not a completed transaction - //' at this state - the buyer still needs an additional step to finalize - //' the transaction - //'-------------------------------------------------------------- + //'-------------------------------------------------------------- + //' At this point, the buyer has completed authorizing the payment + //' at PayPal. The function will call PayPal to obtain the details + //' of the authorization, incuding any shipping information of the + //' buyer. Remember, the authorization is not a completed transaction + //' at this state - the buyer still needs an additional step to finalize + //' the transaction + //'-------------------------------------------------------------- - //declaring of global variables - global $conf, $langs; - global $API_Endpoint, $API_Url, $API_version, $USE_PROXY, $PROXY_HOST, $PROXY_PORT; - global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; + //declaring of global variables + global $conf, $langs; + global $API_Endpoint, $API_Url, $API_version, $USE_PROXY, $PROXY_HOST, $PROXY_PORT; + global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; - //'--------------------------------------------------------------------------- - //' Build a second API request to PayPal, using the token as the - //' ID to get the details on the payment authorization - //'--------------------------------------------------------------------------- - $nvpstr = "&TOKEN=".$token; + //'--------------------------------------------------------------------------- + //' Build a second API request to PayPal, using the token as the + //' ID to get the details on the payment authorization + //'--------------------------------------------------------------------------- + $nvpstr = "&TOKEN=".$token; - //'--------------------------------------------------------------------------- - //' Make the API call and store the results in an array. - //' If the call was a success, show the authorization details, and provide - //' an action to complete the payment. - //' If failed, show the error - //'--------------------------------------------------------------------------- - $resArray = hash_call("GetExpressCheckoutDetails", $nvpstr); - $ack = strtoupper($resArray["ACK"]); - if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") - { - $_SESSION['payer_id'] = $resArray['PAYERID']; - } - return $resArray; + //'--------------------------------------------------------------------------- + //' Make the API call and store the results in an array. + //' If the call was a success, show the authorization details, and provide + //' an action to complete the payment. + //' If failed, show the error + //'--------------------------------------------------------------------------- + $resArray = hash_call("GetExpressCheckoutDetails", $nvpstr); + $ack = strtoupper($resArray["ACK"]); + if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") + { + $_SESSION['payer_id'] = $resArray['PAYERID']; + } + return $resArray; } @@ -481,37 +481,37 @@ function getDetails($token) */ function confirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $tag) { - /* Gather the information to make the final call to + /* Gather the information to make the final call to finalize the PayPal payment. The variable nvpstr holds the name value pairs */ - //declaring of global variables - global $conf, $langs; - global $API_Endpoint, $API_Url, $API_version, $USE_PROXY, $PROXY_HOST, $PROXY_PORT; - global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; + //declaring of global variables + global $conf, $langs; + global $API_Endpoint, $API_Url, $API_version, $USE_PROXY, $PROXY_HOST, $PROXY_PORT; + global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; - $nvpstr = ''; - $nvpstr .= '&TOKEN='.urlencode($token); - $nvpstr .= '&PAYERID='.urlencode($payerID); - $nvpstr .= '&PAYMENTACTION='.urlencode($paymentType); - $nvpstr .= '&AMT='.urlencode($FinalPaymentAmt); - $nvpstr .= '&CURRENCYCODE='.urlencode($currencyCodeType); - $nvpstr .= '&IPADDRESS='.urlencode($ipaddress); - $nvpstr .= '&INVNUM='.urlencode($tag); + $nvpstr = ''; + $nvpstr .= '&TOKEN='.urlencode($token); + $nvpstr .= '&PAYERID='.urlencode($payerID); + $nvpstr .= '&PAYMENTACTION='.urlencode($paymentType); + $nvpstr .= '&AMT='.urlencode($FinalPaymentAmt); + $nvpstr .= '&CURRENCYCODE='.urlencode($currencyCodeType); + $nvpstr .= '&IPADDRESS='.urlencode($ipaddress); + $nvpstr .= '&INVNUM='.urlencode($tag); - /* Make the call to PayPal to finalize payment + /* Make the call to PayPal to finalize payment If an error occured, show the resulting errors */ - $resArray = hash_call("DoExpressCheckoutPayment", $nvpstr); + $resArray = hash_call("DoExpressCheckoutPayment", $nvpstr); - /* Display the API response back to the browser. + /* Display the API response back to the browser. If the response from PayPal was a success, display the response parameters' If the response was an error, display the errors received using APIError.php. */ - $ack = strtoupper($resArray["ACK"]); + $ack = strtoupper($resArray["ACK"]); - return $resArray; + return $resArray; } /** @@ -575,20 +575,20 @@ function DirectPayment($paymentType, $paymentAmount, $creditCardType, $creditCar */ function hash_call($methodName, $nvpStr) { - //declaring of global variables - global $conf, $langs; - global $API_Endpoint, $API_Url, $API_version, $USE_PROXY, $PROXY_HOST, $PROXY_PORT, $PROXY_USER, $PROXY_PASS; - global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; + //declaring of global variables + global $conf, $langs; + global $API_Endpoint, $API_Url, $API_version, $USE_PROXY, $PROXY_HOST, $PROXY_PORT, $PROXY_USER, $PROXY_PASS; + global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; - // TODO problem with triggers - $API_version = "98.0"; + // TODO problem with triggers + $API_version = "98.0"; if (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'alpha')) // We can force sand box with param 'forcesandbox' { - $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; - $API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token="; + $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; + $API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token="; } else { - $API_Endpoint = "https://api-3t.paypal.com/nvp"; - $API_Url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token="; + $API_Endpoint = "https://api-3t.paypal.com/nvp"; + $API_Url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token="; } // Clean parameters @@ -602,73 +602,73 @@ function hash_call($methodName, $nvpStr) if (!empty($conf->global->PAYPAL_API_SANDBOX)) $PAYPAL_API_SANDBOX = $conf->global->PAYPAL_API_SANDBOX; // TODO END problem with triggers - dol_syslog("Paypal API endpoint ".$API_Endpoint); + dol_syslog("Paypal API endpoint ".$API_Endpoint); - //setting the curl parameters. - $ch = curl_init(); + //setting the curl parameters. + $ch = curl_init(); - /*print $API_Endpoint."-".$API_version."-".$PAYPAL_API_USER."-".$PAYPAL_API_PASSWORD."-".$PAYPAL_API_SIGNATURE."
    "; + /*print $API_Endpoint."-".$API_version."-".$PAYPAL_API_USER."-".$PAYPAL_API_PASSWORD."-".$PAYPAL_API_SIGNATURE."
    "; print $USE_PROXY."-".$gv_ApiErrorURL."
    "; print $nvpStr; exit;*/ - curl_setopt($ch, CURLOPT_URL, $API_Endpoint); - curl_setopt($ch, CURLOPT_VERBOSE, 1); - // TLSv1 by default or change to TLSv1.2 in module configuration - curl_setopt($ch, CURLOPT_SSLVERSION, (empty($conf->global->PAYPAL_SSLVERSION) ? 1 : $conf->global->PAYPAL_SSLVERSION)); + curl_setopt($ch, CURLOPT_URL, $API_Endpoint); + curl_setopt($ch, CURLOPT_VERBOSE, 1); + // TLSv1 by default or change to TLSv1.2 in module configuration + curl_setopt($ch, CURLOPT_SSLVERSION, (empty($conf->global->PAYPAL_SSLVERSION) ? 1 : $conf->global->PAYPAL_SSLVERSION)); - //turning off the server and peer verification(TrustManager Concept). - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + //turning off the server and peer verification(TrustManager Concept). + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); - curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); + curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_POST, 1); - //if USE_PROXY constant set to true in Constants.php, then only proxy will be enabled. - if ($USE_PROXY) - { - dol_syslog("Paypal API hash_call set proxy to ".$PROXY_HOST.":".$PROXY_PORT." - ".$PROXY_USER.":".$PROXY_PASS); - //curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); // Curl 7.10 - curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST.":".$PROXY_PORT); - if ($PROXY_USER) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $PROXY_USER.":".$PROXY_PASS); - } + //if USE_PROXY constant set to true in Constants.php, then only proxy will be enabled. + if ($USE_PROXY) + { + dol_syslog("Paypal API hash_call set proxy to ".$PROXY_HOST.":".$PROXY_PORT." - ".$PROXY_USER.":".$PROXY_PASS); + //curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); // Curl 7.10 + curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST.":".$PROXY_PORT); + if ($PROXY_USER) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $PROXY_USER.":".$PROXY_PASS); + } - //NVPRequest for submitting to server - $nvpreq = "METHOD=".urlencode($methodName)."&VERSION=".urlencode($API_version)."&PWD=".urlencode($PAYPAL_API_PASSWORD)."&USER=".urlencode($PAYPAL_API_USER)."&SIGNATURE=".urlencode($PAYPAL_API_SIGNATURE).$nvpStr; - $nvpreq .= "&LOCALECODE=".strtoupper($langs->getDefaultLang(1)); - //$nvpreq.="&BRANDNAME=".urlencode(); // Override merchant name - //$nvpreq.="&NOTIFYURL=".urlencode(); // For Instant Payment Notification url + //NVPRequest for submitting to server + $nvpreq = "METHOD=".urlencode($methodName)."&VERSION=".urlencode($API_version)."&PWD=".urlencode($PAYPAL_API_PASSWORD)."&USER=".urlencode($PAYPAL_API_USER)."&SIGNATURE=".urlencode($PAYPAL_API_SIGNATURE).$nvpStr; + $nvpreq .= "&LOCALECODE=".strtoupper($langs->getDefaultLang(1)); + //$nvpreq.="&BRANDNAME=".urlencode(); // Override merchant name + //$nvpreq.="&NOTIFYURL=".urlencode(); // For Instant Payment Notification url - dol_syslog("Paypal API hash_call nvpreq=".$nvpreq); + dol_syslog("Paypal API hash_call nvpreq=".$nvpreq); - //setting the nvpreq as POST FIELD to curl - curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq); + //setting the nvpreq as POST FIELD to curl + curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq); - //getting response from server - $response = curl_exec($ch); + //getting response from server + $response = curl_exec($ch); - $nvpReqArray = deformatNVP($nvpreq); - $_SESSION['nvpReqArray'] = $nvpReqArray; + $nvpReqArray = deformatNVP($nvpreq); + $_SESSION['nvpReqArray'] = $nvpReqArray; - //convrting NVPResponse to an Associative Array - dol_syslog("Paypal API hash_call Response nvpresp=".$response); - $nvpResArray = deformatNVP($response); + //convrting NVPResponse to an Associative Array + dol_syslog("Paypal API hash_call Response nvpresp=".$response); + $nvpResArray = deformatNVP($response); - if (curl_errno($ch)) { - // moving to display page to display curl errors - $_SESSION['curl_error_no'] = curl_errno($ch); - $_SESSION['curl_error_msg'] = curl_error($ch); + if (curl_errno($ch)) { + // moving to display page to display curl errors + $_SESSION['curl_error_no'] = curl_errno($ch); + $_SESSION['curl_error_msg'] = curl_error($ch); - //Execute the Error handling module to display errors. - } else { - //closing the curl - curl_close($ch); - } + //Execute the Error handling module to display errors. + } else { + //closing the curl + curl_close($ch); + } - return $nvpResArray; + return $nvpResArray; } @@ -681,24 +681,24 @@ function hash_call($methodName, $nvpStr) */ function deformatNVP($nvpstr) { - $intial = 0; - $nvpArray = array(); + $intial = 0; + $nvpArray = array(); - while (strlen($nvpstr)) - { - //postion of Key - $keypos = strpos($nvpstr, '='); - //position of value - $valuepos = strpos($nvpstr, '&') ? strpos($nvpstr, '&') : strlen($nvpstr); + while (strlen($nvpstr)) + { + //postion of Key + $keypos = strpos($nvpstr, '='); + //position of value + $valuepos = strpos($nvpstr, '&') ? strpos($nvpstr, '&') : strlen($nvpstr); - /*getting the Key and Value values and storing in a Associative Array*/ - $keyval = substr($nvpstr, $intial, $keypos); - $valval = substr($nvpstr, $keypos + 1, $valuepos - $keypos - 1); - //decoding the respose - $nvpArray[urldecode($keyval)] = urldecode($valval); - $nvpstr = substr($nvpstr, $valuepos + 1, strlen($nvpstr)); - } - return $nvpArray; + /*getting the Key and Value values and storing in a Associative Array*/ + $keyval = substr($nvpstr, $intial, $keypos); + $valval = substr($nvpstr, $keypos + 1, $valuepos - $keypos - 1); + //decoding the respose + $nvpArray[urldecode($keyval)] = urldecode($valval); + $nvpstr = substr($nvpstr, $valuepos + 1, strlen($nvpstr)); + } + return $nvpArray; } /** diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 24a6d7d36b8..d4df28e0902 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -79,31 +79,31 @@ $htmlother = new FormOther($db); $object = new Product($db); if (!$id && empty($ref)) { - llxHeader("", $langs->trans("ProductStatistics")); + llxHeader("", $langs->trans("ProductStatistics")); - $type = GETPOST('type', 'int'); + $type = GETPOST('type', 'int'); $helpurl = ''; - if ($type == '0') { - $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; - //$title=$langs->trans("StatisticsOfProducts"); - $title = $langs->trans("Statistics"); - } elseif ($type == '1') { - $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; - //$title=$langs->trans("StatisticsOfServices"); - $title = $langs->trans("Statistics"); - } else { - $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; - //$title=$langs->trans("StatisticsOfProductsOrServices"); - $title = $langs->trans("Statistics"); - } + if ($type == '0') { + $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; + //$title=$langs->trans("StatisticsOfProducts"); + $title = $langs->trans("Statistics"); + } elseif ($type == '1') { + $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + //$title=$langs->trans("StatisticsOfServices"); + $title = $langs->trans("Statistics"); + } else { + $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + //$title=$langs->trans("StatisticsOfProductsOrServices"); + $title = $langs->trans("Statistics"); + } - $picto = 'product'; - if ($type == 1) $picto = 'service'; + $picto = 'product'; + if ($type == 1) $picto = 'service'; - print load_fiche_titre($title, $mesg, $picto); + print load_fiche_titre($title, $mesg, $picto); } else { - $result = $object->fetch($id, $ref); + $result = $object->fetch($id, $ref); $title = $langs->trans('ProductServiceCard'); $helpurl = ''; @@ -176,12 +176,12 @@ if ($result || empty($id)) { // Tag if ($conf->categorie->enabled) { - print '
    '.$langs->trans("Categories").''; - //$moreforfilter.='
    '; - $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1); - //$moreforfilter.='
    '; - print $moreforfilter; - print '
    '.$langs->trans("Categories").''; + //$moreforfilter.='
    '; + $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1); + //$moreforfilter.='
    '; + print $moreforfilter; + print '
    '.$langs->trans("Year").''; $arrayyears = array(); for ($year = $currentyear - 10; $year < $currentyear + 10; $year++) { - $arrayyears[$year] = $year; + $arrayyears[$year] = $year; } if (!in_array($year, $arrayyears)) $arrayyears[$year] = $year; if (!in_array($nowyear, $arrayyears)) $arrayyears[$nowyear] = $nowyear; @@ -299,16 +299,16 @@ if ($result || empty($id)) { if (dol_is_file($dir.'/'.$graphfiles[$key]['file'])) { // TODO Load cachefile $graphfiles[$key]['file'] } else { - $morefilters = ''; - if ($search_categ > 0) { - $categ = new Categorie($db); - $categ->fetch($search_categ); - $listofprodids = $categ->getObjectsInCateg('product', 1); - $morefilters = ' AND d.fk_product IN ('.((is_array($listofprodids) && count($listofprodids)) ? join(',', $listofprodids) : '0').')'; - } - if ($search_categ == -2) { - $morefilters = ' AND d.fk_product NOT IN (SELECT cp.fk_product from '.MAIN_DB_PREFIX.'categorie_product as cp)'; - } + $morefilters = ''; + if ($search_categ > 0) { + $categ = new Categorie($db); + $categ->fetch($search_categ); + $listofprodids = $categ->getObjectsInCateg('product', 1); + $morefilters = ' AND d.fk_product IN ('.((is_array($listofprodids) && count($listofprodids)) ? join(',', $listofprodids) : '0').')'; + } + if ($search_categ == -2) { + $morefilters = ' AND d.fk_product NOT IN (SELECT cp.fk_product from '.MAIN_DB_PREFIX.'categorie_product as cp)'; + } if ($key == 'propal') $graph_data = $object->get_nb_propal($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters); if ($key == 'orders') $graph_data = $object->get_nb_order($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters); @@ -371,10 +371,10 @@ if ($result || empty($id)) { // Date generation if ($graphfiles[$key]['output'] && !$px->isGraphKo()) { - if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) $dategenerated = $langs->trans("GeneratedOn", dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']), "dayhour")); - else $dategenerated = $langs->trans("GeneratedOn", dol_print_date(dol_now(), "dayhour")); + if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) $dategenerated = $langs->trans("GeneratedOn", dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']), "dayhour")); + else $dategenerated = $langs->trans("GeneratedOn", dol_print_date(dol_now(), "dayhour")); } else { - $dategenerated = ($mesg ? ''.$mesg.'' : $langs->trans("ChartNotGenerated")); + $dategenerated = ($mesg ? ''.$mesg.'' : $langs->trans("ChartNotGenerated")); } $linktoregenerate = 'id).((string) $type != '' ? '&type='.$type : '').'&action=recalcul&mode='.$mode.'&search_year='.$search_year.'&search_categ='.$search_categ.'">'.img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')', 'refresh').''; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 8a4697be2a1..0567c34a759 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -41,14 +41,14 @@ class MouvementStock extends CommonObject public $table_element = 'stock_mouvement'; - /** - * @var int ID product - */ + /** + * @var int ID product + */ public $product_id; - /** - * @var int ID warehouse - */ + /** + * @var int ID warehouse + */ public $warehouse_id; public $qty; @@ -65,18 +65,18 @@ class MouvementStock extends CommonObject public $price; /** - * @var int ID user author - */ + * @var int ID user author + */ public $fk_user_author; /** - * @var string stock movements label - */ - public $label; + * @var string stock movements label + */ + public $label; - /** - * @var int ID - */ + /** + * @var int ID + */ public $fk_origin; public $origintype; @@ -113,11 +113,11 @@ class MouvementStock extends CommonObject - /** + /** * Constructor * * @param DoliDB $db Database handler - */ + */ public function __construct($db) { $this->db = $db; @@ -147,10 +147,10 @@ class MouvementStock extends CommonObject * @param int $id_product_batch Id product_batch (when skip_batch is false and we already know which record of product_batch to use) * @return int <0 if KO, 0 if fk_product is null or product id does not exists, >0 if OK */ - public function _create($user, $fk_product, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $skip_batch = false, $id_product_batch = 0) + public function _create($user, $fk_product, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $skip_batch = false, $id_product_batch = 0) { - // phpcs:disable - global $conf, $langs; + // phpcs:disable + global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; @@ -227,114 +227,114 @@ class MouvementStock extends CommonObject // If not found, we add record $sql = "SELECT pb.rowid, pb.batch, pb.eatby, pb.sellby FROM ".MAIN_DB_PREFIX."product_lot as pb"; $sql .= " WHERE pb.fk_product = ".$fk_product." AND pb.batch = '".$this->db->escape($batch)."'"; - dol_syslog(get_class($this)."::_create scan serial for this product to check if eatby and sellby match", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - if ($num > 0) - { - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - if ($obj->eatby) - { - if ($eatby) - { - $tmparray = dol_getdate($eatby, true); - $eatbywithouthour = dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); - if ($this->db->jdate($obj->eatby) != $eatby && $this->db->jdate($obj->eatby) != $eatbywithouthour) // We test date without hours and with hours for backward compatibility - { - // If found and eatby/sellby defined into table and provided and differs, return error - $langs->load("stocks"); - $this->errors[] = $langs->transnoentitiesnoconv("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby), 'dayhour'), dol_print_date($eatbywithouthour, 'dayhour')); - dol_syslog("ThisSerialAlreadyExistWithDifferentDate batch=".$batch.", eatby found into product_lot = ".$obj->eatby." = ".dol_print_date($this->db->jdate($obj->eatby), 'dayhourrfc')." so eatbywithouthour = ".$eatbywithouthour." = ".dol_print_date($eatbywithouthour)." - eatby provided = ".$eatby." = ".dol_print_date($eatby, 'dayhourrfc'), LOG_ERR); - $this->db->rollback(); - return -3; - } - } else { - $eatby = $obj->eatby; // If found and eatby/sellby defined into table and not provided, we take value from table - } - } else { - if ($eatby) // If found and eatby/sellby not defined into table and provided, we update table - { - $productlot = new Productlot($this->db); - $result = $productlot->fetch($obj->rowid); - $productlot->eatby = $eatby; - $result = $productlot->update($user); - if ($result <= 0) - { - $this->error = $productlot->error; - $this->errors = $productlot->errors; - $this->db->rollback(); - return -5; - } - } - } - if ($obj->sellby) - { - if ($sellby) - { - $tmparray = dol_getdate($sellby, true); - $sellbywithouthour = dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); - if ($this->db->jdate($obj->sellby) != $sellby && $this->db->jdate($obj->sellby) != $sellbywithouthour) // We test date without hours and with hours for backward compatibility - { - // If found and eatby/sellby defined into table and provided and differs, return error - $this->errors[] = $langs->transnoentitiesnoconv("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)); - dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR); - $this->db->rollback(); - return -3; - } - } else { - $sellby = $obj->sellby; // If found and eatby/sellby defined into table and not provided, we take value from table - } - } - else - { - if ($sellby) // If found and eatby/sellby not defined into table and provided, we update table - { - $productlot = new Productlot($this->db); - $result = $productlot->fetch($obj->rowid); - $productlot->sellby = $sellby; - $result = $productlot->update($user); - if ($result <= 0) - { - $this->error = $productlot->error; - $this->errors = $productlot->errors; - $this->db->rollback(); - return -5; - } - } - } - - $i++; - } - } - else // If not found, we add record - { - $productlot = new Productlot($this->db); - $productlot->entity = $conf->entity; - $productlot->fk_product = $fk_product; - $productlot->batch = $batch; - // If we are here = first time we manage this batch, so we used dates provided by users to create lot - $productlot->eatby = $eatby; - $productlot->sellby = $sellby; - $result = $productlot->create($user); - if ($result <= 0) - { - $this->error = $productlot->error; - $this->errors = $productlot->errors; - $this->db->rollback(); - return -4; - } - } - } - else + dol_syslog(get_class($this)."::_create scan serial for this product to check if eatby and sellby match", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { - dol_print_error($this->db); - $this->db->rollback(); - return -1; + $num = $this->db->num_rows($resql); + $i = 0; + if ($num > 0) + { + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + if ($obj->eatby) + { + if ($eatby) + { + $tmparray = dol_getdate($eatby, true); + $eatbywithouthour = dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); + if ($this->db->jdate($obj->eatby) != $eatby && $this->db->jdate($obj->eatby) != $eatbywithouthour) // We test date without hours and with hours for backward compatibility + { + // If found and eatby/sellby defined into table and provided and differs, return error + $langs->load("stocks"); + $this->errors[] = $langs->transnoentitiesnoconv("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby), 'dayhour'), dol_print_date($eatbywithouthour, 'dayhour')); + dol_syslog("ThisSerialAlreadyExistWithDifferentDate batch=".$batch.", eatby found into product_lot = ".$obj->eatby." = ".dol_print_date($this->db->jdate($obj->eatby), 'dayhourrfc')." so eatbywithouthour = ".$eatbywithouthour." = ".dol_print_date($eatbywithouthour)." - eatby provided = ".$eatby." = ".dol_print_date($eatby, 'dayhourrfc'), LOG_ERR); + $this->db->rollback(); + return -3; + } + } else { + $eatby = $obj->eatby; // If found and eatby/sellby defined into table and not provided, we take value from table + } + } else { + if ($eatby) // If found and eatby/sellby not defined into table and provided, we update table + { + $productlot = new Productlot($this->db); + $result = $productlot->fetch($obj->rowid); + $productlot->eatby = $eatby; + $result = $productlot->update($user); + if ($result <= 0) + { + $this->error = $productlot->error; + $this->errors = $productlot->errors; + $this->db->rollback(); + return -5; + } + } + } + if ($obj->sellby) + { + if ($sellby) + { + $tmparray = dol_getdate($sellby, true); + $sellbywithouthour = dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); + if ($this->db->jdate($obj->sellby) != $sellby && $this->db->jdate($obj->sellby) != $sellbywithouthour) // We test date without hours and with hours for backward compatibility + { + // If found and eatby/sellby defined into table and provided and differs, return error + $this->errors[] = $langs->transnoentitiesnoconv("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)); + dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR); + $this->db->rollback(); + return -3; + } + } else { + $sellby = $obj->sellby; // If found and eatby/sellby defined into table and not provided, we take value from table + } + } + else + { + if ($sellby) // If found and eatby/sellby not defined into table and provided, we update table + { + $productlot = new Productlot($this->db); + $result = $productlot->fetch($obj->rowid); + $productlot->sellby = $sellby; + $result = $productlot->update($user); + if ($result <= 0) + { + $this->error = $productlot->error; + $this->errors = $productlot->errors; + $this->db->rollback(); + return -5; + } + } + } + + $i++; + } + } + else // If not found, we add record + { + $productlot = new Productlot($this->db); + $productlot->entity = $conf->entity; + $productlot->fk_product = $fk_product; + $productlot->batch = $batch; + // If we are here = first time we manage this batch, so we used dates provided by users to create lot + $productlot->eatby = $eatby; + $productlot->sellby = $sellby; + $result = $productlot->create($user); + if ($result <= 0) + { + $this->error = $productlot->error; + $this->errors = $productlot->errors; + $this->db->rollback(); + return -4; + } + } + } + else + { + dol_print_error($this->db); + $this->db->rollback(); + return -1; } } @@ -346,41 +346,41 @@ class MouvementStock extends CommonObject // Note that qty should be > 0 with type 0 or 3, < 0 with type 1 or 2. if ($movestock && $qty < 0 && empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { - if (!empty($conf->productbatch->enabled) && $product->hasbatch() && !$skip_batch) - { - $foundforbatch = 0; - $qtyisnotenough = 0; - foreach ($product->stock_warehouse[$entrepot_id]->detail_batch as $batchcursor => $prodbatch) - { - if ($batch != $batchcursor) continue; - $foundforbatch = 1; - if ($prodbatch->qty < abs($qty)) $qtyisnotenough = $prodbatch->qty; - break; - } - if (!$foundforbatch || $qtyisnotenough) - { - $langs->load("stocks"); - include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; - $tmpwarehouse = new Entrepot($this->db); - $tmpwarehouse->fetch($entrepot_id); + if (!empty($conf->productbatch->enabled) && $product->hasbatch() && !$skip_batch) + { + $foundforbatch = 0; + $qtyisnotenough = 0; + foreach ($product->stock_warehouse[$entrepot_id]->detail_batch as $batchcursor => $prodbatch) + { + if ($batch != $batchcursor) continue; + $foundforbatch = 1; + if ($prodbatch->qty < abs($qty)) $qtyisnotenough = $prodbatch->qty; + break; + } + if (!$foundforbatch || $qtyisnotenough) + { + $langs->load("stocks"); + include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; + $tmpwarehouse = new Entrepot($this->db); + $tmpwarehouse->fetch($entrepot_id); - $this->error = $langs->trans('qtyToTranferLotIsNotEnough', $product->ref, $batch, $qtyisnotenough, $tmpwarehouse->ref); - $this->errors[] = $langs->trans('qtyToTranferLotIsNotEnough', $product->ref, $batch, $qtyisnotenough, $tmpwarehouse->ref); - $this->db->rollback(); - return -8; - } - } - else - { - if (empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty)) - { - $langs->load("stocks"); - $this->error = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; - $this->errors[] = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; - $this->db->rollback(); - return -8; - } - } + $this->error = $langs->trans('qtyToTranferLotIsNotEnough', $product->ref, $batch, $qtyisnotenough, $tmpwarehouse->ref); + $this->errors[] = $langs->trans('qtyToTranferLotIsNotEnough', $product->ref, $batch, $qtyisnotenough, $tmpwarehouse->ref); + $this->db->rollback(); + return -8; + } + } + else + { + if (empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty)) + { + $langs->load("stocks"); + $this->error = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; + $this->errors[] = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; + $this->db->rollback(); + return -8; + } + } } if ($movestock && $entrepot_id > 0) // Change stock for current product, change for subproduct is done after @@ -533,10 +533,10 @@ class MouvementStock extends CommonObject { if ($id_product_batch > 0) { - $result = $this->createBatch($id_product_batch, $qty); + $result = $this->createBatch($id_product_batch, $qty); } else { - $param_batch = array('fk_product_stock' =>$fk_product_stock, 'batchnumber'=>$batch); - $result = $this->createBatch($param_batch, $qty); + $param_batch = array('fk_product_stock' =>$fk_product_stock, 'batchnumber'=>$batch); + $result = $this->createBatch($param_batch, $qty); } if ($result < 0) $error++; } @@ -548,7 +548,7 @@ class MouvementStock extends CommonObject // $sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty; // $sql.= " WHERE rowid = ".$fk_product; - // Update pmp + denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql + // Update pmp + denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET pmp = ".$newpmp.","; $sql .= " stock=(SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; $sql .= " WHERE rowid = ".$fk_product; @@ -562,11 +562,11 @@ class MouvementStock extends CommonObject } } - // If stock is now 0, we can remove entry into llx_product_stock, but only if there is no child lines into llx_product_batch (detail of batch, because we can imagine - // having a lot1/qty=X and lot2/qty=-X, so 0 but we must not loose repartition of different lot. - $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".MAIN_DB_PREFIX."product_batch as pb)"; - $resql = $this->db->query($sql); - // We do not test error, it can fails if there is child in batch details + // If stock is now 0, we can remove entry into llx_product_stock, but only if there is no child lines into llx_product_batch (detail of batch, because we can imagine + // having a lot1/qty=X and lot2/qty=-X, so 0 but we must not loose repartition of different lot. + $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".MAIN_DB_PREFIX."product_batch as pb)"; + $resql = $this->db->query($sql); + // We do not test error, it can fails if there is child in batch details } // Add movement for sub products (recursive call) @@ -577,10 +577,10 @@ class MouvementStock extends CommonObject if ($movestock && !$error) { - // Call trigger - $result = $this->call_trigger('STOCK_MOVEMENT', $user); - if ($result < 0) $error++; - // End call triggers + // Call trigger + $result = $this->call_trigger('STOCK_MOVEMENT', $user); + if ($result < 0) $error++; + // End call triggers } if (!$error) @@ -607,80 +607,80 @@ class MouvementStock extends CommonObject */ public function fetch($id) { - dol_syslog(__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); - $sql = 'SELECT'; - $sql .= ' t.rowid,'; - $sql .= " t.tms,"; - $sql .= " t.datem,"; - $sql .= " t.fk_product,"; - $sql .= " t.fk_entrepot,"; - $sql .= " t.value,"; - $sql .= " t.price,"; - $sql .= " t.type_mouvement,"; - $sql .= " t.fk_user_author,"; - $sql .= " t.label,"; - $sql .= " t.fk_origin,"; - $sql .= " t.origintype,"; - $sql .= " t.inventorycode,"; - $sql .= " t.batch,"; - $sql .= " t.eatby,"; - $sql .= " t.sellby,"; - $sql .= " t.fk_projet as fk_project"; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; - $sql .= ' WHERE 1 = 1'; - //if (null !== $ref) { - //$sql .= ' AND t.ref = ' . '\'' . $ref . '\''; - //} else { - $sql .= ' AND t.rowid = '.$id; - //} + $sql = 'SELECT'; + $sql .= ' t.rowid,'; + $sql .= " t.tms,"; + $sql .= " t.datem,"; + $sql .= " t.fk_product,"; + $sql .= " t.fk_entrepot,"; + $sql .= " t.value,"; + $sql .= " t.price,"; + $sql .= " t.type_mouvement,"; + $sql .= " t.fk_user_author,"; + $sql .= " t.label,"; + $sql .= " t.fk_origin,"; + $sql .= " t.origintype,"; + $sql .= " t.inventorycode,"; + $sql .= " t.batch,"; + $sql .= " t.eatby,"; + $sql .= " t.sellby,"; + $sql .= " t.fk_projet as fk_project"; + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql .= ' WHERE 1 = 1'; + //if (null !== $ref) { + //$sql .= ' AND t.ref = ' . '\'' . $ref . '\''; + //} else { + $sql .= ' AND t.rowid = '.$id; + //} - $resql = $this->db->query($sql); - if ($resql) { - $numrows = $this->db->num_rows($resql); - if ($numrows) { - $obj = $this->db->fetch_object($resql); + $resql = $this->db->query($sql); + if ($resql) { + $numrows = $this->db->num_rows($resql); + if ($numrows) { + $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; + $this->id = $obj->rowid; - $this->product_id = $obj->fk_product; - $this->warehouse_id = $obj->fk_entrepot; - $this->qty = $obj->value; - $this->type = $obj->type_mouvement; + $this->product_id = $obj->fk_product; + $this->warehouse_id = $obj->fk_entrepot; + $this->qty = $obj->value; + $this->type = $obj->type_mouvement; - $this->tms = $this->db->jdate($obj->tms); - $this->datem = $this->db->jdate($obj->datem); - $this->price = $obj->price; - $this->fk_user_author = $obj->fk_user_author; - $this->label = $obj->label; - $this->fk_origin = $obj->fk_origin; - $this->origintype = $obj->origintype; - $this->inventorycode = $obj->inventorycode; - $this->batch = $obj->batch; - $this->eatby = $this->db->jdate($obj->eatby); - $this->sellby = $this->db->jdate($obj->sellby); - $this->fk_project = $obj->fk_project; - } + $this->tms = $this->db->jdate($obj->tms); + $this->datem = $this->db->jdate($obj->datem); + $this->price = $obj->price; + $this->fk_user_author = $obj->fk_user_author; + $this->label = $obj->label; + $this->fk_origin = $obj->fk_origin; + $this->origintype = $obj->origintype; + $this->inventorycode = $obj->inventorycode; + $this->batch = $obj->batch; + $this->eatby = $this->db->jdate($obj->eatby); + $this->sellby = $this->db->jdate($obj->sellby); + $this->fk_project = $obj->fk_project; + } - // Retrieve all extrafield - // fetch optionals attributes and labels - $this->fetch_optionals(); + // Retrieve all extrafield + // fetch optionals attributes and labels + $this->fetch_optionals(); - // $this->fetch_lines(); + // $this->fetch_lines(); - $this->db->free($resql); + $this->db->free($resql); - if ($numrows) { - return 1; - } else { - return 0; - } - } else { - $this->errors[] = 'Error '.$this->db->lasterror(); - dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); + if ($numrows) { + return 1; + } else { + return 0; + } + } else { + $this->errors[] = 'Error '.$this->db->lasterror(); + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); - return -1; - } + return -1; + } } @@ -774,7 +774,7 @@ class MouvementStock extends CommonObject */ public function livraison($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $id_product_batch = 0, $inventorycode = '') { - global $conf; + global $conf; $skip_batch = empty($conf->productbatch->enabled); @@ -800,11 +800,11 @@ class MouvementStock extends CommonObject */ public function reception($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $eatby = '', $sellby = '', $batch = '', $datem = '', $id_product_batch = 0, $inventorycode = '') { - global $conf; + global $conf; - $skip_batch = empty($conf->productbatch->enabled); + $skip_batch = empty($conf->productbatch->enabled); - return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price, $label, $inventorycode, $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); + return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price, $label, $inventorycode, $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); } @@ -869,7 +869,7 @@ class MouvementStock extends CommonObject */ private function createBatch($dluo, $qty) { - global $user; + global $user; $pdluo = new Productbatch($this->db); @@ -932,7 +932,7 @@ class MouvementStock extends CommonObject return $result; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return Url link of origin object * @@ -942,8 +942,8 @@ class MouvementStock extends CommonObject */ public function get_origin($fk_origin, $origintype) { - // phpcs:enable - $origin = ''; + // phpcs:enable + $origin = ''; switch ($origintype) { case 'commande': @@ -982,10 +982,10 @@ class MouvementStock extends CommonObject default: if ($origintype) { - // Separate originetype with "@" : left part is class name, right part is module name - $origintype_array = explode('@', $origintype); - $classname = ucfirst($origintype_array[0]); - $modulename = empty($origintype_array[1]) ? $classname : $origintype_array[1]; + // Separate originetype with "@" : left part is class name, right part is module name + $origintype_array = explode('@', $origintype); + $classname = ucfirst($origintype_array[0]); + $modulename = empty($origintype_array[1]) ? $classname : $origintype_array[1]; $result = dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php'); if ($result) { @@ -1034,21 +1034,21 @@ class MouvementStock extends CommonObject /** - * Initialise an instance with random values. - * Used to build previews or test instances. - * id must be 0 if object instance is a specimen. - * - * @return void - */ - public function initAsSpecimen() - { - global $user, $langs, $conf, $mysoc; + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void + */ + public function initAsSpecimen() + { + global $user, $langs, $conf, $mysoc; - // Initialize parameters - $this->id = 0; + // Initialize parameters + $this->id = 0; - // There is no specific properties. All data into insert are provided as method parameter. - } + // There is no specific properties. All data into insert are provided as method parameter. + } /** * Return a link (with optionaly the picto) @@ -1099,7 +1099,7 @@ class MouvementStock extends CommonObject return $this->LibStatut($mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -1108,7 +1108,7 @@ class MouvementStock extends CommonObject */ public function LibStatut($mode = 0) { - // phpcs:enable + // phpcs:enable global $langs; if ($mode == 0 || $mode == 1) { diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index e398b23935c..923c57b4692 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -70,8 +70,8 @@ $langs->loadLangs(array("main", "members", "companies", "install", "other")); if (empty($conf->adherent->enabled)) accessforbidden('', 0, 0, 1); if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) { - print $langs->trans("Auto subscription form for public visitors has not been enabled"); - exit; + print $langs->trans("Auto subscription form for public visitors has not been enabled"); + exit; } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -97,39 +97,39 @@ $user->loadDefaultValues(); */ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') { - global $user, $conf, $langs, $mysoc; + global $user, $conf, $langs, $mysoc; - top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers - print ''; + print ''; - // Define urllogo - $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; + // Define urllogo + $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; - if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); - } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); - } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { - $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; - } + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; + } print '
    '; - // Output html code for logo - if ($urllogo) { - print '
    '; - print '
    '; - print ''; - print '
    '; - if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; - } - print '
    '; - } - print '
    '; + // Output html code for logo + if ($urllogo) { + print '
    '; + print '
    '; + print ''; + print '
    '; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; + } + print '
    '; + } + print ''; - print '
    '; + print '
    '; } /** @@ -139,12 +139,12 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ */ function llxFooterVierge() { - print '
    '; + print '
    '; - printCommonFooter('public'); + printCommonFooter('public'); - print "\n"; - print "\n"; + print "\n"; + print "\n"; } @@ -156,7 +156,7 @@ $parameters = array(); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } // Action called when page is submitted @@ -166,164 +166,164 @@ if (empty($reshook) && $action == 'add') { $db->begin(); - // test if login already exists - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - if (!GETPOST('login')) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"))."
    \n"; - } - $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape(GETPOST('login'))."'"; - $result = $db->query($sql); - if ($result) { - $num = $db->num_rows($result); - } - if ($num != 0) { - $error++; - $langs->load("errors"); - $errmsg .= $langs->trans("ErrorLoginAlreadyExists")."
    \n"; - } - if (!isset($_POST["pass1"]) || !isset($_POST["pass2"]) || $_POST["pass1"] == '' || $_POST["pass2"] == '' || $_POST["pass1"] != $_POST["pass2"]) { - $error++; - $langs->load("errors"); - $errmsg .= $langs->trans("ErrorPasswordsMustMatch")."
    \n"; - } - if (!GETPOST("email")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("EMail"))."
    \n"; - } - } - if (GETPOST('type') <= 0) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"))."
    \n"; - } - if (!in_array(GETPOST('morphy'), array('mor', 'phy'))) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."
    \n"; - } - if (empty($_POST["lastname"])) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."
    \n"; - } - if (empty($_POST["firstname"])) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."
    \n"; - } - if (GETPOST("email") && !isValidEmail(GETPOST("email"))) { - $error++; - $langs->load("errors"); - $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
    \n"; - } - $birthday = dol_mktime($_POST["birthhour"], $_POST["birthmin"], $_POST["birthsec"], $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); - if ($_POST["birthmonth"] && empty($birthday)) { - $error++; - $langs->load("errors"); - $errmsg .= $langs->trans("ErrorBadDateFormat")."
    \n"; - } - if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { - if (GETPOST("morphy") == 'mor' && GETPOST('budget') <= 0) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("TurnoverOrBudget"))."
    \n"; - } - } + // test if login already exists + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + if (!GETPOST('login')) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"))."
    \n"; + } + $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape(GETPOST('login'))."'"; + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + } + if ($num != 0) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorLoginAlreadyExists")."
    \n"; + } + if (!isset($_POST["pass1"]) || !isset($_POST["pass2"]) || $_POST["pass1"] == '' || $_POST["pass2"] == '' || $_POST["pass1"] != $_POST["pass2"]) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorPasswordsMustMatch")."
    \n"; + } + if (!GETPOST("email")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("EMail"))."
    \n"; + } + } + if (GETPOST('type') <= 0) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"))."
    \n"; + } + if (!in_array(GETPOST('morphy'), array('mor', 'phy'))) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."
    \n"; + } + if (empty($_POST["lastname"])) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."
    \n"; + } + if (empty($_POST["firstname"])) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."
    \n"; + } + if (GETPOST("email") && !isValidEmail(GETPOST("email"))) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
    \n"; + } + $birthday = dol_mktime($_POST["birthhour"], $_POST["birthmin"], $_POST["birthsec"], $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); + if ($_POST["birthmonth"] && empty($birthday)) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorBadDateFormat")."
    \n"; + } + if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { + if (GETPOST("morphy") == 'mor' && GETPOST('budget') <= 0) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("TurnoverOrBudget"))."
    \n"; + } + } - if (isset($public)) $public = 1; - else $public = 0; + if (isset($public)) $public = 1; + else $public = 0; - if (!$error) { - // email a peu pres correct et le login n'existe pas - $adh = new Adherent($db); - $adh->statut = -1; - $adh->public = $public; - $adh->firstname = $_POST["firstname"]; - $adh->lastname = $_POST["lastname"]; - $adh->gender = $_POST["gender"]; - $adh->civility_id = $_POST["civility_id"]; - $adh->societe = $_POST["societe"]; - $adh->address = $_POST["address"]; - $adh->zip = $_POST["zipcode"]; - $adh->town = $_POST["town"]; - $adh->email = $_POST["email"]; - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - $adh->login = $_POST["login"]; - $adh->pass = $_POST["pass1"]; - } - $adh->photo = $_POST["photo"]; - $adh->country_id = $_POST["country_id"]; - $adh->state_id = $_POST["state_id"]; - $adh->typeid = $_POST["type"]; - $adh->note_private = $_POST["note_private"]; - $adh->morphy = $_POST["morphy"]; - $adh->birth = $birthday; + if (!$error) { + // email a peu pres correct et le login n'existe pas + $adh = new Adherent($db); + $adh->statut = -1; + $adh->public = $public; + $adh->firstname = $_POST["firstname"]; + $adh->lastname = $_POST["lastname"]; + $adh->gender = $_POST["gender"]; + $adh->civility_id = $_POST["civility_id"]; + $adh->societe = $_POST["societe"]; + $adh->address = $_POST["address"]; + $adh->zip = $_POST["zipcode"]; + $adh->town = $_POST["town"]; + $adh->email = $_POST["email"]; + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + $adh->login = $_POST["login"]; + $adh->pass = $_POST["pass1"]; + } + $adh->photo = $_POST["photo"]; + $adh->country_id = $_POST["country_id"]; + $adh->state_id = $_POST["state_id"]; + $adh->typeid = $_POST["type"]; + $adh->note_private = $_POST["note_private"]; + $adh->morphy = $_POST["morphy"]; + $adh->birth = $birthday; - // Fill array 'array_options' with data from add form - $extrafields->fetch_name_optionals_label($adh->table_element); - $ret = $extrafields->setOptionalsFromPost(null, $adh); + // Fill array 'array_options' with data from add form + $extrafields->fetch_name_optionals_label($adh->table_element); + $ret = $extrafields->setOptionalsFromPost(null, $adh); if ($ret < 0) $error++; - $result = $adh->create($user); - if ($result > 0) { + $result = $adh->create($user); + if ($result > 0) { require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $object = $adh; + $object = $adh; - $adht = new AdherentType($db); - $adht->fetch($object->typeid); + $adht = new AdherentType($db); + $adht->fetch($object->typeid); - if ($object->email) { - $subject = ''; - $msg = ''; + if ($object->email) { + $subject = ''; + $msg = ''; - // Send subscription email - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - // Set output language - $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); - // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); - // Get email content from template - $arraydefaultmessage = null; - $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER; + // Send subscription email + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "members")); + // Get email content from template + $arraydefaultmessage = null; + $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER; - if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); + if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); - if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { - $subject = $arraydefaultmessage->topic; - $msg = $arraydefaultmessage->content; - } + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); - complete_substitutions_array($substitutionarray, $outputlangs, $object); - $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); - $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs); - if ($subjecttosend && $texttosend) { - $moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n"; + if ($subjecttosend && $texttosend) { + $moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n"; - $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); - } - /*if ($result < 0) { + $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + } + /*if ($result < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); }*/ - } + } - // Send email to the foundation to say a new member subscribed with autosubscribe form - if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) && - !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL)) { - // Define link to login card - $appli = constant('DOL_APPLICATION_TITLE'); - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; - if (preg_match('/\d\.\d/', $appli)) { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } else $appli .= " ".DOL_VERSION; - } else { + // Send email to the foundation to say a new member subscribed with autosubscribe form + if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) && + !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL)) { + // Define link to login card + $appli = constant('DOL_APPLICATION_TITLE'); + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { + $appli = $conf->global->MAIN_APPLICATION_TITLE; + if (preg_match('/\d\.\d/', $appli)) { + if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core + } else $appli .= " ".DOL_VERSION; + } else { $appli .= " ".DOL_VERSION; - } + } - $to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL); - $from = $conf->global->ADHERENT_MAIL_FROM; + $to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL); + $from = $conf->global->ADHERENT_MAIL_FROM; $mailfile = new CMailFile( '['.$appli.'] '.$conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT, $to, @@ -338,103 +338,103 @@ if (empty($reshook) && $action == 'add') { -1 ); - if (!$mailfile->sendfile()) { - dol_syslog($langs->trans("ErrorFailedToSendMail", $from, $to), LOG_ERR); - } - } + if (!$mailfile->sendfile()) { + dol_syslog($langs->trans("ErrorFailedToSendMail", $from, $to), LOG_ERR); + } + } - if (!empty($backtopage)) { + if (!empty($backtopage)) { $urlback = $backtopage; } elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) { - $urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION; - // TODO Make replacement of __AMOUNT__, etc... - } else { + $urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION; + // TODO Make replacement of __AMOUNT__, etc... + } else { $urlback = $_SERVER["PHP_SELF"]."?action=added"; } - if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') { - if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'all') { - $urlback = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); - if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); - if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email')); - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } else { - $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); - } - } - } elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paybox') { - $urlback = DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); - if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); - if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email')); - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } else { - $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); - } - } - } elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') { - $urlback = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); - if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); - if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email')); - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } else { - $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); - } - } - } elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'stripe') { - $urlback = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref; - if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); - if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email')); - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } else { - $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); - } - } - } else { - dol_print_error('', "Autosubscribe form is setup to ask an online payment for a not managed online payment"); - exit; - } - } + if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') { + if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'all') { + $urlback = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); + if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); + if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email')); + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { + $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); + } else { + $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); + } + } + } elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paybox') { + $urlback = DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); + if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); + if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email')); + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { + $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); + } else { + $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); + } + } + } elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') { + $urlback = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); + if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); + if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email')); + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { + $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); + } else { + $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); + } + } + } elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'stripe') { + $urlback = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref; + if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); + if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email')); + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { + $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); + } else { + $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); + } + } + } else { + dol_print_error('', "Autosubscribe form is setup to ask an online payment for a not managed online payment"); + exit; + } + } - if (!empty($entity)) $urlback .= '&entity='.$entity; - dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback); - } else { - $error++; - $errmsg .= join('
    ', $adh->errors); - } - } + if (!empty($entity)) $urlback .= '&entity='.$entity; + dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback); + } else { + $error++; + $errmsg .= join('
    ', $adh->errors); + } + } - if (!$error) { - $db->commit(); + if (!$error) { + $db->commit(); - Header("Location: ".$urlback); - exit; - } else { - $db->rollback(); - } + Header("Location: ".$urlback); + exit; + } else { + $db->rollback(); + } } // Action called after a submitted was send and member created successfully // If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url. // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url. if (empty($reshook) && $action == 'added') { - llxHeaderVierge($langs->trans("NewMemberForm")); + llxHeaderVierge($langs->trans("NewMemberForm")); - // Si on a pas ete redirige - print '
    '; - print '
    '; - print $langs->trans("NewMemberbyWeb"); - print '
    '; + // Si on a pas ete redirige + print '
    '; + print '
    '; + print $langs->trans("NewMemberbyWeb"); + print '
    '; - llxFooterVierge(); - exit; + llxFooterVierge(); + exit; } @@ -460,9 +460,9 @@ print '
    '; print '
    '; if (!empty($conf->global->MEMBER_NEWFORM_TEXT)) { - print $langs->trans($conf->global->MEMBER_NEWFORM_TEXT)."
    \n"; + print $langs->trans($conf->global->MEMBER_NEWFORM_TEXT)."
    \n"; } else { - print $langs->trans("NewSubscriptionDesc", $conf->global->MAIN_INFO_SOCIETE_MAIL)."
    \n"; + print $langs->trans("NewSubscriptionDesc", $conf->global->MAIN_INFO_SOCIETE_MAIL)."
    \n"; } print '
    '; @@ -510,31 +510,31 @@ print ''." // Type if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { - $listoftype = $adht->liste_array(); - $tmp = array_keys($listoftype); - $defaulttype = ''; - $isempty = 1; - if (count($listoftype) == 1) { + $listoftype = $adht->liste_array(); + $tmp = array_keys($listoftype); + $defaulttype = ''; + $isempty = 1; + if (count($listoftype) == 1) { $defaulttype = $tmp[0]; $isempty = 0; } - print ''."\n"; + print ''."\n"; } else { - $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); - print ''; + $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); + print ''; } // Moral/Physic attribute $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { - print ''."\n"; + print ''."\n"; } else { - print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY]; - print ''; + print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY]; + print ''; } // Civility print ''; print ''; // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - print ''; + print ''; } // EMail print ''."\n"; // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''."\n"; - print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; } // Birthday print ''."\n"; // Add specific fields used by Dolibarr foundation for example if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { - $arraybudget = array('50'=>'<= 100 000', '100'=>'<= 200 000', '200'=>'<= 500 000', '300'=>'<= 1 500 000', '600'=>'<= 3 000 000', '1000'=>'<= 5 000 000', '2000'=>'5 000 000+'); - print ''."\n"; + print ''."\n"; } if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { - // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount - $amount = 0; - if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { - $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; - } + // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount + $amount = 0; + if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; + } - if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { - $amount = GETPOST('amount') ?GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT; - } - // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' - print ''; + if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { + $amount = GETPOST('amount') ?GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT; + } + // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' + print ''; } print "
    '.$langs->trans("Type").' *'; - print $form->selectarray("type", $adht->liste_array(), GETPOST('type') ?GETPOST('type') : $defaulttype, $isempty); - print '
    '.$langs->trans("Type").' *'; + print $form->selectarray("type", $adht->liste_array(), GETPOST('type') ?GETPOST('type') : $defaulttype, $isempty); + print '
    '.$langs->trans('MemberNature').' *'."\n"; - print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); - print '
    '.$langs->trans('MemberNature').' *'."\n"; + print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); + print '
    '.$langs->trans('UserTitle').''; @@ -564,34 +564,34 @@ print '
    '.$langs->trans('Country').''; $country_id = GETPOST('country_id'); if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { - $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); + $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); } if (!$country_id && !empty($conf->geoipmaxmind->enabled)) { - $country_code = dol_user_country(); - //print $country_code; - if ($country_code) { - $new_country_id = getCountry($country_code, 3, $db, $langs); - //print 'xxx'.$country_code.' - '.$new_country_id; - if ($new_country_id) $country_id = $new_country_id; - } + $country_code = dol_user_country(); + //print $country_code; + if ($country_code) { + $new_country_id = getCountry($country_code, 3, $db, $langs); + //print 'xxx'.$country_code.' - '.$new_country_id; + if ($new_country_id) $country_id = $new_country_id; + } } $country_code = getCountry($country_id, 2, $db, $langs); print $form->select_country($country_id, 'country_id'); print '
    '.$langs->trans('State').''; - if ($country_code) print $formcompany->select_state(GETPOST("state_id"), $country_code); - else print ''; - print '
    '.$langs->trans('State').''; + if ($country_code) print $formcompany->select_state(GETPOST("state_id"), $country_code); + else print ''; + print '
    '.$langs->trans("Email").' *
    '.$langs->trans("Login").' *
    '.$langs->trans("Password").' *
    '.$langs->trans("PasswordAgain").' *
    '.$langs->trans("Login").' *
    '.$langs->trans("Password").' *
    '.$langs->trans("PasswordAgain").' *
    '.$langs->trans("DateToBirth").''; @@ -612,12 +612,12 @@ print '
    '.$langs->trans("TurnoverOrBudget").' *'; - print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1); - print ' € or $'; + $arraybudget = array('50'=>'<= 100 000', '100'=>'<= 200 000', '200'=>'<= 500 000', '300'=>'<= 1 500 000', '600'=>'<= 3 000 000', '1000'=>'<= 5 000 000', '2000'=>'5 000 000+'); + print '
    '.$langs->trans("TurnoverOrBudget").' *'; + print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1); + print ' € or $'; - print ''; - print '
    '.$langs->trans("Subscription").''; - if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { - print ''; - } else { - print ''; - print ''; - } - print ' '.$langs->trans("Currency".$conf->currency); - print '
    '.$langs->trans("Subscription").''; + if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { + print ''; + } else { + print ''; + print ''; + } + print ' '.$langs->trans("Currency".$conf->currency); + print '
    \n"; @@ -682,7 +682,7 @@ print dol_get_fiche_end(); print '
    '; print ''; if (!empty($backtopage)) { - print '     '; + print '     '; } print '
    '; diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 7c58d0ef944..1291035760f 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -64,11 +64,11 @@ if (empty($source)) $source = 'proposal'; if (!$action) { - if ($source && !$ref) - { - print $langs->trans('ErrorBadParameters')." - ref missing"; - exit; - } + if ($source && !$ref) + { + print $langs->trans('ErrorBadParameters')." - ref missing"; + exit; + } } @@ -83,18 +83,18 @@ $SECUREKEY = GETPOST("securekey"); // Secure key if (!empty($source)) { - $urlok .= 'source='.urlencode($source).'&'; - $urlko .= 'source='.urlencode($source).'&'; + $urlok .= 'source='.urlencode($source).'&'; + $urlko .= 'source='.urlencode($source).'&'; } if (!empty($REF)) { - $urlok .= 'ref='.urlencode($REF).'&'; - $urlko .= 'ref='.urlencode($REF).'&'; + $urlok .= 'ref='.urlencode($REF).'&'; + $urlko .= 'ref='.urlencode($REF).'&'; } if (!empty($SECUREKEY)) { - $urlok .= 'securekey='.urlencode($SECUREKEY).'&'; - $urlko .= 'securekey='.urlencode($SECUREKEY).'&'; + $urlok .= 'securekey='.urlencode($SECUREKEY).'&'; + $urlko .= 'securekey='.urlencode($SECUREKEY).'&'; } if (!empty($entity)) { @@ -114,7 +114,7 @@ $creditor = $mysoc->name; if ($action == 'dosign') { - // TODO + // TODO } @@ -134,12 +134,12 @@ llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'on // Check link validity for param 'source' if (!empty($source) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', ''))) { - $langs->load("errors"); - dol_print_error_email('BADREFINONLINESIGNFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $source, $ref)); - // End of page - llxFooter(); - $db->close(); - exit; + $langs->load("errors"); + dol_print_error_email('BADREFINONLINESIGNFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $source, $ref)); + // End of page + llxFooter(); + $db->close(); + exit; } print ''."\n"; @@ -194,16 +194,16 @@ if ($urllogo) $text = ''; if (!empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT)) { - $langs->load("members"); - $reg = array(); - if (preg_match('/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) $text .= $langs->trans($reg[1])."
    \n"; - else $text .= $conf->global->ONLINE_SIGN_NEWFORM_TEXT."
    \n"; - $text = '

    '.$text.'

    '.$text.'

    '.$langs->trans("WelcomeOnOnlineSignaturePage", $mysoc->name).'
    '.$langs->trans("ThisScreenAllowsYouToSignDocFrom", $creditor).'


    '.$langs->trans("WelcomeOnOnlineSignaturePage", $mysoc->name).'
    '.$langs->trans("ThisScreenAllowsYouToSignDocFrom", $creditor).'

    '.$langs->trans("Creditor"); - print ''.$creditor.''; - print ''; - print '
    '.$creditor.''; + print ''; + print '
    '."\n"; print "\n"; if ($action != 'dosign') { - if ($found && !$error) { - // We are in a management option and no error - } else { - dol_print_error_email('ERRORNEWONLINESIGN'); - } + if ($found && !$error) { + // We are in a management option and no error + } else { + dol_print_error_email('ERRORNEWONLINESIGN'); + } } else { - // Print + // Print } print ''."\n"; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index a44428808a4..90ded9e8008 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -417,42 +417,42 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) dol_syslog("POST vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_stripe'); $error = 0; - $errormessage = ''; + $errormessage = ''; - // When using the Charge API architecture - if (empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) - { - try { - $metadata = array( - 'dol_version' => DOL_VERSION, - 'dol_entity' => $conf->entity, - 'dol_company' => $mysoc->name, // Usefull when using multicompany - 'dol_tax_num' => $vatnumber, - 'ipaddress'=> getUserRemoteIP() - ); + // When using the Charge API architecture + if (empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) + { + try { + $metadata = array( + 'dol_version' => DOL_VERSION, + 'dol_entity' => $conf->entity, + 'dol_company' => $mysoc->name, // Usefull when using multicompany + 'dol_tax_num' => $vatnumber, + 'ipaddress'=> getUserRemoteIP() + ); - if (!empty($thirdparty_id)) $metadata["dol_thirdparty_id"] = $thirdparty_id; + if (!empty($thirdparty_id)) $metadata["dol_thirdparty_id"] = $thirdparty_id; - if ($thirdparty_id > 0) - { - dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_stripe'); + if ($thirdparty_id > 0) + { + dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_stripe'); - $service = 'StripeTest'; - $servicestatus = 0; - if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'int')) - { - $service = 'StripeLive'; - $servicestatus = 1; - } + $service = 'StripeTest'; + $servicestatus = 0; + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'int')) + { + $service = 'StripeLive'; + $servicestatus = 1; + } - $thirdparty = new Societe($db); - $thirdparty->fetch($thirdparty_id); + $thirdparty = new Societe($db); + $thirdparty->fetch($thirdparty_id); - // Create Stripe customer - include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; - $stripe = new Stripe($db); - $stripeacc = $stripe->getStripeAccount($service); - $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1); + // Create Stripe customer + include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; + $stripe = new Stripe($db); + $stripeacc = $stripe->getStripeAccount($service); + $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1); if (empty($customer)) { $error++; @@ -461,51 +461,51 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) $action = ''; } - // Create Stripe card from Token - if (!$error) - { - if ($savesource) { - $card = $customer->sources->create(array("source" => $stripeToken, "metadata" => $metadata)); - } else { - $card = $stripeToken; - } + // Create Stripe card from Token + if (!$error) + { + if ($savesource) { + $card = $customer->sources->create(array("source" => $stripeToken, "metadata" => $metadata)); + } else { + $card = $stripeToken; + } - if (empty($card)) - { - $error++; - dol_syslog('Failed to create card record', LOG_WARNING, 0, '_stripe'); - setEventMessages('Failed to create card record', null, 'errors'); - $action = ''; - } else { - if (!empty($FULLTAG)) $metadata["FULLTAG"] = $FULLTAG; - if (!empty($dol_id)) $metadata["dol_id"] = $dol_id; - if (!empty($dol_type)) $metadata["dol_type"] = $dol_type; + if (empty($card)) + { + $error++; + dol_syslog('Failed to create card record', LOG_WARNING, 0, '_stripe'); + setEventMessages('Failed to create card record', null, 'errors'); + $action = ''; + } else { + if (!empty($FULLTAG)) $metadata["FULLTAG"] = $FULLTAG; + if (!empty($dol_id)) $metadata["dol_id"] = $dol_id; + if (!empty($dol_type)) $metadata["dol_type"] = $dol_type; - dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_stripe'); - $charge = \Stripe\Charge::create(array( - 'amount' => price2num($amountstripe, 'MU'), - 'currency' => $currency, - 'capture' => true, // Charge immediatly - 'description' => 'Stripe payment: '.$FULLTAG.' ref='.$ref, - 'metadata' => $metadata, - 'customer' => $customer->id, - 'source' => $card, - 'statement_descriptor_suffix' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) - ), array("idempotency_key" => "$FULLTAG", "stripe_account" => "$stripeacc")); - // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) - if (empty($charge)) - { - $error++; - dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe'); - setEventMessages('Failed to charge card', null, 'errors'); - $action = ''; - } - } - } - } else { - $vatcleaned = $vatnumber ? $vatnumber : null; + dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_stripe'); + $charge = \Stripe\Charge::create(array( + 'amount' => price2num($amountstripe, 'MU'), + 'currency' => $currency, + 'capture' => true, // Charge immediatly + 'description' => 'Stripe payment: '.$FULLTAG.' ref='.$ref, + 'metadata' => $metadata, + 'customer' => $customer->id, + 'source' => $card, + 'statement_descriptor_suffix' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + ), array("idempotency_key" => "$FULLTAG", "stripe_account" => "$stripeacc")); + // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) + if (empty($charge)) + { + $error++; + dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe'); + setEventMessages('Failed to charge card', null, 'errors'); + $action = ''; + } + } + } + } else { + $vatcleaned = $vatnumber ? $vatnumber : null; - /*$taxinfo = array('type'=>'vat'); + /*$taxinfo = array('type'=>'vat'); if ($vatcleaned) { $taxinfo["tax_id"] = $vatcleaned; @@ -514,18 +514,18 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) if (empty($vatcleaned)) $taxinfo=null; */ - dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_stripe'); + dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_stripe'); - $customer = \Stripe\Customer::create(array( - 'email' => $email, - 'description' => ($email ? 'Anonymous customer for '.$email : 'Anonymous customer'), - 'metadata' => $metadata, - 'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?) - )); - // Return $customer = array('id'=>'cus_XXXX', ...) + $customer = \Stripe\Customer::create(array( + 'email' => $email, + 'description' => ($email ? 'Anonymous customer for '.$email : 'Anonymous customer'), + 'metadata' => $metadata, + 'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?) + )); + // Return $customer = array('id'=>'cus_XXXX', ...) - // Create the VAT record in Stripe - /* We don't know country of customer, so we can't create tax + // Create the VAT record in Stripe + /* We don't know country of customer, so we can't create tax if (! empty($conf->global->STRIPE_SAVE_TAX_IDS)) // We setup to save Tax info on Stripe side. Warning: This may result in error when saving customer { if (! empty($vatcleaned)) @@ -539,145 +539,145 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) } }*/ - if (!empty($FULLTAG)) $metadata["FULLTAG"] = $FULLTAG; - if (!empty($dol_id)) $metadata["dol_id"] = $dol_id; - if (!empty($dol_type)) $metadata["dol_type"] = $dol_type; + if (!empty($FULLTAG)) $metadata["FULLTAG"] = $FULLTAG; + if (!empty($dol_id)) $metadata["dol_id"] = $dol_id; + if (!empty($dol_type)) $metadata["dol_type"] = $dol_type; - // The customer was just created with a source, so we can make a charge - // with no card defined, the source just used for customer creation will be used. - dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe'); - $charge = \Stripe\Charge::create(array( - 'customer' => $customer->id, - 'amount' => price2num($amountstripe, 'MU'), - 'currency' => $currency, - 'capture' => true, // Charge immediatly - 'description' => 'Stripe payment: '.$FULLTAG.' ref='.$ref, - 'metadata' => $metadata, - 'statement_descriptor' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) - ), array("idempotency_key" => "$FULLTAG", "stripe_account" => "$stripeacc")); - // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) - if (empty($charge)) - { - $error++; - dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe'); - setEventMessages('Failed to charge card', null, 'errors'); - $action = ''; - } - } - } catch (\Stripe\Error\Card $e) { - // Since it's a decline, \Stripe\Error\Card will be caught - $body = $e->getJsonBody(); - $err = $body['error']; + // The customer was just created with a source, so we can make a charge + // with no card defined, the source just used for customer creation will be used. + dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe'); + $charge = \Stripe\Charge::create(array( + 'customer' => $customer->id, + 'amount' => price2num($amountstripe, 'MU'), + 'currency' => $currency, + 'capture' => true, // Charge immediatly + 'description' => 'Stripe payment: '.$FULLTAG.' ref='.$ref, + 'metadata' => $metadata, + 'statement_descriptor' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + ), array("idempotency_key" => "$FULLTAG", "stripe_account" => "$stripeacc")); + // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) + if (empty($charge)) + { + $error++; + dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe'); + setEventMessages('Failed to charge card', null, 'errors'); + $action = ''; + } + } + } catch (\Stripe\Error\Card $e) { + // Since it's a decline, \Stripe\Error\Card will be caught + $body = $e->getJsonBody(); + $err = $body['error']; - print('Status is:'.$e->getHttpStatus()."\n"); - print('Type is:'.$err['type']."\n"); - print('Code is:'.$err['code']."\n"); - // param is '' in this case - print('Param is:'.$err['param']."\n"); - print('Message is:'.$err['message']."\n"); + print('Status is:'.$e->getHttpStatus()."\n"); + print('Type is:'.$err['type']."\n"); + print('Code is:'.$err['code']."\n"); + // param is '' in this case + print('Param is:'.$err['param']."\n"); + print('Message is:'.$err['message']."\n"); - $error++; - $errormessage = "ErrorCard ".$e->getMessage()." err=".var_export($err, true); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); - setEventMessages($e->getMessage(), null, 'errors'); - $action = ''; - } catch (\Stripe\Error\RateLimit $e) { - // Too many requests made to the API too quickly - $error++; - $errormessage = "ErrorRateLimit ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); - setEventMessages($e->getMessage(), null, 'errors'); - $action = ''; - } catch (\Stripe\Error\InvalidRequest $e) { - // Invalid parameters were supplied to Stripe's API - $error++; - $errormessage = "ErrorInvalidRequest ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); - setEventMessages($e->getMessage(), null, 'errors'); - $action = ''; - } catch (\Stripe\Error\Authentication $e) { - // Authentication with Stripe's API failed - // (maybe you changed API keys recently) - $error++; - $errormessage = "ErrorAuthentication ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); - setEventMessages($e->getMessage(), null, 'errors'); - $action = ''; - } catch (\Stripe\Error\ApiConnection $e) { - // Network communication with Stripe failed - $error++; - $errormessage = "ErrorApiConnection ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); - setEventMessages($e->getMessage(), null, 'errors'); - $action = ''; - } catch (\Stripe\Error\Base $e) { - // Display a very generic error to the user, and maybe send - // yourself an email - $error++; - $errormessage = "ErrorBase ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); - setEventMessages($e->getMessage(), null, 'errors'); - $action = ''; - } catch (Exception $e) { - // Something else happened, completely unrelated to Stripe - $error++; - $errormessage = "ErrorException ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); - setEventMessages($e->getMessage(), null, 'errors'); - $action = ''; - } - } + $error++; + $errormessage = "ErrorCard ".$e->getMessage()." err=".var_export($err, true); + dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + setEventMessages($e->getMessage(), null, 'errors'); + $action = ''; + } catch (\Stripe\Error\RateLimit $e) { + // Too many requests made to the API too quickly + $error++; + $errormessage = "ErrorRateLimit ".$e->getMessage(); + dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + setEventMessages($e->getMessage(), null, 'errors'); + $action = ''; + } catch (\Stripe\Error\InvalidRequest $e) { + // Invalid parameters were supplied to Stripe's API + $error++; + $errormessage = "ErrorInvalidRequest ".$e->getMessage(); + dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + setEventMessages($e->getMessage(), null, 'errors'); + $action = ''; + } catch (\Stripe\Error\Authentication $e) { + // Authentication with Stripe's API failed + // (maybe you changed API keys recently) + $error++; + $errormessage = "ErrorAuthentication ".$e->getMessage(); + dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + setEventMessages($e->getMessage(), null, 'errors'); + $action = ''; + } catch (\Stripe\Error\ApiConnection $e) { + // Network communication with Stripe failed + $error++; + $errormessage = "ErrorApiConnection ".$e->getMessage(); + dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + setEventMessages($e->getMessage(), null, 'errors'); + $action = ''; + } catch (\Stripe\Error\Base $e) { + // Display a very generic error to the user, and maybe send + // yourself an email + $error++; + $errormessage = "ErrorBase ".$e->getMessage(); + dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + setEventMessages($e->getMessage(), null, 'errors'); + $action = ''; + } catch (Exception $e) { + // Something else happened, completely unrelated to Stripe + $error++; + $errormessage = "ErrorException ".$e->getMessage(); + dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + setEventMessages($e->getMessage(), null, 'errors'); + $action = ''; + } + } - // When using the PaymentIntent API architecture - if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) - { - $service = 'StripeTest'; - $servicestatus = 0; - if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'int')) - { - $service = 'StripeLive'; - $servicestatus = 1; - } - include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; - $stripe = new Stripe($db); - $stripeacc = $stripe->getStripeAccount($service); + // When using the PaymentIntent API architecture + if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) + { + $service = 'StripeTest'; + $servicestatus = 0; + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'int')) + { + $service = 'StripeLive'; + $servicestatus = 1; + } + include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; + $stripe = new Stripe($db); + $stripeacc = $stripe->getStripeAccount($service); - // We go here if $conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is set. - // In such a case, payment is always ok when we call the "charge" action. - $paymentintent_id = GETPOST("paymentintent_id", "alpha"); + // We go here if $conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is set. + // In such a case, payment is always ok when we call the "charge" action. + $paymentintent_id = GETPOST("paymentintent_id", "alpha"); - // Force to use the correct API key - global $stripearrayofkeysbyenv; - \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$servicestatus]['secret_key']); + // Force to use the correct API key + global $stripearrayofkeysbyenv; + \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$servicestatus]['secret_key']); - try { - if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage - $paymentintent = \Stripe\PaymentIntent::retrieve($paymentintent_id); - } else { - $paymentintent = \Stripe\PaymentIntent::retrieve($paymentintent_id, array("stripe_account" => $stripeacc)); - } - } catch (Exception $e) - { - $error++; - $errormessage = "CantRetrievePaymentIntent ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); - setEventMessages($e->getMessage(), null, 'errors'); - $action = ''; - } + try { + if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage + $paymentintent = \Stripe\PaymentIntent::retrieve($paymentintent_id); + } else { + $paymentintent = \Stripe\PaymentIntent::retrieve($paymentintent_id, array("stripe_account" => $stripeacc)); + } + } catch (Exception $e) + { + $error++; + $errormessage = "CantRetrievePaymentIntent ".$e->getMessage(); + dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + setEventMessages($e->getMessage(), null, 'errors'); + $action = ''; + } - if ($paymentintent->status != 'succeeded') - { - $error++; - $errormessage = "StatusOfRetrievedIntent is not succeeded: ".$paymentintent->status; - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); - setEventMessages($paymentintent->status, null, 'errors'); - $action = ''; - } else { - // TODO We can alse record the payment mode into llx_societe_rib with stripe $paymentintent->payment_method - // Note that with other old Stripe architecture (using Charge API), the payment mode was not recorded, so it is not mandatory to do it here. - //dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_stripe'); - } - } + if ($paymentintent->status != 'succeeded') + { + $error++; + $errormessage = "StatusOfRetrievedIntent is not succeeded: ".$paymentintent->status; + dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + setEventMessages($paymentintent->status, null, 'errors'); + $action = ''; + } else { + // TODO We can alse record the payment mode into llx_societe_rib with stripe $paymentintent->payment_method + // Note that with other old Stripe architecture (using Charge API), the payment mode was not recorded, so it is not mandatory to do it here. + //dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_stripe'); + } + } $remoteip = getUserRemoteIP(); @@ -727,8 +727,8 @@ if ($source && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_r $langs->load("errors"); dol_print_error_email('BADREFINPAYMENTFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $source, $ref)); // End of page - llxFooter(); - $db->close(); + llxFooter(); + $db->close(); exit; } @@ -1394,9 +1394,9 @@ if ($source == 'membersubscription') print ''."\n"; if ($object->datefin > 0) { - print ''.$langs->trans("DateEndSubscription"); - print ''.dol_print_date($member->datefin, 'day'); - print ''."\n"; + print ''.$langs->trans("DateEndSubscription"); + print ''.dol_print_date($member->datefin, 'day'); + print ''."\n"; } if ($member->last_subscription_date || $member->last_subscription_amount) @@ -1667,13 +1667,13 @@ if ($action != 'dopayment') { print '

    '.$langs->trans("DonationPaid").''; } else { - // Membership can be paid and we still allow to make renewal - if ($source == 'membersubscription' && $object->datefin > dol_now()) - { - $langs->load("members"); - print '
    '.$langs->trans("MembershipPaid", dol_print_date($object->datefin, 'day')).'
    '; - print '
    '.$langs->trans("PaymentWillBeRecordedForNextPeriod").'
    '; - } + // Membership can be paid and we still allow to make renewal + if ($source == 'membersubscription' && $object->datefin > dol_now()) + { + $langs->load("members"); + print '
    '.$langs->trans("MembershipPaid", dol_print_date($object->datefin, 'day')).'
    '; + print '
    '.$langs->trans("PaymentWillBeRecordedForNextPeriod").'
    '; + } // Buttons for all payments registration methods @@ -1862,48 +1862,48 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment //if (empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) || ! empty($paymentintent)) //{ - print ' + print ' '; - print '
    '; - if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) - { - print '
    '; - } + if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) + { + print '
    '; + } - print '
    '; - print ''; + print '
    '; + print ''; - if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) - { - print '
    '; - } + if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) + { + print '
    '; + } - print '
    + print '
    '; - print ' + print '
    '; - print '
    '; - print ''; - print ''; + print '
    '; + print ''; + print ''; - print '
    '; + print ''; + print ''; //} if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) { - if (empty($paymentintent)) - { - print '
    '.$langs->trans("Error").'
    '; - } else { - print ''; - //$_SESSION["paymentintent_id"] = $paymentintent->id; - } + if (empty($paymentintent)) + { + print '
    '.$langs->trans("Error").'
    '; + } else { + print ''; + //$_SESSION["paymentintent_id"] = $paymentintent->id; + } } print ''."\n"; @@ -1916,71 +1916,71 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment print info_admin($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Stripe")), 0, 0, 'error'); } else { print ''; - print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; - // Code to ask the credit card. This use the default "API version". No way to force API version when using JS code. - print ''; + print ''; } } // This hook is used to show the embedded form to make payments with external payment modules (ie Payzen, ...) diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php index a5be30aab49..504ecadfc71 100644 --- a/htdocs/public/recruitment/index.php +++ b/htdocs/public/recruitment/index.php @@ -22,15 +22,15 @@ */ if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); + define('NOCSRFCHECK', '1'); } // Do not check anti CSRF attack test if (!defined('NOREQUIREMENU')) { - define('NOREQUIREMENU', '1'); + define('NOREQUIREMENU', '1'); } // If there is no need to load and show top and left menu if (!defined("NOLOGIN")) { - define("NOLOGIN", '1'); + define("NOLOGIN", '1'); } if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 91ce8993bef..bd7b5416efb 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -69,7 +69,7 @@ $parameters = array( // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } // Add file in email form if (empty($reshook) && GETPOST('addfile', 'alpha') && !GETPOST('add', 'alpha')) { diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 6e27164ba23..ffe2a1373e8 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -57,7 +57,7 @@ class RecruitmentJobPosition extends CommonObject */ public $isextrafieldmanaged = 1; - /** + /** * @var string String with name of icon for recruitmentjobposition. Must be the part after the 'object_' into object_recruitmentjobposition.png */ public $picto = 'recruitmentjobposition'; @@ -126,30 +126,30 @@ class RecruitmentJobPosition extends CommonObject ); public $rowid; - /** - * @var string ref - */ + /** + * @var string ref + */ public $ref; public $entity; - /** - * @var string label - */ + /** + * @var string label + */ public $label; public $qty; public $fk_soc; public $fk_project; public $fk_user_recruiter; - /** - * @var string recruiter email - */ - public $email_recruiter; + /** + * @var string recruiter email + */ + public $email_recruiter; - /** - * @var string suggested remuneration - */ - public $remuneration_suggested; + /** + * @var string suggested remuneration + */ + public $remuneration_suggested; public $fk_user_supervisor; public $fk_establishment; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index d392375fdd0..ef4252f41df 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -52,8 +52,8 @@ class Dolresource extends CommonObject public $mandatory; /** - * @var int ID - */ + * @var int ID + */ public $fk_user_create; public $type_label; @@ -63,75 +63,75 @@ class Dolresource extends CommonObject public $oldcopy; - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - } + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + } - /** - * Create object into database - * - * @param User $user User that creates - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, Id of created object if OK - */ - public function create($user, $notrigger = 0) - { - global $conf, $langs, $hookmanager; - $error = 0; + /** + * Create object into database + * + * @param User $user User that creates + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create($user, $notrigger = 0) + { + global $conf, $langs, $hookmanager; + $error = 0; - // Clean parameters + // Clean parameters - if (isset($this->ref)) $this->ref = trim($this->ref); - if (isset($this->description)) $this->description = trim($this->description); - if (!is_numeric($this->country_id)) $this->country_id = 0; - if (isset($this->fk_code_type_resource)) $this->fk_code_type_resource = trim($this->fk_code_type_resource); - if (isset($this->note_public)) $this->note_public = trim($this->note_public); - if (isset($this->note_private)) $this->note_private = trim($this->note_private); + if (isset($this->ref)) $this->ref = trim($this->ref); + if (isset($this->description)) $this->description = trim($this->description); + if (!is_numeric($this->country_id)) $this->country_id = 0; + if (isset($this->fk_code_type_resource)) $this->fk_code_type_resource = trim($this->fk_code_type_resource); + if (isset($this->note_public)) $this->note_public = trim($this->note_public); + if (isset($this->note_private)) $this->note_private = trim($this->note_private); - // Insert request - $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."("; - $sql .= "entity,"; - $sql .= "ref,"; - $sql .= "description,"; - $sql .= "fk_country,"; - $sql .= "fk_code_type_resource,"; - $sql .= "note_public,"; - $sql .= "note_private"; - $sql .= ") VALUES ("; - $sql .= $conf->entity.", "; - $sql .= " ".(!isset($this->ref) ? 'NULL' : "'".$this->db->escape($this->ref)."'").","; - $sql .= " ".(!isset($this->description) ? 'NULL' : "'".$this->db->escape($this->description)."'").","; - $sql .= " ".($this->country_id > 0 ? $this->country_id : 'null').","; - $sql .= " ".(!isset($this->fk_code_type_resource) ? 'NULL' : "'".$this->db->escape($this->fk_code_type_resource)."'").","; - $sql .= " ".(!isset($this->note_public) ? 'NULL' : "'".$this->db->escape($this->note_public)."'").","; - $sql .= " ".(!isset($this->note_private) ? 'NULL' : "'".$this->db->escape($this->note_private)."'"); - $sql .= ")"; + // Insert request + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."("; + $sql .= "entity,"; + $sql .= "ref,"; + $sql .= "description,"; + $sql .= "fk_country,"; + $sql .= "fk_code_type_resource,"; + $sql .= "note_public,"; + $sql .= "note_private"; + $sql .= ") VALUES ("; + $sql .= $conf->entity.", "; + $sql .= " ".(!isset($this->ref) ? 'NULL' : "'".$this->db->escape($this->ref)."'").","; + $sql .= " ".(!isset($this->description) ? 'NULL' : "'".$this->db->escape($this->description)."'").","; + $sql .= " ".($this->country_id > 0 ? $this->country_id : 'null').","; + $sql .= " ".(!isset($this->fk_code_type_resource) ? 'NULL' : "'".$this->db->escape($this->fk_code_type_resource)."'").","; + $sql .= " ".(!isset($this->note_public) ? 'NULL' : "'".$this->db->escape($this->note_public)."'").","; + $sql .= " ".(!isset($this->note_private) ? 'NULL' : "'".$this->db->escape($this->note_private)."'"); + $sql .= ")"; - $this->db->begin(); + $this->db->begin(); - dol_syslog(get_class($this)."::create", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); - } + dol_syslog(get_class($this)."::create", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->errors[] = "Error ".$this->db->lasterror(); + } - if (!$error) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); - } + if (!$error) + { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); + } - if (!$error) - { - $action = 'create'; + if (!$error) + { + $action = 'create'; - // Actions on extra fields + // Actions on extra fields if (!$error) { $result = $this->insertExtraFields(); @@ -139,100 +139,100 @@ class Dolresource extends CommonObject { $error++; } - } - } + } + } - if (!$error && !$notrigger) - { - // Call trigger - $result = $this->call_trigger('RESOURCE_CREATE', $user); - if ($result < 0) $error++; - // End call triggers - } + if (!$error && !$notrigger) + { + // Call trigger + $result = $this->call_trigger('RESOURCE_CREATE', $user); + if ($result < 0) $error++; + // End call triggers + } - // Commit or rollback - if ($error) - { - foreach ($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } else { - $this->db->commit(); - return $this->id; - } - } + // Commit or rollback + if ($error) + { + foreach ($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; + } else { + $this->db->commit(); + return $this->id; + } + } - /** - * Load object in memory from database - * - * @param int $id Id of object - * @param string $ref Ref of object - * @return int <0 if KO, >0 if OK - */ - public function fetch($id, $ref = '') - { - global $langs; - $sql = "SELECT"; - $sql .= " t.rowid,"; - $sql .= " t.entity,"; - $sql .= " t.ref,"; - $sql .= " t.description,"; + /** + * Load object in memory from database + * + * @param int $id Id of object + * @param string $ref Ref of object + * @return int <0 if KO, >0 if OK + */ + public function fetch($id, $ref = '') + { + global $langs; + $sql = "SELECT"; + $sql .= " t.rowid,"; + $sql .= " t.entity,"; + $sql .= " t.ref,"; + $sql .= " t.description,"; $sql .= " t.fk_country,"; - $sql .= " t.fk_code_type_resource,"; - $sql .= " t.note_public,"; - $sql .= " t.note_private,"; - $sql .= " t.tms,"; - $sql .= " ty.label as type_label"; - $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_resource as ty ON ty.code=t.fk_code_type_resource"; - if ($id) $sql .= " WHERE t.rowid = ".$this->db->escape($id); - else $sql .= " WHERE t.ref = '".$this->db->escape($ref)."'"; + $sql .= " t.fk_code_type_resource,"; + $sql .= " t.note_public,"; + $sql .= " t.note_private,"; + $sql .= " t.tms,"; + $sql .= " ty.label as type_label"; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_resource as ty ON ty.code=t.fk_code_type_resource"; + if ($id) $sql .= " WHERE t.rowid = ".$this->db->escape($id); + else $sql .= " WHERE t.ref = '".$this->db->escape($ref)."'"; - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->entity = $obj->entity; - $this->ref = $obj->ref; - $this->description = $obj->description; - $this->country_id = $obj->fk_country; - $this->fk_code_type_resource = $obj->fk_code_type_resource; - $this->note_public = $obj->note_public; - $this->note_private = $obj->note_private; - $this->type_label = $obj->type_label; + $this->id = $obj->rowid; + $this->entity = $obj->entity; + $this->ref = $obj->ref; + $this->description = $obj->description; + $this->country_id = $obj->fk_country; + $this->fk_code_type_resource = $obj->fk_code_type_resource; + $this->note_public = $obj->note_public; + $this->note_private = $obj->note_private; + $this->type_label = $obj->type_label; - // Retrieve all extrafield - // fetch optionals attributes and labels - $this->fetch_optionals(); - } - $this->db->free($resql); + // Retrieve all extrafield + // fetch optionals attributes and labels + $this->fetch_optionals(); + } + $this->db->free($resql); - return $this->id; - } else { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); - return -1; - } - } + return $this->id; + } else { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); + return -1; + } + } - /** - * Update object into database - * - * @param User $user User that modifies - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK - */ - public function update($user = null, $notrigger = 0) + /** + * Update object into database + * + * @param User $user User that modifies + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update($user = null, $notrigger = 0) { global $conf, $langs, $hookmanager; $error = 0; @@ -241,7 +241,7 @@ class Dolresource extends CommonObject if (isset($this->ref)) $this->ref = trim($this->ref); if (isset($this->fk_code_type_resource)) $this->fk_code_type_resource = trim($this->fk_code_type_resource); if (isset($this->description)) $this->description = trim($this->description); - if (!is_numeric($this->country_id)) $this->country_id = 0; + if (!is_numeric($this->country_id)) $this->country_id = 0; if (empty($this->oldcopy)) { @@ -327,19 +327,19 @@ class Dolresource extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Load object in memory from database - * - * @param int $id id object - * @return int <0 if KO, >0 if OK - */ - public function fetch_element_resource($id) - { - // phpcs:enable - global $langs; - $sql = "SELECT"; - $sql .= " t.rowid,"; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Load object in memory from database + * + * @param int $id id object + * @return int <0 if KO, >0 if OK + */ + public function fetch_element_resource($id) + { + // phpcs:enable + global $langs; + $sql = "SELECT"; + $sql .= " t.rowid,"; $sql .= " t.resource_id,"; $sql .= " t.resource_type,"; $sql .= " t.element_id,"; @@ -349,24 +349,24 @@ class Dolresource extends CommonObject $sql .= " t.fk_user_create,"; $sql .= " t.tms"; $sql .= " FROM ".MAIN_DB_PREFIX."element_resources as t"; - $sql .= " WHERE t.rowid = ".$this->db->escape($id); + $sql .= " WHERE t.rowid = ".$this->db->escape($id); - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->resource_id = $obj->resource_id; - $this->resource_type = $obj->resource_type; - $this->element_id = $obj->element_id; - $this->element_type = $obj->element_type; - $this->busy = $obj->busy; - $this->mandatory = $obj->mandatory; - $this->fk_user_create = $obj->fk_user_create; + $this->id = $obj->rowid; + $this->resource_id = $obj->resource_id; + $this->resource_type = $obj->resource_type; + $this->element_id = $obj->element_id; + $this->element_type = $obj->element_type; + $this->busy = $obj->busy; + $this->mandatory = $obj->mandatory; + $this->fk_user_create = $obj->fk_user_create; if ($obj->resource_id && $obj->resource_type) { $this->objresource = fetchObjectByElement($obj->resource_id, $obj->resource_type); @@ -374,27 +374,27 @@ class Dolresource extends CommonObject if ($obj->element_id && $obj->element_type) { $this->objelement = fetchObjectByElement($obj->element_id, $obj->element_type); } - } - $this->db->free($resql); + } + $this->db->free($resql); - return $this->id; - } else { - $this->error = "Error ".$this->db->lasterror(); - return -1; - } - } + return $this->id; + } else { + $this->error = "Error ".$this->db->lasterror(); + return -1; + } + } - /** - * Delete a resource object - * - * @param int $rowid Id of resource line to delete - * @param int $notrigger Disable all triggers - * @return int >0 if OK, <0 if KO - */ - public function delete($rowid, $notrigger = 0) + /** + * Delete a resource object + * + * @param int $rowid Id of resource line to delete + * @param int $notrigger Disable all triggers + * @return int >0 if OK, <0 if KO + */ + public function delete($rowid, $notrigger = 0) { global $user, $langs, $conf; - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error = 0; @@ -467,108 +467,108 @@ class Dolresource extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Load resource objects into $this->lines - * - * @param string $sortorder sort order - * @param string $sortfield sort field - * @param int $limit limit page - * @param int $offset page - * @param array $filter filter output - * @return int <0 if KO, >0 if OK - */ - public function fetch_all($sortorder, $sortfield, $limit, $offset, $filter = '') - { - // phpcs:enable - global $conf; - - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); - - $sql = "SELECT "; - $sql .= " t.rowid,"; - $sql .= " t.entity,"; - $sql .= " t.ref,"; - $sql .= " t.description,"; - $sql .= " t.fk_code_type_resource,"; - $sql .= " t.tms,"; - // Add fields from extrafields - if (!empty($extrafields->attributes[$this->table_element]['label'])) - foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$this->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); - $sql .= " ty.label as type_label"; - $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_resource as ty ON ty.code=t.fk_code_type_resource"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$this->table_element."_extrafields as ef ON ef.fk_object=t.rowid"; - $sql .= " WHERE t.entity IN (".getEntity('resource').")"; - // Manage filter - if (!empty($filter)) { - foreach ($filter as $key => $value) { - if (strpos($key, 'date')) { - $sql .= ' AND '.$key.' = \''.$this->db->idate($value).'\''; - } elseif (strpos($key, 'ef.') !== false) { - $sql .= $value; - } else { - $sql .= ' AND '.$key.' LIKE \'%'.$this->db->escape($value).'%\''; - } - } - } - $sql .= $this->db->order($sortfield, $sortorder); - $this->num_all = 0; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) - { - $result = $this->db->query($sql); - $this->num_all = $this->db->num_rows($result); - } - if ($limit) $sql .= $this->db->plimit($limit, $offset); - dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); - - $this->lines = array(); - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - if ($num) - { - while ($obj = $this->db->fetch_object($resql)) - { - $line = new Dolresource($this->db); - $line->id = $obj->rowid; - $line->ref = $obj->ref; - $line->description = $obj->description; - $line->country_id = $obj->fk_country; - $line->fk_code_type_resource = $obj->fk_code_type_resource; - $line->type_label = $obj->type_label; - - // fetch optionals attributes and labels - - $line->fetch_optionals(); - - $this->lines[] = $line; - } - $this->db->free($resql); - } - return $num; - } else { - $this->error = $this->db->lasterror(); - return -1; - } - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Load all objects into $this->lines - * - * @param string $sortorder sort order + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Load resource objects into $this->lines + * + * @param string $sortorder sort order * @param string $sortfield sort field * @param int $limit limit page * @param int $offset page * @param array $filter filter output * @return int <0 if KO, >0 if OK - */ - public function fetch_all_resources($sortorder, $sortfield, $limit, $offset, $filter = '') - { - // phpcs:enable + */ + public function fetch_all($sortorder, $sortfield, $limit, $offset, $filter = '') + { + // phpcs:enable + global $conf; + + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + + $sql = "SELECT "; + $sql .= " t.rowid,"; + $sql .= " t.entity,"; + $sql .= " t.ref,"; + $sql .= " t.description,"; + $sql .= " t.fk_code_type_resource,"; + $sql .= " t.tms,"; + // Add fields from extrafields + if (!empty($extrafields->attributes[$this->table_element]['label'])) + foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$this->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); + $sql .= " ty.label as type_label"; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_resource as ty ON ty.code=t.fk_code_type_resource"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$this->table_element."_extrafields as ef ON ef.fk_object=t.rowid"; + $sql .= " WHERE t.entity IN (".getEntity('resource').")"; + // Manage filter + if (!empty($filter)) { + foreach ($filter as $key => $value) { + if (strpos($key, 'date')) { + $sql .= ' AND '.$key.' = \''.$this->db->idate($value).'\''; + } elseif (strpos($key, 'ef.') !== false) { + $sql .= $value; + } else { + $sql .= ' AND '.$key.' LIKE \'%'.$this->db->escape($value).'%\''; + } + } + } + $sql .= $this->db->order($sortfield, $sortorder); + $this->num_all = 0; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { + $result = $this->db->query($sql); + $this->num_all = $this->db->num_rows($result); + } + if ($limit) $sql .= $this->db->plimit($limit, $offset); + dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); + + $this->lines = array(); + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + if ($num) + { + while ($obj = $this->db->fetch_object($resql)) + { + $line = new Dolresource($this->db); + $line->id = $obj->rowid; + $line->ref = $obj->ref; + $line->description = $obj->description; + $line->country_id = $obj->fk_country; + $line->fk_code_type_resource = $obj->fk_code_type_resource; + $line->type_label = $obj->type_label; + + // fetch optionals attributes and labels + + $line->fetch_optionals(); + + $this->lines[] = $line; + } + $this->db->free($resql); + } + return $num; + } else { + $this->error = $this->db->lasterror(); + return -1; + } + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Load all objects into $this->lines + * + * @param string $sortorder sort order + * @param string $sortfield sort field + * @param int $limit limit page + * @param int $offset page + * @param array $filter filter output + * @return int <0 if KO, >0 if OK + */ + public function fetch_all_resources($sortorder, $sortfield, $limit, $offset, $filter = '') + { + // phpcs:enable global $conf; $sql = "SELECT "; $sql .= " t.rowid,"; @@ -593,7 +593,7 @@ class Dolresource extends CommonObject } } } - $sql .= $this->db->order($sortfield, $sortorder); + $sql .= $this->db->order($sortfield, $sortorder); if ($limit) $sql .= $this->db->plimit($limit + 1, $offset); dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); @@ -619,7 +619,7 @@ class Dolresource extends CommonObject $line->objresource = fetchObjectByElement($obj->resource_id, $obj->resource_type); if ($obj->element_id && $obj->element_type) $line->objelement = fetchObjectByElement($obj->element_id, $obj->element_type); - $this->lines[] = $line; + $this->lines[] = $line; } $this->db->free($resql); } @@ -628,119 +628,119 @@ class Dolresource extends CommonObject $this->error = $this->db->lasterror(); return -1; } - } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Load all objects into $this->lines - * - * @param string $sortorder sort order - * @param string $sortfield sort field - * @param int $limit limit page - * @param int $offset page - * @param array $filter filter output - * @return int <0 if KO, >0 if OK - */ - public function fetch_all_used($sortorder, $sortfield, $limit, $offset = 1, $filter = '') - { - // phpcs:enable - global $conf; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Load all objects into $this->lines + * + * @param string $sortorder sort order + * @param string $sortfield sort field + * @param int $limit limit page + * @param int $offset page + * @param array $filter filter output + * @return int <0 if KO, >0 if OK + */ + public function fetch_all_used($sortorder, $sortfield, $limit, $offset = 1, $filter = '') + { + // phpcs:enable + global $conf; - if (!$sortorder) $sortorder = "ASC"; - if (!$sortfield) $sortfield = "t.rowid"; + if (!$sortorder) $sortorder = "ASC"; + if (!$sortfield) $sortfield = "t.rowid"; - $sql = "SELECT "; - $sql .= " t.rowid,"; - $sql .= " t.resource_id,"; - $sql .= " t.resource_type,"; - $sql .= " t.element_id,"; - $sql .= " t.element_type,"; - $sql .= " t.busy,"; - $sql .= " t.mandatory,"; - $sql .= " t.fk_user_create,"; - $sql .= " t.tms"; - $sql .= ' FROM '.MAIN_DB_PREFIX.'element_resources as t '; - $sql .= " WHERE t.entity IN (".getEntity('resource').")"; + $sql = "SELECT "; + $sql .= " t.rowid,"; + $sql .= " t.resource_id,"; + $sql .= " t.resource_type,"; + $sql .= " t.element_id,"; + $sql .= " t.element_type,"; + $sql .= " t.busy,"; + $sql .= " t.mandatory,"; + $sql .= " t.fk_user_create,"; + $sql .= " t.tms"; + $sql .= ' FROM '.MAIN_DB_PREFIX.'element_resources as t '; + $sql .= " WHERE t.entity IN (".getEntity('resource').")"; - //Manage filter - if (!empty($filter)) { - foreach ($filter as $key => $value) { - if (strpos($key, 'date')) { - $sql .= ' AND '.$key.' = \''.$this->db->idate($value).'\''; - } else { - $sql .= ' AND '.$key.' LIKE \'%'.$this->db->escape($value).'%\''; - } - } - } - $sql .= $this->db->order($sortfield, $sortorder); - if ($limit) $sql .= $this->db->plimit($limit + 1, $offset); - dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); + //Manage filter + if (!empty($filter)) { + foreach ($filter as $key => $value) { + if (strpos($key, 'date')) { + $sql .= ' AND '.$key.' = \''.$this->db->idate($value).'\''; + } else { + $sql .= ' AND '.$key.' LIKE \'%'.$this->db->escape($value).'%\''; + } + } + } + $sql .= $this->db->order($sortfield, $sortorder); + if ($limit) $sql .= $this->db->plimit($limit + 1, $offset); + dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - if ($num) - { - $this->lines = array(); - while ($obj = $this->db->fetch_object($resql)) - { - $line = new Dolresource($this->db); - $line->id = $obj->rowid; - $line->resource_id = $obj->resource_id; - $line->resource_type = $obj->resource_type; - $line->element_id = $obj->element_id; - $line->element_type = $obj->element_type; - $line->busy = $obj->busy; - $line->mandatory = $obj->mandatory; - $line->fk_user_create = $obj->fk_user_create; + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + if ($num) + { + $this->lines = array(); + while ($obj = $this->db->fetch_object($resql)) + { + $line = new Dolresource($this->db); + $line->id = $obj->rowid; + $line->resource_id = $obj->resource_id; + $line->resource_type = $obj->resource_type; + $line->element_id = $obj->element_id; + $line->element_type = $obj->element_type; + $line->busy = $obj->busy; + $line->mandatory = $obj->mandatory; + $line->fk_user_create = $obj->fk_user_create; - $this->lines[] = fetchObjectByElement($obj->resource_id, $obj->resource_type); - } - $this->db->free($resql); - } - return $num; - } else { - $this->error = $this->db->lasterror(); - return -1; - } - } + $this->lines[] = fetchObjectByElement($obj->resource_id, $obj->resource_type); + } + $this->db->free($resql); + } + return $num; + } else { + $this->error = $this->db->lasterror(); + return -1; + } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Fetch all resources available, declared by modules - * Load available resource in array $this->available_resources - * - * @return int number of available resources declared by modules - * @deprecated, remplaced by hook getElementResources - * @see getElementResources() - */ - public function fetch_all_available() - { - // phpcs:enable - global $conf; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Fetch all resources available, declared by modules + * Load available resource in array $this->available_resources + * + * @return int number of available resources declared by modules + * @deprecated, remplaced by hook getElementResources + * @see getElementResources() + */ + public function fetch_all_available() + { + // phpcs:enable + global $conf; - if (!empty($conf->modules_parts['resources'])) - { - $this->available_resources = (array) $conf->modules_parts['resources']; + if (!empty($conf->modules_parts['resources'])) + { + $this->available_resources = (array) $conf->modules_parts['resources']; - return count($this->available_resources); - } - return 0; - } + return count($this->available_resources); + } + return 0; + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Update element resource into database - * - * @param User $user User that modifies - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK - */ - public function update_element_resource($user = null, $notrigger = 0) - { - // phpcs:enable - global $conf, $langs; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Update element resource into database + * + * @param User $user User that modifies + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update_element_resource($user = null, $notrigger = 0) + { + // phpcs:enable + global $conf, $langs; $error = 0; // Clean parameters @@ -751,8 +751,8 @@ class Dolresource extends CommonObject if (isset($this->busy)) $this->busy = trim($this->busy); if (isset($this->mandatory)) $this->mandatory = trim($this->mandatory); - // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX."element_resources SET"; + // Update request + $sql = "UPDATE ".MAIN_DB_PREFIX."element_resources SET"; $sql .= " resource_id=".(isset($this->resource_id) ? "'".$this->db->escape($this->resource_id)."'" : "null").","; $sql .= " resource_type=".(isset($this->resource_type) ? "'".$this->db->escape($this->resource_type)."'" : "null").","; $sql .= " element_id=".(isset($this->element_id) ? $this->element_id : "null").","; @@ -761,32 +761,32 @@ class Dolresource extends CommonObject $sql .= " mandatory=".(isset($this->mandatory) ? $this->mandatory : "null").","; $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').""; - $sql .= " WHERE rowid=".$this->id; + $sql .= " WHERE rowid=".$this->id; $this->db->begin(); dol_syslog(get_class($this)."::update", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } + $resql = $this->db->query($sql); + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { if (!$notrigger) { - // Call trigger - $result = $this->call_trigger('RESOURCE_MODIFY', $user); - if ($result < 0) $error++; - // End call triggers - } + // Call trigger + $result = $this->call_trigger('RESOURCE_MODIFY', $user); + if ($result < 0) $error++; + // End call triggers + } } - // Commit or rollback + // Commit or rollback if ($error) { foreach ($this->errors as $errmsg) { - dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); return -1 * $error; @@ -794,201 +794,201 @@ class Dolresource extends CommonObject $this->db->commit(); return 1; } - } + } - /** - * Return an array with resources linked to the element - * - * @param string $element Element - * @param int $element_id Id - * @param string $resource_type Type - * @return array Aray of resources - */ - public function getElementResources($element, $element_id, $resource_type = '') - { - $resources = array(); + /** + * Return an array with resources linked to the element + * + * @param string $element Element + * @param int $element_id Id + * @param string $resource_type Type + * @return array Aray of resources + */ + public function getElementResources($element, $element_id, $resource_type = '') + { + $resources = array(); - // Links beetween objects are stored in this table - $sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'element_resources'; - $sql .= " WHERE element_id=".$element_id." AND element_type='".$this->db->escape($element)."'"; - if ($resource_type) - $sql .= " AND resource_type LIKE '%".$this->db->escape($resource_type)."%'"; - $sql .= ' ORDER BY resource_type'; + // Links beetween objects are stored in this table + $sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'element_resources'; + $sql .= " WHERE element_id=".$element_id." AND element_type='".$this->db->escape($element)."'"; + if ($resource_type) + $sql .= " AND resource_type LIKE '%".$this->db->escape($resource_type)."%'"; + $sql .= ' ORDER BY resource_type'; - dol_syslog(get_class($this)."::getElementResources", LOG_DEBUG); + dol_syslog(get_class($this)."::getElementResources", LOG_DEBUG); - $resources = array(); - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); + $resources = array(); + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); - $resources[$i] = array( - 'rowid' => $obj->rowid, - 'resource_id' => $obj->resource_id, - 'resource_type'=>$obj->resource_type, - 'busy'=>$obj->busy, - 'mandatory'=>$obj->mandatory - ); - $i++; - } - } + $resources[$i] = array( + 'rowid' => $obj->rowid, + 'resource_id' => $obj->resource_id, + 'resource_type'=>$obj->resource_type, + 'busy'=>$obj->busy, + 'mandatory'=>$obj->mandatory + ); + $i++; + } + } - return $resources; - } + return $resources; + } - /** - * Return an int number of resources linked to the element - * - * @param string $element Element type - * @param int $element_id Element id - * @return int Nb of resources loaded - */ - public function fetchElementResources($element, $element_id) - { - $resources = $this->getElementResources($element, $element_id); - $i = 0; - foreach ($resources as $nb => $resource) { - $this->lines[$i] = fetchObjectByElement($resource['resource_id'], $resource['resource_type']); - $i++; - } - return $i; - } + /** + * Return an int number of resources linked to the element + * + * @param string $element Element type + * @param int $element_id Element id + * @return int Nb of resources loaded + */ + public function fetchElementResources($element, $element_id) + { + $resources = $this->getElementResources($element, $element_id); + $i = 0; + foreach ($resources as $nb => $resource) { + $this->lines[$i] = fetchObjectByElement($resource['resource_id'], $resource['resource_type']); + $i++; + } + return $i; + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Load in cache resource type code (setup in dictionary) - * - * @return int Number of lines loaded, 0 if already loaded, <0 if KO - */ - public function load_cache_code_type_resource() - { - // phpcs:enable - global $langs; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Load in cache resource type code (setup in dictionary) + * + * @return int Number of lines loaded, 0 if already loaded, <0 if KO + */ + public function load_cache_code_type_resource() + { + // phpcs:enable + global $langs; - if (is_array($this->cache_code_type_resource) && count($this->cache_code_type_resource)) return 0; // Cache deja charge + if (is_array($this->cache_code_type_resource) && count($this->cache_code_type_resource)) return 0; // Cache deja charge - $sql = "SELECT rowid, code, label, active"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_type_resource"; - $sql .= " WHERE active > 0"; - $sql .= " ORDER BY rowid"; - dol_syslog(get_class($this)."::load_cache_code_type_resource", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $label = ($langs->trans("ResourceTypeShort".$obj->code) != ("ResourceTypeShort".$obj->code) ? $langs->trans("ResourceTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); - $this->cache_code_type_resource[$obj->rowid]['code'] = $obj->code; - $this->cache_code_type_resource[$obj->rowid]['label'] = $label; - $this->cache_code_type_resource[$obj->rowid]['active'] = $obj->active; - $i++; - } - return $num; - } else { - dol_print_error($this->db); - return -1; - } - } + $sql = "SELECT rowid, code, label, active"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_type_resource"; + $sql .= " WHERE active > 0"; + $sql .= " ORDER BY rowid"; + dol_syslog(get_class($this)."::load_cache_code_type_resource", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $label = ($langs->trans("ResourceTypeShort".$obj->code) != ("ResourceTypeShort".$obj->code) ? $langs->trans("ResourceTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); + $this->cache_code_type_resource[$obj->rowid]['code'] = $obj->code; + $this->cache_code_type_resource[$obj->rowid]['label'] = $label; + $this->cache_code_type_resource[$obj->rowid]['active'] = $obj->active; + $i++; + } + return $num; + } else { + dol_print_error($this->db); + return -1; + } + } - /** - * Return clicable link of object (with eventually picto) - * - * @param int $withpicto Add picto into link - * @param string $option Where point the link ('compta', 'expedition', 'document', ...) - * @param string $get_params Parametres added to url - * @param int $notooltip 1=Disable tooltip - * @param string $morecss Add more css on link - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @return string String with URL - */ - public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) - { - global $conf, $langs; + /** + * Return clicable link of object (with eventually picto) + * + * @param int $withpicto Add picto into link + * @param string $option Where point the link ('compta', 'expedition', 'document', ...) + * @param string $get_params Parametres added to url + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $conf, $langs; - $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("Resource").''; - $label .= '
    '; - $label .= ''.$langs->trans('Ref').': '.$this->ref; - /*if (isset($this->status)) { + $result = ''; + $label = img_picto('', $this->picto).' '.$langs->trans("Resource").''; + $label .= '
    '; + $label .= ''.$langs->trans('Ref').': '.$this->ref; + /*if (isset($this->status)) { $label.= '
    ' . $langs->trans("Status").": ".$this->getLibStatut(5); }*/ - if (isset($this->type_label)) { - $label .= '
    '.$langs->trans("ResourceType").": ".$this->type_label; - } + if (isset($this->type_label)) { + $label .= '
    '.$langs->trans("ResourceType").": ".$this->type_label; + } - $url = DOL_URL_ROOT.'/resource/card.php?id='.$this->id; + $url = DOL_URL_ROOT.'/resource/card.php?id='.$this->id; - if ($option != 'nolink') - { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; - } + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; + } - $linkclose = ''; - if (empty($notooltip)) - { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label = $langs->trans("ShowMyObject"); - $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + $linkclose = ''; + if (empty($notooltip)) + { + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label = $langs->trans("ShowMyObject"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); - $linkstart = '
    '; - $linkend = ''; - /*$linkstart = ''; + $linkstart = ''; + $linkend = ''; + /*$linkstart = ''; $linkend = '';*/ - $result .= $linkstart; - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); - if ($withpicto != 2) $result .= $this->ref; - $result .= $linkend; + $result .= $linkstart; + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto != 2) $result .= $this->ref; + $result .= $linkend; - return $result; - } + return $result; + } - /** - * Retourne le libelle du status d'un user (actif, inactif) - * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Label of status - */ - public function getLibStatut($mode = 0) - { - return $this->LibStatut($this->status, $mode); - } + /** + * Retourne le libelle du status d'un user (actif, inactif) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + public function getLibStatut($mode = 0) + { + return $this->LibStatut($this->status, $mode); + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return the status - * - * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto - * @return string Label of status - */ - public static function LibStatut($status, $mode = 0) - { - // phpcs:enable - global $langs; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return the status + * + * @param int $status Id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto + * @return string Label of status + */ + public static function LibStatut($status, $mode = 0) + { + // phpcs:enable + global $langs; - return ''; - } + return ''; + } } diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 1d46981d8d3..4f5209eb123 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -31,668 +31,668 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; */ class PaymentSalary extends CommonObject { - /** - * @var string ID to identify managed object - */ - public $element = 'payment_salary'; - - /** - * @var string Name of table without prefix where object is stored - */ - public $table_element = 'payment_salary'; - - /** - * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png - */ - public $picto = 'payment'; - - public $tms; - - /** - * @var int User ID - */ - public $fk_user; - - public $datep; - public $datev; - public $amount; - - /** - * @var int ID - */ - public $fk_project; - - public $type_payment; - public $num_payment; - - /** - * @var string salary payments label - */ - public $label; - - public $datesp; - public $dateep; - - /** - * @var int ID - */ - public $fk_bank; - - /** - * @var int ID - */ - public $fk_user_author; - - /** - * @var int ID - */ - public $fk_user_modif; - - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - $this->element = 'payment_salary'; - $this->table_element = 'payment_salary'; - } - - /** - * Update database - * - * @param User $user User that modify - * @param int $notrigger 0=no, 1=yes (no update trigger) - * @return int <0 if KO, >0 if OK - */ - public function update($user = null, $notrigger = 0) - { - global $conf, $langs; - - $error = 0; - - // Clean parameters - $this->amount = trim($this->amount); - $this->label = trim($this->label); - $this->note = trim($this->note); - - // Check parameters - if (empty($this->fk_user) || $this->fk_user < 0) - { - $this->error = 'ErrorBadParameter'; - return -1; - } - - $this->db->begin(); - - // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET"; - - $sql .= " tms='".$this->db->idate($this->tms)."',"; - $sql .= " fk_user=".$this->fk_user.","; - $sql .= " datep='".$this->db->idate($this->datep)."',"; - $sql .= " datev='".$this->db->idate($this->datev)."',"; - $sql .= " amount=".price2num($this->amount).","; - $sql .= " fk_projet=".((int) $this->fk_project).","; - $sql .= " fk_typepayment=".$this->fk_typepayment."',"; - $sql .= " num_payment='".$this->db->escape($this->num_payment)."',"; - $sql .= " label='".$this->db->escape($this->label)."',"; - $sql .= " datesp='".$this->db->idate($this->datesp)."',"; - $sql .= " dateep='".$this->db->idate($this->dateep)."',"; - $sql .= " note='".$this->db->escape($this->note)."',"; - $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").","; - $sql .= " fk_user_author=".((int) $this->fk_user_author).","; - $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : 'null'); - - $sql .= " WHERE rowid=".$this->id; - - dol_syslog(get_class($this)."::update", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) - { - $this->error = "Error ".$this->db->lasterror(); - return -1; - } - - // Update extrafield - if (!$error) - { - if (!$error) - { - $result = $this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } - } - - if (!$notrigger) - { - // Call trigger - $result = $this->call_trigger('PAYMENT_SALARY_MODIFY', $user); - if ($result < 0) $error++; - // End call triggers - } - - if (!$error) - { - $this->db->commit(); - return 1; - } else { - $this->db->rollback(); - return -1; - } - } - - - /** - * Load object in memory from database - * - * @param int $id id object - * @param User $user User that load - * @return int <0 if KO, >0 if OK - */ - public function fetch($id, $user = null) - { - global $langs; - $sql = "SELECT"; - $sql .= " s.rowid,"; - - $sql .= " s.tms,"; - $sql .= " s.fk_user,"; - $sql .= " s.datep,"; - $sql .= " s.datev,"; - $sql .= " s.amount,"; - $sql .= " s.fk_projet as fk_project,"; - $sql .= " s.fk_typepayment,"; - $sql .= " s.num_payment,"; - $sql .= " s.label,"; - $sql .= " s.datesp,"; - $sql .= " s.dateep,"; - $sql .= " s.note,"; - $sql .= " s.fk_bank,"; - $sql .= " s.fk_user_author,"; - $sql .= " s.fk_user_modif,"; - $sql .= " b.fk_account,"; - $sql .= " b.fk_type,"; - $sql .= " b.rappro"; - - $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid"; - $sql .= " WHERE s.rowid = ".$id; - - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); - - $this->id = $obj->rowid; - $this->ref = $obj->rowid; - $this->tms = $this->db->jdate($obj->tms); - $this->fk_user = $obj->fk_user; - $this->datep = $this->db->jdate($obj->datep); - $this->datev = $this->db->jdate($obj->datev); - $this->amount = $obj->amount; - $this->fk_project = $obj->fk_project; - $this->type_payement = $obj->fk_typepayment; - $this->num_payment = $obj->num_payment; - $this->label = $obj->label; - $this->datesp = $this->db->jdate($obj->datesp); - $this->dateep = $this->db->jdate($obj->dateep); - $this->note = $obj->note; - $this->fk_bank = $obj->fk_bank; - $this->fk_user_author = $obj->fk_user_author; - $this->fk_user_modif = $obj->fk_user_modif; - $this->fk_account = $obj->fk_account; - $this->fk_type = $obj->fk_type; - $this->rappro = $obj->rappro; - - // Retrieve all extrafield - // fetch optionals attributes and labels - $this->fetch_optionals(); - } - $this->db->free($resql); - - return 1; - } else { - $this->error = "Error ".$this->db->lasterror(); - return -1; - } - } - - - /** - * Delete object in database - * - * @param User $user User that delete - * @return int <0 if KO, >0 if OK - */ - public function delete($user) - { - global $conf, $langs; - - $error = 0; - - // Call trigger - $result = $this->call_trigger('PAYMENT_SALARY_DELETE', $user); - if ($result < 0) return -1; - // End call triggers - - // Delete donation - if (!$error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary_extrafields"; - $sql .= " WHERE fk_object=".$this->id; - - $resql = $this->db->query($sql); - if (!$resql) - { - $this->errors[] = $this->db->lasterror(); - $error++; - } - } - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary"; - $sql .= " WHERE rowid=".$this->id; - - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) - { - $this->error = "Error ".$this->db->lasterror(); - return -1; - } - - return 1; - } - - - /** - * Initialise an instance with random values. - * Used to build previews or test instances. - * id must be 0 if object instance is a specimen. - * - * @return void - */ - public function initAsSpecimen() - { - $this->id = 0; - - $this->tms = ''; - $this->fk_user = ''; - $this->datep = ''; - $this->datev = ''; - $this->amount = ''; - $this->label = ''; - $this->datesp = ''; - $this->dateep = ''; - $this->note = ''; - $this->fk_bank = ''; - $this->fk_user_author = ''; - $this->fk_user_modif = ''; - } - - /** - * Create in database - * - * @param User $user User that create - * @return int <0 if KO, >0 if OK - */ - public function create($user) - { - global $conf, $langs; - - $error = 0; - $now = dol_now(); - - // Clean parameters - $this->amount = price2num(trim($this->amount)); - $this->label = trim($this->label); - $this->note = trim($this->note); - $this->fk_bank = trim($this->fk_bank); - $this->fk_user_author = trim($this->fk_user_author); - $this->fk_user_modif = trim($this->fk_user_modif); - - // Check parameters - if (!$this->label) - { - $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")); - return -3; - } - if ($this->fk_user < 0 || $this->fk_user == '') - { - $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Employee")); - return -4; - } - if ($this->amount < 0 || $this->amount == '') - { - $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")); - return -5; - } - if (!empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0)) - { - $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Account")); - return -6; - } - if (!empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0)) - { - $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")); - return -7; - } - - $this->db->begin(); - - // Insert into llx_payment_salary - $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_user"; - $sql .= ", datep"; - $sql .= ", datev"; - $sql .= ", amount"; - $sql .= ", fk_projet"; - $sql .= ", salary"; - $sql .= ", fk_typepayment"; - $sql .= ", num_payment"; - if ($this->note) $sql .= ", note"; - $sql .= ", label"; - $sql .= ", datesp"; - $sql .= ", dateep"; - $sql .= ", fk_user_author"; - $sql .= ", datec"; - $sql .= ", fk_bank"; - $sql .= ", entity"; - $sql .= ") "; - $sql .= " VALUES ("; - $sql .= "'".$this->db->escape($this->fk_user)."'"; - $sql .= ", '".$this->db->idate($this->datep)."'"; - $sql .= ", '".$this->db->idate($this->datev)."'"; - $sql .= ", ".$this->amount; - $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 0); - $sql .= ", ".($this->salary > 0 ? $this->salary : "null"); - $sql .= ", ".$this->db->escape($this->type_payment); - $sql .= ", '".$this->db->escape($this->num_payment)."'"; - if ($this->note) $sql .= ", '".$this->db->escape($this->note)."'"; - $sql .= ", '".$this->db->escape($this->label)."'"; - $sql .= ", '".$this->db->idate($this->datesp)."'"; - $sql .= ", '".$this->db->idate($this->dateep)."'"; - $sql .= ", '".$this->db->escape($user->id)."'"; - $sql .= ", '".$this->db->idate($now)."'"; - $sql .= ", NULL"; - $sql .= ", ".$conf->entity; - $sql .= ")"; - - dol_syslog(get_class($this)."::create", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); - - if ($this->id > 0) - { - if (!empty($conf->banque->enabled) && !empty($this->amount)) - { - // Insert into llx_bank - require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - - $acc = new Account($this->db); - $result = $acc->fetch($this->accountid); - if ($result <= 0) dol_print_error($this->db); - - // Update extrafield - if (!$error) { - if (!$error) - { - $result = $this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } - } - - // Insert payment into llx_bank - // Add link 'payment_salary' in bank_url between payment and bank transaction - $bank_line_id = $acc->addline( - $this->datep, - $this->type_payment, - $this->label, - -abs($this->amount), - $this->num_payment, - '', - $user, - '', - '', - '', - $this->datev - ); - - // Update fk_bank into llx_paiement. - // So we know the payment which has generate the banking ecriture - if ($bank_line_id > 0) - { - $this->update_fk_bank($bank_line_id); - } else { - $this->error = $acc->error; - $error++; - } - - if (!$error) - { - // Add link 'payment_salary' in bank_url between payment and bank transaction - $url = DOL_URL_ROOT.'/salaries/card.php?id='; - - $result = $acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary"); - if ($result <= 0) - { - $this->error = $acc->error; - $error++; - } - } - - $fuser = new User($this->db); - $fuser->fetch($this->fk_user); - - // Add link 'user' in bank_url between operation and bank transaction - $result = $acc->add_url_line( - $bank_line_id, - $this->fk_user, - DOL_URL_ROOT.'/user/card.php?id=', - $fuser->getFullName($langs), - // $langs->trans("SalaryPayment").' '.$fuser->getFullName($langs).' '.dol_print_date($this->datesp,'dayrfc').' '.dol_print_date($this->dateep,'dayrfc'), - 'user' - ); - - if ($result <= 0) - { - $this->error = $acc->error; - $error++; - } - } - - // Call trigger - $result = $this->call_trigger('PAYMENT_SALARY_CREATE', $user); - if ($result < 0) $error++; - // End call triggers - } else $error++; - - if (!$error) - { - $this->db->commit(); - return $this->id; - } else { - $this->db->rollback(); - return -2; - } - } else { - $this->error = $this->db->error(); - $this->db->rollback(); - return -1; - } - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Update link between payment salary and line generate into llx_bank - * - * @param int $id_bank Id bank account - * @return int <0 if KO, >0 if OK - */ - public function update_fk_bank($id_bank) - { - // phpcs:enable - $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank; - $sql .= ' WHERE rowid = '.$this->id; - $result = $this->db->query($sql); - if ($result) - { - return 1; - } else { - dol_print_error($this->db); - return -1; - } - } - - - /** - * Send name clicable (with possibly the picto) - * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param string $option link option - * @param int $notooltip 1=Disable tooltip - * @param string $morecss Add more css on link - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @return string Chaine with URL - */ - public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) - { - global $db, $conf, $langs, $hookmanager; - global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; - - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips - - $result = ''; - - $label = ''.$langs->trans("ShowSalaryPayment").''; - $label .= '
    '; - $label .= ''.$langs->trans('Ref').': '.$this->ref; - - $url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id; - - if ($option != 'nolink') - { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; - } - - $linkclose = ''; - if (empty($notooltip)) - { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label = $langs->trans("ShowMyObject"); - $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - - /* + /** + * @var string ID to identify managed object + */ + public $element = 'payment_salary'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'payment_salary'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'payment'; + + public $tms; + + /** + * @var int User ID + */ + public $fk_user; + + public $datep; + public $datev; + public $amount; + + /** + * @var int ID + */ + public $fk_project; + + public $type_payment; + public $num_payment; + + /** + * @var string salary payments label + */ + public $label; + + public $datesp; + public $dateep; + + /** + * @var int ID + */ + public $fk_bank; + + /** + * @var int ID + */ + public $fk_user_author; + + /** + * @var int ID + */ + public $fk_user_modif; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + $this->element = 'payment_salary'; + $this->table_element = 'payment_salary'; + } + + /** + * Update database + * + * @param User $user User that modify + * @param int $notrigger 0=no, 1=yes (no update trigger) + * @return int <0 if KO, >0 if OK + */ + public function update($user = null, $notrigger = 0) + { + global $conf, $langs; + + $error = 0; + + // Clean parameters + $this->amount = trim($this->amount); + $this->label = trim($this->label); + $this->note = trim($this->note); + + // Check parameters + if (empty($this->fk_user) || $this->fk_user < 0) + { + $this->error = 'ErrorBadParameter'; + return -1; + } + + $this->db->begin(); + + // Update request + $sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET"; + + $sql .= " tms='".$this->db->idate($this->tms)."',"; + $sql .= " fk_user=".$this->fk_user.","; + $sql .= " datep='".$this->db->idate($this->datep)."',"; + $sql .= " datev='".$this->db->idate($this->datev)."',"; + $sql .= " amount=".price2num($this->amount).","; + $sql .= " fk_projet=".((int) $this->fk_project).","; + $sql .= " fk_typepayment=".$this->fk_typepayment."',"; + $sql .= " num_payment='".$this->db->escape($this->num_payment)."',"; + $sql .= " label='".$this->db->escape($this->label)."',"; + $sql .= " datesp='".$this->db->idate($this->datesp)."',"; + $sql .= " dateep='".$this->db->idate($this->dateep)."',"; + $sql .= " note='".$this->db->escape($this->note)."',"; + $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").","; + $sql .= " fk_user_author=".((int) $this->fk_user_author).","; + $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : 'null'); + + $sql .= " WHERE rowid=".$this->id; + + dol_syslog(get_class($this)."::update", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) + { + $this->error = "Error ".$this->db->lasterror(); + return -1; + } + + // Update extrafield + if (!$error) + { + if (!$error) + { + $result = $this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + + if (!$notrigger) + { + // Call trigger + $result = $this->call_trigger('PAYMENT_SALARY_MODIFY', $user); + if ($result < 0) $error++; + // End call triggers + } + + if (!$error) + { + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + return -1; + } + } + + + /** + * Load object in memory from database + * + * @param int $id id object + * @param User $user User that load + * @return int <0 if KO, >0 if OK + */ + public function fetch($id, $user = null) + { + global $langs; + $sql = "SELECT"; + $sql .= " s.rowid,"; + + $sql .= " s.tms,"; + $sql .= " s.fk_user,"; + $sql .= " s.datep,"; + $sql .= " s.datev,"; + $sql .= " s.amount,"; + $sql .= " s.fk_projet as fk_project,"; + $sql .= " s.fk_typepayment,"; + $sql .= " s.num_payment,"; + $sql .= " s.label,"; + $sql .= " s.datesp,"; + $sql .= " s.dateep,"; + $sql .= " s.note,"; + $sql .= " s.fk_bank,"; + $sql .= " s.fk_user_author,"; + $sql .= " s.fk_user_modif,"; + $sql .= " b.fk_account,"; + $sql .= " b.fk_type,"; + $sql .= " b.rappro"; + + $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid"; + $sql .= " WHERE s.rowid = ".$id; + + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); + + $this->id = $obj->rowid; + $this->ref = $obj->rowid; + $this->tms = $this->db->jdate($obj->tms); + $this->fk_user = $obj->fk_user; + $this->datep = $this->db->jdate($obj->datep); + $this->datev = $this->db->jdate($obj->datev); + $this->amount = $obj->amount; + $this->fk_project = $obj->fk_project; + $this->type_payement = $obj->fk_typepayment; + $this->num_payment = $obj->num_payment; + $this->label = $obj->label; + $this->datesp = $this->db->jdate($obj->datesp); + $this->dateep = $this->db->jdate($obj->dateep); + $this->note = $obj->note; + $this->fk_bank = $obj->fk_bank; + $this->fk_user_author = $obj->fk_user_author; + $this->fk_user_modif = $obj->fk_user_modif; + $this->fk_account = $obj->fk_account; + $this->fk_type = $obj->fk_type; + $this->rappro = $obj->rappro; + + // Retrieve all extrafield + // fetch optionals attributes and labels + $this->fetch_optionals(); + } + $this->db->free($resql); + + return 1; + } else { + $this->error = "Error ".$this->db->lasterror(); + return -1; + } + } + + + /** + * Delete object in database + * + * @param User $user User that delete + * @return int <0 if KO, >0 if OK + */ + public function delete($user) + { + global $conf, $langs; + + $error = 0; + + // Call trigger + $result = $this->call_trigger('PAYMENT_SALARY_DELETE', $user); + if ($result < 0) return -1; + // End call triggers + + // Delete donation + if (!$error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary_extrafields"; + $sql .= " WHERE fk_object=".$this->id; + + $resql = $this->db->query($sql); + if (!$resql) + { + $this->errors[] = $this->db->lasterror(); + $error++; + } + } + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary"; + $sql .= " WHERE rowid=".$this->id; + + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) + { + $this->error = "Error ".$this->db->lasterror(); + return -1; + } + + return 1; + } + + + /** + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void + */ + public function initAsSpecimen() + { + $this->id = 0; + + $this->tms = ''; + $this->fk_user = ''; + $this->datep = ''; + $this->datev = ''; + $this->amount = ''; + $this->label = ''; + $this->datesp = ''; + $this->dateep = ''; + $this->note = ''; + $this->fk_bank = ''; + $this->fk_user_author = ''; + $this->fk_user_modif = ''; + } + + /** + * Create in database + * + * @param User $user User that create + * @return int <0 if KO, >0 if OK + */ + public function create($user) + { + global $conf, $langs; + + $error = 0; + $now = dol_now(); + + // Clean parameters + $this->amount = price2num(trim($this->amount)); + $this->label = trim($this->label); + $this->note = trim($this->note); + $this->fk_bank = trim($this->fk_bank); + $this->fk_user_author = trim($this->fk_user_author); + $this->fk_user_modif = trim($this->fk_user_modif); + + // Check parameters + if (!$this->label) + { + $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")); + return -3; + } + if ($this->fk_user < 0 || $this->fk_user == '') + { + $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Employee")); + return -4; + } + if ($this->amount < 0 || $this->amount == '') + { + $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")); + return -5; + } + if (!empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0)) + { + $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Account")); + return -6; + } + if (!empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0)) + { + $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")); + return -7; + } + + $this->db->begin(); + + // Insert into llx_payment_salary + $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_user"; + $sql .= ", datep"; + $sql .= ", datev"; + $sql .= ", amount"; + $sql .= ", fk_projet"; + $sql .= ", salary"; + $sql .= ", fk_typepayment"; + $sql .= ", num_payment"; + if ($this->note) $sql .= ", note"; + $sql .= ", label"; + $sql .= ", datesp"; + $sql .= ", dateep"; + $sql .= ", fk_user_author"; + $sql .= ", datec"; + $sql .= ", fk_bank"; + $sql .= ", entity"; + $sql .= ") "; + $sql .= " VALUES ("; + $sql .= "'".$this->db->escape($this->fk_user)."'"; + $sql .= ", '".$this->db->idate($this->datep)."'"; + $sql .= ", '".$this->db->idate($this->datev)."'"; + $sql .= ", ".$this->amount; + $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 0); + $sql .= ", ".($this->salary > 0 ? $this->salary : "null"); + $sql .= ", ".$this->db->escape($this->type_payment); + $sql .= ", '".$this->db->escape($this->num_payment)."'"; + if ($this->note) $sql .= ", '".$this->db->escape($this->note)."'"; + $sql .= ", '".$this->db->escape($this->label)."'"; + $sql .= ", '".$this->db->idate($this->datesp)."'"; + $sql .= ", '".$this->db->idate($this->dateep)."'"; + $sql .= ", '".$this->db->escape($user->id)."'"; + $sql .= ", '".$this->db->idate($now)."'"; + $sql .= ", NULL"; + $sql .= ", ".$conf->entity; + $sql .= ")"; + + dol_syslog(get_class($this)."::create", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); + + if ($this->id > 0) + { + if (!empty($conf->banque->enabled) && !empty($this->amount)) + { + // Insert into llx_bank + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + + $acc = new Account($this->db); + $result = $acc->fetch($this->accountid); + if ($result <= 0) dol_print_error($this->db); + + // Update extrafield + if (!$error) { + if (!$error) + { + $result = $this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + + // Insert payment into llx_bank + // Add link 'payment_salary' in bank_url between payment and bank transaction + $bank_line_id = $acc->addline( + $this->datep, + $this->type_payment, + $this->label, + -abs($this->amount), + $this->num_payment, + '', + $user, + '', + '', + '', + $this->datev + ); + + // Update fk_bank into llx_paiement. + // So we know the payment which has generate the banking ecriture + if ($bank_line_id > 0) + { + $this->update_fk_bank($bank_line_id); + } else { + $this->error = $acc->error; + $error++; + } + + if (!$error) + { + // Add link 'payment_salary' in bank_url between payment and bank transaction + $url = DOL_URL_ROOT.'/salaries/card.php?id='; + + $result = $acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary"); + if ($result <= 0) + { + $this->error = $acc->error; + $error++; + } + } + + $fuser = new User($this->db); + $fuser->fetch($this->fk_user); + + // Add link 'user' in bank_url between operation and bank transaction + $result = $acc->add_url_line( + $bank_line_id, + $this->fk_user, + DOL_URL_ROOT.'/user/card.php?id=', + $fuser->getFullName($langs), + // $langs->trans("SalaryPayment").' '.$fuser->getFullName($langs).' '.dol_print_date($this->datesp,'dayrfc').' '.dol_print_date($this->dateep,'dayrfc'), + 'user' + ); + + if ($result <= 0) + { + $this->error = $acc->error; + $error++; + } + } + + // Call trigger + $result = $this->call_trigger('PAYMENT_SALARY_CREATE', $user); + if ($result < 0) $error++; + // End call triggers + } else $error++; + + if (!$error) + { + $this->db->commit(); + return $this->id; + } else { + $this->db->rollback(); + return -2; + } + } else { + $this->error = $this->db->error(); + $this->db->rollback(); + return -1; + } + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Update link between payment salary and line generate into llx_bank + * + * @param int $id_bank Id bank account + * @return int <0 if KO, >0 if OK + */ + public function update_fk_bank($id_bank) + { + // phpcs:enable + $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank; + $sql .= ' WHERE rowid = '.$this->id; + $result = $this->db->query($sql); + if ($result) + { + return 1; + } else { + dol_print_error($this->db); + return -1; + } + } + + + /** + * Send name clicable (with possibly the picto) + * + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param string $option link option + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string Chaine with URL + */ + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $db, $conf, $langs, $hookmanager; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips + + $result = ''; + + $label = ''.$langs->trans("ShowSalaryPayment").''; + $label .= '
    '; + $label .= ''.$langs->trans('Ref').': '.$this->ref; + + $url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; + } + + $linkclose = ''; + if (empty($notooltip)) + { + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label = $langs->trans("ShowMyObject"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + + /* $hookmanager->initHooks(array('myobjectdao')); $parameters=array('id'=>$this->id); $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); - $linkstart = ''; - $linkend = ''; + $linkstart = ''; + $linkend = ''; - $result .= $linkstart; - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); - if ($withpicto != 2) $result .= $this->ref; - $result .= $linkend; - //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + $result .= $linkstart; + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto != 2) $result .= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); - global $action, $hookmanager; - $hookmanager->initHooks(array('salarypayment')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); - $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $result = $hookmanager->resPrint; - else $result .= $hookmanager->resPrint; + global $action, $hookmanager; + $hookmanager->initHooks(array('salarypayment')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $result = $hookmanager->resPrint; + else $result .= $hookmanager->resPrint; - return $result; - } + return $result; + } - /** - * Information on record - * - * @param int $id Id of record - * @return void - */ - public function info($id) - { - $sql = 'SELECT ps.rowid, ps.datec, ps.fk_user_author'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'payment_salary as ps'; - $sql .= ' WHERE ps.rowid = '.$id; + /** + * Information on record + * + * @param int $id Id of record + * @return void + */ + public function info($id) + { + $sql = 'SELECT ps.rowid, ps.datec, ps.fk_user_author'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'payment_salary as ps'; + $sql .= ' WHERE ps.rowid = '.$id; - dol_syslog(get_class($this).'::info', LOG_DEBUG); - $result = $this->db->query($sql); + dol_syslog(get_class($this).'::info', LOG_DEBUG); + $result = $this->db->query($sql); - if ($result) - { - if ($this->db->num_rows($result)) - { - $obj = $this->db->fetch_object($result); - $this->id = $obj->rowid; - if ($obj->fk_user_author) - { - $cuser = new User($this->db); - $cuser->fetch($obj->fk_user_author); - $this->user_creation = $cuser; - } - $this->date_creation = $this->db->jdate($obj->datec); - } - $this->db->free($result); - } else { - dol_print_error($this->db); - } - } + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->id = $obj->rowid; + if ($obj->fk_user_author) + { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } + $this->date_creation = $this->db->jdate($obj->datec); + } + $this->db->free($result); + } else { + dol_print_error($this->db); + } + } - /** - * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee) - * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Libelle - */ - public function getLibStatut($mode = 0) - { - return $this->LibStatut($this->statut, $mode); - } + /** + * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Libelle + */ + public function getLibStatut($mode = 0) + { + return $this->LibStatut($this->statut, $mode); + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Renvoi le libelle d'un statut donne - * - * @param int $status Statut - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Libelle du statut - */ - public function LibStatut($status, $mode = 0) - { - // phpcs:enable - global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Renvoi le libelle d'un statut donne + * + * @param int $status Statut + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Libelle du statut + */ + public function LibStatut($status, $mode = 0) + { + // phpcs:enable + global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage - $langs->load('compta'); - /*if ($mode == 0) + $langs->load('compta'); + /*if ($mode == 0) { if ($status == 0) return $langs->trans('ToValidate'); if ($status == 1) return $langs->trans('Validated'); @@ -727,6 +727,6 @@ class PaymentSalary extends CommonObject if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1'); if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); }*/ - return ''; - } + return ''; + } } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 50c740e7be3..c48a0c4be3c 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -610,8 +610,8 @@ if (!empty($type)) if ($type == 'f') $label = 'NewSupplier'; } -if ($contextpage = 'poslist' && $type == 't' && ( !empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) { - print get_htmloutput_mesg(img_warning('default') . ' ' . $langs->trans("BecarefullChangeThirdpartyBeforeAddProductToInvoice"), '', 'warning', 1); +if ($contextpage = 'poslist' && $type == 't' && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) { + print get_htmloutput_mesg(img_warning('default').' '.$langs->trans("BecarefullChangeThirdpartyBeforeAddProductToInvoice"), '', 'warning', 1); } // Show the new button only when this page is not opend from the Extended POS (pop-up window) @@ -1257,13 +1257,13 @@ while ($i < min($num, $limit)) { // Prospect status print '
    '; - print '
    ' . $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto); + print '
    '.$companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto); print '
    -
    '; foreach ($prospectstatic->cacheprospectstatus as $key => $val) { $titlealt = 'default'; if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label']; - if ($obj->stcomm_id != $val['id']) print '' . img_action($titlealt, $val['code'], $val['picto']) . ''; + if ($obj->stcomm_id != $val['id']) print ''.img_action($titlealt, $val['code'], $val['picto']).''; } print '
    '; if (!$i) $totalarray['nbfield']++; diff --git a/htdocs/takepos/smpcb.php b/htdocs/takepos/smpcb.php index f138438a707..1e02e9bc591 100644 --- a/htdocs/takepos/smpcb.php +++ b/htdocs/takepos/smpcb.php @@ -40,7 +40,7 @@ if (GETPOSTISSET('status')) { if (GETPOST('smp-status')) { print ''; print ''; - print ' + print ' The HTML5 Herald diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index d3a59962d88..7864c93243f 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -39,11 +39,11 @@ dol_syslog("Call ActionComm webservices interfaces"); // Enable and test if module web services is enabled if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) { - $langs->load("admin"); - dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); - print $langs->trans("WarningModuleNotActive", 'WebServices').'.

    '; - print $langs->trans("ToActivateModule"); - exit; + $langs->load("admin"); + dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); + print $langs->trans("WarningModuleNotActive", 'WebServices').'.

    '; + print $langs->trans("ToActivateModule"); + exit; } // Create the soap Object @@ -57,36 +57,36 @@ $server->wsdl->schemaTargetNamespace = $ns; // Define WSDL Authentication object $server->wsdl->addComplexType( - 'authentication', - 'complexType', - 'struct', - 'all', - '', - array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), - ) + 'authentication', + 'complexType', + 'struct', + 'all', + '', + array( + 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), + 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), + 'login' => array('name'=>'login', 'type'=>'xsd:string'), + 'password' => array('name'=>'password', 'type'=>'xsd:string'), + 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), + ) ); // Define WSDL Return object $server->wsdl->addComplexType( - 'result', - 'complexType', - 'struct', - 'all', - '', - array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), - ) + 'result', + 'complexType', + 'struct', + 'all', + '', + array( + 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), + 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + ) ); $actioncomm_fields = array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), + 'id' => array('name'=>'id', 'type'=>'xsd:string'), 'ref' => array('name'=>'ref', 'type'=>'xsd:string'), 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), 'type_id' => array('name'=>'type_id', 'type'=>'xsd:string'), @@ -137,11 +137,11 @@ if (is_array($extrafield_array)) $actioncomm_fields = array_merge($actioncomm_fi // Define other specific objects $server->wsdl->addComplexType( - 'actioncomm', - 'complexType', - 'struct', - 'all', - '', + 'actioncomm', + 'complexType', + 'struct', + 'all', + '', $actioncomm_fields ); @@ -165,12 +165,12 @@ $server->wsdl->addComplexType( 'sequence', '', array( - 'actioncommtype' => array( - 'name' => 'actioncommtype', - 'type' => 'tns:actioncommtype', - 'minOccurs' => '0', - 'maxOccurs' => 'unbounded' - ) + 'actioncommtype' => array( + 'name' => 'actioncommtype', + 'type' => 'tns:actioncommtype', + 'minOccurs' => '0', + 'maxOccurs' => 'unbounded' + ) ) ); @@ -199,16 +199,16 @@ $server->register( // Register WSDL $server->register( - 'getActionComm', - // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string'), - // Exit values - array('result'=>'tns:result', 'actioncomm'=>'tns:actioncomm'), - $ns, - $ns.'#getActionComm', - $styledoc, - $styleuse, - 'WS to get actioncomm' + 'getActionComm', + // Entry values + array('authentication'=>'tns:authentication', 'id'=>'xsd:string'), + // Exit values + array('result'=>'tns:result', 'actioncomm'=>'tns:actioncomm'), + $ns, + $ns.'#getActionComm', + $styledoc, + $styleuse, + 'WS to get actioncomm' ); // Register WSDL @@ -251,100 +251,100 @@ $server->register( */ function getActionComm($authentication, $id) { - global $db, $conf, $langs; + global $db, $conf, $langs; - dol_syslog("Function: getActionComm login=".$authentication['login']." id=".$id); + dol_syslog("Function: getActionComm login=".$authentication['login']." id=".$id); - if ($authentication['entity']) $conf->entity = $authentication['entity']; + if ($authentication['entity']) $conf->entity = $authentication['entity']; - // Init and check authentication - $objectresp = array(); - $errorcode = ''; $errorlabel = ''; - $error = 0; - $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); - // Check parameters - if ($error || (!$id)) - { - $error++; - $errorcode = 'BAD_PARAMETERS'; $errorlabel = "Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both."; - } + // Init and check authentication + $objectresp = array(); + $errorcode = ''; $errorlabel = ''; + $error = 0; + $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); + // Check parameters + if ($error || (!$id)) + { + $error++; + $errorcode = 'BAD_PARAMETERS'; $errorlabel = "Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both."; + } - if (!$error) - { - $fuser->getrights(); + if (!$error) + { + $fuser->getrights(); - if ($fuser->rights->agenda->allactions->read) - { - $actioncomm = new ActionComm($db); - $result = $actioncomm->fetch($id); - if ($result > 0) - { - $actioncomm_result_fields = array( + if ($fuser->rights->agenda->allactions->read) + { + $actioncomm = new ActionComm($db); + $result = $actioncomm->fetch($id); + if ($result > 0) + { + $actioncomm_result_fields = array( 'id' => $actioncomm->id, 'ref'=> $actioncomm->ref, - 'ref_ext'=> $actioncomm->ref_ext, - 'type_id'=> $actioncomm->type_id, - 'type_code'=> $actioncomm->type_code, - 'type'=> $actioncomm->type, - 'label'=> $actioncomm->label, - 'datep'=> dol_print_date($actioncomm->datep, 'dayhourrfc'), - 'datef'=> dol_print_date($actioncomm->datef, 'dayhourrfc'), - 'datec'=> dol_print_date($actioncomm->datec, 'dayhourrfc'), - 'datem'=> dol_print_date($actioncomm->datem, 'dayhourrfc'), - 'note'=> $actioncomm->note_private, - 'percentage'=> $actioncomm->percentage, - 'author'=> $actioncomm->authorid, - 'usermod'=> $actioncomm->usermodid, - 'userownerid'=> $actioncomm->userownerid, - 'priority'=> $actioncomm->priority, - 'fulldayevent'=> $actioncomm->fulldayevent, - 'location'=> $actioncomm->location, - 'socid'=> $actioncomm->socid, - 'contactid'=> $actioncomm->contact_id, - 'projectid'=> $actioncomm->fk_project, - 'fk_element'=> $actioncomm->fk_element, - 'elementtype'=> $actioncomm->elementtype - ); + 'ref_ext'=> $actioncomm->ref_ext, + 'type_id'=> $actioncomm->type_id, + 'type_code'=> $actioncomm->type_code, + 'type'=> $actioncomm->type, + 'label'=> $actioncomm->label, + 'datep'=> dol_print_date($actioncomm->datep, 'dayhourrfc'), + 'datef'=> dol_print_date($actioncomm->datef, 'dayhourrfc'), + 'datec'=> dol_print_date($actioncomm->datec, 'dayhourrfc'), + 'datem'=> dol_print_date($actioncomm->datem, 'dayhourrfc'), + 'note'=> $actioncomm->note_private, + 'percentage'=> $actioncomm->percentage, + 'author'=> $actioncomm->authorid, + 'usermod'=> $actioncomm->usermodid, + 'userownerid'=> $actioncomm->userownerid, + 'priority'=> $actioncomm->priority, + 'fulldayevent'=> $actioncomm->fulldayevent, + 'location'=> $actioncomm->location, + 'socid'=> $actioncomm->socid, + 'contactid'=> $actioncomm->contact_id, + 'projectid'=> $actioncomm->fk_project, + 'fk_element'=> $actioncomm->fk_element, + 'elementtype'=> $actioncomm->elementtype + ); - $elementtype = 'actioncomm'; + $elementtype = 'actioncomm'; - // Retrieve all extrafield for actioncomm - // fetch optionals attributes and labels - $extrafields = new ExtraFields($db); - $extrafields->fetch_name_optionals_label($elementtype, true); - //Get extrafield values - $actioncomm->fetch_optionals(); + // Retrieve all extrafield for actioncomm + // fetch optionals attributes and labels + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label($elementtype, true); + //Get extrafield values + $actioncomm->fetch_optionals(); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) - { - foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) - { - $actioncomm_result_fields = array_merge($actioncomm_result_fields, array('options_'.$key => $actioncomm->array_options['options_'.$key])); - } - } + if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + { + foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) + { + $actioncomm_result_fields = array_merge($actioncomm_result_fields, array('options_'.$key => $actioncomm->array_options['options_'.$key])); + } + } - // Create - $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'actioncomm'=>$actioncomm_result_fields); - } - else { - $error++; - $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; - } - } - else { - $error++; - $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; - } - } + // Create + $objectresp = array( + 'result'=>array('result_code'=>'OK', 'result_label'=>''), + 'actioncomm'=>$actioncomm_result_fields); + } + else { + $error++; + $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; + } + } + else { + $error++; + $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; + } + } - if ($error) - { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); - } + if ($error) + { + $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + } - return $objectresp; + return $objectresp; } @@ -384,8 +384,8 @@ function getListActionCommType($authentication) } $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'actioncommtypes'=>$resultarray); + 'result'=>array('result_code'=>'OK', 'result_label'=>''), + 'actioncommtypes'=>$resultarray); } else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index c4818d050f6..9abc7b6088f 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -35,11 +35,11 @@ dol_syslog("Call Contact webservices interfaces"); // Enable and test if module web services is enabled if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) { - $langs->load("admin"); - dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); - print $langs->trans("WarningModuleNotActive", 'WebServices').'.

    '; - print $langs->trans("ToActivateModule"); - exit; + $langs->load("admin"); + dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); + print $langs->trans("WarningModuleNotActive", 'WebServices').'.

    '; + print $langs->trans("ToActivateModule"); + exit; } // Create the soap Object @@ -53,31 +53,31 @@ $server->wsdl->schemaTargetNamespace = $ns; // Define WSDL Authentication object $server->wsdl->addComplexType( - 'authentication', - 'complexType', - 'struct', - 'all', - '', - array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), - ) + 'authentication', + 'complexType', + 'struct', + 'all', + '', + array( + 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), + 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), + 'login' => array('name'=>'login', 'type'=>'xsd:string'), + 'password' => array('name'=>'password', 'type'=>'xsd:string'), + 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), + ) ); // Define WSDL Return object $server->wsdl->addComplexType( - 'result', - 'complexType', - 'struct', - 'all', - '', - array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), - ) + 'result', + 'complexType', + 'struct', + 'all', + '', + array( + 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), + 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + ) ); $contact_fields = array( @@ -142,11 +142,11 @@ if (is_array($extrafield_array)) $contact_fields = array_merge($contact_fields, // Define other specific objects $server->wsdl->addComplexType( - 'contact', - 'complexType', - 'struct', - 'all', - '', + 'contact', + 'complexType', + 'struct', + 'all', + '', $contact_fields ); @@ -179,16 +179,16 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped // Register WSDL $server->register( - 'getContact', - // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref_ext'=>'xsd:string'), - // Exit values - array('result'=>'tns:result', 'contact'=>'tns:contact'), - $ns, - $ns.'#getContact', - $styledoc, - $styleuse, - 'WS to get a contact' + 'getContact', + // Entry values + array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref_ext'=>'xsd:string'), + // Exit values + array('result'=>'tns:result', 'contact'=>'tns:contact'), + $ns, + $ns.'#getContact', + $styledoc, + $styleuse, + 'WS to get a contact' ); // Register WSDL @@ -243,113 +243,113 @@ $server->register( */ function getContact($authentication, $id, $ref_ext) { - global $db, $conf, $langs; + global $db, $conf, $langs; - dol_syslog("Function: getContact login=".$authentication['login']." id=".$id." ref_ext=".$ref_ext); + dol_syslog("Function: getContact login=".$authentication['login']." id=".$id." ref_ext=".$ref_ext); - if ($authentication['entity']) $conf->entity = $authentication['entity']; + if ($authentication['entity']) $conf->entity = $authentication['entity']; - // Init and check authentication - $objectresp = array(); - $errorcode = ''; $errorlabel = ''; - $error = 0; - $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); - // Check parameters - if (!$error && ($id && $ref_ext)) - { - $error++; - $errorcode = 'BAD_PARAMETERS'; $errorlabel = "Parameter id and ref_ext can't be both provided. You must choose one or other but not both."; - } + // Init and check authentication + $objectresp = array(); + $errorcode = ''; $errorlabel = ''; + $error = 0; + $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); + // Check parameters + if (!$error && ($id && $ref_ext)) + { + $error++; + $errorcode = 'BAD_PARAMETERS'; $errorlabel = "Parameter id and ref_ext can't be both provided. You must choose one or other but not both."; + } - if (!$error) - { - $fuser->getrights(); + if (!$error) + { + $fuser->getrights(); - $contact = new Contact($db); - $result = $contact->fetch($id, 0, $ref_ext); - if ($result > 0) - { - // Only internal user who have contact read permission - // Or for external user who have contact read permission, with restrict on societe_id - if ( - $fuser->rights->societe->contact->lire && !$fuser->societe_id - || ($fuser->rights->societe->contact->lire && ($fuser->societe_id == $contact->socid)) - ) { - $contact_result_fields = array( - 'id' => $contact->id, - 'ref_ext' => $contact->ref_ext, - 'lastname' => $contact->lastname, - 'firstname' => $contact->firstname, - 'address' => $contact->address, - 'zip' => $contact->zip, - 'town' => $contact->town, - 'state_id' => $contact->state_id, - 'state_code' => $contact->state_code, - 'state' => $contact->state, - 'country_id' => $contact->country_id, - 'country_code' => $contact->country_code, - 'country' => $contact->country, - 'socid' => $contact->socid, - 'status' => $contact->statut, - 'phone_pro' => $contact->phone_pro, - 'fax' => $contact->fax, - 'phone_perso' => $contact->phone_perso, - 'phone_mobile' => $contact->phone_mobile, - 'code' => $contact->code, - 'email' => $contact->email, - 'birthday' => $contact->birthday, - 'default_lang' => $contact->default_lang, - 'note' => $contact->note, - 'ref_facturation' => $contact->ref_facturation, - 'ref_contrat' => $contact->ref_contrat, - 'ref_commande' => $contact->ref_commande, - 'ref_propal' => $contact->ref_propal, - 'user_id' => $contact->user_id, - 'user_login' => $contact->user_login, - 'civility_id' => $contact->civility_id, - 'poste' => $contact->poste - ); + $contact = new Contact($db); + $result = $contact->fetch($id, 0, $ref_ext); + if ($result > 0) + { + // Only internal user who have contact read permission + // Or for external user who have contact read permission, with restrict on societe_id + if ( + $fuser->rights->societe->contact->lire && !$fuser->societe_id + || ($fuser->rights->societe->contact->lire && ($fuser->societe_id == $contact->socid)) + ) { + $contact_result_fields = array( + 'id' => $contact->id, + 'ref_ext' => $contact->ref_ext, + 'lastname' => $contact->lastname, + 'firstname' => $contact->firstname, + 'address' => $contact->address, + 'zip' => $contact->zip, + 'town' => $contact->town, + 'state_id' => $contact->state_id, + 'state_code' => $contact->state_code, + 'state' => $contact->state, + 'country_id' => $contact->country_id, + 'country_code' => $contact->country_code, + 'country' => $contact->country, + 'socid' => $contact->socid, + 'status' => $contact->statut, + 'phone_pro' => $contact->phone_pro, + 'fax' => $contact->fax, + 'phone_perso' => $contact->phone_perso, + 'phone_mobile' => $contact->phone_mobile, + 'code' => $contact->code, + 'email' => $contact->email, + 'birthday' => $contact->birthday, + 'default_lang' => $contact->default_lang, + 'note' => $contact->note, + 'ref_facturation' => $contact->ref_facturation, + 'ref_contrat' => $contact->ref_contrat, + 'ref_commande' => $contact->ref_commande, + 'ref_propal' => $contact->ref_propal, + 'user_id' => $contact->user_id, + 'user_login' => $contact->user_login, + 'civility_id' => $contact->civility_id, + 'poste' => $contact->poste + ); - $elementtype = 'socpeople'; + $elementtype = 'socpeople'; - //Retrieve all extrafield for thirdsparty - // fetch optionals attributes and labels - $extrafields = new ExtraFields($db); - $extrafields->fetch_name_optionals_label($elementtype, true); - //Get extrafield values - $contact->fetch_optionals(); + //Retrieve all extrafield for thirdsparty + // fetch optionals attributes and labels + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label($elementtype, true); + //Get extrafield values + $contact->fetch_optionals(); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) - { - foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) - { - $contact_result_fields = array_merge($contact_result_fields, array('options_'.$key => $contact->array_options['options_'.$key])); - } - } + if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + { + foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) + { + $contact_result_fields = array_merge($contact_result_fields, array('options_'.$key => $contact->array_options['options_'.$key])); + } + } - // Create - $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'contact'=>$contact_result_fields - ); - } - else { - $error++; - $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; - } - } - else { - $error++; - $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref_ext='.$ref_ext; - } - } + // Create + $objectresp = array( + 'result'=>array('result_code'=>'OK', 'result_label'=>''), + 'contact'=>$contact_result_fields + ); + } + else { + $error++; + $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; + } + } + else { + $error++; + $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref_ext='.$ref_ext; + } + } - if ($error) - { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); - } + if ($error) + { + $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + } - return $objectresp; + return $objectresp; } @@ -623,11 +623,11 @@ function updateContact($authentication, $contact) $error++; $errorcode = 'KO'; $errorlabel = "Contact id or ref_ext is mandatory."; } // Check parameters - if (!$error && ($id && $ref_ext)) - { - $error++; - $errorcode = 'BAD_PARAMETERS'; $errorlabel = "Parameter id and ref_ext can't be all provided. You must choose one of them."; - } + if (!$error && ($id && $ref_ext)) + { + $error++; + $errorcode = 'BAD_PARAMETERS'; $errorlabel = "Parameter id and ref_ext can't be all provided. You must choose one of them."; + } if (!$error) { diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 327cab7bed9..224b2f00fa7 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -44,11 +44,11 @@ $langs->load("main"); // Enable and test if module web services is enabled if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) { - $langs->load("admin"); - dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); - print $langs->trans("WarningModuleNotActive", 'WebServices').'.

    '; - print $langs->trans("ToActivateModule"); - exit; + $langs->load("admin"); + dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); + print $langs->trans("WarningModuleNotActive", 'WebServices').'.

    '; + print $langs->trans("ToActivateModule"); + exit; } // Create the soap Object @@ -62,72 +62,72 @@ $server->wsdl->schemaTargetNamespace = $ns; // Define WSDL Authentication object $server->wsdl->addComplexType( - 'authentication', - 'complexType', - 'struct', - 'all', - '', - array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string') - ) + 'authentication', + 'complexType', + 'struct', + 'all', + '', + array( + 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), + 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), + 'login' => array('name'=>'login', 'type'=>'xsd:string'), + 'password' => array('name'=>'password', 'type'=>'xsd:string'), + 'entity' => array('name'=>'entity', 'type'=>'xsd:string') + ) ); // Define WSDL Return object $server->wsdl->addComplexType( - 'result', - 'complexType', - 'struct', - 'all', - '', - array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string') - ) + 'result', + 'complexType', + 'struct', + 'all', + '', + array( + 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), + 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string') + ) ); $productorservice_fields = array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'ref' => array('name'=>'ref', 'type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), - 'type' => array('name'=>'type', 'type'=>'xsd:string'), - 'label' => array('name'=>'label', 'type'=>'xsd:string'), - 'description' => array('name'=>'description', 'type'=>'xsd:string'), - 'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'), - 'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'), - 'note' => array('name'=>'note', 'type'=>'xsd:string'), - 'status_tobuy' => array('name'=>'status_tobuy', 'type'=>'xsd:string'), - 'status_tosell' => array('name'=>'status_tosell', 'type'=>'xsd:string'), - 'barcode' => array('name'=>'barcode', 'type'=>'xsd:string'), - 'barcode_type' => array('name'=>'barcode_type', 'type'=>'xsd:string'), - 'country_id' => array('name'=>'country_id', 'type'=>'xsd:string'), - 'country_code' => array('name'=>'country_code', 'type'=>'xsd:string'), - 'customcode' => array('name'=>'customcode', 'type'=>'xsd:string'), + 'id' => array('name'=>'id', 'type'=>'xsd:string'), + 'ref' => array('name'=>'ref', 'type'=>'xsd:string'), + 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), + 'type' => array('name'=>'type', 'type'=>'xsd:string'), + 'label' => array('name'=>'label', 'type'=>'xsd:string'), + 'description' => array('name'=>'description', 'type'=>'xsd:string'), + 'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'), + 'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'), + 'note' => array('name'=>'note', 'type'=>'xsd:string'), + 'status_tobuy' => array('name'=>'status_tobuy', 'type'=>'xsd:string'), + 'status_tosell' => array('name'=>'status_tosell', 'type'=>'xsd:string'), + 'barcode' => array('name'=>'barcode', 'type'=>'xsd:string'), + 'barcode_type' => array('name'=>'barcode_type', 'type'=>'xsd:string'), + 'country_id' => array('name'=>'country_id', 'type'=>'xsd:string'), + 'country_code' => array('name'=>'country_code', 'type'=>'xsd:string'), + 'customcode' => array('name'=>'customcode', 'type'=>'xsd:string'), - 'price_net' => array('name'=>'price_net', 'type'=>'xsd:string'), - 'price' => array('name'=>'price', 'type'=>'xsd:string'), - 'price_min_net' => array('name'=>'price_min_net', 'type'=>'xsd:string'), - 'price_min' => array('name'=>'price_min', 'type'=>'xsd:string'), + 'price_net' => array('name'=>'price_net', 'type'=>'xsd:string'), + 'price' => array('name'=>'price', 'type'=>'xsd:string'), + 'price_min_net' => array('name'=>'price_min_net', 'type'=>'xsd:string'), + 'price_min' => array('name'=>'price_min', 'type'=>'xsd:string'), - 'price_base_type' => array('name'=>'price_base_type', 'type'=>'xsd:string'), + 'price_base_type' => array('name'=>'price_base_type', 'type'=>'xsd:string'), - 'vat_rate' => array('name'=>'vat_rate', 'type'=>'xsd:string'), - 'vat_npr' => array('name'=>'vat_npr', 'type'=>'xsd:string'), - 'localtax1_tx' => array('name'=>'localtax1_tx', 'type'=>'xsd:string'), - 'localtax2_tx' => array('name'=>'localtax2_tx', 'type'=>'xsd:string'), + 'vat_rate' => array('name'=>'vat_rate', 'type'=>'xsd:string'), + 'vat_npr' => array('name'=>'vat_npr', 'type'=>'xsd:string'), + 'localtax1_tx' => array('name'=>'localtax1_tx', 'type'=>'xsd:string'), + 'localtax2_tx' => array('name'=>'localtax2_tx', 'type'=>'xsd:string'), - 'stock_alert' => array('name'=>'stock_alert', 'type'=>'xsd:string'), - 'stock_real' => array('name'=>'stock_real', 'type'=>'xsd:string'), - 'stock_pmp' => array('name'=>'stock_pmp', 'type'=>'xsd:string'), - 'warehouse_ref' => array('name'=>'warehouse_ref', 'type'=>'xsd:string'), // Used only for create or update to set which warehouse to use for stock correction if stock_real differs from database + 'stock_alert' => array('name'=>'stock_alert', 'type'=>'xsd:string'), + 'stock_real' => array('name'=>'stock_real', 'type'=>'xsd:string'), + 'stock_pmp' => array('name'=>'stock_pmp', 'type'=>'xsd:string'), + 'warehouse_ref' => array('name'=>'warehouse_ref', 'type'=>'xsd:string'), // Used only for create or update to set which warehouse to use for stock correction if stock_real differs from database - 'canvas' => array('name'=>'canvas', 'type'=>'xsd:string'), - 'import_key' => array('name'=>'import_key', 'type'=>'xsd:string'), + 'canvas' => array('name'=>'canvas', 'type'=>'xsd:string'), + 'import_key' => array('name'=>'import_key', 'type'=>'xsd:string'), - 'dir' => array('name'=>'dir', 'type'=>'xsd:string'), - 'images' => array('name'=>'images', 'type'=>'tns:ImagesArray') + 'dir' => array('name'=>'dir', 'type'=>'xsd:string'), + 'images' => array('name'=>'images', 'type'=>'tns:ImagesArray') ); @@ -158,12 +158,12 @@ if (is_array($extrafield_array)) $productorservice_fields = array_merge($product // Define other specific objects $server->wsdl->addComplexType( - 'product', - 'complexType', - 'struct', - 'all', - '', - $productorservice_fields + 'product', + 'complexType', + 'struct', + 'all', + '', + $productorservice_fields ); @@ -206,33 +206,33 @@ $server->wsdl->addComplexType( // Define other specific objects $server->wsdl->addComplexType( - 'filterproduct', - 'complexType', - 'struct', - 'all', - '', - array( - //'limit' => array('name'=>'limit','type'=>'xsd:string'), + 'filterproduct', + 'complexType', + 'struct', + 'all', + '', + array( + //'limit' => array('name'=>'limit','type'=>'xsd:string'), 'type' => array('name'=>'type', 'type'=>'xsd:string'), - 'status_tobuy' => array('name'=>'status_tobuy', 'type'=>'xsd:string'), - 'status_tosell' => array('name'=>'status_tosell', 'type'=>'xsd:string'), - ) + 'status_tobuy' => array('name'=>'status_tobuy', 'type'=>'xsd:string'), + 'status_tosell' => array('name'=>'status_tosell', 'type'=>'xsd:string'), + ) ); $server->wsdl->addComplexType( - 'ProductsArray2', - 'complexType', - 'array', - 'sequence', - '', - array( - 'product' => array( - 'name' => 'product', - 'type' => 'tns:product', - 'minOccurs' => '0', - 'maxOccurs' => 'unbounded' - ) - ) + 'ProductsArray2', + 'complexType', + 'array', + 'sequence', + '', + array( + 'product' => array( + 'name' => 'product', + 'type' => 'tns:product', + 'minOccurs' => '0', + 'maxOccurs' => 'unbounded' + ) + ) ); @@ -247,72 +247,72 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped // Register WSDL $server->register( - 'getProductOrService', - // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string', 'lang'=>'xsd:string'), - // Exit values - array('result'=>'tns:result', 'product'=>'tns:product'), - $ns, - $ns.'#getProductOrService', - $styledoc, - $styleuse, - 'WS to get product or service' + 'getProductOrService', + // Entry values + array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string', 'lang'=>'xsd:string'), + // Exit values + array('result'=>'tns:result', 'product'=>'tns:product'), + $ns, + $ns.'#getProductOrService', + $styledoc, + $styleuse, + 'WS to get product or service' ); // Register WSDL $server->register( - 'createProductOrService', - // Entry values - array('authentication'=>'tns:authentication', 'product'=>'tns:product'), - // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), - $ns, - $ns.'#createProductOrService', - $styledoc, - $styleuse, - 'WS to create a product or service' + 'createProductOrService', + // Entry values + array('authentication'=>'tns:authentication', 'product'=>'tns:product'), + // Exit values + array('result'=>'tns:result', 'id'=>'xsd:string'), + $ns, + $ns.'#createProductOrService', + $styledoc, + $styleuse, + 'WS to create a product or service' ); // Register WSDL $server->register( - 'updateProductOrService', - // Entry values - array('authentication'=>'tns:authentication', 'product'=>'tns:product'), - // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), - $ns, - $ns.'#updateProductOrService', - $styledoc, - $styleuse, - 'WS to update a product or service' + 'updateProductOrService', + // Entry values + array('authentication'=>'tns:authentication', 'product'=>'tns:product'), + // Exit values + array('result'=>'tns:result', 'id'=>'xsd:string'), + $ns, + $ns.'#updateProductOrService', + $styledoc, + $styleuse, + 'WS to update a product or service' ); // Register WSDL $server->register( - 'deleteProductOrService', - // Entry values - array('authentication'=>'tns:authentication', 'listofid'=>'xsd:string'), - // Exit values - array('result'=>'tns:result', 'nbdeleted'=>'xsd:int'), - $ns, - $ns.'#deleteProductOrService', - $styledoc, - $styleuse, - 'WS to delete a product or service' + 'deleteProductOrService', + // Entry values + array('authentication'=>'tns:authentication', 'listofid'=>'xsd:string'), + // Exit values + array('result'=>'tns:result', 'nbdeleted'=>'xsd:int'), + $ns, + $ns.'#deleteProductOrService', + $styledoc, + $styleuse, + 'WS to delete a product or service' ); // Register WSDL $server->register( - 'getListOfProductsOrServices', - // Entry values - array('authentication'=>'tns:authentication', 'filterproduct'=>'tns:filterproduct'), - // Exit values - array('result'=>'tns:result', 'products'=>'tns:ProductsArray2'), - $ns, - $ns.'#getListOfProductsOrServices', - $styledoc, - $styleuse, - 'WS to get list of all products or services id and ref' + 'getListOfProductsOrServices', + // Entry values + array('authentication'=>'tns:authentication', 'filterproduct'=>'tns:filterproduct'), + // Exit values + array('result'=>'tns:result', 'products'=>'tns:ProductsArray2'), + $ns, + $ns.'#getListOfProductsOrServices', + $styledoc, + $styleuse, + 'WS to get list of all products or services id and ref' ); // Register WSDL @@ -342,131 +342,131 @@ $server->register( */ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = '', $lang = '') { - global $db, $conf, $langs; + global $db, $conf, $langs; - dol_syslog("Function: getProductOrService login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); + dol_syslog("Function: getProductOrService login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); - $langcode = ($lang ? $lang : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT)); - $langs->setDefaultLang($langcode); + $langcode = ($lang ? $lang : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT)); + $langs->setDefaultLang($langcode); - if ($authentication['entity']) $conf->entity = $authentication['entity']; + if ($authentication['entity']) $conf->entity = $authentication['entity']; - // Init and check authentication - $objectresp = array(); - $errorcode = ''; $errorlabel = ''; - $error = 0; - $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); - // Check parameters - if (!$error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext))) - { - $error++; - $errorcode = 'BAD_PARAMETERS'; $errorlabel = "Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both."; - } + // Init and check authentication + $objectresp = array(); + $errorcode = ''; $errorlabel = ''; + $error = 0; + $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); + // Check parameters + if (!$error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext))) + { + $error++; + $errorcode = 'BAD_PARAMETERS'; $errorlabel = "Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both."; + } - if (!$error) - { - $langcode = ($lang ? $lang : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT)); - $langs->setDefaultLang($langcode); + if (!$error) + { + $langcode = ($lang ? $lang : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT)); + $langs->setDefaultLang($langcode); - $fuser->getrights(); + $fuser->getrights(); - $nbmax = 10; - if ($fuser->rights->produit->lire || $fuser->rights->service->lire) - { - $product = new Product($db); - $result = $product->fetch($id, $ref, $ref_ext); + $nbmax = 10; + if ($fuser->rights->produit->lire || $fuser->rights->service->lire) + { + $product = new Product($db); + $result = $product->fetch($id, $ref, $ref_ext); - if ($result > 0) - { - $product->load_stock(); + if ($result > 0) + { + $product->load_stock(); - $dir = (!empty($conf->product->dir_output) ? $conf->product->dir_output : $conf->service->dir_output); - $pdir = get_exdir($product->id, 2, 0, 0, $product, 'product').$product->ref."/"; - $dir = $dir.'/'.$pdir; + $dir = (!empty($conf->product->dir_output) ? $conf->product->dir_output : $conf->service->dir_output); + $pdir = get_exdir($product->id, 2, 0, 0, $product, 'product').$product->ref."/"; + $dir = $dir.'/'.$pdir; - if (!empty($product->multilangs[$langs->defaultlang]["label"])) $product->label = $product->multilangs[$langs->defaultlang]["label"]; - if (!empty($product->multilangs[$langs->defaultlang]["description"])) $product->description = $product->multilangs[$langs->defaultlang]["description"]; - if (!empty($product->multilangs[$langs->defaultlang]["note"])) $product->note = $product->multilangs[$langs->defaultlang]["note"]; + if (!empty($product->multilangs[$langs->defaultlang]["label"])) $product->label = $product->multilangs[$langs->defaultlang]["label"]; + if (!empty($product->multilangs[$langs->defaultlang]["description"])) $product->description = $product->multilangs[$langs->defaultlang]["description"]; + if (!empty($product->multilangs[$langs->defaultlang]["note"])) $product->note = $product->multilangs[$langs->defaultlang]["note"]; - $productorservice_result_fields = array( - 'id' => $product->id, - 'ref' => $product->ref, - 'ref_ext' => $product->ref_ext, - 'label' => $product->label, - 'description' => $product->description, - 'date_creation' => dol_print_date($product->date_creation, 'dayhourrfc'), - 'date_modification' => dol_print_date($product->date_modification, 'dayhourrfc'), - 'note' => $product->note, - 'status_tosell' => $product->status, - 'status_tobuy' => $product->status_buy, - 'type' => $product->type, - 'barcode' => $product->barcode, - 'barcode_type' => $product->barcode_type, - 'country_id' => $product->country_id > 0 ? $product->country_id : '', - 'country_code' => $product->country_code, - 'custom_code' => $product->customcode, + $productorservice_result_fields = array( + 'id' => $product->id, + 'ref' => $product->ref, + 'ref_ext' => $product->ref_ext, + 'label' => $product->label, + 'description' => $product->description, + 'date_creation' => dol_print_date($product->date_creation, 'dayhourrfc'), + 'date_modification' => dol_print_date($product->date_modification, 'dayhourrfc'), + 'note' => $product->note, + 'status_tosell' => $product->status, + 'status_tobuy' => $product->status_buy, + 'type' => $product->type, + 'barcode' => $product->barcode, + 'barcode_type' => $product->barcode_type, + 'country_id' => $product->country_id > 0 ? $product->country_id : '', + 'country_code' => $product->country_code, + 'custom_code' => $product->customcode, - 'price_net' => $product->price, - 'price' => $product->price_ttc, - 'price_min_net' => $product->price_min, - 'price_min' => $product->price_min_ttc, - 'price_base_type' => $product->price_base_type, - 'vat_rate' => $product->tva_tx, - //! French VAT NPR - 'vat_npr' => $product->tva_npr, - //! Spanish local taxes - 'localtax1_tx' => $product->localtax1_tx, - 'localtax2_tx' => $product->localtax2_tx, + 'price_net' => $product->price, + 'price' => $product->price_ttc, + 'price_min_net' => $product->price_min, + 'price_min' => $product->price_min_ttc, + 'price_base_type' => $product->price_base_type, + 'vat_rate' => $product->tva_tx, + //! French VAT NPR + 'vat_npr' => $product->tva_npr, + //! Spanish local taxes + 'localtax1_tx' => $product->localtax1_tx, + 'localtax2_tx' => $product->localtax2_tx, - 'stock_real' => $product->stock_reel, - 'stock_virtual' => $product->stock_theorique, - 'stock_alert' => $product->seuil_stock_alerte, - 'pmp' => $product->pmp, - 'import_key' => $product->import_key, - 'dir' => $pdir, - 'images' => $product->liste_photos($dir, $nbmax) - ); + 'stock_real' => $product->stock_reel, + 'stock_virtual' => $product->stock_theorique, + 'stock_alert' => $product->seuil_stock_alerte, + 'pmp' => $product->pmp, + 'import_key' => $product->import_key, + 'dir' => $pdir, + 'images' => $product->liste_photos($dir, $nbmax) + ); - $elementtype = 'product'; + $elementtype = 'product'; - //Retrieve all extrafield for thirdsparty - // fetch optionals attributes and labels - $extrafields = new ExtraFields($db); - $extrafields->fetch_name_optionals_label($elementtype, true); - //Get extrafield values - $product->fetch_optionals(); + //Retrieve all extrafield for thirdsparty + // fetch optionals attributes and labels + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label($elementtype, true); + //Get extrafield values + $product->fetch_optionals(); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) - { - foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) - { - $productorservice_result_fields = array_merge($productorservice_result_fields, array('options_'.$key => $product->array_options['options_'.$key])); - } - } + if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + { + foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) + { + $productorservice_result_fields = array_merge($productorservice_result_fields, array('options_'.$key => $product->array_options['options_'.$key])); + } + } - // Create - $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'product'=>$productorservice_result_fields - ); - } - else { - $error++; - $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; - } - } - else { - $error++; - $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; - } - } + // Create + $objectresp = array( + 'result'=>array('result_code'=>'OK', 'result_label'=>''), + 'product'=>$productorservice_result_fields + ); + } + else { + $error++; + $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; + } + } + else { + $error++; + $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; + } + } - if ($error) - { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); - } + if ($error) + { + $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + } //var_dump($objectresp);exit; - return $objectresp; + return $objectresp; } @@ -479,54 +479,54 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = '' */ function createProductOrService($authentication, $product) { - global $db, $conf, $langs; + global $db, $conf, $langs; - $now = dol_now(); + $now = dol_now(); - dol_syslog("Function: createProductOrService login=".$authentication['login']); + dol_syslog("Function: createProductOrService login=".$authentication['login']); - if ($authentication['entity']) $conf->entity = $authentication['entity']; + if ($authentication['entity']) $conf->entity = $authentication['entity']; - // Init and check authentication - $objectresp = array(); - $errorcode = ''; $errorlabel = ''; - $error = 0; - $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); - // Check parameters - if ($product['price_net'] > 0) $product['price_base_type'] = 'HT'; - if ($product['price'] > 0) $product['price_base_type'] = 'TTC'; + // Init and check authentication + $objectresp = array(); + $errorcode = ''; $errorlabel = ''; + $error = 0; + $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); + // Check parameters + if ($product['price_net'] > 0) $product['price_base_type'] = 'HT'; + if ($product['price'] > 0) $product['price_base_type'] = 'TTC'; - if ($product['price_net'] > 0 && $product['price'] > 0) - { - $error++; $errorcode = 'KO'; $errorlabel = "You must choose between price or price_net to provide price."; - } + if ($product['price_net'] > 0 && $product['price'] > 0) + { + $error++; $errorcode = 'KO'; $errorlabel = "You must choose between price or price_net to provide price."; + } - if ($product['barcode'] && !$product['barcode_type']) - { - $error++; $errorcode = 'KO'; $errorlabel = "You must set a barcode type when setting a barcode."; - } + if ($product['barcode'] && !$product['barcode_type']) + { + $error++; $errorcode = 'KO'; $errorlabel = "You must set a barcode type when setting a barcode."; + } - if (!$error) - { - include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + if (!$error) + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - $newobject = new Product($db); - $newobject->ref = $product['ref']; - $newobject->ref_ext = $product['ref_ext']; - $newobject->type = $product['type']; - $newobject->label = $product['label']; - $newobject->description = $product['description']; - $newobject->note_public = $product['note_public']; - $newobject->note_private = $product['note_private']; - $newobject->status = $product['status_tosell']; - $newobject->status_buy = $product['status_tobuy']; - $newobject->price = $product['price_net']; - $newobject->price_ttc = $product['price']; - $newobject->tva_tx = $product['vat_rate']; - $newobject->price_base_type = $product['price_base_type']; - $newobject->date_creation = $now; + $newobject = new Product($db); + $newobject->ref = $product['ref']; + $newobject->ref_ext = $product['ref_ext']; + $newobject->type = $product['type']; + $newobject->label = $product['label']; + $newobject->description = $product['description']; + $newobject->note_public = $product['note_public']; + $newobject->note_private = $product['note_private']; + $newobject->status = $product['status_tosell']; + $newobject->status_buy = $product['status_tobuy']; + $newobject->price = $product['price_net']; + $newobject->price_ttc = $product['price']; + $newobject->tva_tx = $product['vat_rate']; + $newobject->price_base_type = $product['price_base_type']; + $newobject->date_creation = $now; if ($product['barcode']) { @@ -534,16 +534,16 @@ function createProductOrService($authentication, $product) $newobject->barcode_type = $product['barcode_type']; } - $newobject->stock_reel = $product['stock_real']; - $newobject->pmp = $product['pmp']; - $newobject->seuil_stock_alert = $product['stock_alert']; + $newobject->stock_reel = $product['stock_real']; + $newobject->pmp = $product['pmp']; + $newobject->seuil_stock_alert = $product['stock_alert']; - $newobject->country_id = $product['country_id']; - if ($product['country_code']) $newobject->country_id = getCountry($product['country_code'], 3); - $newobject->customcode = $product['customcode']; + $newobject->country_id = $product['country_id']; + if ($product['country_code']) $newobject->country_id = getCountry($product['country_code'], 3); + $newobject->customcode = $product['customcode']; - $newobject->canvas = $product['canvas']; - /*foreach($product['lines'] as $line) + $newobject->canvas = $product['canvas']; + /*foreach($product['lines'] as $line) { $newline=new FactureLigne($db); $newline->type=$line['type']; @@ -556,13 +556,13 @@ function createProductOrService($authentication, $product) $newline->qty=$line['qty']; $newline->fk_product=$line['product_id']; }*/ - //var_dump($product['ref_ext']); - //var_dump($product['lines'][0]['type']); + //var_dump($product['ref_ext']); + //var_dump($product['lines'][0]['type']); - $elementtype = 'product'; + $elementtype = 'product'; - $extrafields = new ExtraFields($db); - $extrafields->fetch_name_optionals_label($elementtype, true); + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label($elementtype, true); if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) @@ -572,17 +572,17 @@ function createProductOrService($authentication, $product) } } - $db->begin(); + $db->begin(); - $result = $newobject->create($fuser, 0); - if ($result <= 0) - { - $error++; - } + $result = $newobject->create($fuser, 0); + if ($result <= 0) + { + $error++; + } - if (!$error) - { - // Update stock if stock count is provided and differs from database after creation or update + if (!$error) + { + // Update stock if stock count is provided and differs from database after creation or update if (isset($product['stock_real']) && $product['stock_real'] != '' && !empty($conf->global->stock->enabled)) { include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; @@ -619,25 +619,25 @@ function createProductOrService($authentication, $product) } } - if (!$error) - { - $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); - } - else { - $db->rollback(); - $error++; - $errorcode = 'KO'; - $errorlabel = $newobject->error; - } - } + if (!$error) + { + $db->commit(); + $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); + } + else { + $db->rollback(); + $error++; + $errorcode = 'KO'; + $errorlabel = $newobject->error; + } + } - if ($error) - { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); - } + if ($error) + { + $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + } - return $objectresp; + return $objectresp; } @@ -728,15 +728,15 @@ function updateProductOrService($authentication, $product) } } - $db->begin(); + $db->begin(); - $result = $newobject->update($newobject->id, $fuser); - if ($result <= 0) - { - $error++; - } - else { - // Update stock if stock count is provided and differs from database after creation or update + $result = $newobject->update($newobject->id, $fuser); + if ($result <= 0) + { + $error++; + } + else { + // Update stock if stock count is provided and differs from database after creation or update if (isset($product['stock_real']) && $product['stock_real'] != '' && !empty($conf->global->stock->enabled)) { include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; @@ -771,47 +771,47 @@ function updateProductOrService($authentication, $product) } } } - } + } - if (!$error) - { - if ($newobject->price_base_type == 'HT') - { - $result = $newobject->updatePrice($newobject->price, $newobject->price_base_type, $fuser); - if ($result <= 0) - { - $error++; - } - } - elseif ($newobject->price_base_type == 'TTC') - { - $result = $newobject->updatePrice($newobject->price_ttc, $newobject->price_base_type); - if ($result <= 0) - { - $error++; - } - } - } + if (!$error) + { + if ($newobject->price_base_type == 'HT') + { + $result = $newobject->updatePrice($newobject->price, $newobject->price_base_type, $fuser); + if ($result <= 0) + { + $error++; + } + } + elseif ($newobject->price_base_type == 'TTC') + { + $result = $newobject->updatePrice($newobject->price_ttc, $newobject->price_base_type); + if ($result <= 0) + { + $error++; + } + } + } - if (!$error) - { - $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); - } - else { - $db->rollback(); - $error++; - $errorcode = 'KO'; - $errorlabel = $newobject->error; - } - } + if (!$error) + { + $db->commit(); + $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); + } + else { + $db->rollback(); + $error++; + $errorcode = 'KO'; + $errorlabel = $newobject->error; + } + } - if ($error) - { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); - } + if ($error) + { + $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + } - return $objectresp; + return $objectresp; } @@ -824,87 +824,87 @@ function updateProductOrService($authentication, $product) */ function deleteProductOrService($authentication, $listofidstring) { - global $db, $conf, $langs; + global $db, $conf, $langs; - dol_syslog("Function: deleteProductOrService login=".$authentication['login']); + dol_syslog("Function: deleteProductOrService login=".$authentication['login']); - if ($authentication['entity']) $conf->entity = $authentication['entity']; + if ($authentication['entity']) $conf->entity = $authentication['entity']; - // Init and check authentication - $objectresp = array(); - $errorcode = ''; $errorlabel = ''; - $error = 0; - $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); + // Init and check authentication + $objectresp = array(); + $errorcode = ''; $errorlabel = ''; + $error = 0; + $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); // User must be defined to user authenticated - global $user; - $user = $fuser; + global $user; + $user = $fuser; - $listofid = explode(',', trim($listofidstring)); - $listofiddeleted = array(); + $listofid = explode(',', trim($listofidstring)); + $listofiddeleted = array(); - // Check parameters - if (count($listofid) == 0 || empty($listofid[0])) - { - $error++; $errorcode = 'KO'; $errorlabel = "List of Id of products or services to delete are required."; - } + // Check parameters + if (count($listofid) == 0 || empty($listofid[0])) + { + $error++; $errorcode = 'KO'; $errorlabel = "List of Id of products or services to delete are required."; + } - if (!$error) - { - $firsterror = ''; + if (!$error) + { + $firsterror = ''; $db->begin(); - foreach ($listofid as $key => $id) + foreach ($listofid as $key => $id) { - $newobject = new Product($db); - $result = $newobject->fetch($id); + $newobject = new Product($db); + $result = $newobject->fetch($id); - if ($result == 0) - { - $error++; - $firsterror = 'Product or service with id '.$id.' not found'; - break; - } - else { - $result = $newobject->delete($user); - if ($result <= 0) - { - $error++; - $firsterror = $newobject->error; - break; - } + if ($result == 0) + { + $error++; + $firsterror = 'Product or service with id '.$id.' not found'; + break; + } + else { + $result = $newobject->delete($user); + if ($result <= 0) + { + $error++; + $firsterror = $newobject->error; + break; + } - $listofiddeleted[] = $id; + $listofiddeleted[] = $id; } } - if (!$error) - { - $db->commit(); - //$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'listofid'=>$listofiddeleted); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'nbdeleted'=>count($listofiddeleted)); - } - else { - $db->rollback(); - $error++; - $errorcode = 'KO'; - $errorlabel = $firsterror; + if (!$error) + { + $db->commit(); + //$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'listofid'=>$listofiddeleted); + $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'nbdeleted'=>count($listofiddeleted)); } - } + else { + $db->rollback(); + $error++; + $errorcode = 'KO'; + $errorlabel = $firsterror; + } + } - if ($error) - { - //$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), 'listofid'=>$listofiddeleted); - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), 'nbdeleted'=>0); - } - elseif (count($listofiddeleted) == 0) - { + if ($error) + { + //$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), 'listofid'=>$listofiddeleted); + $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), 'nbdeleted'=>0); + } + elseif (count($listofiddeleted) == 0) + { //$objectresp=array('result'=>array('result_code'=>'NOT_FOUND', 'result_label'=>'No product or service with id '.join(',',$listofid).' found'), 'listofid'=>$listofiddeleted); $objectresp = array('result'=>array('result_code'=>'NOT_FOUND', 'result_label'=>'No product or service with id '.join(',', $listofid).' found'), 'nbdeleted'=>0); - } + } - return $objectresp; + return $objectresp; } @@ -917,65 +917,65 @@ function deleteProductOrService($authentication, $listofidstring) */ function getListOfProductsOrServices($authentication, $filterproduct) { - global $db, $conf, $langs; + global $db, $conf, $langs; - dol_syslog("Function: getListOfProductsOrServices login=".$authentication['login']); + dol_syslog("Function: getListOfProductsOrServices login=".$authentication['login']); - if ($authentication['entity']) $conf->entity = $authentication['entity']; + if ($authentication['entity']) $conf->entity = $authentication['entity']; - // Init and check authentication - $objectresp = array(); - $arrayproducts = array(); - $errorcode = ''; $errorlabel = ''; - $error = 0; - $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); - // Check parameters + // Init and check authentication + $objectresp = array(); + $arrayproducts = array(); + $errorcode = ''; $errorlabel = ''; + $error = 0; + $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); + // Check parameters - if (!$error) - { - $sql = "SELECT rowid, ref, ref_ext"; - $sql .= " FROM ".MAIN_DB_PREFIX."product"; - $sql .= " WHERE entity=".$conf->entity; - foreach ($filterproduct as $key => $val) - { - if ($key == 'type' && $val >= 0) $sql .= " AND fk_product_type = ".$db->escape($val); - if ($key == 'status_tosell') $sql .= " AND tosell = ".$db->escape($val); - if ($key == 'status_tobuy') $sql .= " AND tobuy = ".$db->escape($val); - } + if (!$error) + { + $sql = "SELECT rowid, ref, ref_ext"; + $sql .= " FROM ".MAIN_DB_PREFIX."product"; + $sql .= " WHERE entity=".$conf->entity; + foreach ($filterproduct as $key => $val) + { + if ($key == 'type' && $val >= 0) $sql .= " AND fk_product_type = ".$db->escape($val); + if ($key == 'status_tosell') $sql .= " AND tosell = ".$db->escape($val); + if ($key == 'status_tobuy') $sql .= " AND tobuy = ".$db->escape($val); + } $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); + if ($resql) + { + $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $arrayproducts[] = array('id'=>$obj->rowid, 'ref'=>$obj->ref, 'ref_ext'=>$obj->ref_ext); - $i++; - } - } - else { - $error++; - $errorcode = $db->lasterrno(); - $errorlabel = $db->lasterror(); - } - } + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $arrayproducts[] = array('id'=>$obj->rowid, 'ref'=>$obj->ref, 'ref_ext'=>$obj->ref_ext); + $i++; + } + } + else { + $error++; + $errorcode = $db->lasterrno(); + $errorlabel = $db->lasterror(); + } + } - if ($error) - { - $objectresp = array( + if ($error) + { + $objectresp = array( 'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), - 'products'=>$arrayproducts - ); - } else { - $objectresp = array( + 'products'=>$arrayproducts + ); + } else { + $objectresp = array( 'result'=>array('result_code' => 'OK', 'result_label' => ''), - 'products'=>$arrayproducts - ); - } + 'products'=>$arrayproducts + ); + } - return $objectresp; + return $objectresp; } @@ -1050,34 +1050,34 @@ function getProductsForCategory($authentication, $id, $lang = '') $dir = $dir.'/'.$pdir; $products[] = array( - 'id' => $tmpproduct->id, + 'id' => $tmpproduct->id, 'ref' => $tmpproduct->ref, 'ref_ext' => $tmpproduct->ref_ext, - 'label' => !empty($tmpproduct->multilangs[$langs->defaultlang]["label"]) ? $tmpproduct->multilangs[$langs->defaultlang]["label"] : $tmpproduct->label, - 'description' => !empty($tmpproduct->multilangs[$langs->defaultlang]["description"]) ? $tmpproduct->multilangs[$langs->defaultlang]["description"] : $tmpproduct->description, - 'date_creation' => dol_print_date($tmpproduct->date_creation, 'dayhourrfc'), - 'date_modification' => dol_print_date($tmpproduct->date_modification, 'dayhourrfc'), - 'note' => !empty($tmpproduct->multilangs[$langs->defaultlang]["note"]) ? $tmpproduct->multilangs[$langs->defaultlang]["note"] : $tmpproduct->note, - 'status_tosell' => $tmpproduct->status, - 'status_tobuy' => $tmpproduct->status_buy, - 'type' => $tmpproduct->type, - 'barcode' => $tmpproduct->barcode, - 'barcode_type' => $tmpproduct->barcode_type, - 'country_id' => $tmpproduct->country_id > 0 ? $tmpproduct->country_id : '', - 'country_code' => $tmpproduct->country_code, - 'custom_code' => $tmpproduct->customcode, + 'label' => !empty($tmpproduct->multilangs[$langs->defaultlang]["label"]) ? $tmpproduct->multilangs[$langs->defaultlang]["label"] : $tmpproduct->label, + 'description' => !empty($tmpproduct->multilangs[$langs->defaultlang]["description"]) ? $tmpproduct->multilangs[$langs->defaultlang]["description"] : $tmpproduct->description, + 'date_creation' => dol_print_date($tmpproduct->date_creation, 'dayhourrfc'), + 'date_modification' => dol_print_date($tmpproduct->date_modification, 'dayhourrfc'), + 'note' => !empty($tmpproduct->multilangs[$langs->defaultlang]["note"]) ? $tmpproduct->multilangs[$langs->defaultlang]["note"] : $tmpproduct->note, + 'status_tosell' => $tmpproduct->status, + 'status_tobuy' => $tmpproduct->status_buy, + 'type' => $tmpproduct->type, + 'barcode' => $tmpproduct->barcode, + 'barcode_type' => $tmpproduct->barcode_type, + 'country_id' => $tmpproduct->country_id > 0 ? $tmpproduct->country_id : '', + 'country_code' => $tmpproduct->country_code, + 'custom_code' => $tmpproduct->customcode, - 'price_net' => $tmpproduct->price, - 'price' => $tmpproduct->price_ttc, - 'vat_rate' => $tmpproduct->tva_tx, + 'price_net' => $tmpproduct->price, + 'price' => $tmpproduct->price_ttc, + 'vat_rate' => $tmpproduct->tva_tx, 'price_base_type' => $tmpproduct->price_base_type, - 'stock_real' => $tmpproduct->stock_reel, - 'stock_alert' => $tmpproduct->seuil_stock_alerte, - 'pmp' => $tmpproduct->pmp, - 'import_key' => $tmpproduct->import_key, - 'dir' => $pdir, + 'stock_real' => $tmpproduct->stock_reel, + 'stock_alert' => $tmpproduct->seuil_stock_alerte, + 'pmp' => $tmpproduct->pmp, + 'import_key' => $tmpproduct->import_key, + 'dir' => $pdir, 'images' => $tmpproduct->liste_photos($dir, $nbmax) ); diff --git a/htdocs/zapier/class/api_zapier.class.php b/htdocs/zapier/class/api_zapier.class.php index 76c610fa2cd..5ad97434d07 100644 --- a/htdocs/zapier/class/api_zapier.class.php +++ b/htdocs/zapier/class/api_zapier.class.php @@ -34,241 +34,241 @@ require_once DOL_DOCUMENT_ROOT.'/zapier/class/hook.class.php'; */ class ZapierApi extends DolibarrApi { - /** - * @var array $FIELDS Mandatory fields, checked when create and update object - */ - static $FIELDS = array( - 'url', - ); + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'url', + ); - /** - * @var Hook $hook {@type Hook} - */ - public $hook; + /** + * @var Hook $hook {@type Hook} + */ + public $hook; - /** - * Constructor - * - * @url GET / - * - */ - public function __construct() - { - global $db, $conf; - $this->db = $db; - $this->hook = new Hook($this->db); - } + /** + * Constructor + * + * @url GET / + * + */ + public function __construct() + { + global $db, $conf; + $this->db = $db; + $this->hook = new Hook($this->db); + } - /** - * Get properties of a hook object - * - * Return an array with hook informations - * - * @param int $id ID of hook - * @return array|mixed data without useless information - * - * @url GET /hooks/{id} - * @throws RestException - */ - public function get($id) - { - if (!DolibarrApiAccess::$user->rights->zapier->read) { - throw new RestException(401); - } + /** + * Get properties of a hook object + * + * Return an array with hook informations + * + * @param int $id ID of hook + * @return array|mixed data without useless information + * + * @url GET /hooks/{id} + * @throws RestException + */ + public function get($id) + { + if (!DolibarrApiAccess::$user->rights->zapier->read) { + throw new RestException(401); + } - $result = $this->hook->fetch($id); - if (!$result) { - throw new RestException(404, 'Hook not found'); - } + $result = $this->hook->fetch($id); + if (!$result) { + throw new RestException(404, 'Hook not found'); + } - if (!DolibarrApi::_checkAccessToResource('hook', $this->hook->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if (!DolibarrApi::_checkAccessToResource('hook', $this->hook->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - return $this->_cleanObjectDatas($this->hook); - } + return $this->_cleanObjectDatas($this->hook); + } - /** - * Get list of possibles choices for module - * - * Return an array with hook informations - * @param integer $id ID - * - * @return array|mixed data - * - * @url GET /getmoduleschoices/ - * @throws RestException - */ - public function getModulesChoices($id) - { - if (!DolibarrApiAccess::$user->rights->zapier->read) { - throw new RestException(401); - } - $arraychoices = array( - 'invoices' => 'Invoices', - 'orders' => 'Orders', - 'thirdparties' => 'Thirparties', - 'contacts' => 'Contacts', - ); - // $result = $this->hook->fetch($id); - // if (! $result ) { - // throw new RestException(404, 'Hook not found'); - // } + /** + * Get list of possibles choices for module + * + * Return an array with hook informations + * @param integer $id ID + * + * @return array|mixed data + * + * @url GET /getmoduleschoices/ + * @throws RestException + */ + public function getModulesChoices($id) + { + if (!DolibarrApiAccess::$user->rights->zapier->read) { + throw new RestException(401); + } + $arraychoices = array( + 'invoices' => 'Invoices', + 'orders' => 'Orders', + 'thirdparties' => 'Thirparties', + 'contacts' => 'Contacts', + ); + // $result = $this->hook->fetch($id); + // if (! $result ) { + // throw new RestException(404, 'Hook not found'); + // } - // if (! DolibarrApi::_checkAccessToResource('hook', $this->hook->id)) { - // throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - // } + // if (! DolibarrApi::_checkAccessToResource('hook', $this->hook->id)) { + // throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + // } - return $arraychoices; - } + return $arraychoices; + } - /** - * List hooks - * - * Get a list of hooks - * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @return array Array of order objects - * - * @throws RestException - * - * @url GET /hooks/ - */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') - { - global $db, $conf; + /** + * List hooks + * + * Get a list of hooks + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of order objects + * + * @throws RestException + * + * @url GET /hooks/ + */ + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + { + global $db, $conf; - $obj_ret = array(); + $obj_ret = array(); - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; + $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; - // Set to 1 if there is a field socid in table of object - $restrictonsocid = 0; + // Set to 1 if there is a field socid in table of object + $restrictonsocid = 0; - // If the internal user must only see his customers, force searching by him - $search_sale = 0; - if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { - $search_sale = DolibarrApiAccess::$user->id; - } + // If the internal user must only see his customers, force searching by him + $search_sale = 0; + if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { + $search_sale = DolibarrApiAccess::$user->id; + } - $sql = "SELECT t.rowid"; - if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { - // We need these fields in order to filter by sale (including the case where the user can only see his prospects) - $sql .= ", sc.fk_soc, sc.fk_user"; - } - $sql .= " FROM ".MAIN_DB_PREFIX."hook_mytable as t"; + $sql = "SELECT t.rowid"; + if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { + // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + $sql .= ", sc.fk_soc, sc.fk_user"; + } + $sql .= " FROM ".MAIN_DB_PREFIX."hook_mytable as t"; - if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale - $sql .= " WHERE 1 = 1"; + if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + $sql .= " WHERE 1 = 1"; - // Example of use $mode - //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; - //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; + // Example of use $mode + //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; + //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; - $tmpobject = new Hook($this->db); - if ($tmpobject->ismultientitymanaged) { - $sql .= ' AND t.entity IN ('.getEntity('hook').')'; - } - if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { - $sql .= " AND t.fk_soc = sc.fk_soc"; - } - if ($restrictonsocid && $socid) { - $sql .= " AND t.fk_soc = ".$socid; - } - if ($restrictonsocid && $search_sale > 0) { - // Join for the needed table to filter by sale - $sql .= " AND t.rowid = sc.fk_soc"; - } - // Insert sale filter - if ($restrictonsocid && $search_sale > 0) { - $sql .= " AND sc.fk_user = ".$search_sale; - } - if ($sqlfilters) { - if (!DolibarrApi::_checkFilters($sqlfilters)) { - throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); - } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; - $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; - } + $tmpobject = new Hook($this->db); + if ($tmpobject->ismultientitymanaged) { + $sql .= ' AND t.entity IN ('.getEntity('hook').')'; + } + if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { + $sql .= " AND t.fk_soc = sc.fk_soc"; + } + if ($restrictonsocid && $socid) { + $sql .= " AND t.fk_soc = ".$socid; + } + if ($restrictonsocid && $search_sale > 0) { + // Join for the needed table to filter by sale + $sql .= " AND t.rowid = sc.fk_soc"; + } + // Insert sale filter + if ($restrictonsocid && $search_sale > 0) { + $sql .= " AND sc.fk_user = ".$search_sale; + } + if ($sqlfilters) { + if (!DolibarrApi::_checkFilters($sqlfilters)) { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } - $sql .= $this->db->order($sortfield, $sortorder); - if ($limit) { - if ($page < 0) { - $page = 0; - } - $offset = $limit * $page; + $sql .= $this->db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; - $sql .= $this->db->plimit($limit + 1, $offset); - } + $sql .= $this->db->plimit($limit + 1, $offset); + } - $result = $this->db->query($sql); - $i = 0; - if ($result) { - $num = $this->db->num_rows($result); - while ($i < $num) { - $obj = $this->db->fetch_object($result); - $hook_static = new Hook($this->db); - if ($hook_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($hook_static); - } - $i++; - } - } else { - throw new RestException(503, 'Error when retrieve hook list'); - } - if (!count($obj_ret)) { - throw new RestException(404, 'No hook found'); - } - return $obj_ret; - } + $result = $this->db->query($sql); + $i = 0; + if ($result) { + $num = $this->db->num_rows($result); + while ($i < $num) { + $obj = $this->db->fetch_object($result); + $hook_static = new Hook($this->db); + if ($hook_static->fetch($obj->rowid)) { + $obj_ret[] = $this->_cleanObjectDatas($hook_static); + } + $i++; + } + } else { + throw new RestException(503, 'Error when retrieve hook list'); + } + if (!count($obj_ret)) { + throw new RestException(404, 'No hook found'); + } + return $obj_ret; + } - /** - * Create hook object - * - * @param array $request_data Request datas - * @return int ID of hook - * - * @url POST /hook/ - */ - public function post($request_data = null) - { - if (!DolibarrApiAccess::$user->rights->zapier->write) { - throw new RestException(401); - } - // Check mandatory fields - $fields = array( - 'url', - ); - $result = $this->validate($request_data, $fields); + /** + * Create hook object + * + * @param array $request_data Request datas + * @return int ID of hook + * + * @url POST /hook/ + */ + public function post($request_data = null) + { + if (!DolibarrApiAccess::$user->rights->zapier->write) { + throw new RestException(401); + } + // Check mandatory fields + $fields = array( + 'url', + ); + $result = $this->validate($request_data, $fields); - foreach ($request_data as $field => $value) { - $this->hook->$field = $value; - } - $this->hook->fk_user = DolibarrApiAccess::$user->id; - // on crée le hook dans la base - if (!$this->hook->create(DolibarrApiAccess::$user)) { - throw new RestException(500, "Error creating Hook", array_merge(array($this->hook->error), $this->hook->errors)); - } - return array( - 'id' => $this->hook->id, - ); - } + foreach ($request_data as $field => $value) { + $this->hook->$field = $value; + } + $this->hook->fk_user = DolibarrApiAccess::$user->id; + // on crée le hook dans la base + if (!$this->hook->create(DolibarrApiAccess::$user)) { + throw new RestException(500, "Error creating Hook", array_merge(array($this->hook->error), $this->hook->errors)); + } + return array( + 'id' => $this->hook->id, + ); + } - // /** - // * Update hook - // * - // * @param int $id Id of hook to update - // * @param array $request_data Datas - // * @return int - // * - // * @url PUT /hooks/{id} - // */ - /*public function put($id, $request_data = null) + // /** + // * Update hook + // * + // * @param int $id Id of hook to update + // * @param array $request_data Datas + // * @return int + // * + // * @url PUT /hooks/{id} + // */ + /*public function put($id, $request_data = null) { if (! DolibarrApiAccess::$user->rights->zapier->write) { throw new RestException(401); @@ -297,80 +297,80 @@ class ZapierApi extends DolibarrApi } }*/ - /** - * Delete hook - * - * @param int $id Hook ID - * @return array - * - * @url DELETE /hook/{id} - */ - public function delete($id) - { - if (!DolibarrApiAccess::$user->rights->zapier->delete) { - throw new RestException(401); - } - $result = $this->hook->fetch($id); - if (!$result) { - throw new RestException(404, 'Hook not found'); - } + /** + * Delete hook + * + * @param int $id Hook ID + * @return array + * + * @url DELETE /hook/{id} + */ + public function delete($id) + { + if (!DolibarrApiAccess::$user->rights->zapier->delete) { + throw new RestException(401); + } + $result = $this->hook->fetch($id); + if (!$result) { + throw new RestException(404, 'Hook not found'); + } - if (!DolibarrApi::_checkAccessToResource('hook', $this->hook->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if (!DolibarrApi::_checkAccessToResource('hook', $this->hook->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - if (!$this->hook->delete(DolibarrApiAccess::$user)) { - throw new RestException(500, 'Error when deleting Hook : '.$this->hook->error); - } + if (!$this->hook->delete(DolibarrApiAccess::$user)) { + throw new RestException(500, 'Error when deleting Hook : '.$this->hook->error); + } - return array( - 'success' => array( - 'code' => 200, - 'message' => 'Hook deleted' - ) - ); - } + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Hook deleted' + ) + ); + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore - /** - * Clean sensible object datas - * - * @param object $object Object to clean - * @return array Array of cleaned object properties - */ - public function _cleanObjectDatas($object) - { - // phpcs:disable - $object = parent::_cleanObjectDatas($object); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + */ + public function _cleanObjectDatas($object) + { + // phpcs:disable + $object = parent::_cleanObjectDatas($object); - /*unset($object->note); + /*unset($object->note); unset($object->address); unset($object->barcode_type); unset($object->barcode_type_code); unset($object->barcode_type_label); unset($object->barcode_type_coder);*/ - return $object; - } + return $object; + } - /** - * Validate fields before create or update object - * - * @param array $data Array of data to validate - * @param array $fields Array of fields needed - * @return array - * - * @throws RestException - */ - private function validate($data, $fields) - { - $hook = array(); - foreach ($fields as $field) { - if (!isset($data[$field])) { - throw new RestException(400, $field." field missing"); - } - $hook[$field] = $data[$field]; - } - return $hook; - } + /** + * Validate fields before create or update object + * + * @param array $data Array of data to validate + * @param array $fields Array of fields needed + * @return array + * + * @throws RestException + */ + private function validate($data, $fields) + { + $hook = array(); + foreach ($fields as $field) { + if (!isset($data[$field])) { + throw new RestException(400, $field." field missing"); + } + $hook[$field] = $data[$field]; + } + return $hook; + } } diff --git a/htdocs/zapier/hook_list.php b/htdocs/zapier/hook_list.php index 9e987d88322..8450ec3e0d8 100644 --- a/htdocs/zapier/hook_list.php +++ b/htdocs/zapier/hook_list.php @@ -53,8 +53,8 @@ $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : (int) GETPOST("page", 'int'); if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { - // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action - $page = 0; + // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action + $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; @@ -76,19 +76,19 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { - // Set here default search field. By default 1st field in definition. - $sortfield = "t.".key($object->fields); + // Set here default search field. By default 1st field in definition. + $sortfield = "t.".key($object->fields); } if (!$sortorder) { - $sortorder = "ASC"; + $sortorder = "ASC"; } // Security check $socid = 0; if ($user->socid > 0) { - // Protection if external user - //$socid = $user->socid; - accessforbidden(); + // Protection if external user + //$socid = $user->socid; + accessforbidden(); } //$result = restrictedArea($user, 'zapier', $id, ''); @@ -96,27 +96,27 @@ if ($user->socid > 0) { $search_all = GETPOST("search_all", 'alpha'); $search = array(); foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); + if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); } // List of fields to search into when doing a "search in all" $fieldstosearchall = array(); foreach ($object->fields as $key => $val) { - if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; + if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; } // Definition of fields for list $arrayfields = array(); foreach ($object->fields as $key => $val) { - // If $val['visible']==0, then we never show the field - if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); + // If $val['visible']==0, then we never show the field + if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); } // Extra fields if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { + if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) + $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + } } $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); @@ -128,11 +128,11 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; - $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { - $massaction = ''; + $massaction = ''; } $parameters = array(); @@ -140,30 +140,30 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { - // Selection of new fields - include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - // Purge search criteria - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { - // All tests are required to be compatible with all browsers - foreach ($object->fields as $key => $val) { - $search[$key] = ''; - } - $toselect = ''; - $search_array_options = array(); - } - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') - || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { - $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation - } + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // All tests are required to be compatible with all browsers + foreach ($object->fields as $key => $val) { + $search[$key] = ''; + } + $toselect = ''; + $search_array_options = array(); + } + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { + $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } - // Mass actions - $objectclass = 'Hook'; - $objectlabel = 'Hook'; - $permissiontoread = $user->rights->zapier->read; - $permissiontodelete = $user->rights->zapier->delete; - $uploaddir = $conf->zapier->dir_output; - include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + // Mass actions + $objectclass = 'Hook'; + $objectlabel = 'Hook'; + $permissiontoread = $user->rights->zapier->read; + $permissiontodelete = $user->rights->zapier->delete; + $uploaddir = $conf->zapier->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -185,13 +185,13 @@ $title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("Hooks")); // -------------------------------------------------------------------- $sql = 'SELECT '; foreach ($object->fields as $key => $val) { - $sql .= 't.'.$key.', '; + $sql .= 't.'.$key.', '; } // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); - } + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); + } } // Add fields from hooks $parameters = array(); @@ -201,21 +201,21 @@ $sql = preg_replace('/, $/', '', $sql); $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; if ($object->ismultientitymanaged == 1) { - $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; + $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; } else { - $sql .= " WHERE 1 = 1"; + $sql .= " WHERE 1 = 1"; } foreach ($search as $key => $val) { - if ($key == 'status' && $search[$key] == -1) { - continue; - } - $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ($search[$key] != '') { - $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); - } + if ($key == 'status' && $search[$key] == -1) { + continue; + } + $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); + if ($search[$key] != '') { + $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + } } if ($search_all) { - $sql .= natural_search(array_keys($fieldstosearchall), $search_all); + $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -245,35 +245,35 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $resql = $db->query($sql); - $nbtotalofrecords = $db->num_rows($resql); - if (($page * $limit) > $nbtotalofrecords) { - // if total of record found is smaller than page * limit, goto and load page 0 - $page = 0; - $offset = 0; - } + $resql = $db->query($sql); + $nbtotalofrecords = $db->num_rows($resql); + if (($page * $limit) > $nbtotalofrecords) { + // if total of record found is smaller than page * limit, goto and load page 0 + $page = 0; + $offset = 0; + } } // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { - $num = $nbtotalofrecords; + $num = $nbtotalofrecords; } else { - $sql .= $db->plimit($limit + 1, $offset); + $sql .= $db->plimit($limit + 1, $offset); - $resql = $db->query($sql); - if (!$resql) { - dol_print_error($db); - exit; - } + $resql = $db->query($sql); + if (!$resql) { + dol_print_error($db); + exit; + } - $num = $db->num_rows($resql); + $num = $db->num_rows($resql); } // Direct jump if only one record found if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { - $obj = $db->fetch_object($resql); - $id = $obj->rowid; - header("Location: ".dol_buildpath('/zapierfordolibarr/hook_card.php', 1).'?id='.$id); - exit; + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".dol_buildpath('/zapierfordolibarr/hook_card.php', 1).'?id='.$id); + exit; } @@ -303,13 +303,13 @@ $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { - foreach ($search[$key] as $skey) { - $param .= '&search_'.$key.'[]='.urlencode($skey); - } - } else { - $param .= '&search_'.$key.'='.urlencode($search[$key]); - } + if (is_array($search[$key]) && count($search[$key])) { + foreach ($search[$key] as $skey) { + $param .= '&search_'.$key.'[]='.urlencode($skey); + } + } else { + $param .= '&search_'.$key.'='.urlencode($search[$key]); + } } if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); // Add $param from extra fields @@ -317,8 +317,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // List of mass actions available $arrayofmassactions = array( - //'presend'=>$langs->trans("SendByMail"), - //'builddoc'=>$langs->trans("PDFMerge"), + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->zapier->delete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); @@ -337,9 +337,9 @@ print ''; $newcardbutton = ''; //if ($user->rights->zapier->creer) //{ - $newcardbutton = ''.$langs->trans('New').''; - $newcardbutton .= ''; - $newcardbutton .= ''; + $newcardbutton = ''.$langs->trans('New').''; + $newcardbutton .= ''; + $newcardbutton .= ''; //} //else //{ @@ -358,8 +358,8 @@ $trackid = 'xxxx'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { - foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); - print '
    '.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
    '; + foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); + print '
    '.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
    '; } $moreforfilter = ''; @@ -373,9 +373,9 @@ if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint; if (!empty($moreforfilter)) { - print '
    '; - print $moreforfilter; - print '
    '; + print '
    '; + print $moreforfilter; + print '
    '; } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; @@ -390,22 +390,22 @@ print ''; foreach ($object->fields as $key => $val) { - $cssforfield = ''; - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'right'; - } - if ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - } + $cssforfield = ''; + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'right'; + } + if ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } + if (!empty($arrayfields['t.'.$key]['checked'])) { + print ''; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -426,25 +426,25 @@ print ''."\n"; // -------------------------------------------------------------------- print ''; foreach ($object->fields as $key => $val) { - $cssforfield = ''; - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield .= ($cssforfield ? ' ' : '').'right'; - if ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } - if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; - } + $cssforfield = ''; + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; + if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield .= ($cssforfield ? ' ' : '').'right'; + if ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } + if (!empty($arrayfields['t.'.$key]['checked'])) { + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array( - 'arrayfields' => $arrayfields, - 'param' => $param, - 'sortfield' => $sortfield, - 'sortorder' => $sortorder, + 'arrayfields' => $arrayfields, + 'param' => $param, + 'sortfield' => $sortfield, + 'sortorder' => $sortorder, ); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -456,12 +456,12 @@ print ''."\n"; // Detect if we need a fetch on each output line $needToFetchEachLine = 0; if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { - foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { - // There is at least one compute field that use $object - $needToFetchEachLine++; - } - } + foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { + if (preg_match('/\$object/', $val)) { + // There is at least one compute field that use $object + $needToFetchEachLine++; + } + } } @@ -470,71 +470,71 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co $i = 0; $totalarray = array(); while ($i < min($num, $limit)) { - $obj = $db->fetch_object($resql); - if (empty($obj)) { - break; // Should not happen - } + $obj = $db->fetch_object($resql); + if (empty($obj)) { + break; // Should not happen + } - // Store properties in $object - $object->id = $obj->rowid; - foreach ($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; - } + // Store properties in $object + $object->id = $obj->rowid; + foreach ($object->fields as $key => $val) { + if (isset($obj->$key)) $object->$key = $obj->$key; + } - // Show here line of result - print ''; - foreach ($object->fields as $key => $val) { - $cssforfield = ''; - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } + // Show here line of result + print ''; + foreach ($object->fields as $key => $val) { + $cssforfield = ''; + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } - if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield .= ($cssforfield ? ' ' : '').'right'; + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield .= ($cssforfield ? ' ' : '').'right'; - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') print $object->getLibStatut(5); - elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); - else print $object->showOutputField($val, $key, $obj->$key, ''); - print ''; - if (!$i) $totalarray['nbfield']++; - if (!empty($val['isameasure'])) { - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; - $totalarray['val']['t.'.$key] += $obj->$key; - } - } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - print ''; - if (!$i) $totalarray['nbfield']++; + if (!empty($arrayfields['t.'.$key]['checked'])) { + print ''; + if ($key == 'status') print $object->getLibStatut(5); + elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); + else print $object->showOutputField($val, $key, $obj->$key, ''); + print ''; + if (!$i) $totalarray['nbfield']++; + if (!empty($val['isameasure'])) { + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['val']['t.'.$key] += $obj->$key; + } + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if (!$i) $totalarray['nbfield']++; - print ''; + print ''; - $i++; + $i++; } // Show total line @@ -543,21 +543,21 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; // If no record found if ($num == 0) { - $colspan = 1; - foreach ($arrayfields as $key => $val) { - if (!empty($val['checked'])) { - $colspan++; - } - } - print ''; + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print ''; } $db->free($resql); $parameters = array( - 'arrayfields' => $arrayfields, - 'sql' => $sql, + 'arrayfields' => $arrayfields, + 'sql' => $sql, ); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -568,23 +568,23 @@ print ''."\n"; print ''."\n"; if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { - $hidegeneratedfilelistifempty = 1; - if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { - $hidegeneratedfilelistifempty = 0; - } + $hidegeneratedfilelistifempty = 1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { + $hidegeneratedfilelistifempty = 0; + } - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; - $formfile = new FormFile($db); + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); - // Show list of available documents - $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; - $urlsource .= str_replace('&', '&', $param); + // Show list of available documents + $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource .= str_replace('&', '&', $param); - $filedir = $diroutputmassaction; - $genallowed = $user->rights->zapier->read; - $delallowed = $user->rights->zapier->create; + $filedir = $diroutputmassaction; + $genallowed = $user->rights->zapier->read; + $delallowed = $user->rights->zapier->create; - print $formfile->showdocuments('massfilesarea_zapier', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); + print $formfile->showdocuments('massfilesarea_zapier', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } // End of page From 33e56a2d7c090276a553efad81e1f536223b2882 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 19:56:36 +0100 Subject: [PATCH 78/79] Fix decimal qty for #14666 --- htdocs/comm/propal/card.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 7190168b513..dd84fbd651a 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -806,7 +806,7 @@ if (empty($reshook)) $tva_tx = ''; } - $qty = GETPOST('qty'.$predef); + $qty = price2num(GETPOST('qty'.$predef), 'MS'); $remise_percent = GETPOST('remise_percent'.$predef); if (empty($remise_percent)) $remise_percent = 0; @@ -1229,7 +1229,10 @@ if (empty($reshook)) } } } - $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, $_POST["units"], $pu_ht_devise); + + $qty = price2num(GETPOST('qty'), 'MS'); + + $result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, $_POST["units"], $pu_ht_devise); if ($result >= 0) { $db->commit(); From 039bc3c412bb75deacaadfad7ab96e8de95fdb80 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2020 20:50:33 +0100 Subject: [PATCH 79/79] Fix phpunit --- test/phpunit/PaypalTest.php | 2 +- test/phpunit/RestAPIDocumentTest.php | 6 +++--- test/phpunit/RestAPIUserTest.php | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/phpunit/PaypalTest.php b/test/phpunit/PaypalTest.php index 47d8341f501..19774a11c09 100644 --- a/test/phpunit/PaypalTest.php +++ b/test/phpunit/PaypalTest.php @@ -146,7 +146,7 @@ class PaypalTest extends PHPUnit\Framework\TestCase $urltotest=getPaypalPaymentUrl(0, 'free'); print "urltotest=".$urltotest."\n"; - $result=getURLContent($urltotest, 'GET'); + $result=getURLContent($urltotest, 'GET', '', 1, array(), array('http', 'https'), 2); print __METHOD__." result=".$result."\n"; $this->assertLessThanOrEqual($result, 0); diff --git a/test/phpunit/RestAPIDocumentTest.php b/test/phpunit/RestAPIDocumentTest.php index 65b8c206c9d..06094904bd9 100644 --- a/test/phpunit/RestAPIDocumentTest.php +++ b/test/phpunit/RestAPIDocumentTest.php @@ -120,7 +120,7 @@ class RestAPIDocumentTest extends PHPUnit\Framework\TestCase $password = 'admin'; $url = $this->api_url.'/login?login='.$login.'&password='.$password; // Call the API login method to save api_key for this test class - $result = getURLContent($url, 'GET', '', 1, array()); + $result = getURLContent($url, 'GET', '', 1, array(), array('http', 'https'), 2); echo __METHOD__.' result = '.var_export($result, true)."\n"; echo __METHOD__.' curl_error_no: '.$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'], ''); @@ -171,7 +171,7 @@ class RestAPIDocumentTest extends PHPUnit\Framework\TestCase 'fileencoding'=>"" ); - $result = getURLContent($url, 'POST', $data, 1); + $result = getURLContent($url, 'POST', $data, 1,array(), array('http', 'https'), 2); echo __METHOD__.' Result for sending document: '.var_export($result, true)."\n"; echo __METHOD__.' curl_error_no: '.$result['curl_error_no']."\n"; $object = json_decode($result['content'], true); @@ -192,7 +192,7 @@ class RestAPIDocumentTest extends PHPUnit\Framework\TestCase 'fileencoding'=>"" ); - $result2 = getURLContent($url, 'POST', $data, 1); + $result2 = getURLContent($url, 'POST', $data, 1, array(), array('http', 'https'), 2); echo __METHOD__.' Result for sending document: '.var_export($result2, true)."\n"; echo __METHOD__.' curl_error_no: '.$result2['curl_error_no']."\n"; $object2 = json_decode($result2['content'], true); diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index 9d49d10af73..a937bdbd9f8 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -125,7 +125,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase $password='admin'; $url=$this->api_url.'/login?login='.$login.'&password='.$password; // Call the API login method to save api_key for this test class - $result=getURLContent($url, 'GET', '', 1, array()); + $result=getURLContent($url, 'GET', '', 1, array(), array('http', 'https'), 2); print __METHOD__." result = ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'], ''); @@ -163,7 +163,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase //$addheaders=array('Content-Type: application/json'); print __METHOD__." Request GET url=".$url."\n"; - $result=getURLContent($url, 'GET', '', 1, array()); + $result=getURLContent($url, 'GET', '', 1, array(), array('http', 'https'), 2); //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'], ''); @@ -174,7 +174,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase $url = $this->api_url.'/users/1?api_key='.$this->api_key; print __METHOD__." Request GET url=".$url."\n"; - $result=getURLContent($url, 'GET', '', 1, array()); + $result=getURLContent($url, 'GET', '', 1, array(), array('http', 'https'), 2); //print __METHOD__." Result for existing user user: ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'], ''); @@ -203,7 +203,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase $body = json_encode($bodyobj); print __METHOD__." Request POST url=".$url."\n"; - $result=getURLContent($url, 'POST', $body, 1, $addheaders); + $result=getURLContent($url, 'POST', $body, 1, $addheaders, array('http', 'https'), 2); //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'], ''); @@ -221,7 +221,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase ); $body = json_encode($bodyobj); print __METHOD__." Request POST url=".$url."\n"; - $result=getURLContent($url, 'POST', $body, 1, $addheaders); + $result=getURLContent($url, 'POST', $body, 1, $addheaders, array('http', 'https'), 2); print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'], ''); @@ -231,7 +231,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase // attempt to create duplicated user print __METHOD__." Request POST url=".$url."\n"; - $result=getURLContent($url, 'POST', $body, 1, $addheaders); + $result=getURLContent($url, 'POST', $body, 1, $addheaders, array('http', 'https'), 2); //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'], '');
    '; - if ($massactionbutton || $massaction) { - // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) $selected = 1; - print ''; - } - print ''; + if ($massactionbutton || $massaction) { + // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) $selected = 1; + print ''; + } + print '
    '.$langs->trans("NoRecordFound").'
    '.$langs->trans("NoRecordFound").'