From 3d179fb7d37b1e115f7c9f48bfa9cfae8c40c6a1 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Tue, 24 Apr 2018 09:17:03 +0200 Subject: [PATCH 01/77] FIX : Fetch function will fetch comments --- htdocs/projet/class/task.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 83de25b21ad..ab34ec1acb3 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -194,7 +194,7 @@ class Task extends CommonObject */ function fetch($id, $ref='', $loadparentdata=0) { - global $langs; + global $langs, $conf; $sql = "SELECT"; $sql.= " t.rowid,"; @@ -267,7 +267,11 @@ class Task extends CommonObject } // Retreive all extrafield data - $this->fetch_optionals(); + $this->fetch_optionals(); + + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK)) { + $this->fetchComments(); + } } $this->db->free($resql); From d875553648c1e41d9a2f2805f3994e77aee12b2e Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Tue, 22 May 2018 16:03:03 +0200 Subject: [PATCH 02/77] FIX : Remove fetchComments from project and task fetch function --- htdocs/projet/class/project.class.php | 8 +------- htdocs/projet/class/task.class.php | 4 ---- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 8cbb45eae37..ef5844e4ab8 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -447,18 +447,12 @@ class Project extends CommonObject // Retreive all extrafield for thirdparty $this->fetch_optionals(); - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) - { - $this->fetchComments(); - } - return 1; } $this->db->free($resql); - if ($num_rows) return 1; - else return 0; + return 0; } else { diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 29cadb08ad6..c953ec58089 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -268,10 +268,6 @@ class Task extends CommonObject // Retreive all extrafield data $this->fetch_optionals(); - - if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK)) { - $this->fetchComments(); - } } $this->db->free($resql); From a455f60c42f41710536be2f23ff37c8e308798f3 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Tue, 22 May 2018 16:07:32 +0200 Subject: [PATCH 03/77] FIX : Add calls to fetchComments function --- htdocs/projet/card.php | 1 + htdocs/projet/comment.php | 1 + htdocs/projet/contact.php | 2 ++ htdocs/projet/document.php | 1 + htdocs/projet/element.php | 1 + htdocs/projet/ganttview.php | 1 + htdocs/projet/info.php | 1 + htdocs/projet/note.php | 1 + htdocs/projet/tasks.php | 1 + htdocs/projet/tasks/comment.php | 1 + htdocs/projet/tasks/contact.php | 2 ++ htdocs/projet/tasks/document.php | 2 ++ htdocs/projet/tasks/note.php | 2 ++ htdocs/projet/tasks/task.php | 2 ++ htdocs/projet/tasks/time.php | 2 ++ 15 files changed, 21 insertions(+) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index bd8709affaa..762fc1a7e06 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -64,6 +64,7 @@ if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id,$ref); // If we create project, ref may be defined into POST but record does not yet exists into database if ($ret > 0) { $object->fetch_thirdparty(); + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); $id=$object->id; } } diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index a51d4872c80..236233d983c 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -67,6 +67,7 @@ if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id,$ref); // If we create project, ref may be defined into POST but record does not yet exists into database if ($ret > 0) { $object->fetch_thirdparty(); + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); $id=$object->id; } } diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index f162aa9db40..5d9e8bcc056 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -43,6 +43,7 @@ $mine = GETPOST('mode')=='mine' ? 1 : 0; $object = new Project($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once +if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); // Security check $socid=0; @@ -140,6 +141,7 @@ $userstatic=new User($db); if ($id > 0 || ! empty($ref)) { + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); // To verify role of users //$userAccess = $object->restrictedProjectArea($user,'read'); $userWrite = $object->restrictedProjectArea($user,'write'); diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index fbf9574bd75..b6c69e12622 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -48,6 +48,7 @@ $result=restrictedArea($user,'projet',$id,'projet&project'); $object = new Project($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once +if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); if ($id > 0 || ! empty($ref)) { $upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index dd19ceeb263..e85db9b9252 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -97,6 +97,7 @@ $projectid=$id; // For backward compatibility $object = new Project($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once +if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); // Security check $socid=$object->socid; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 0c1e86c8ab5..473aa18b744 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -42,6 +42,7 @@ $mine = ($mode == 'mine' ? 1 : 0); $object = new Project($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once +if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); // Security check $socid=0; diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index 68f4b8b4cbb..8024977f2fa 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -97,6 +97,7 @@ if ($id > 0 || ! empty($ref)) { $object->fetch($id, $ref); $object->fetch_thirdparty(); + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); $object->info($object->id); } diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index 88217fbfb1c..bb5a769640f 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -38,6 +38,7 @@ $mine = $_REQUEST['mode']=='mine' ? 1 : 0; $object = new Project($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once +if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); // Security check $socid=0; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 9bbd7891ee7..49d52a522d6 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -51,6 +51,7 @@ $extrafields_project = new ExtraFields($db); $extrafields_task = new ExtraFields($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once +if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); if ($id > 0 || ! empty($ref)) { diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 3bf96d7d081..6eb441eb28c 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -105,6 +105,7 @@ if ($id > 0 || ! empty($ref)) $result=$projectstatic->fetch($object->fk_project); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments(); $object->project = clone $projectstatic; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index fad5466cb7f..747bf36391c 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -173,9 +173,11 @@ if ($id > 0 || ! empty($ref)) { if ($object->fetch($id, $ref) > 0) { + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); $id = $object->id; // So when doing a search from ref, id is also set correctly. $result=$projectstatic->fetch($object->fk_project); + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments(); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); $object->project = clone $projectstatic; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 1cb5acb73b5..92af4a35c65 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -92,7 +92,9 @@ if ($id > 0 || ! empty($ref)) { if ($object->fetch($id,$ref) > 0) { + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); $projectstatic->fetch($object->fk_project); + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments(); if (! empty($projectstatic->socid)) { $projectstatic->fetch_thirdparty(); diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index f915aaf836a..dd5c14d3c1f 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -50,7 +50,9 @@ if ($id > 0 || ! empty($ref)) { if ($object->fetch($id,$ref) > 0) { + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); $projectstatic->fetch($object->fk_project); + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments(); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); $object->project = clone $projectstatic; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 2f87d411c5f..12329c2ed6b 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -211,8 +211,10 @@ if ($id > 0 || ! empty($ref)) if ($object->fetch($id,$ref) > 0) { $res=$object->fetch_optionals($object->id,$extralabels); + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); $result=$projectstatic->fetch($object->fk_project); + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments(); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); $object->project = clone $projectstatic; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 2da534e53a0..4f8755ddb6d 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -292,7 +292,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } elseif ($object->fetch($id, $ref) >= 0) { + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); $result=$projectstatic->fetch($object->fk_project); + if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments(); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); $res=$projectstatic->fetch_optionals($object->id,$extralabels_projet); From 633bf3034f5678e67e554b9fb89142c198e84d9a Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Thu, 5 Jul 2018 11:52:58 +0200 Subject: [PATCH 04/77] new add total price on dashboard --- htdocs/core/class/workboardresponse.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/workboardresponse.class.php b/htdocs/core/class/workboardresponse.class.php index 13de74281ff..62d84e11186 100644 --- a/htdocs/core/class/workboardresponse.class.php +++ b/htdocs/core/class/workboardresponse.class.php @@ -1,6 +1,7 @@ + * Copyright (C) 2018 Charlene Benke * * 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 @@ -66,4 +67,10 @@ class WorkboardResponse */ public $nbtodolate = 0; -} \ No newline at end of file + /** + * total price of items + * @var int + */ + public $total = 0; + +} From c169ff4b973722dc992e1ca74e4a61063a919965 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Thu, 5 Jul 2018 12:01:48 +0200 Subject: [PATCH 05/77] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c6e43206c78..e7ea8877d97 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3712,7 +3712,7 @@ class Facture extends CommonInvoice $clause = " WHERE"; - $sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut"; + $sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut, f.total"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; if (!$user->rights->societe->client->voir && !$user->societe_id) { @@ -3745,6 +3745,7 @@ class Facture extends CommonInvoice $generic_facture->statut = $obj->fk_statut; $response->nbtodo++; + $response->total += $obj->total; if ($generic_facture->hasDelay()) { $response->nbtodolate++; From 9539adfffbedb4281f0a52d6a69c58e19aa3fb6c Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Thu, 5 Jul 2018 12:02:38 +0200 Subject: [PATCH 06/77] Update index.php --- htdocs/index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/index.php b/htdocs/index.php index 2843289c557..6125823b4d3 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -565,6 +565,9 @@ if (! empty($valid_dashboardlines)) $sep=($conf->dol_use_jmobile?'
':' '); $boxwork .= ''.$board->img.' '.$board->label.'
'; $boxwork .= ''.$board->nbtodo.''; + if ($board->total > 0) { + $boxwork .= ' / '.price($board->total) .''; + } $boxwork .= ''; if ($board->nbtodolate > 0) { From 5a6cfd5efe7448cb4f0cf27738c964255893a5ff Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Thu, 5 Jul 2018 12:08:59 +0200 Subject: [PATCH 07/77] Update commande.class.php --- htdocs/commande/class/commande.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 17e4387c4de..4ab9beaaf9e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3237,7 +3237,7 @@ class Commande extends CommonOrder $clause = " WHERE"; - $sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut"; + $sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) { @@ -3264,6 +3264,7 @@ class Commande extends CommonOrder while ($obj=$this->db->fetch_object($resql)) { $response->nbtodo++; + $response->total+= $obj->total_ht; $generic_commande->statut = $obj->fk_statut; $generic_commande->date_commande = $this->db->jdate($obj->date_commande); From bfe7cd0d9f3a8af843d7b59f233e8bf57a6a23b4 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Thu, 5 Jul 2018 12:11:20 +0200 Subject: [PATCH 08/77] Update propal.class.php --- htdocs/comm/propal/class/propal.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 562032de9fa..99c5d1e747e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3137,7 +3137,7 @@ class Propal extends CommonObject $clause = " WHERE"; - $sql = "SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin"; + $sql = "SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin, p.total_ht"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; if (!$user->rights->societe->client->voir && !$user->societe_id) { @@ -3181,6 +3181,8 @@ class Propal extends CommonObject while ($obj=$this->db->fetch_object($resql)) { $response->nbtodo++; + $response->total+=$obj->total_ht; + if ($mode == 'opened') { $datelimit = $this->db->jdate($obj->datefin); From b87c3b80afc3bb45df0d132aa6a3df39de8bd68f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 25 Jul 2018 09:36:34 +0200 Subject: [PATCH 09/77] code cleaning --- htdocs/variants/admin/admin.php | 18 ++++++++---------- htdocs/variants/card.php | 19 ++++++++++--------- htdocs/variants/combinations.php | 21 +++++++++++---------- htdocs/variants/create.php | 9 +++++---- htdocs/variants/create_val.php | 7 ++++--- htdocs/variants/generator.php | 10 +++++----- 6 files changed, 43 insertions(+), 41 deletions(-) diff --git a/htdocs/variants/admin/admin.php b/htdocs/variants/admin/admin.php index dc039bf6d5f..4790961aba7 100644 --- a/htdocs/variants/admin/admin.php +++ b/htdocs/variants/admin/admin.php @@ -1,6 +1,6 @@ +/* Copyright (C) 2016 Marcos García + * Copyright (C) 2018 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 @@ -31,15 +31,15 @@ if ($_POST) { $value = GETPOST('PRODUIT_ATTRIBUTES_HIDECHILD'); if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_HIDECHILD', $value, 'chaine', 0, '', $conf->entity)) { - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null); } else { - setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); + setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); } if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) { - setEventMessage($langs->trans('RecordSaved')); + setEventMessages($langs->trans('RecordSaved'), null); } else { - setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); + setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); } } @@ -62,9 +62,9 @@ print ''.$langs->trans('HideProductCombinations').' print $form->selectyesno("PRODUIT_ATTRIBUTES_HIDECHILD",$conf->global->PRODUIT_ATTRIBUTES_HIDECHILD,1).''; print ''.$langs->trans('CombinationsSeparator').''; if(isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { - $separator = $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR; + $separator = $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR; } else { - $separator = "_"; + $separator = "_"; } print ''; print ''; @@ -72,6 +72,4 @@ print '
*/nltechno* */htdocs/includes *.min.css + *.js @@ -157,7 +158,7 @@ - + diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 52b5f1c411f..60e60537c57 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -78,7 +78,8 @@ class AccountancyExport * * @param DoliDb $db Database handler */ - public function __construct(DoliDB &$db) { + public function __construct(DoliDB &$db) + { global $conf; $this->db = &$db; @@ -91,7 +92,8 @@ class AccountancyExport * * @return array of type */ - public static function getType() { + public static function getType() + { global $langs; return array ( @@ -113,7 +115,8 @@ class AccountancyExport * * @return array of type */ - public static function getTypeConfig() { + public static function getTypeConfig() + { global $conf, $langs; return array ( @@ -175,7 +178,8 @@ class AccountancyExport * * @return void */ - public static function downloadFile() { + public static function downloadFile() + { global $conf; $filename = 'general_ledger'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; @@ -186,7 +190,8 @@ class AccountancyExport * * @param unknown $TData data */ - public function export(&$TData) { + public function export(&$TData) + { global $conf, $langs; self::downloadFile(); @@ -235,7 +240,8 @@ class AccountancyExport * * @return void */ - public function exportNormal($objectLines) { + public function exportNormal($objectLines) + { global $conf; foreach ( $objectLines as $line ) { @@ -259,7 +265,8 @@ class AccountancyExport * * @return void */ - public function exportCegid($objectLines) { + public function exportCegid($objectLines) + { foreach ( $objectLines as $line ) { $date = dol_print_date($line->doc_date, '%d%m%Y'); $separator = ";"; @@ -284,7 +291,8 @@ class AccountancyExport * * @return void */ - public function exportCogilog($objectLines) { + public function exportCogilog($objectLines) + { foreach ( $objectLines as $line ) { $date = dol_print_date($line->doc_date, '%d%m%Y'); $separator = ";"; @@ -317,7 +325,8 @@ class AccountancyExport * * @return void */ - public function exportCoala($objectLines) { + public function exportCoala($objectLines) + { // Coala export $separator = ";"; $end_line = "\n"; @@ -344,7 +353,8 @@ class AccountancyExport * * @return void */ - public function exportBob50($objectLines) { + public function exportBob50($objectLines) + { // Bob50 $separator = ";"; @@ -382,7 +392,8 @@ class AccountancyExport * * @return void */ - public function exportCiel(&$TData) { + public function exportCiel(&$TData) + { global $conf; $end_line ="\r\n"; @@ -422,7 +433,8 @@ class AccountancyExport * * @return void */ - public function exportQuadratus(&$TData) { + public function exportQuadratus(&$TData) + { global $conf; $end_line ="\r\n"; @@ -505,7 +517,8 @@ class AccountancyExport * * @return void */ - public function exportEbp($objectLines) { + public function exportEbp($objectLines) + { $separator = ','; $end_line = "\n"; @@ -537,7 +550,8 @@ class AccountancyExport * * @return void */ - public function exportAgiris($objectLines) { + public function exportAgiris($objectLines) + { $separator = ';'; $end_line = "\n"; @@ -574,7 +588,8 @@ class AccountancyExport * * @return void */ - public function exportConfigurable($objectLines) { + public function exportConfigurable($objectLines) + { global $conf; foreach ($objectLines as $line) { @@ -603,7 +618,8 @@ class AccountancyExport * @param unknown $str data * @param integer $size data */ - public static function trunc($str, $size) { + public static function trunc($str, $size) + { return dol_trunc($str, $size, 'right', 'UTF-8', 1); } } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index f7fed2e2b5b..2d9e2fa4fdb 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -88,7 +88,8 @@ class BookKeeping extends CommonObject * * @param DoliDb $db Database handler */ - public function __construct(DoliDB $db) { + public function __construct(DoliDB $db) + { $this->db = $db; } @@ -99,7 +100,8 @@ class BookKeeping extends CommonObject * @param bool $notrigger false=launch triggers after, true=disable triggers * @return int <0 if KO, Id of created object if OK */ - public function create(User $user, $notrigger = false) { + public function create(User $user, $notrigger = false) + { global $conf, $langs; dol_syslog(__METHOD__, LOG_DEBUG); @@ -420,7 +422,8 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, Id of created object if OK */ - public function createStd(User $user, $notrigger = false, $mode='') { + public function createStd(User $user, $notrigger = false, $mode='') + { global $conf; dol_syslog(__METHOD__, LOG_DEBUG); @@ -590,7 +593,8 @@ class BookKeeping extends CommonObject * * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetch($id, $ref = null, $mode='') { + public function fetch($id, $ref = null, $mode='') + { global $conf; dol_syslog(__METHOD__, LOG_DEBUG); @@ -687,7 +691,8 @@ class BookKeeping extends CommonObject * * @return int <0 if KO, >=0 if OK */ - public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { + public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { global $conf; dol_syslog(__METHOD__, LOG_DEBUG); @@ -811,7 +816,8 @@ class BookKeeping extends CommonObject * * @return int <0 if KO, >0 if OK */ - public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { global $conf; dol_syslog(__METHOD__, LOG_DEBUG); @@ -1016,7 +1022,8 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - public function update(User $user, $notrigger = false, $mode='') { + public function update(User $user, $notrigger = false, $mode='') + { $error = 0; dol_syslog(__METHOD__, LOG_DEBUG); @@ -1185,7 +1192,8 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - public function delete(User $user, $notrigger = false, $mode='') { + public function delete(User $user, $notrigger = false, $mode='') + { dol_syslog(__METHOD__, LOG_DEBUG); $error = 0; @@ -1234,7 +1242,8 @@ class BookKeeping extends CommonObject * @param string $importkey Import key * @return int Result */ - function deleteByImportkey($importkey) { + function deleteByImportkey($importkey) + { $this->db->begin(); // first check if line not yet in bookkeeping @@ -1263,7 +1272,8 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - function deleteByYearAndJournal($delyear='', $journal='', $mode='') { + function deleteByYearAndJournal($delyear='', $journal='', $mode='') + { global $conf; if (empty($delyear) && empty($journal)) @@ -1302,7 +1312,8 @@ class BookKeeping extends CommonObject * @param int $piecenum Piecenum to delete * @return int Result */ - function deleteMvtNum($piecenum) { + function deleteMvtNum($piecenum) + { global $conf; $this->db->begin(); @@ -1336,7 +1347,8 @@ class BookKeeping extends CommonObject * * @return int New id of clone */ - public function createFromClone($fromid) { + public function createFromClone($fromid) + { dol_syslog(__METHOD__, LOG_DEBUG); global $user; @@ -1381,7 +1393,8 @@ class BookKeeping extends CommonObject * * @return void */ - public function initAsSpecimen() { + public function initAsSpecimen() + { global $user; $now=dol_now(); @@ -1417,7 +1430,8 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - public function fetchPerMvt($piecenum, $mode='') { + public function fetchPerMvt($piecenum, $mode='') + { global $conf; $sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type,date_creation"; @@ -1481,7 +1495,8 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - function fetchAllPerMvt($piecenum, $mode='') { + function fetchAllPerMvt($piecenum, $mode='') + { global $conf; $sql = "SELECT rowid, doc_date, doc_type,"; @@ -1539,7 +1554,8 @@ class BookKeeping extends CommonObject * @param string $model Model * @return int Result */ - function export_bookkeping($model = 'ebp') { + function export_bookkeping($model = 'ebp') + { global $conf; $sql = "SELECT rowid, doc_date, doc_type,"; @@ -1696,7 +1712,8 @@ class BookKeeping extends CommonObject * @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number * @return string String with HTML select */ - function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { + function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') + { global $conf; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index c6e33023e4c..9dbbaa7916d 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -69,7 +69,8 @@ class PrestaShopWebservice * @param string $key Authentification key * @param mixed $debug Debug mode Activated (true) or deactivated (false) */ - function __construct($url, $key, $debug = true) { + function __construct($url, $key, $debug = true) + { if (!extension_loaded('curl')) throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library'); $this->url = $url; diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index a0e992e9da9..ac26a326962 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -310,7 +310,7 @@ class Facturation * @return string Ref */ public function ref($aRef=null) - { + { if (is_null($aRef)) { @@ -652,7 +652,7 @@ class Facturation { return $this->prix_total_ttc; } - else if ( $aTotalTtc == 'RESET' ) + elseif ( $aTotalTtc == 'RESET' ) { $this->prix_total_ttc = null; } @@ -663,4 +663,3 @@ class Facturation } } - diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index c559d760f0f..843e2fc0ee6 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -103,7 +103,8 @@ class Categories extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -266,7 +267,8 @@ class Categories extends DolibarrApi * @param Categorie $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 50d9faf0637..2b65e6cc378 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -916,7 +916,8 @@ class AdvanceTargetingMailing extends CommonObject * For exemple jean;joe;jim%%;!jimo;!jima%> will target all jean, joe, start with jim but not jimo and not everythnig taht start by jima * @return string Sql to use for the where condition */ - public function transformToSQL($column_to_test,$criteria) { + public function transformToSQL($column_to_test,$criteria) + { $return_sql_criteria = '('; //This is a multiple value test diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 7408bb27d37..61c306fe5bf 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -34,7 +34,8 @@ class FormAdvTargetEmailing extends Form * * @param DoliDB $db handler */ - function __construct($db) { + function __construct($db) + { global $langs; $this->db = $db; @@ -47,7 +48,8 @@ class FormAdvTargetEmailing extends Form * @param string $htmlname select field * @return string select field */ - function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status') { + function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status') + { global $conf, $langs; $options_array = array(); @@ -83,7 +85,8 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array or Code or Label of preselected country * @return string HTML string with select */ - function multiselectCountry($htmlname = 'country_id', $selected_array=array()) { + function multiselectCountry($htmlname = 'country_id', $selected_array=array()) + { global $conf, $langs; $langs->load("dict"); @@ -143,7 +146,8 @@ class FormAdvTargetEmailing extends Form * @param User $user User action * @return string combo list code */ - function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user) { + function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user) + { global $conf; @@ -184,7 +188,8 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array selected array * @return string combo list code */ - function multiselectselectLanguage($htmlname='', $selected_array=array()) { + function multiselectselectLanguage($htmlname='', $selected_array=array()) + { global $conf,$langs; @@ -330,7 +335,8 @@ class FormAdvTargetEmailing extends Form * @param int $showempty show empty * @return string HTML combo */ - function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) { + function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) + { global $conf, $langs; $form=new Form($this->db); @@ -417,7 +423,8 @@ class FormAdvTargetEmailing extends Form * @param string $type_element Type element. Example: 'mailing' * @return string HTML combo */ - public function selectAdvtargetemailingTemplate($htmlname='template_id', $selected=0, $showempty=0, $type_element='mailing') { + public function selectAdvtargetemailingTemplate($htmlname='template_id', $selected=0, $showempty=0, $type_element='mailing') + { global $conf, $user, $langs; $out = ''; @@ -460,4 +467,4 @@ class FormAdvTargetEmailing extends Form $this->db->free ( $resql ); return $out; } -} \ No newline at end of file +} diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 39857d88365..0313add9cae 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -97,7 +97,8 @@ class Proposals extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" * @return array Array of order objects */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -215,7 +216,8 @@ class Proposals extends DolibarrApi * * @return int */ - function getLines($id) { + function getLines($id) + { if(! DolibarrApiAccess::$user->rights->propal->lire) { throw new RestException(401); } @@ -381,7 +383,8 @@ class Proposals extends DolibarrApi * @throws 401 * @throws 404 */ - function deleteLine($id, $lineid) { + function deleteLine($id, $lineid) + { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); } @@ -415,7 +418,8 @@ class Proposals extends DolibarrApi * * @return int */ - function put($id, $request_data = null) { + function put($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); } @@ -703,23 +707,24 @@ class Proposals extends DolibarrApi } - /** - * Clean sensible object datas - * - * @param object $object Object to clean - * @return array Array of cleaned object properties - */ - function _cleanObjectDatas($object) { + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + */ + function _cleanObjectDatas($object) + { - $object = parent::_cleanObjectDatas($object); + $object = parent::_cleanObjectDatas($object); - unset($object->note); - unset($object->name); - unset($object->lastname); - unset($object->firstname); - unset($object->civility_id); - unset($object->address); + unset($object->note); + unset($object->name); + unset($object->lastname); + unset($object->firstname); + unset($object->civility_id); + unset($object->address); - return $object; - } + return $object; + } } diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index d43325f9c58..c0266d76d70 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -97,9 +97,10 @@ class Orders extends DolibarrApi * @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 + * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -218,7 +219,8 @@ class Orders extends DolibarrApi * * @return int */ - function getLines($id) { + function getLines($id) + { if(! DolibarrApiAccess::$user->rights->commande->lire) { throw new RestException(401); } @@ -249,7 +251,8 @@ class Orders extends DolibarrApi * * @return int */ - function postLine($id, $request_data = null) { + function postLine($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } @@ -311,7 +314,8 @@ class Orders extends DolibarrApi * * @return object */ - function putLine($id, $lineid, $request_data = null) { + function putLine($id, $lineid, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } @@ -371,7 +375,8 @@ class Orders extends DolibarrApi * @throws 401 * @throws 404 */ - function deleteLine($id, $lineid) { + function deleteLine($id, $lineid) + { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } @@ -403,7 +408,8 @@ class Orders extends DolibarrApi * * @return int */ - function put($id, $request_data = null) { + function put($id, $request_data = null) + { if (! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } @@ -544,7 +550,8 @@ class Orders extends DolibarrApi * @throws 404 * @throws 405 */ - function reopen($id) { + function reopen($id) + { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); @@ -581,7 +588,8 @@ class Orders extends DolibarrApi * @throws 404 * @throws 405 */ - function setinvoiced($id) { + function setinvoiced($id) + { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); @@ -706,21 +714,22 @@ class Orders extends DolibarrApi } - /** - * Create an order using an existing proposal. - * - * - * @param int $proposalid Id of the proposal - * - * @url POST /createfromproposal/{proposalid} - * - * @return int - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 - */ - function createOrderFromProposal($proposalid) { + /** + * Create an order using an existing proposal. + * + * + * @param int $proposalid Id of the proposal + * + * @url POST /createfromproposal/{proposalid} + * + * @return int + * @throws 400 + * @throws 401 + * @throws 404 + * @throws 405 + */ + function createOrderFromProposal($proposalid) + { require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; @@ -756,7 +765,8 @@ class Orders extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 2b8ebd57d06..ab2903c95b4 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -32,7 +32,7 @@ class Invoices extends DolibarrApi * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( - 'socid' + 'socid', ); /** @@ -104,7 +104,8 @@ class Invoices extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -245,7 +246,8 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 405 */ - function createInvoiceFromOrder($orderid) { + function createInvoiceFromOrder($orderid) + { require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; @@ -282,7 +284,8 @@ class Invoices extends DolibarrApi * * @return int */ - function getLines($id) { + function getLines($id) + { if(! DolibarrApiAccess::$user->rights->facture->lire) { throw new RestException(401); } @@ -319,7 +322,8 @@ class Invoices extends DolibarrApi * @throws 401 * @throws 404 */ - function putLine($id, $lineid, $request_data = null) { + function putLine($id, $lineid, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); } @@ -383,7 +387,8 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 405 */ - function deleteLine($id, $lineid) { + function deleteLine($id, $lineid) + { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); @@ -511,7 +516,8 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 400 */ - function postLine($id, $request_data = null) { + function postLine($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); } @@ -849,7 +855,8 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 405 */ - function useDiscount($id, $discountid) { + function useDiscount($id, $discountid) + { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); @@ -894,7 +901,8 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 405 */ - function useCreditNote($id, $discountid) { + function useCreditNote($id, $discountid) + { require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; @@ -938,7 +946,8 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 405 */ - function getPayments($id) { + function getPayments($id) + { if(! DolibarrApiAccess::$user->rights->facture->lire) { throw new RestException(401); @@ -985,8 +994,9 @@ class Invoices extends DolibarrApi * @throws 401 * @throws 404 */ - function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement='', $comment='', $chqemetteur='', $chqbank='') { - global $conf; + function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement='', $comment='', $chqemetteur='', $chqbank='') + { + global $conf; require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; @@ -1215,18 +1225,19 @@ class Invoices extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { - $object = parent::_cleanObjectDatas($object); + $object = parent::_cleanObjectDatas($object); 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); + 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; } /** @@ -1241,8 +1252,9 @@ class Invoices extends DolibarrApi { $invoice = array(); foreach (Invoices::$FIELDS as $field) { - if (!isset($data[$field])) + if (!isset($data[$field])) { throw new RestException(400, "$field field missing"); + } $invoice[$field] = $data[$field]; } return $invoice; diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index f5303074e63..8c206554ee1 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -100,7 +100,8 @@ class Contracts extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -216,7 +217,8 @@ class Contracts extends DolibarrApi * * @return int */ - function getLines($id) { + function getLines($id) + { if(! DolibarrApiAccess::$user->rights->contrat->lire) { throw new RestException(401); } @@ -247,7 +249,8 @@ class Contracts extends DolibarrApi * * @return int */ - function postLine($id, $request_data = null) { + function postLine($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } @@ -300,7 +303,8 @@ class Contracts extends DolibarrApi * * @return object */ - function putLine($id, $lineid, $request_data = null) { + function putLine($id, $lineid, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } @@ -359,7 +363,8 @@ class Contracts extends DolibarrApi * * @return object */ - function activateLine($id, $lineid, $datestart, $dateend = null, $comment = null) { + function activateLine($id, $lineid, $datestart, $dateend = null, $comment = null) + { if(! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } @@ -396,7 +401,8 @@ class Contracts extends DolibarrApi * * @return object */ - function unactivateLine($id, $lineid, $datestart, $comment = null) { + function unactivateLine($id, $lineid, $datestart, $comment = null) + { if(! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } @@ -436,7 +442,8 @@ class Contracts extends DolibarrApi * @throws 401 * @throws 404 */ - function deleteLine($id, $lineid) { + function deleteLine($id, $lineid) + { if(! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } @@ -470,7 +477,8 @@ class Contracts extends DolibarrApi * * @return int */ - function put($id, $request_data = null) { + function put($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } @@ -632,7 +640,8 @@ class Contracts extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index a867d8937c9..1fb2bb3afa6 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2350,7 +2350,8 @@ class Contrat extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int New id of clone */ - function createFromClone($socid = 0, $notrigger=0) { + function createFromClone($socid = 0, $notrigger=0) + { global $db, $user, $langs, $conf, $hookmanager; dol_include_once('/projet/class/project.class.php'); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 72ef472229d..b2b1234acdc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6873,7 +6873,8 @@ abstract class CommonObject * @param array $fieldsentry Properties of field * @return string */ - protected function quote($value, $fieldsentry) { + protected function quote($value, $fieldsentry) + { if (is_null($value)) return 'NULL'; else if (preg_match('/^(int|double|real)/i', $fieldsentry['type'])) return $this->db->escape("$value"); else return "'".$this->db->escape($value)."'"; diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 3a7a79122c9..b9a9ad6f4bf 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -677,7 +677,8 @@ class Utils * * @return int 0 if OK, < 0 if KO */ - function compressSyslogs() { + function compressSyslogs() + { global $conf; if(empty($conf->loghandlers['mod_syslog_file'])) { // File Syslog disabled diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index d2f401813a0..6cd05444445 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -29,7 +29,8 @@ * @param Opensurveysondage $object Current viewing poll * @return array Tabs for the opensurvey section */ -function opensurvey_prepare_head(Opensurveysondage $object) { +function opensurvey_prepare_head(Opensurveysondage $object) +{ global $langs, $conf; diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index 0049daeaa7d..53be8d0b12e 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Page to set how to autocalculate price for each level when option * PRODUCT_MULTIPRICE is on. */ @@ -145,7 +145,7 @@ for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { $price_options[$i] = $langs->trans('SellingPrice').' '.$i; } -$genPriceOptions = function($level) use ($price_options) { +$genPriceOptions = function ($level) use ($price_options) { $return = array(); @@ -190,14 +190,14 @@ $genPriceOptions = function($level) use ($price_options) { -
'; - + print ''; llxFooter(); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 8ba4eaaecc8..ce6928c7331 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -102,7 +102,8 @@ class Products extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" * @return array Array of product objects */ - function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode=0, $category=0, $sqlfilters = '') { + function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode=0, $category=0, $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -340,7 +341,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve category list : '.array_merge(array($categories->error), $categories->errors)); + throw new RestException(503, 'Error when retrieve category list : '.array_merge(array($categories->error), $categories->errors)); } return $result; @@ -467,7 +468,8 @@ class Products extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 6ae31645a50..b34f4a88b2d 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -167,7 +167,8 @@ class FormProduct * @param String $final_label full label with all parents, separated by ' >> ' (completed on each call) * @return String full label with all parents, separated by ' >> ' */ - private function get_parent_path($tab, $final_label='') { + private function get_parent_path($tab, $final_label='') + { if(empty($final_label)) $final_label = $tab['label']; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d19f8f86732..0964bd0e2da 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4505,7 +4505,8 @@ class Product extends CommonObject * * @param int[]|int $categories Category or categories IDs */ - public function setCategories($categories) { + public function setCategories($categories) + { // Handle single category if (! is_array($categories)) { $categories = array($categories); diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index fdff7b1fe6d..56b5004d31b 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -54,7 +54,8 @@ class Productcustomerprice extends CommonObject * * @param DoliDb $db handler */ - function __construct($db) { + function __construct($db) + { $this->db = $db; return 1; @@ -68,7 +69,8 @@ class Productcustomerprice extends CommonObject * @param int $forceupdateaffiliate update price on each soc child * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger = 0, $forceupdateaffiliate = 0) { + function create($user, $notrigger = 0, $forceupdateaffiliate = 0) + { global $conf, $langs; $error = 0; @@ -342,7 +344,7 @@ class Productcustomerprice extends CommonObject $sql .= " AND prod.rowid=t.fk_product "; $sql .= " AND prod.entity IN (" . getEntity('product') . ")"; $sql .= " AND t.entity IN (" . getEntity('productprice') . ")"; - + // Manage filter if (count($filter) > 0) { foreach ( $filter as $key => $value ) { @@ -522,7 +524,8 @@ class Productcustomerprice extends CommonObject * @param int $forceupdateaffiliate update price on each soc child * @return int <0 if KO, >0 if OK */ - function update($user = 0, $notrigger = 0, $forceupdateaffiliate = 0) { + function update($user = 0, $notrigger = 0, $forceupdateaffiliate = 0) + { global $conf, $langs; $error = 0; @@ -719,7 +722,8 @@ class Productcustomerprice extends CommonObject * @param int $forceupdateaffiliate update price on each soc child * @return int <0 if KO, >0 if OK */ - function setPriceOnAffiliateThirdparty($user, $forceupdateaffiliate) { + function setPriceOnAffiliateThirdparty($user, $forceupdateaffiliate) + { $error = 0; @@ -811,7 +815,8 @@ class Productcustomerprice extends CommonObject * @param int $notrigger triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger = 0) { + function delete($user, $notrigger = 0) + { global $conf, $langs; $error = 0; @@ -864,7 +869,8 @@ class Productcustomerprice extends CommonObject * @param int $fromid of object to clone * @return int id of clone */ - function createFromClone($fromid) { + function createFromClone($fromid) + { global $user, $langs; @@ -914,7 +920,8 @@ class Productcustomerprice extends CommonObject * * @return void */ - function initAsSpecimen() { + function initAsSpecimen() + { $this->id = 0; diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index 92c6ffadca4..641a8f155b7 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -647,7 +647,8 @@ class PropalmergepdfproductLine var $tms=''; var $import_key; - function __construct() { - return 1; - } + function __construct() + { + return 1; + } } diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index 16d21c02eb3..2dc45a262ab 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -93,7 +93,8 @@ class StockMovements extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -153,15 +154,15 @@ class StockMovements extends DolibarrApi return $obj_ret; } -/* - * @param int $product_id Id product id {@min 1} - * @param int $warehouse_id Id warehouse {@min 1} - * @param float $qty Qty to add (Use negative value for a stock decrease) {@min 0} {@message qty must be higher than 0} - * @param string $lot Lot - * @param string $movementcode Movement code {@example INV123} - * @param string $movementlabel Movement label {@example Inventory number 123} - * @param string $price To update AWP (Average Weighted Price) when you make a stock increase (qty must be higher then 0). - */ + /* + * @param int $product_id Id product id {@min 1} + * @param int $warehouse_id Id warehouse {@min 1} + * @param float $qty Qty to add (Use negative value for a stock decrease) {@min 0} {@message qty must be higher than 0} + * @param string $lot Lot + * @param string $movementcode Movement code {@example INV123} + * @param string $movementlabel Movement label {@example Inventory number 123} + * @param string $price To update AWP (Average Weighted Price) when you make a stock increase (qty must be higher then 0). + */ /** @@ -279,7 +280,8 @@ class StockMovements extends DolibarrApi * @param MouvementStock $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 10b76d22a25..91ee105acb7 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -92,7 +92,8 @@ class Warehouses extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -248,7 +249,8 @@ class Warehouses extends DolibarrApi * @param Entrepot $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 039918ea66c..bae42639d28 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -690,7 +690,8 @@ class Entrepot extends CommonObject * @param array() $TChildWarehouses array which will contain all children (param by reference) * @return array() $TChildWarehouses array which will contain all children */ - function get_children_warehouses($id, &$TChildWarehouses) { + function get_children_warehouses($id, &$TChildWarehouses) + { $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'entrepot @@ -707,7 +708,7 @@ class Entrepot extends CommonObject return $TChildWarehouses; } - + /** * Create object on disk * diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index ab157bf237c..e5a73590d75 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -98,7 +98,8 @@ class Projects extends DolibarrApi * @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 project objects */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -214,7 +215,8 @@ class Projects extends DolibarrApi * * @url GET {id}/tasks */ - function getLines($id, $includetimespent=0) { + function getLines($id, $includetimespent=0) + { if(! DolibarrApiAccess::$user->rights->projet->lire) { throw new RestException(401); } @@ -256,7 +258,8 @@ class Projects extends DolibarrApi * * @return int */ - function getRoles($id, $userid=0) { + function getRoles($id, $userid=0) + { global $db; if(! DolibarrApiAccess::$user->rights->projet->lire) { @@ -300,7 +303,8 @@ class Projects extends DolibarrApi * @return int */ /* - function postLine($id, $request_data = null) { + function postLine($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->projet->creer) { throw new RestException(401); } @@ -362,7 +366,8 @@ class Projects extends DolibarrApi * @return object */ /* - function putLine($id, $lineid, $request_data = null) { + function putLine($id, $lineid, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->projet->creer) { throw new RestException(401); } @@ -418,7 +423,8 @@ class Projects extends DolibarrApi * * @return int */ - function put($id, $request_data = null) { + function put($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->projet->creer) { throw new RestException(401); } @@ -535,7 +541,8 @@ class Projects extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 3125546c10a..cd79a12cecc 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -106,7 +106,8 @@ class Tasks extends DolibarrApi * @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 project objects */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -221,7 +222,8 @@ class Tasks extends DolibarrApi * @url GET {id}/tasks */ /* - function getLines($id, $includetimespent=0) { + function getLines($id, $includetimespent=0) + { if(! DolibarrApiAccess::$user->rights->projet->lire) { throw new RestException(401); } @@ -263,7 +265,8 @@ class Tasks extends DolibarrApi * * @return int */ - function getRoles($id, $userid=0) { + function getRoles($id, $userid=0) + { global $db; if(! DolibarrApiAccess::$user->rights->projet->lire) { @@ -305,7 +308,8 @@ class Tasks extends DolibarrApi * @return int */ /* - function postLine($id, $request_data = null) { + function postLine($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->projet->creer) { throw new RestException(401); } @@ -367,7 +371,8 @@ class Tasks extends DolibarrApi * @return object */ /* - function putLine($id, $lineid, $request_data = null) { + function putLine($id, $lineid, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->projet->creer) { throw new RestException(401); } @@ -422,7 +427,8 @@ class Tasks extends DolibarrApi * * @return int */ - function put($id, $request_data = null) { + function put($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->projet->creer) { throw new RestException(401); } @@ -550,7 +556,8 @@ class Tasks extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/public/emailing/mailing-read.php b/htdocs/public/emailing/mailing-read.php index 4aa388ecf24..23511974137 100644 --- a/htdocs/public/emailing/mailing-read.php +++ b/htdocs/public/emailing/mailing-read.php @@ -36,13 +36,17 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no * * @return void */ -function llxHeader() { } +function llxHeader() +{ +} /** * Footer empty * * @return void */ -function llxFooter() { } +function llxFooter() +{ +} require '../../main.inc.php'; diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php index 61e8ccdb0d6..1dc1477e7b4 100644 --- a/htdocs/public/emailing/mailing-unsubscribe.php +++ b/htdocs/public/emailing/mailing-unsubscribe.php @@ -35,13 +35,17 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no * * @return void */ -function llxHeader() { } +function llxHeader() +{ +} /** * Footer empty * * @return void */ -function llxFooter() { } +function llxFooter() +{ +} require '../../main.inc.php'; diff --git a/htdocs/public/website/index.php b/htdocs/public/website/index.php index 436e352819a..862d8ada71a 100644 --- a/htdocs/public/website/index.php +++ b/htdocs/public/website/index.php @@ -34,13 +34,17 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); * * @return void */ -function llxHeader() { } +function llxHeader() +{ +} /** * Footer empty * * @return void */ -function llxFooter() { } +function llxFooter() +{ +} require '../../master.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -204,4 +208,3 @@ print '