From b90c56fbb52d95e441df0aeeff5adc6d090be363 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 27 Oct 2015 06:29:18 +0100 Subject: [PATCH 01/22] HRM : move migration into 3.8 to 3.9 --- .../install/mysql/migration/3.8.0-3.9.0.sql | 68 ++++++++++++++ .../install/mysql/migration/3.9.0-4.0.0.sql | 88 ------------------- 2 files changed, 68 insertions(+), 88 deletions(-) delete mode 100644 htdocs/install/mysql/migration/3.9.0-4.0.0.sql diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 92ab08d141d..97ef7e3c1d4 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -105,6 +105,74 @@ ALTER TABLE llx_product ADD COLUMN onportal tinyint DEFAULT 0 after tobuy; ALTER TABLE llx_user ADD COLUMN employee tinyint DEFAULT 1; +CREATE TABLE IF NOT EXISTS llx_c_hrm_function +( + rowid integer PRIMARY KEY, + pos tinyint DEFAULT 0 NOT NULL, + code varchar(16) NOT NULL, + label varchar(50), + c_level tinyint DEFAULT 0 NOT NULL, + active tinyint DEFAULT 1 NOT NULL +)ENGINE=innodb; + +INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(1, 5,'EXECBOARD', 'Executive board', 0, 1); +INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(2, 10, 'MANAGDIR', 'Managing director', 1, 1); +INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(3, 15, 'ACCOUNTMANAG', 'Account manager', 0, 1); +INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(3, 20, 'ENGAGDIR', 'Engagement director', 1, 1); +INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(4, 25, 'DIRECTOR', 'Director', 1, 1); +INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(5, 30, 'PROJMANAG', 'Project manager', 0, 1); +INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(6, 35, 'DEPHEAD', 'Department head', 0, 1); +INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(7, 40, 'SECRETAR', 'Secretary', 0, 1); +INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(8, 45, 'EMPLOYEE', 'Department employee', 0, 1); + +CREATE TABLE IF NOT EXISTS llx_c_hrm_department +( + rowid integer PRIMARY KEY, + pos tinyint DEFAULT 0 NOT NULL, + code varchar(16) NOT NULL, + label varchar(50), + active tinyint DEFAULT 1 NOT NULL +)ENGINE=innodb; + +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(1, 5,'MANAGEMENT', 'Management', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(2, 10,'GESTION', 'Gestion', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(3, 15,'TRAINING', 'Training', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(4, 20,'IT', 'Inform. Technology (IT)', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(5, 25,'MARKETING', 'Marketing', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(6, 30,'SALES', 'Sales', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(7, 35,'LEGAL', 'Legal', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(8, 40,'FINANCIAL', 'Financial accounting', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(9, 45,'HUMANRES', 'Human resources', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(10, 50,'PURCHASING', 'Purchasing', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(11, 55,'SERVICES', 'Services', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(12, 60,'CUSTOMSERV', 'Customer service', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(13, 65,'CONSULTING', 'Consulting', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(14, 70,'LOGISTIC', 'Logistics', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(15, 75,'CONSTRUCT', 'Engineering/design', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(16, 80,'PRODUCTION', 'Manufacturing', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(17, 85,'QUALITY', 'Quality assurance', 1); +INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(18, 85,'MAINT', 'Plant assurance', 1); + +CREATE TABLE IF NOT EXISTS llx_establishment ( + rowid integer NOT NULL auto_increment PRIMARY KEY, + entity integer NOT NULL DEFAULT 1, + name varchar(50), + address varchar(255), + zip varchar(25), + town varchar(50), + fk_state integer DEFAULT 0, + fk_country integer DEFAULT 0, + profid1 varchar(20), + profid2 varchar(20), + profid3 varchar(20), + phone varchar(20), + fk_user_author integer NOT NULL, + fk_user_mod integer NOT NULL, + datec datetime NOT NULL, + tms timestamp NOT NULL, + status tinyint DEFAULT 1 +) ENGINE=InnoDB; + ALTER TABLE llx_projet_task_time ADD COLUMN invoice_id integer DEFAULT NULL; ALTER TABLE llx_projet_task_time ADD COLUMN invoice_line_id integer DEFAULT NULL; diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql deleted file mode 100644 index accf65266c1..00000000000 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ /dev/null @@ -1,88 +0,0 @@ --- --- Be carefull to requests order. --- This file must be loaded by calling /install/index.php page --- when current version is 3.9.0 or higher. --- --- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; --- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; --- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); --- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; --- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); --- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; --- To restrict request to Mysql version x.y use -- VMYSQLx.y --- To restrict request to Pgsql version x.y use -- VPGSQLx.y --- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; --- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE --- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; --- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; --- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); --- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); - -CREATE TABLE IF NOT EXISTS llx_c_hrm_function -( - rowid integer PRIMARY KEY, - pos tinyint DEFAULT 0 NOT NULL, - code varchar(16) NOT NULL, - label varchar(50), - c_level tinyint DEFAULT 0 NOT NULL, - active tinyint DEFAULT 1 NOT NULL -)ENGINE=innodb; - -INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(1, 5,'EXECBOARD', 'Executive board', 0, 1); -INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(2, 10, 'MANAGDIR', 'Managing director', 1, 1); -INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(3, 15, 'ACCOUNTMANAG', 'Account manager', 0, 1); -INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(3, 20, 'ENGAGDIR', 'Engagement director', 1, 1); -INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(4, 25, 'DIRECTOR', 'Director', 1, 1); -INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(5, 30, 'PROJMANAG', 'Project manager', 0, 1); -INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(6, 35, 'DEPHEAD', 'Department head', 0, 1); -INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(7, 40, 'SECRETAR', 'Secretary', 0, 1); -INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(8, 45, 'EMPLOYEE', 'Department employee', 0, 1); - -CREATE TABLE IF NOT EXISTS llx_c_hrm_department -( - rowid integer PRIMARY KEY, - pos tinyint DEFAULT 0 NOT NULL, - code varchar(16) NOT NULL, - label varchar(50), - active tinyint DEFAULT 1 NOT NULL -)ENGINE=innodb; - -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(1, 5,'MANAGEMENT', 'Management', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(2, 10,'GESTION', 'Gestion', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(3, 15,'TRAINING', 'Training', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(4, 20,'IT', 'Inform. Technology (IT)', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(5, 25,'MARKETING', 'Marketing', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(6, 30,'SALES', 'Sales', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(7, 35,'LEGAL', 'Legal', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(8, 40,'FINANCIAL', 'Financial accounting', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(9, 45,'HUMANRES', 'Human resources', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(10, 50,'PURCHASING', 'Purchasing', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(11, 55,'SERVICES', 'Services', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(12, 60,'CUSTOMSERV', 'Customer service', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(13, 65,'CONSULTING', 'Consulting', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(14, 70,'LOGISTIC', 'Logistics', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(15, 75,'CONSTRUCT', 'Engineering/design', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(16, 80,'PRODUCTION', 'Manufacturing', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(17, 85,'QUALITY', 'Quality assurance', 1); -INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(18, 85,'MAINT', 'Plant assurance', 1); - -CREATE TABLE IF NOT EXISTS llx_establishment ( - rowid integer NOT NULL auto_increment PRIMARY KEY, - entity integer NOT NULL DEFAULT 1, - name varchar(50), - address varchar(255), - zip varchar(25), - town varchar(50), - fk_state integer DEFAULT 0, - fk_country integer DEFAULT 0, - profid1 varchar(20), - profid2 varchar(20), - profid3 varchar(20), - phone varchar(20), - fk_user_author integer NOT NULL, - fk_user_mod integer NOT NULL, - datec datetime NOT NULL, - tms timestamp NOT NULL, - status tinyint DEFAULT 1 -) ENGINE=InnoDB; - From 93d340e4979b6e60b0710074571456b9377104e1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 27 Oct 2015 07:26:57 +0100 Subject: [PATCH 02/22] HRM module : continue to work --- htdocs/hrm/admin/admin_establishment.php | 2 +- htdocs/hrm/admin/admin_hrm.php | 2 +- htdocs/hrm/class/employee.class.php | 226 +++++++++++++++++++++++ htdocs/hrm/employee/index.html | 0 htdocs/hrm/employee/list.php | 223 ++++++++++++++++++++++ htdocs/langs/en_US/admin.lang | 2 + htdocs/langs/en_US/hrm.lang | 1 + 7 files changed, 454 insertions(+), 2 deletions(-) create mode 100644 htdocs/hrm/class/employee.class.php create mode 100644 htdocs/hrm/employee/index.html create mode 100644 htdocs/hrm/employee/list.php diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index 6a9cf961960..771f2e243bc 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -53,7 +53,7 @@ dol_htmloutput_mesg($mesg); // Subheader $linkback = '' . $langs->trans("BackToModuleList") . ''; -print load_fiche_titre($langs->trans($page_name), $linkback); +print load_fiche_titre($langs->trans("HRMSetup"), $linkback); // Configuration header $head = hrm_admin_prepare_head(); diff --git a/htdocs/hrm/admin/admin_hrm.php b/htdocs/hrm/admin/admin_hrm.php index bc0487bad94..7dba4392740 100644 --- a/htdocs/hrm/admin/admin_hrm.php +++ b/htdocs/hrm/admin/admin_hrm.php @@ -48,7 +48,7 @@ dol_htmloutput_mesg($mesg); // Subheader $linkback = '' . $langs->trans("BackToModuleList") . ''; -print load_fiche_titre($langs->trans($page_name), $linkback); +print load_fiche_titre($langs->trans("HRMSetup"), $linkback); // Configuration header $head = hrm_admin_prepare_head(); diff --git a/htdocs/hrm/class/employee.class.php b/htdocs/hrm/class/employee.class.php new file mode 100644 index 00000000000..4014bb717f2 --- /dev/null +++ b/htdocs/hrm/class/employee.class.php @@ -0,0 +1,226 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/hrm/class/employee.class.php + * \ingroup HRM + * \brief File of class to manage employees + */ + +require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; + +/** + * Class to manage establishments + */ +class Employee extends CommonObject +{ + public $element='employee'; + public $table_element='user'; + public $table_element_line = ''; + public $fk_element = 'fk_user'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + + var $rowid; + + var $name; + var $address; + var $zip; + var $town; + var $status; // 0=open, 1=closed + var $entity; + + var $statuts=array(); + var $statuts_short=array(); + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + + $this->statuts_short = array(0 => 'Opened', 1 => 'Closed'); + $this->statuts = array(0 => 'Opened', 1 => 'Closed'); + + return 1; + } + + /** + * Load an object from database + * + * @param int $id Id of record to load + * @return int <0 if KO, >0 if OK + */ + function fetch($id) + { + $sql = "SELECT rowid, firstname, lastname, status, fk_user"; + $sql.= " FROM ".MAIN_DB_PREFIX."user"; + $sql.= " WHERE rowid = ".$id; + + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $result = $this->db->query($sql); + if ( $result ) + { + $obj = $this->db->fetch_object($result); + + $this->id = $obj->rowid; + $this->name = $obj->name; + $this->address = $obj->address; + $this->zip = $obj->zip; + $this->town = $obj->town; + $this->status = $obj->status; + + return 1; + } + else + { + $this->error=$this->db->lasterror(); + return -1; + } + } + + /** + * Return a link to the employee card (with optionaly the picto) + * Use this->id,this->lastname, this->firstname + * + * @param int $withpictoimg Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo) + * @param string $option On what the link point to + * @param integer $notooltip 1=Disable tooltip on picto and name + * @param int $maxlen Max length of visible employee name + * @param int $hidethirdpartylogo Hide logo of thirdparty + * @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login + * @param string $morecss Add more css on link + * @return string String with URL + */ + function getNomUrl($withpictoimg=0, $option='', $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='') + { + global $langs, $conf; + + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0; + + $result = ''; + $companylink = ''; + $link = ''; + + $label = '' . $langs->trans("Employee") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Name') . ': ' . $this->getFullName($langs,'',''); + $label.= '
' . $langs->trans("EMail").': '.$this->email; + $label.='
'; + if (! empty($this->photo)) + { + $label.= '
'; + $label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1); + $label.= '
'; + } + + $link.= 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $langs->load("users"); + $label=$langs->trans("ShowUser"); + $link.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $link.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $link.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + $link.= '>'; + $linkend=''; + + //if ($withpictoimg == -1) $result.='
'; + $result.=$link; + if ($withpictoimg) + { + $paddafterimage=''; + if (abs($withpictoimg) == 1) $paddafterimage='style="padding-right: 3px;"'; + if ($withpictoimg > 0) $picto='
'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"')).'
'; + else $picto='
'.Form::showphoto('userphoto', $this, 0, 0, 0, 'loginphoto', 'mini', 0, 1).'
'; + $result.=$picto; + } + if (abs($withpictoimg) != 2) + { + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='
'; + if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen); + else $result.=$this->getFullName($langs,'',($mode == 'firstname' ? 2 : -1),$maxlen); + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='
'; + } + $result.=$linkend; + //if ($withpictoimg == -1) $result.='
'; + $result.=$companylink; + return $result; + } + + /** + * Return status label of an employee + * + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label of status + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->statut,$mode); + } + + /** + * Return label of given status + * + * @param int $statut Id statut + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label of status + */ + function LibStatut($statut,$mode=0) + { + global $langs; + $langs->load('users'); + + if ($mode == 0) + { + $prefix=''; + if ($statut == 1) return $langs->trans('Enabled'); + if ($statut == 0) return $langs->trans('Disabled'); + } + if ($mode == 1) + { + if ($statut == 1) return $langs->trans('Enabled'); + if ($statut == 0) return $langs->trans('Disabled'); + } + if ($mode == 2) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 3) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5'); + } + if ($mode == 4) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 5) + { + if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + } + } +} diff --git a/htdocs/hrm/employee/index.html b/htdocs/hrm/employee/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/hrm/employee/list.php b/htdocs/hrm/employee/list.php new file mode 100644 index 00000000000..1635ba41cda --- /dev/null +++ b/htdocs/hrm/employee/list.php @@ -0,0 +1,223 @@ + + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Alexandre Spangaro + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/hrm/employee/list.php + * \ingroup core + * \brief Page of users + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/class/employee.class.php'; + +if (! $user->rights->hrm->employee->read) + accessforbidden(); + +$langs->load("users"); +$langs->load("companies"); +$langs->load("hrm"); + +// Security check (for external users) +$socid=0; +if ($user->societe_id > 0) + $socid = $user->societe_id; + +$sall=GETPOST('sall','alpha'); +$search_user=GETPOST('search_user','alpha'); +$search_login=GETPOST('search_login','alpha'); +$search_lastname=GETPOST('search_lastname','alpha'); +$search_firstname=GETPOST('search_firstname','alpha'); +$search_statut=GETPOST('search_statut','alpha'); +$search_thirdparty=GETPOST('search_thirdparty','alpha'); +$optioncss = GETPOST('optioncss','alpha'); + +if ($search_statut == '') $search_statut='1'; + +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); +if ($page == -1) { $page = 0; } +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +$limit = $conf->liste_limit; +if (! $sortfield) $sortfield="u.login"; +if (! $sortorder) $sortorder="ASC"; + +$employeestatic = new Employee($db); +$companystatic = new Societe($db); +$form = new Form($db); + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) +{ + $search_user=""; + $search_login=""; + $search_lastname=""; + $search_firstname=""; + $search_statut=""; + $search_thirdparty=""; +} + + +/* + * View + */ + +llxHeader('',$langs->trans("ListOfEmployees")); + +$buttonviewhierarchy='
'; + +print load_fiche_titre($langs->trans("ListOfEmployees"), $buttonviewhierarchy); + +$sql = "SELECT u.rowid, u.lastname, u.firstname, u.email, u.gender,"; +$sql.= " u.datec,"; +$sql.= " u.tms as datem,"; +$sql.= " u.ldap_sid, u.statut, u.entity,"; +$sql.= " u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2,"; +$sql.= " s.nom as name, s.canvas"; +$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u2 ON u.fk_user = u2.rowid"; +$sql.= " WHERE u.employee >= '1'"; +$sql.= " AND u.entity IN (".getEntity('user',1).")"; + +if ($socid > 0) $sql.= " AND u.fk_soc = ".$socid; +if ($search_user != '') $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user); +if ($search_thirdparty != '') $sql.=natural_search(array('s.nom'), $search_thirdparty); +if ($search_login != '') $sql.= natural_search("u.login", $search_login); +if ($search_lastname != '') $sql.= natural_search("u.lastname", $search_lastname); +if ($search_firstname != '') $sql.= natural_search("u.firstname", $search_firstname); +if ($search_statut != '' && $search_statut >= 0) $sql.= " AND (u.statut=".$search_statut.")"; +if ($sall) $sql.= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email', 'u.note'), $sall); +$sql.=$db->order($sortfield,$sortorder); + +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $i = 0; + + print '
'."\n"; + if ($optioncss != '') print ''; + + $param="search_user=".$search_user."&sall=".$sall; + $param.="&search_statut=".$search_statut; + if ($optioncss != '') $param.='&optioncss='.$optioncss; + + print ''; + print ''; + print_liste_field_titre($langs->trans("Login"),$_SERVER['PHP_SELF'],"u.login",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("LastName"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("FirstName"),$_SERVER['PHP_SELF'],"u.firstname",$param,"","",$sortfield,$sortorder); + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) + { + print_liste_field_titre($langs->trans("Entity"),$_SERVER['PHP_SELF'],"u.entity",$param,"","",$sortfield,$sortorder); + } + print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u2.login",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER['PHP_SELF'],"u.statut",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + + // Search bar + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) $colspan++; + print ''; + print ''; + print ''; + print ''; + print ''; + + // Status + print ''; + + print ''; + + print "\n"; + + $employee2=new Employee($db); + + $var=True; + while ($i < $num) + { + $obj = $db->fetch_object($result); + $var=!$var; + + $employeestatic->id=$obj->rowid; + $employeestatic->ref=$obj->label; + $employeestatic->login=$obj->login; + $employeestatic->statut=$obj->statut; + $employeestatic->email=$obj->email; + $employeestatic->gender=$obj->gender; + $employeestatic->societe_id=$obj->fk_soc; + $employeestatic->firstname=''; + $employeestatic->lastname=$obj->login; + + $li=$employeestatic->getNomUrl(1,'',0,0,24,1); + + print ""; + print ''; + print ''; + print ''; + + // Resp + print ''; + + // Statut + $employeestatic->statut=$obj->statut; + print ''; + print ''; + print "\n"; + $i++; + } + print "
 '; + print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); + print ''; + print ''; + print '
'; + print $li; + if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity) + { + print img_picto($langs->trans("SuperAdministrator"),'redstar'); + } + else if ($obj->admin) + { + print img_picto($langs->trans("Administrator"),'star'); + } + print ''.ucfirst($obj->lastname).''.ucfirst($obj->firstname).''; + if ($obj->login2) + { + $employee2->login=$obj->login2; + //$employee2->lastname=$obj->lastname2; + //$employee2->firstname=$obj->firstname2; + $employee2->lastname=$employee2->login; + $employee2->firstname=''; + print $employee2->getNomUrl(1); + } + print ''.$employeestatic->getLibStatut(5).' 
"; + print "
\n"; + $db->free($result); +} +else +{ + dol_print_error($db); +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f6399bffa6b..cf1689031a4 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1126,6 +1126,8 @@ EncryptedPasswordInDatabase=To allow the encryption of the passwords in the data DisableForgetPasswordLinkOnLogonPage=Do not show the link "Forget password" on login page UsersSetup=Users module setup UserMailRequired=EMail required to create a new user +##### HRM setup ##### +HRMSetup=HRM module setup ##### Company setup ##### CompanySetup=Companies module setup CompanyCodeChecker=Module for third parties code generation and checking (customer or supplier) diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 33c6c271261..b2e9387d62f 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -8,6 +8,7 @@ DeleteEstablishment=Delete establishment ConfirmDeleteEstablishment=Are-you sure to delete this establishment ? OpenEtablishment=Open establishment CloseEtablishment=Close establishment +ListOfEmployees=List of employees Employees=Employees Employee=Employee NewEmployee=New employee From 12e7c7b9e4aca2673ed136fa2ddafaae77a68993 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Tue, 27 Oct 2015 13:42:00 +0100 Subject: [PATCH 03/22] [Qual] Uniformize code --- htdocs/admin/contract.php | 2 +- htdocs/admin/events.php | 2 +- htdocs/admin/expedition.php | 22 +++++++++++----------- htdocs/admin/expensereport.php | 24 ++++++++++++------------ htdocs/admin/facture.php | 32 ++++++++++++++++---------------- htdocs/admin/fckeditor.php | 6 +++--- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 3198ad51448..acfe7de156f 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -63,7 +63,7 @@ if ($action == 'updateMask') } else { - setEventMessage($langs->trans("Error"), null, 'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 04a46071142..a2b5a24c82a 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -61,7 +61,7 @@ if ($action == "save") } $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 9710929ee17..555badf11d8 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -6,7 +6,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2011-2015 Philippe Grand * * 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 @@ -65,9 +65,9 @@ if ($action == 'updateMask') if (isset($res)) { if ($res > 0) - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); else - setEventMessage($langs->trans("Error"), 'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -77,9 +77,9 @@ else if ($action == 'set_SHIPPING_FREE_TEXT') $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); if ($res > 0) - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); else - setEventMessage($langs->trans("Error"), 'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } else if ($action == 'set_SHIPPING_DRAFT_WATERMARK') @@ -88,9 +88,9 @@ else if ($action == 'set_SHIPPING_DRAFT_WATERMARK') $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); if ($res > 0) - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); else - setEventMessage($langs->trans("Error"), 'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } else if ($action == 'specimen') @@ -127,13 +127,13 @@ else if ($action == 'specimen') } else { - setEventMessage($module->error, 'errors'); + setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } else { - setEventMessage($langs->trans("ErrorModuleNotFound"), 'errors'); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -158,12 +158,12 @@ else if ($action == 'setModuleOptions') if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index ab5f7fb013f..5c8fa9732e4 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent - * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2011-2015 Philippe Grand * * 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 @@ -60,11 +60,11 @@ if ($action == 'updateMask') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -102,13 +102,13 @@ else if ($action == 'specimen') // For fiche inter } else { - setEventMessage($obj->error,'errors'); - dol_syslog($obj->error, LOG_ERR); + setEventMessages($module->error, $module->errors,'errors'); + dol_syslog($module->error, LOG_ERR); } } else { - setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -133,12 +133,12 @@ if ($action == 'setModuleOptions') if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -196,11 +196,11 @@ else if ($action == 'set_EXPENSEREPORT_FREE_TEXT') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -214,11 +214,11 @@ else if ($action == 'set_EXPENSEREPORT_DRAFT_WATERMARK') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 568cd5dca21..dee1789d6ec 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -69,11 +69,11 @@ if ($action == 'updateMask') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -111,13 +111,13 @@ if ($action == 'specimen') } else { - setEventMessage($module->error,'errors'); + setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } else { - setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -139,11 +139,11 @@ if ($action == 'setModuleOptions') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -200,11 +200,11 @@ if ($action == 'setribchq') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -218,11 +218,11 @@ if ($action == 'set_FACTURE_DRAFT_WATERMARK') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -236,11 +236,11 @@ if ($action == 'set_INVOICE_FREE_TEXT') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -254,11 +254,11 @@ if ($action == 'setforcedate') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -272,11 +272,11 @@ if ($action == 'set_FAC_AUTO_FILLJS') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index b605da7e07b..b5bd4d045f6 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -121,11 +121,11 @@ if (GETPOST('save','alpha')) if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -143,7 +143,7 @@ $var=true; if (empty($conf->use_javascript_ajax)) { - setEventMessage(array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), 'errors'); + setEventMessages(array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), null, 'errors'); } else { From fb28586f3259708251f77250a1c05e447bbb8231 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2015 19:18:22 +0100 Subject: [PATCH 04/22] Better visible of what is possible for stock management --- htdocs/admin/stock.php | 126 +++++++++++++++++++++------------ htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/stocks.lang | 4 +- 3 files changed, 83 insertions(+), 49 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 2ed2f4f869e..b446f5355ad 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -141,58 +141,75 @@ $var=true; $found=0; +$var=!$var; +print ""; +print ''.$langs->trans("DeStockOnBill").''; +print ''; if (! empty($conf->facture->enabled)) { - $var=!$var; - print ""; - print ''.$langs->trans("DeStockOnBill").''; - print ''; - print "
"; + print ""; print ''; print ""; print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled); print ''; - print "
\n\n\n"; - $found++; + print "\n"; } +else +{ + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name")); +} +print "\n\n"; +$found++; +$var=!$var; +print ""; +print ''.$langs->trans("DeStockOnValidateOrder").''; +print ''; if (! empty($conf->commande->enabled)) { - $var=!$var; - print ""; - print ''.$langs->trans("DeStockOnValidateOrder").''; - print ''; - print "
"; + print ""; print ''; print ""; print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled); print ''; - print "
\n\n\n"; - $found++; + print "\n"; } +else +{ + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name")); +} +print "\n\n"; +$found++; +//if (! empty($conf->expedition->enabled)) +//{ +$var=!$var; +print ""; +print ''.$langs->trans("DeStockOnShipment").''; +print ''; if (! empty($conf->expedition->enabled)) { - $var=!$var; - print ""; - print ''.$langs->trans("DeStockOnShipment").''; - print ''; print "
"; print ''; print ""; print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled); print ''; - print "
\n\n\n"; - $found++; + print "\n"; } +else +{ + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")); +} +print "\n\n"; +$found++; -if (! $found) +/*if (! $found) { $var=!$var; print ""; - print ''.$langs->trans("NoModueToManageStockDecrease").''; + print ''.$langs->trans("NoModuleToManageStockDecrease").''; print "\n"; -} +}*/ print ''; @@ -208,57 +225,74 @@ $var=true; $found=0; +$var=!$var; +print ""; +print ''.$langs->trans("ReStockOnBill").''; +print ''; if (! empty($conf->fournisseur->enabled)) { - $var=!$var; - print ""; - print ''.$langs->trans("ReStockOnBill").''; - print ''; - print "
"; + print ""; print ''; print ""; print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled); print ''; - print "
\n\n\n"; - $found++; + print "\n"; } +else +{ + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); +} +print "\n\n"; +$found++; + +$var=!$var; +print ""; +print ''.$langs->trans("ReStockOnValidateOrder").''; +print ''; if (! empty($conf->fournisseur->enabled)) { - $var=!$var; - print ""; - print ''.$langs->trans("ReStockOnValidateOrder").''; - print ''; - print "
"; + print ""; print ''; print ""; print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled); print ''; - print "
\n\n\n"; - $found++; + print "\n"; } +else +{ + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); +} +print "\n\n"; +$found++; + +$var=!$var; +print ""; +print ''.$langs->trans("ReStockOnDispatchOrder").''; +print ''; if (! empty($conf->fournisseur->enabled)) { - $var=!$var; - print ""; - print ''.$langs->trans("ReStockOnDispatchOrder").''; - print ''; - print "
"; + print ""; print ''; print ""; print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled); print ''; - print "
\n\n\n"; - $found++; + print "\n"; } +else +{ + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); +} +print "\n\n"; +$found++; -if (! $found) +/*if (! $found) { $var=!$var; print ""; print ''.$langs->trans("NoModueToManageStockIncrease").''; print "\n"; -} +}*/ print ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f6399bffa6b..f53df55b6c5 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -356,7 +356,7 @@ ThemeDir=Skins directory ConnectionTimeout=Connexion timeout ResponseTimeout=Response timeout SmsTestMessage=Test message from __PHONEFROM__ to __PHONETO__ -ModuleMustBeEnabledFirst=Module %s must be enabled first before using this feature. +ModuleMustBeEnabledFirst=Module %s must be enabled first if you need this feature. SecurityToken=Key to secure URLs NoSmsEngine=No SMS sender manager available. SMS sender manager are not installed with default distribution (because they depends on an external supplier) but you can find some on %s PDF=PDF diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 8a46433ff9c..2ac77f8a489 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -53,8 +53,8 @@ QtyDispatched=Quantity dispatched QtyDispatchedShort=Qty dispatched QtyToDispatchShort=Qty to dispatch OrderDispatch=Stock dispatching -RuleForStockManagementDecrease=Rule for stock management decrease -RuleForStockManagementIncrease=Rule for stock management increase +RuleForStockManagementDecrease=Rule for automatic stock management decrease (manual decrease is always possible, even if an automatic decrease rule is activated) +RuleForStockManagementIncrease=Rule for automatic stock management increase (manual increase is always possible, even if an automatic increase rule is activated) DeStockOnBill=Decrease real stocks on customers invoices/credit notes validation DeStockOnValidateOrder=Decrease real stocks on customers orders validation DeStockOnShipment=Decrease real stocks on shipping validation From 76ded0aceadbad8843b80619ae6f83f5648fa780 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2015 19:26:33 +0100 Subject: [PATCH 05/22] Fix using DATE_FORMAT is forbidden --- htdocs/core/boxes/box_task.php | 35 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index d6a65884ffb..97767dd15d1 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -82,52 +82,51 @@ class box_task extends ModeleBoxes $sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt"; - $sql.= " WHERE DATE_FORMAT(pt.datec,'%Y') = '".date("Y")."' "; + $sql.= " WHERE pt.datec BETWEEN '".$this->db->idate(dol_get_first_day(date("Y"), 1))."' AND '".$this->db->idate(dol_get_last_day(date("Y"), 12))."'"; $sql.= " AND pt.rowid = ptt.fk_task"; $sql.= " GROUP BY pt.fk_statut "; $sql.= " ORDER BY pt.fk_statut DESC"; $sql.= $db->plimit($max, 0); $result = $db->query($sql); - - if ($result) { + if ($result) + { $num = $db->num_rows($result); $i = 0; - while ($i < $num) { - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projecttask'); - + while ($i < $num) + { $objp = $db->fetch_object($result); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0), + 'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0), ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => $objp->nb." ".$langs->trans("Tasks"), 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut, ); $totalnb += $objp->nb; - $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5)); + $this->info_box_contents[$i][] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5)); $totalplannedtot += $objp->plannedtot; - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->durationtot,'all',25200,5)); + $this->info_box_contents[$i][] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->durationtot,'all',25200,5)); $totaldurationtot += $objp->durationtot; - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3)); + $this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3)); $i++; } } + else dol_print_error($this->db); } // Add the sum à the bottom of the boxes - $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left"', 'text' => $langs->trans("Total")." ".$textHead); - $this->info_box_contents[$i][1] = array('td' => '', 'text' => ""); - $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); - $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); - $this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5)); - $this->info_box_contents[$i][5] = array('td' => '', 'text' => ""); + $this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => 'align="left"', 'text' => $langs->trans("Total")." ".$textHead); + $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); + $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5)); + $this->info_box_contents[$i][] = array('td' => '', 'text' => ""); } From f9c9c58cba2d8aae545756e3cea906252be2419e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Oct 2015 20:36:27 +0100 Subject: [PATCH 06/22] Label must be cheque or transfer --- htdocs/langs/en_US/bills.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 94e1fa60251..8ff109b2b09 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -351,7 +351,7 @@ ExtraInfos=Extra infos RegulatedOn=Regulated on ChequeNumber=Check N° ChequeOrTransferNumber=Check/Transfer N° -ChequeMaker=Check transmitter +ChequeMaker=Check/Transfer transmitter ChequeBank=Bank of Check CheckBank=Check NetToBePaid=Net to be paid From 8cf2aa456b895549fb25ccbec6e330a95802754d Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Wed, 28 Oct 2015 13:59:05 +0100 Subject: [PATCH 07/22] Missing argument 1 for CommonDocGenerator::__construct() add _construct on htdocs/core/class/commondocgenerator.class.php class need to send $db as parameters --- htdocs/exports/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/exports/index.php b/htdocs/exports/index.php index 8f9f7946e56..ca3bcea1458 100644 --- a/htdocs/exports/index.php +++ b/htdocs/exports/index.php @@ -123,7 +123,7 @@ print ''.$langs->trans("LibraryVersion").''; print ''; include_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; -$model=new ModeleExports(); +$model=new ModeleExports($db); $liste=$model->liste_modeles($db); // This is not a static method for exports because method load non static properties $var=true; From d517595f824a81ae5e0d0ffaed9237ca3462bc5e Mon Sep 17 00:00:00 2001 From: philippe grand Date: Wed, 28 Oct 2015 19:28:18 +0100 Subject: [PATCH 08/22] [Qual] Uniformize code --- htdocs/admin/fichinter.php | 28 ++++++++++++++-------------- htdocs/admin/geoipmaxmind.php | 6 +++--- htdocs/admin/ldap.php | 4 ++-- htdocs/admin/ldap_contacts.php | 4 ++-- htdocs/admin/ldap_groups.php | 4 ++-- htdocs/admin/ldap_members.php | 4 ++-- htdocs/admin/ldap_users.php | 6 +++--- htdocs/admin/limits.php | 6 +++--- htdocs/admin/livraison.php | 18 +++++++++--------- htdocs/admin/loan.php | 4 ++-- htdocs/admin/mailing.php | 4 ++-- htdocs/admin/mailman.php | 4 ++-- htdocs/admin/mails.php | 6 +++--- htdocs/admin/menus.php | 3 +-- htdocs/langs/en_US/admin.lang | 1 + 15 files changed, 51 insertions(+), 51 deletions(-) diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index d29420316a9..103ba462607 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent - * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2011-2015 Philippe Grand * * 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 @@ -60,11 +60,11 @@ if ($action == 'updateMask') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -102,13 +102,13 @@ else if ($action == 'specimen') // For fiche inter } else { - setEventMessage($obj->error,'errors'); - dol_syslog($obj->error, LOG_ERR); + setEventMessages($module->error, $module->errors, 'errors'); + dol_syslog($module->error, LOG_ERR); } } else { - setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -133,12 +133,12 @@ if ($action == 'setModuleOptions') if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -192,11 +192,11 @@ else if ($action == 'set_FICHINTER_FREE_TEXT') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -209,11 +209,11 @@ else if ($action == 'set_FICHINTER_DRAFT_WATERMARK') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -226,11 +226,11 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index 5e4c9de6fd7..b4d379e15d1 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -46,7 +46,7 @@ if ($action == 'set') if (! $gimcdf && ! file_exists($gimcdf)) { - setEventMessage($langs->trans("ErrorFileNotFound",$gimcdf),'errors'); + setEventMessages($langs->trans("ErrorFileNotFound",$gimcdf), null, 'errors'); $error++; } @@ -57,11 +57,11 @@ if ($action == 'set') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } } diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index cd55cddbf45..bfccacc40ac 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -63,7 +63,7 @@ if ($action == 'setvalue' && $user->admin) if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -89,7 +89,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); + setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } dol_fiche_head($head, 'ldap', $langs->trans("LDAPSetup")); diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index d24147417e3..3af47f46aac 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -77,7 +77,7 @@ if ($action == 'setvalue' && $user->admin) if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -102,7 +102,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); + setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } dol_fiche_head($head, 'contacts', $langs->trans("LDAPSetup")); diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 765a1549038..bba8f2109a3 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -68,7 +68,7 @@ if ($action == 'setvalue' && $user->admin) if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -93,7 +93,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); + setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } dol_fiche_head($head, 'groups', $langs->trans("LDAPSetup")); diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index ae92c8f38cd..720147fa353 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -92,7 +92,7 @@ if ($action == 'setvalue' && $user->admin) if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -117,7 +117,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); + setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } dol_fiche_head($head, 'members', $langs->trans("LDAPSetup")); diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 096f844436f..76d3bb9dfd0 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -78,7 +78,7 @@ if ($action == 'setvalue' && $user->admin) if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -103,7 +103,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); + setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } dol_fiche_head($head, 'users', $langs->trans("LDAPSetup")); @@ -427,7 +427,7 @@ if (function_exists("ldap_connect")) } else { - setEventMessage($ldap->error, 'errors'); + setEventMessages($ldap->error, $ldap->errors, 'errors'); } print "
\n"; diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 8949fba6d3c..823866f8ce6 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -43,7 +43,7 @@ if ($action == 'update') || $_POST["MAIN_MAX_DECIMALS_SHOWN"] > $MAXDEC) { $error++; - setEventMessage($langs->trans("ErrorDecimalLargerThanAreForbidden",$MAXDEC), 'errors'); + setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden",$MAXDEC), null, 'errors'); } if ($_POST["MAIN_MAX_DECIMALS_UNIT"] < 0 @@ -52,7 +52,7 @@ if ($action == 'update') { $langs->load("errors"); $error++; - setEventMessage($langs->trans("ErrorNegativeValueNotAllowed"), 'errors'); + setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors'); } if ($_POST["MAIN_ROUNDING_RULE_TOT"]) @@ -61,7 +61,7 @@ if ($action == 'update') { $langs->load("errors"); $error++; - setEventMessage($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), 'errors'); + setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors'); } } diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 38345adac9a..ec00cc7233c 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -6,7 +6,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent - * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2011-2015 Philippe Grand * * 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 @@ -58,11 +58,11 @@ if ($action == 'updateMask') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -75,11 +75,11 @@ if ($action == 'set_DELIVERY_FREE_TEXT') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -117,13 +117,13 @@ if ($action == 'specimen') } else { - setEventMessage($module->error,'errors'); + setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } else { - setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -148,12 +148,12 @@ if ($action == 'setModuleOptions') if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/loan.php b/htdocs/admin/loan.php index a966b751955..1cc55bd5a36 100644 --- a/htdocs/admin/loan.php +++ b/htdocs/admin/loan.php @@ -61,11 +61,11 @@ if ($action == 'update') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 8c4769780fd..541c8aa1b2d 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -64,12 +64,12 @@ if ($action == 'setvalue') if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index e3aab979a41..27d7b59553a 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -65,11 +65,11 @@ if ($action == 'update' || $action == 'add') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index c973d1a5852..90ba23d0046 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -123,7 +123,7 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml'])) $result = dol_delete_file($pathtodelete,1); if ($result) { - setEventMessage($langs->trans("FileWasRemoved"), $filetodelete); + setEventMessages(array($langs->trans("FileWasRemoved"), $filetodelete), null, 'mesgs'); include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); @@ -209,7 +209,7 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE if ($result) { - setEventMessage($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2))); + setEventMessages($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2)), null, 'mesgs'); } else { @@ -677,7 +677,7 @@ else $errormsg .= ' - '.$mail->error; } - setEventMessage($errormsg, 'errors'); + setEventMessages($errormsg, null, 'errors'); } print '
'; } diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index c0ac9a3df8c..f8b89c515aa 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -102,8 +102,7 @@ if ($action == 'update' && empty($_POST["cancel"])) else { $error++; - //TODO: Translate - setEventMessage('Failed to initialize menu '.$key.'.', 'errors'); + setEventMessages($langs->trans("FailedToInitializeMenu").' '.$key, null, 'errors'); $db->rollback(); } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c3f2da80612..a4b7423ebe8 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1532,6 +1532,7 @@ DeleteMenu=Delete menu entry ConfirmDeleteMenu=Are you sure you want to delete menu entry %s ? DeleteLine=Delete line ConfirmDeleteLine=Are you sure you want to delete this line ? +FailedToInitializeMenu=Failed to initialize menu ##### Tax ##### TaxSetup=Taxes, social or fiscal taxes and dividends module setup OptionVatMode=VAT due From 8c84ce15768a10275f11ab886118e3678d4f1bf2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Oct 2015 22:05:37 +0100 Subject: [PATCH 09/22] Create table llx_stock_serial. This table may be used to store eatby and sellby date for a couple product-batch number in one place only. --- .../install/mysql/migration/3.8.0-3.9.0.sql | 14 ++++++++ .../mysql/tables/llx_stock_lotserial.sql | 32 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_stock_lotserial.sql diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index d426cd72105..89ce9dec401 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -105,3 +105,17 @@ ALTER TABLE llx_product ADD COLUMN onportal tinyint DEFAULT 0 after tobuy; ALTER TABLE llx_user ADD COLUMN employee tinyint DEFAULT 1; + +create table llx_stock_lotserial +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + datec datetime, + tms timestamp, + fk_user_creat integer, + fk_user_modif integer, + fk_product integer NOT NULL, -- Id of product + batch varchar(30) DEFAULT NULL, -- Lot or serial number + eatby date DEFAULT NULL, -- Eatby date + sellby date DEFAULT NULL -- Sellby date +) ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_stock_lotserial.sql b/htdocs/install/mysql/tables/llx_stock_lotserial.sql new file mode 100644 index 00000000000..a9099480e42 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_stock_lotserial.sql @@ -0,0 +1,32 @@ +-- ============================================================================ +-- Copyright (C) 2015 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- This table may be used to store eatby and sellby date for a couple +-- product-batch number. +-- ============================================================================ + +create table llx_stock_lotserial +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + datec datetime, + tms timestamp, + fk_user_creat integer, + fk_user_modif integer, + fk_product integer NOT NULL, -- Id of product + batch varchar(30) DEFAULT NULL, -- Lot or serial number + eatby date DEFAULT NULL, -- Eatby date + sellby date DEFAULT NULL -- Sellby date +) ENGINE=innodb; From 8e1fd5c3edde7ac700c170f4e500ff08d0c0fd86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Oct 2015 22:25:15 +0100 Subject: [PATCH 10/22] Uniformize labels and css style --- htdocs/langs/en_US/stocks.lang | 2 +- htdocs/product/reassort.php | 4 ++-- htdocs/product/reassortlot.php | 4 ++-- htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 2ac77f8a489..a3cc5ca8f9b 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -16,7 +16,7 @@ CancelSending=Cancel sending DeleteSending=Delete sending Stock=Stock Stocks=Stocks -StocksByLotSerial=Stock by lot/serial +StocksByLotSerial=Stocks by lot/serial Movement=Movement Movements=Movements ErrorWarehouseRefRequired=Warehouse reference name is required diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index cee05f69340..9c81d03d16f 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -255,8 +255,8 @@ if ($resql) // TODO Add info of running suppliers/customers orders //print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); - print_liste_field_titre($langs->trans("Sell"),$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Buy"),$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; // Lignes des champs de filtre diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index d7f5905fbd3..48da413dfde 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -267,8 +267,8 @@ if ($resql) // TODO Add info of running suppliers/customers orders //print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); print ' '; - print_liste_field_titre($langs->trans("Sell"),$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Buy"),$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; // Lignes des champs de filtre diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 641b13030ee..ce83c4c41f2 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -237,7 +237,7 @@ body { trans("DIRECTION").";\n"; ?> } -a:link, a:visited, a:hover, a:active { font-family: ; font-weight: bold; color: #4A4A4A; text-decoration: none; } +a:link, a:visited, a:hover, a:active { font-family: ; font-weight: bold; color: #000; text-decoration: none; } a:hover { text-decoration: underline; color: #000000;} diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index a4da1e4205b..47da3176126 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -230,7 +230,7 @@ body { trans("DIRECTION").";\n"; ?> } -a:link, a:visited, a:hover, a:active { font-family: ; font-weight: bold; color: #4A4A4A; text-decoration: none; } +a:link, a:visited, a:hover, a:active { font-family: ; font-weight: bold; color: #000; text-decoration: none; } a:hover { text-decoration: underline; color: #000000;} From f5eaeb2fb5b0f82e41152cdd0f4380cd05c5afd7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Oct 2015 22:51:06 +0100 Subject: [PATCH 11/22] Some minor fixes --- htdocs/langs/en_US/stocks.lang | 6 +++--- htdocs/product/list.php | 4 ++-- htdocs/product/reassort.php | 2 +- htdocs/product/reassortlot.php | 4 ++-- htdocs/product/stock/massstockmove.php | 2 +- htdocs/product/stock/mouvement.php | 7 ++++--- htdocs/product/stock/replenish.php | 6 +++--- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index a3cc5ca8f9b..37b19c871b7 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -83,8 +83,8 @@ WarehousesAndProductsBatchDetail=Warehouses and products (with detail per lot/se AverageUnitPricePMPShort=Weighted average input price AverageUnitPricePMP=Weighted average input price SellPriceMin=Selling Unit Price -EstimatedStockValueSellShort=Value to sell -EstimatedStockValueSell=Value to Sell +EstimatedStockValueSellShort=Value for sell +EstimatedStockValueSell=Value for sell EstimatedStockValueShort=Input stock value EstimatedStockValue=Input stock value DeleteAWarehouse=Delete a warehouse @@ -113,7 +113,7 @@ AlertOnly= Alerts only WarehouseForStockDecrease=The warehouse %s will be used for stock decrease WarehouseForStockIncrease=The warehouse %s will be used for stock increase ForThisWarehouse=For this warehouse -ReplenishmentStatusDesc=This is a list of all products with a stock lower than desired stock (or lower than alert value if checkbox "alert only" is checked), and suggest you to create supplier orders to fill the difference. +ReplenishmentStatusDesc=This is a list of all products with a stock lower than desired stock (or lower than alert value if checkbox "alert only" is checked). Using the checkbox, you can create supplier orders to fill the difference. ReplenishmentOrdersDesc=This is a list of all opened supplier orders including predefined products. Only opened orders with predefined products, so orders that may affect stocks, are visible here. Replenishments=Replenishments NbOfProductBeforePeriod=Quantity of product %s in stock before selected period (< %s) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ac411cce8d5..d54db832d7e 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -327,8 +327,8 @@ else if ($user->rights->fournisseur->lire) print_liste_field_titre($langs->trans("BuyingPriceMinShort"), '', '', '', '', 'align="right"'); if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print_liste_field_titre($langs->trans("DesiredStock"), '', '', '', '', 'align="right"'); if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print_liste_field_titre($langs->trans("PhysicalStock"), '', '', '', '', 'align="right"'); - print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')', $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')', $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 9c81d03d16f..be5be86a8b8 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -53,7 +53,7 @@ $fourn_id = GETPOST("fourn_id",'int'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (! $sortfield) $sortfield="stock_physique"; +if (! $sortfield) $sortfield="p.ref"; if (! $sortorder) $sortorder="ASC"; $limit = $conf->liste_limit; $offset = $limit * $page ; diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 48da413dfde..41482c4e796 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -56,7 +56,7 @@ $fourn_id = GETPOST("fourn_id",'int'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (! $sortfield) $sortfield="stock_physique"; +if (! $sortfield) $sortfield="p.ref"; if (! $sortorder) $sortorder="ASC"; $limit = $conf->liste_limit; $offset = $limit * $page ; @@ -266,7 +266,7 @@ if ($resql) print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); // TODO Add info of running suppliers/customers orders //print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); - print ' '; + print_liste_field_titre(''); print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index ff182c69c62..604d7d30280 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -325,7 +325,7 @@ $title = $langs->trans('MassMovement'); llxHeader('', $title); -print load_fiche_titre($langs->trans("MassStockMovement")).'

'; +print load_fiche_titre($langs->trans("MassStockMovement")); $titletoadd=$langs->trans("Select"); $titletoaddnoent=$langs->transnoentitiesnoconv("Select"); diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 73ec0a9ea8b..d57213b54a8 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -504,7 +504,7 @@ if ($resql) if (empty($conf->productbatch->enabled)) print ' '; //else print '
'; $syear = $year?$year:-1; - print ''; + print ''; //print $formother->selectyear($syear,'year',1, 20, 5); print ''; // Product Ref @@ -579,10 +579,11 @@ if ($resql) print "\n"; // Product label print ''; - $productstatic->id=$objp->rowid; + /*$productstatic->id=$objp->rowid; $productstatic->ref=$objp->produit; $productstatic->type=$objp->type; - print $productstatic->getNomUrl(1,'',16); + print $productstatic->getNomUrl(1,'',16);*/ + print $productstatic->label; print "\n"; // Batch if (! empty($conf->productbatch->enabled)) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index e96e3c81a6a..620f1acbb40 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2014 Laurent Destaileur + * Copyright (C) 2013-2015 Laurent Destaileur * Copyright (C) 2014 Regis Houssin * * This program is free software: you can redistribute it and/or modify @@ -445,8 +445,8 @@ if ($usevirtualstock == 0) $stocklabel = $langs->trans('PhysicalStock'); // Lines of title -print ''; - +print ''; +print_liste_field_titre('', $_SERVER["PHP_SELF"], ''); print_liste_field_titre($langs->trans('Ref'), $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); print_liste_field_titre($langs->trans('Label'), $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); if (!empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans('Duration'), $_SERVER["PHP_SELF"], 'p.duration', $param, '', 'align="center"', $sortfield, $sortorder); From 4042c6d5cc3216808d5c9dcdcd200381f1495932 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Oct 2015 23:02:02 +0100 Subject: [PATCH 12/22] Minor fixes --- htdocs/langs/en_US/stocks.lang | 6 +++--- htdocs/product/class/product.class.php | 2 +- htdocs/product/stock/mouvement.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 37b19c871b7..943e988b2f7 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -34,9 +34,9 @@ LastMovements=Last movements Units=Units Unit=Unit StockCorrection=Correct stock -StockTransfer=Stock transfer -StockMovement=Transfer -StockMovements=Stock transfers +StockTransfer=Stock movement +StockMovement=Stock movement +StockMovements=Stock movements LabelMovement=Movement label NumberOfUnit=Number of units UnitPurchaseValue=Unit purchase price diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6860d496561..fb5eba2abc5 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2972,7 +2972,7 @@ class Product extends CommonObject * Return clicable link of object (with eventually picto) * * @param int $withpicto Add picto into link - * @param string $option Where point the link + * @param string $option Where point the link ('stock', 'composition', 'category', 'supplier', '') * @param int $maxlength Maxlength of ref * @return string String with URL */ diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index d57213b54a8..12ede4463cb 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -575,7 +575,7 @@ if ($resql) $productstatic->ref=$objp->product_ref; $productstatic->label=$objp->produit; $productstatic->type=$objp->type; - print $productstatic->getNomUrl(1,'',16); + print $productstatic->getNomUrl(1,'stock',16); print "\n"; // Product label print ''; From 7940b249f5f60b1e9edfa2dda1345c23635a6a5a Mon Sep 17 00:00:00 2001 From: jfefe Date: Thu, 29 Oct 2015 09:58:43 +0100 Subject: [PATCH 13/22] Update Readme.md Add badges to show build status and downloads per day. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 576e3153ef9..f6f4b8be34f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # DOLIBARR ERP & CRM +![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dd/dolibarr.svg) + Dolibarr ERP & CRM is a modern software to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...). It's an Open Source software (wrote in PHP language) designed for small and medium companies, foundation and freelances. From aa6b5bc1ce72647a3c33b49980f629561ba4482e Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 29 Oct 2015 13:58:16 +0100 Subject: [PATCH 14/22] [Qual] Uniformize code --- htdocs/admin/ldap_members.php | 2 +- htdocs/admin/mails.php | 2 +- htdocs/admin/modules.php | 6 +++--- htdocs/admin/notification.php | 4 ++-- htdocs/admin/payment.php | 4 ++-- htdocs/admin/prelevement.php | 4 ++-- htdocs/admin/propal.php | 28 ++++++++++++++-------------- htdocs/admin/proxy.php | 6 +++--- htdocs/admin/salaries.php | 4 ++-- htdocs/admin/security.php | 4 ++-- htdocs/admin/security_file.php | 6 +++--- htdocs/admin/security_other.php | 2 +- htdocs/admin/sms.php | 6 +++--- htdocs/admin/spip.php | 4 ++-- htdocs/admin/stock.php | 4 ++-- htdocs/admin/supplier_invoice.php | 14 +++++++------- htdocs/admin/supplier_order.php | 10 +++++----- htdocs/admin/syslog.php | 8 ++++---- htdocs/admin/taxes.php | 4 ++-- 19 files changed, 61 insertions(+), 61 deletions(-) diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index 720147fa353..bd9eda149b4 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -117,7 +117,7 @@ $head = ldap_prepare_head(); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { - setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); + setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } dol_fiche_head($head, 'members', $langs->trans("LDAPSetup")); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 90ba23d0046..271605830bc 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -213,7 +213,7 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE } else { - setEventMessage($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result,'errors'); + setEventMessages($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result, null, 'errors'); } $action=''; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index b55830dff4d..14c95aa0d2e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -66,7 +66,7 @@ $familyinfo=array( if ($action == 'set' && $user->admin) { $result=activateModule($value); - if ($result) setEventMessage($result, 'errors'); + if ($result) setEventMessages($result, null, 'errors'); header("Location: modules.php?mode=".$mode); exit; } @@ -74,7 +74,7 @@ if ($action == 'set' && $user->admin) if ($action == 'reset' && $user->admin) { $result=unActivateModule($value); - if ($result) setEventMessage($result, 'errors'); + if ($result) setEventMessages($result, null, 'errors'); header("Location: modules.php?mode=".$mode); exit; } @@ -125,7 +125,7 @@ foreach ($modulesdir as $dir) if (! empty($modNameLoaded[$modName])) { $mesg="Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.
"; - setEventMessage($mesg, 'warnings'); + setEventMessages($mesg, null, 'warnings'); dol_syslog($mesg, LOG_ERR); continue; } diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index dd97e44eb96..a7699db4292 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -93,13 +93,13 @@ if ($action == 'setvalue' && $user->admin) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 1bf794d52f8..c9bf610bd1b 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -54,11 +54,11 @@ if ($action == 'updateMask') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 56aa69e9943..f2d8c2d84dc 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -81,12 +81,12 @@ if ($action == "set") if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 41362fd5664..b4f1fe67e0b 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -59,11 +59,11 @@ if ($action == 'updateMask') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -101,13 +101,13 @@ if ($action == 'specimen') } else { - setEventMessage($module->error,'errors'); + setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } else { - setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -121,11 +121,11 @@ if ($action == 'set_PROPALE_DRAFT_WATERMARK') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -139,11 +139,11 @@ if ($action == 'set_PROPOSAL_FREE_TEXT') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -155,11 +155,11 @@ if ($action == 'setdefaultduration') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -171,11 +171,11 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -199,12 +199,12 @@ if ($action == 'setModuleOptions') if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 100da221ce6..080dafca744 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -44,12 +44,12 @@ if (GETPOST("action") == 'set_proxy') { if (GETPOST("MAIN_USE_CONNECT_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_CONNECT_TIMEOUT"))) { - setEventMessage($langs->trans("ErrorValueMustBeInteger"),'errors'); + setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors'); $error++; } if (GETPOST("MAIN_USE_RESPONSE_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_RESPONSE_TIMEOUT"))) { - setEventMessage($langs->trans("ErrorValueMustBeInteger"),'errors'); + setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors'); $error++; } @@ -68,7 +68,7 @@ if (GETPOST("action") == 'set_proxy') if (! $error) { - setEventMessage($langs->trans("RecordModifiedSuccessfully")); + setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } } diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php index 53deb9610ca..58e85dbf8d3 100644 --- a/htdocs/admin/salaries.php +++ b/htdocs/admin/salaries.php @@ -60,11 +60,11 @@ if ($action == 'update') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 397b16b1299..250a7426ff8 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -135,7 +135,7 @@ if ($action == 'activate_encryptdbpassconf') } else { - setEventMessage($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)),'warnings'); + setEventMessages($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)), null, 'warnings'); } } else if ($action == 'disable_encryptdbpassconf') @@ -152,7 +152,7 @@ else if ($action == 'disable_encryptdbpassconf') } else { - setEventMessage($langs->trans('InstrucToClearPass',$dolibarr_main_db_pass),'warnings'); + setEventMessages($langs->trans('InstrucToClearPass',$dolibarr_main_db_pass), null, 'warnings'); } } diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index a7afaf0ef0a..d1237a8c734 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -86,7 +86,7 @@ else if ($action == 'updateform') $res4=dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity); $res5=dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity); $res6=dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity); - if ($res3 && $res4 && $res5 && $res6) setEventMessage($langs->trans("RecordModifiedSuccessfully")); + if ($res3 && $res4 && $res5 && $res6) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } @@ -97,8 +97,8 @@ else if ($action == 'delete') $langs->load("other"); $file = $conf->admin->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $ret=dol_delete_file($file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); Header('Location: '.$_SERVER["PHP_SELF"]); exit; } diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 6c040e8d6d6..cd84962107d 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -76,7 +76,7 @@ else if ($action == 'updateform') { $res1=dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"],'chaine',0,'',$conf->entity); $res2=dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity); - if ($res1 && $res2) setEventMessage($langs->trans("RecordModifiedSuccessfully")); + if ($res1 && $res2) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index bad71e31dc7..604b426b800 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -88,7 +88,7 @@ if ($action == 'send' && ! $_POST['cancel']) if (! empty($formsms->error)) { - setEventMessage($formsms->error,'errors'); + setEventMessages($formsms->error, $formsms->errors, 'errors'); $action='test'; $error++; } @@ -123,11 +123,11 @@ if ($action == 'send' && ! $_POST['cancel']) if ($result) { - setEventMessage($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto)); + setEventMessages($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto), null, 'mesgs'); } else { - setEventMessage($langs->trans("ResultKo"),'errors'); + setEventMessages($langs->trans("ResultKo"), null, 'errors'); } $action=''; diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index 13d959eb38c..241062732a4 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -71,11 +71,11 @@ if ($action == 'update' || $action == 'add') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } } diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index b446f5355ad..98ff43360a8 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -96,12 +96,12 @@ if($action) if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 7e075f25c8f..c1b350edfee 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2011-2015 Philippe Grand * * 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 @@ -63,11 +63,11 @@ if ($action == 'updateMask') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -106,13 +106,13 @@ if ($action == 'specimen') // For invoices } else { - setEventMessage($module->error,'errors'); + setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } else { - setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -174,11 +174,11 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 69d518d9a61..bc25e8efa87 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2011-2015 Philippe Grand * * 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 @@ -64,11 +64,11 @@ if ($action == 'updateMask') if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -107,13 +107,13 @@ else if ($action == 'specimen') // For orders } else { - setEventMessage($module->error,'errors'); + setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } else { - setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 59921dd3687..f3cfcff9807 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -119,12 +119,12 @@ if ($action == 'set') if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($error, 'errors'); + setEventMessages($error, $errors, 'errors'); } @@ -140,11 +140,11 @@ if ($action == 'setlevel') if (! $res > 0) $error++; if (! $error) { - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index 36c2f66aa51..b1ce8ef5dab 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -98,10 +98,10 @@ if ($action == 'update') { if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"),'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } From 282972784ee3ac3874ef0ad2c0d65c48e202fe6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Oct 2015 19:18:41 +0100 Subject: [PATCH 15/22] Prepare table for budget lines --- .../install/mysql/migration/3.8.0-3.9.0.sql | 30 ++++++++++++++++++ .../install/mysql/tables/llx_budget_lines.sql | 31 +++++++++++++++++++ .../mysql/tables/llx_stock_lotserial.sql | 12 ++++--- 3 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_budget_lines.sql diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index a425ca2e3f2..94d7cd53314 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -194,3 +194,33 @@ ALTER TABLE llx_projet_task_time ADD COLUMN invoice_id integer DEFAULT NULL; ALTER TABLE llx_projet_task_time ADD COLUMN invoice_line_id integer DEFAULT NULL; +create table llx_stock_lotserial +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer, + fk_product integer NOT NULL, -- Id of product + batch varchar(30) DEFAULT NULL, -- Lot or serial number + eatby date DEFAULT NULL, -- Eatby date + sellby date DEFAULT NULL, -- Sellby date + datec datetime, + tms timestamp, + fk_user_creat integer, + fk_user_modif integer, + import_key integer +) ENGINE=innodb; + + +create table llx_budget_lines +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer NOT NULL DEFAULT 1, + label varchar(255) NOT NULL, + fk_project integer NOT NULL, + amount double(24,8) NOT NULL, + datec datetime, + tms timestamp, + fk_user_creat integer, + fk_user_modif integer, + import_key integer +)ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_budget_lines.sql b/htdocs/install/mysql/tables/llx_budget_lines.sql new file mode 100644 index 00000000000..58d900a3e14 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_budget_lines.sql @@ -0,0 +1,31 @@ +-- ============================================================================ +-- Copyright (C) 2015 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =========================================================================== + +create table llx_budget_lines +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer NOT NULL DEFAULT 1, + label varchar(255) NOT NULL, + fk_project integer NOT NULL, + amount double(24,8) NOT NULL, + datec datetime, + tms timestamp, + fk_user_creat integer, + fk_user_modif integer, + import_key integer +)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_stock_lotserial.sql b/htdocs/install/mysql/tables/llx_stock_lotserial.sql index a9099480e42..ed8a14e49d0 100644 --- a/htdocs/install/mysql/tables/llx_stock_lotserial.sql +++ b/htdocs/install/mysql/tables/llx_stock_lotserial.sql @@ -21,12 +21,14 @@ create table llx_stock_lotserial ( rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime, - tms timestamp, - fk_user_creat integer, - fk_user_modif integer, + entity integer, fk_product integer NOT NULL, -- Id of product batch varchar(30) DEFAULT NULL, -- Lot or serial number eatby date DEFAULT NULL, -- Eatby date - sellby date DEFAULT NULL -- Sellby date + sellby date DEFAULT NULL, -- Sellby date + datec datetime, + tms timestamp, + fk_user_creat integer, + fk_user_modif integer, + import_key integer ) ENGINE=innodb; From c481dc88ce63cc456201045c696bf99f06c1f8f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Oct 2015 20:25:07 +0100 Subject: [PATCH 16/22] Clean dead code --- htdocs/societe/list.php | 52 +---------------------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 0e102af33f9..732fe834728 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -147,56 +147,6 @@ if (empty($reshook)) } } -// special search -/*if ($mode == 'search') -{ - $sql = "SELECT s.rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - // We'll need this table joined to the select in order to filter by categ - if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs"; - $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; - // sall criteria - $sql.= natural_search($fields, $sall); - - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND s.rowid = ".$socid; - if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale - if ($search_categ) $sql.= " AND s.rowid = cs.fk_soc"; // Join for the needed table to filter by categ - if (! $user->rights->societe->lire || ! $user->rights->fournisseur->lire) - { - if (! $user->rights->fournisseur->lire) $sql.=" AND s.fournisseur != 1"; - } - // Insert sale filter - if ($search_sale) - { - $sql .= " AND sc.fk_user = ".$search_sale; - } - // Insert categ filter - if ($search_categ) - { - $sql .= " AND cs.fk_categorie = ".$search_categ; - } - // Filter on type of thirdparty - if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")"; - if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1"; - if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; - - $result=$db->query($sql); - if ($result) - { - if ($db->num_rows($result) == 1) - { - $obj = $db->fetch_object($result); - $socid = $obj->rowid; - header("Location: ".DOL_URL_ROOT."/societe/soc.php?socid=".$socid); - exit; - } - $db->free($result); - } -} -*/ - // Do we click on purge search criteria ? if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { @@ -584,7 +534,7 @@ if ($resql) print ''; print ''; - if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($langs->trans("Gencod"), $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder); From 2b5746aec38d620a683d3cd24ff332d73704c1e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Oct 2015 21:05:47 +0100 Subject: [PATCH 17/22] Add field position into some dictionaries tables --- htdocs/install/mysql/data/llx_c_typent.sql | 2 ++ htdocs/install/mysql/migration/3.8.0-3.9.0.sql | 3 +++ htdocs/install/mysql/tables/llx_c_forme_juridique.sql | 3 ++- htdocs/install/mysql/tables/llx_c_type_fees.sql | 3 ++- htdocs/install/mysql/tables/llx_c_typent.sql | 3 ++- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_typent.sql b/htdocs/install/mysql/data/llx_c_typent.sql index 918230cc5a3..11b512f26c2 100644 --- a/htdocs/install/mysql/data/llx_c_typent.sql +++ b/htdocs/install/mysql/data/llx_c_typent.sql @@ -31,6 +31,7 @@ -- delete from llx_c_typent; +-- Entries for all countries insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 0, 'TE_UNKNOWN', '-', NULL, 1); insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 1, 'TE_STARTUP', 'Start-up', NULL, 0); insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 2, 'TE_GROUP', 'Grand groupe', NULL, 1); @@ -41,6 +42,7 @@ insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 6, 'TE_WH insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 7, 'TE_RETAIL', 'Revendeur', NULL, 0); insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 8, 'TE_PRIVATE', 'Particulier', NULL, 1); insert into llx_c_typent (id,code,libelle,fk_country,active) values (100, 'TE_OTHER', 'Autres', NULL, 1); +-- Argentina (country 23) insert into llx_c_typent (id,code,libelle,fk_country,active) values (231, 'TE_A_RI', 'Responsable Inscripto', 23, 0); insert into llx_c_typent (id,code,libelle,fk_country,active) values (232, 'TE_B_RNI', 'Responsable No Inscripto', 23, 0); insert into llx_c_typent (id,code,libelle,fk_country,active) values (233, 'TE_C_FE', 'Consumidor Final/Exento', 23, 0); diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 94d7cd53314..82dff688eda 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -224,3 +224,6 @@ create table llx_budget_lines import_key integer )ENGINE=innodb; +ALTER TABLE llx_c_typent ADD COLUMN position integer NOT NULL DEFAULT 0; +ALTER TABLE llx_c_forme_juridique ADD COLUMN position integer NOT NULL DEFAULT 0; +ALTER TABLE llx_c_type_fees ADD COLUMN position integer NOT NULL DEFAULT 0; diff --git a/htdocs/install/mysql/tables/llx_c_forme_juridique.sql b/htdocs/install/mysql/tables/llx_c_forme_juridique.sql index 0087f371092..ea8b45bf2d7 100644 --- a/htdocs/install/mysql/tables/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/tables/llx_c_forme_juridique.sql @@ -25,6 +25,7 @@ create table llx_c_forme_juridique libelle varchar(255), isvatexempted tinyint DEFAULT 0 NOT NULL, active tinyint DEFAULT 1 NOT NULL, - module varchar(32) NULL + module varchar(32) NULL, + position integer NOT NULL DEFAULT 0 )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_type_fees.sql b/htdocs/install/mysql/tables/llx_c_type_fees.sql index e980562aff2..80bb3d9109d 100644 --- a/htdocs/install/mysql/tables/llx_c_type_fees.sql +++ b/htdocs/install/mysql/tables/llx_c_type_fees.sql @@ -25,5 +25,6 @@ create table llx_c_type_fees label varchar(30), accountancy_code varchar(32) NULL, active tinyint DEFAULT 1 NOT NULL, - module varchar(32) NULL + module varchar(32) NULL, + position integer NOT NULL DEFAULT 0 )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_typent.sql b/htdocs/install/mysql/tables/llx_c_typent.sql index 06a41727b69..d492c41ff13 100644 --- a/htdocs/install/mysql/tables/llx_c_typent.sql +++ b/htdocs/install/mysql/tables/llx_c_typent.sql @@ -24,5 +24,6 @@ create table llx_c_typent libelle varchar(30), fk_country integer NULL, -- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B) active tinyint DEFAULT 1 NOT NULL, - module varchar(32) NULL + module varchar(32) NULL, + position integer NOT NULL DEFAULT 0 )ENGINE=innodb; From 3760f247a2f21f0249cf4c1aa906c8afd66399d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Oct 2015 22:12:11 +0100 Subject: [PATCH 18/22] NEW Can now select fields to show in product list. Extrafields are also supported. --- htdocs/core/class/extrafields.class.php | 52 ++- htdocs/product/list.php | 427 ++++++++++++++++-------- htdocs/societe/class/societe.class.php | 6 +- htdocs/societe/list.php | 64 +++- htdocs/user/index.php | 59 +++- 5 files changed, 447 insertions(+), 161 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index aa2f014c7ba..55cf274e78c 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1111,7 +1111,7 @@ class ExtraFields * * @param string $key Key of attribute * @param string $value Value to show - * @param string $moreparam More param + * @param string $moreparam To add more parametes on html input tag (only checkbox use html input for output rendering) * @return string Formated value */ function showOutputField($key,$value,$moreparam='') @@ -1128,6 +1128,8 @@ class ExtraFields $perms=$this->attribute_perms[$key]; $list=$this->attribute_list[$key]; + $showsize=0; + if ($type == 'date') { $showsize=10; @@ -1357,11 +1359,59 @@ class ExtraFields $showsize=round($size); if ($showsize > 48) $showsize=48; } + //print $type.'-'.$size; $out=$value; + return $out; } + /** + * Return tag to describe alignement to use for this extrafield + * + * @param string $key Key of attribute + * @return string Formated value + */ + function getAlignFlag($key) + { + global $conf,$langs; + + $type=$this->attribute_type[$key]; + + $align=''; + + if ($type == 'date') + { + $align="center"; + } + elseif ($type == 'datetime') + { + $align="center"; + } + elseif ($type == 'int') + { + $align="right"; + } + elseif ($type == 'double') + { + $align="right"; + } + elseif ($type == 'boolean') + { + $align="center"; + } + elseif ($type == 'radio') + { + $align="center"; + } + elseif ($type == 'checkbox') + { + $align="center"; + } + + return $align; + } + /** * Return HTML string to print separator extrafield * diff --git a/htdocs/product/list.php b/htdocs/product/list.php index d54db832d7e..dc9dcb7ed58 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -56,18 +56,28 @@ $fourn_id = GETPOST("fourn_id",'int'); $catid = GETPOST('catid','int'); $optioncss = GETPOST('optioncss','alpha'); +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortfield) $sortfield="p.ref"; if (! $sortorder) $sortorder="ASC"; -$limit = $conf->liste_limit; +$contextpage='productservicelist'; +if ($type === '1') { $contextpage='servicelist'; if ($search_type=='') $search_type='1'; } +if ($type === '0') { $contextpage='productlist'; if ($search_type=='') $search_type='0'; } +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array($contextpage)); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('product'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $canvas=GETPOST("canvas"); @@ -107,15 +117,18 @@ if (! empty($conf->barcode->enabled)) { * Actions */ +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { - $sref=""; $sall=""; - $sbarcode=""; + $sref=""; $snom=""; + $sbarcode=""; $search_categ=0; $tosell=""; $tobuy=""; + $search_array_options=array(); } @@ -152,10 +165,17 @@ else } $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; - $sql.= ' p.fk_product_type, p.tms as datem,'; - $sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; + $sql.= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; + $sql.= ' p.datec as date_creation, p.tms as date_update,'; $sql.= ' MIN(pfp.unitprice) as minsellprice'; + // Add fields from extrafields + foreach ($extrafields->attribute_label as $key => $val) $sql.=",ef.".$key.' as options_'.$key; + // Add fields from hooks + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook + $sql.=$hookmanager->resPrint; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields as ef on (p.rowid = ef.fk_object)"; if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; // multilang @@ -181,11 +201,33 @@ else if ($search_categ > 0) $sql.= " AND cp.fk_categorie = ".$db->escape($search_categ); if ($search_categ == -2) $sql.= " AND cp.fk_categorie IS NULL"; if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id; + // Add where from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $typ=$extrafields->attribute_type[$tmpkey]; + $mode=0; + if (in_array($typ, array('int'))) $mode=1; // Search on a numeric + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + } + } + // Add where from hooks + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook + $sql.=$hookmanager->resPrint; $sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,"; - $sql.= " p.fk_product_type, p.tms,"; - $sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock"; + $sql.= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; + $sql.= ' p.datec, p.tms'; + // Add fields from extrafields + foreach ($extrafields->attribute_label as $key => $val) $sql.=",ef.".$key; + // Add fields from hooks + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook + $sql.=$hookmanager->resPrint; //if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet - $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { @@ -230,12 +272,24 @@ else setEventMessage($langs->trans("ProductDeleted", GETPOST('delprod'))); } - $param="&sref=".$sref.($sbarcode?"&sbarcode=".$sbarcode:"")."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy; - $param.=($fourn_id?"&fourn_id=".$fourn_id:""); - $param.=($search_categ?"&search_categ=".$search_categ:""); - $param.=isset($type)?"&type=".$type:""; + if ($sref) $param="&sref=".$sref; + if ($sbarcode) $param.=($sbarcode?"&sbarcode=".$sbarcode:""); + if ($snom) $param.="&snom=".$snom; + if ($sall) $param.="&sall=".$sall; + if ($tosell != '') $param.="&tosell=".$tosell; + if ($tobuy != '') $param.="&tobuy=".$tobuy; + if ($fourn_id) $param.=($fourn_id?"&fourn_id=".$fourn_id:""); + if ($seach_categ) $param.=($search_categ?"&search_categ=".$search_categ:""); + if ($type != '') $param.='&type='.urlencode($type); if ($optioncss != '') $param.='&optioncss='.$optioncss; - + // Add $param from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords,'title_products.png'); if (! empty($catid)) @@ -270,6 +324,7 @@ else print '
'; if ($optioncss != '') print ''; print ''; + print ''; print ''; print ''; print ''; @@ -283,13 +338,6 @@ else // Filter on categories $moreforfilter=''; - $colspan=6; - if (! empty($conf->barcode->enabled)) $colspan++; - if (! empty($conf->service->enabled) && $type != 0) $colspan++; - if (empty($conf->global->PRODUIT_MULTIPRICES)) $colspan++; - if ($user->rights->fournisseur->lire) $colspan++; - if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) $colspan+=2; - if (! empty($conf->categorie->enabled)) { $moreforfilter.='
'; @@ -307,93 +355,162 @@ else print '
'; } - // Lignes des titres - print '
'; - print ''; - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); - if (! empty($conf->barcode->enabled)) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,'','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder); - if (! empty($conf->service->enabled) && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); - if (empty($conf->global->PRODUIT_MULTIPRICES)) + if (empty($conf->global->PRODUIT_MULTIPRICES)) { - $titlefield=$langs->trans("SellingPrice"); + $titlesellprice=$langs->trans("SellingPrice"); if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - $titlefield=$form->textwithpicto($langs->trans("SellingPrice"), $langs->trans("DefaultPriceRealPriceMayDependOnCustomer")); + $titlesellprice=$form->textwithpicto($langs->trans("SellingPrice"), $langs->trans("DefaultPriceRealPriceMayDependOnCustomer")); } - print_liste_field_titre($titlefield, $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder); } - if ($user->rights->fournisseur->lire) print_liste_field_titre($langs->trans("BuyingPriceMinShort"), '', '', '', '', 'align="right"'); - if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print_liste_field_titre($langs->trans("DesiredStock"), '', '', '', '', 'align="right"'); - if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print_liste_field_titre($langs->trans("PhysicalStock"), '', '', '', '', 'align="right"'); - print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')', $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')', $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + + $arrayfields=array( + 'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), + 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>($contextpage != 'servicelist'), 'enabled'=>(! empty($conf->barcode->enabled))), + 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))), + 'p.sellprice'=>array('label'=>$titlesellprice, 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), + 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(! empty($user->rights->fournisseur->lire))), + 'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), + 'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), + 'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + 'p.tosell'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Sell").')', 'checked'=>1, 'position'=>1000), + 'p.tobuy'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Purchases").')', 'checked'=>1, 'position'=>1000) + ); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key]); + } + } + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + print '
'; + print ''; + if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"],"p.label","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.barcode']['checked'])) print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"],"p.barcode","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desirestock","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder); + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } + } + // Hook fields + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tosell']['checked'])) print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"],"p.tosell","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tobuy']['checked'])) print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"],"p.tobuy","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; - // Lignes des champs de filtre + // Lines with input filters print ''; - print ''; - print ''; + if (! empty($arrayfields['p.ref']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.label']['checked'])) + { + print ''; + } // Barcode - if (! empty($conf->barcode->enabled)) + if (! empty($arrayfields['p.barcode']['checked'])) { print ''; } - // Date modification - print ''; - // Duration - if (! empty($conf->service->enabled) && $type != 0) + if (! empty($arrayfields['p.duration']['checked'])) { print ''; } - // Sell price - if (empty($conf->global->PRODUIT_MULTIPRICES)) + if (! empty($arrayfields['p.sellprice']['checked'])) { print ''; } - // Minimum buying Price - if ($user->rights->fournisseur->lire) { - print ''; - } - - // Stock - if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) + if (! empty($arrayfields['p.minbuyprice']['checked'])) { print ''; - //desiredstock + } + // Desired stock + if (! empty($arrayfields['p.desiredstock']['checked'])) + { print ''; } - - print ''; - - print ''; - + // Stock + if (! empty($arrayfields['p.stock']['checked'])) + { + print ''; + } + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) print ''; + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['p.datec']['checked'])) + { + print ''; + } + // Date modification + if (! empty($arrayfields['p.tms']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.tosell']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.tobuy']['checked'])) + { + print ''; + } print ''; - - // Ref - print '\n"; + $product_static->status_buy = $objp->tobuy; + $product_static->status = $objp->tosell; + $var=!$var; + print ''; + + // Ref + if (! empty($arrayfields['p.ref']['checked'])) + { + print '\n"; + } + // Label - print ''; - + if (! empty($arrayfields['p.label']['checked'])) + { + print ''; + } + // Barcode - if (! empty($conf->barcode->enabled)) - { + if (! empty($arrayfields['p.barcode']['checked'])) + { print ''; } - // Modification Date - print '\n"; - // Duration - if (! empty($conf->service->enabled) && $type != 0) + if (! empty($arrayfields['p.duration']['checked'])) { print ''; } - // Show stock - if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) + if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) // To optimize call of load_stock { if ($objp->fk_product_type != 1) { $product_static->id = $objp->rowid; $product_static->load_stock(); - print ''; - print ''; - } - else - { - print ''; - print ''; } } - - $product_static->status_buy = $objp->tobuy; - $product_static->status = $objp->tosell; + + // Desired stock + if (! empty($arrayfields['p.desiredstock']['checked'])) + { + print ''; + print ''; + } + + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); + print ''; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['p.datec']['checked'])) + { + print ''; + } + // Date modification + if (! empty($arrayfields['p.tms']['checked'])) + { + print ''; + } + // Status (to sell) - print ''; - + if (! empty($arrayfields['p.tosell']['checked'])) + { + print ''; + } // Status (to buy) - print ''; - + if (! empty($arrayfields['p.tobuy']['checked'])) + { + print ''; + } + // Action print ''; print "\n"; $i++; } - $param="&sref=".$sref.($sbarcode?"&sbarcode=".$sbarcode:"")."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy; - $param.=($fourn_id?"&fourn_id=".$fourn_id:""); - $param.=($search_categ?"&search_categ=".$search_categ:""); - $param.=isset($type)?"&type=".$type:""; print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', '', '', 'paginationatbottom'); $db->free($resql); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index fb99f819af2..57049610390 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1760,7 +1760,7 @@ class Societe extends CommonObject if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; - if ($conf->global->SOCIETE_ADD_REF_IN_LIST && (!empty($withpicto))) + if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto))) { if (($this->client) && (! empty ( $this->code_client ))) { $code = $this->code_client . ' - '; @@ -1771,9 +1771,7 @@ class Societe extends CommonObject $name =$code.' '.$name; } - if (!empty($this->name_alias)) { - $name .= ' ('.$this->name_alias.')'; - } + if (!empty($this->name_alias)) $name .= ' ('.$this->name_alias.')'; $result=''; $label=''; $link=''; $linkend=''; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 732fe834728..6c554aa5137 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -75,13 +75,14 @@ $optioncss=GETPOST('optioncss','alpha'); $mode=GETPOST("mode"); $action=GETPOST('action'); +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield=GETPOST("sortfield",'alpha'); $sortorder=GETPOST("sortorder",'alpha'); $page=GETPOST("page",'int'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="s.nom"; if ($page == -1) { $page = 0 ; } -$offset = $conf->liste_limit * $page ; +$offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; @@ -296,13 +297,13 @@ if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; // We'll need these fields in order to filter by categ if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_soc"; // Add fields from extrafields -foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +foreach ($extrafields->attribute_label as $key => $val) $sql.=",ef.".$key.' as options_'.$key; // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; -if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays) "; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent) "; $sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st"; @@ -529,6 +530,14 @@ if ($resql) 's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 's.status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); + } + } $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields print '
'; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; - print ' '; - print ''; print ' '; print ''; print ''; - print ' '; - print ''; print ' '; print ''; print ' '; print ''; - print $form->selectarray('tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$tosell,1); - print ''; - print $form->selectarray('tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$tobuy,1); - print ''; + print ' '; + print ''; + print ''; + print ''; + print $form->selectarray('tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$tosell,1); + print ''; + print $form->selectarray('tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$tobuy,1); + print ''; print ''; print ''; @@ -427,32 +544,38 @@ else } } - $var=!$var; - print '
'; $product_static->id = $objp->rowid; $product_static->ref = $objp->ref; $product_static->label = $objp->label; $product_static->type = $objp->fk_product_type; - print $product_static->getNomUrl(1,'',24); - print "
'; + print $product_static->getNomUrl(1,'',24); + print "'.dol_trunc($objp->label,40).''.dol_trunc($objp->label,40).''.$objp->barcode.''.dol_print_date($db->jdate($objp->datem),'day')."'; if (preg_match('/([0-9]+)[a-z]/i',$objp->duration)) @@ -468,7 +591,7 @@ else } // Sell price - if (empty($conf->global->PRODUIT_MULTIPRICES)) + if (! empty($arrayfields['p.sellprice']['checked'])) { print ''; if ($objp->tosell) @@ -480,7 +603,7 @@ else } // Better buy price - if ($user->rights->fournisseur->lire) + if (! empty($arrayfields['p.minbuyprice']['checked'])) { print ''; if ($objp->tobuy && $objp->minsellprice != '') @@ -502,62 +625,102 @@ else print ''; - print $objp->desiredstock; - print ''; - if ($product_static->stock_reel < $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' '; - print $product_static->stock_reel; - print ''; - print ' '; - print ''; - print ' '; - print ''; + if ($objp->fk_product_type != 1) + { + print $objp->desiredstock; + } + } + // Stock + if (! empty($arrayfields['p.stock']['checked'])) + { + print ''; + if ($objp->fk_product_type != 1) + { + if ($product_static->stock_reel < $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' '; + print $product_static->stock_reel; + } + print ''; + print dol_print_date($objp->date_creation, 'dayhour'); + print ''; + print dol_print_date($objp->date_update, 'dayhour'); + print ''; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); - } else { - print $product_static->LibStatut($objp->tosell,5,0); - } - print ''; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); + } else { + print $product_static->LibStatut($objp->tosell,5,0); + } + print ''; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); - } else { - print $product_static->LibStatut($objp->tobuy,5,1); - } - print ''; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); + } else { + print $product_static->LibStatut($objp->tobuy,5,1); + } + print ' 
'; @@ -554,14 +563,15 @@ if ($resql) if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder); // Extra fields - if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_list as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if ($val) - { - if (! empty($arrayfields["ef.".$key]['checked'])) print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,"",$sortfield,$sortorder); - } + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } } } // Hook fields @@ -740,7 +750,18 @@ if ($resql) print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2); print ''; } - + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print ''; + } + } + } // Fields from hook $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook @@ -879,18 +900,21 @@ if ($resql) if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { $companystatic->name=$langs->trans("Customer"); + $companystatic->name_alias=''; $s.=$companystatic->getNomUrl(0,'customer'); } if (($obj->client==2 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { if ($s) $s.=" / "; $companystatic->name=$langs->trans("Prospect"); - $s.=$companystatic->getNomUrl(0,'prospect'); + $companystatic->name_alias=''; + $s.=$companystatic->getNomUrl(0,'prospect'); } if (! empty($conf->fournisseur->enabled) && $obj->fournisseur) { if ($s) $s.=" / "; $companystatic->name=$langs->trans("Supplier"); + $companystatic->name_alias=''; $s.=$companystatic->getNomUrl(0,'supplier'); } print $s; @@ -916,7 +940,23 @@ if ($resql) } print ''; } - + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + } + } + } // Fields from hook $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 6b618552dc6..3af01d29046 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -55,14 +55,14 @@ $optioncss = GETPOST('optioncss','alpha'); if ($search_statut == '') $search_statut='1'; +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = $conf->liste_limit; if (! $sortfield) $sortfield="u.login"; if (! $sortorder) $sortorder="ASC"; @@ -93,6 +93,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_datepreviouslogin=""; $search_date_creation=""; $search_date_update=""; + $search_array_options=array(); } // List of fields to search into when doing a "search in all" @@ -135,12 +136,13 @@ $sql.= " u.tms as date_update, u.datec as date_creation,"; $sql.= " u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2, u2.admin as admin2, u2.fk_soc as fk_soc2, u2.email as email2, u2.gender as gender2, u2.photo as photo2, u2.entity as entity2,"; $sql.= " s.nom as name, s.canvas"; // Add fields from extrafields -foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +foreach ($extrafields->attribute_label as $key => $val) $sql.=",ef.".$key.' as options_'.$key; // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user_extrafields as ef on (u.rowid = ef.fk_object)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u2 ON u.fk_user = u2.rowid"; if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && (! empty($conf->multicompany->transverse_mode) || (! empty($user->admin) && empty($user->entity)))) @@ -236,6 +238,14 @@ if ($result) 'u.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'u.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); + } + } $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields print '
'; + print '
'; @@ -251,17 +261,18 @@ if ($result) if (! empty($arrayfields['u.datelastlogin']['checked'])) print_liste_field_titre($langs->trans("LastConnexion"),$_SERVER['PHP_SELF'],"u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['u.datepreviouslogin']['checked'])) print_liste_field_titre($langs->trans("PreviousConnexion"),$_SERVER['PHP_SELF'],"u.datepreviouslogin",$param,"",'align="center"',$sortfield,$sortorder); // Extra fields - if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_list as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if ($val) - { - if (! empty($arrayfields["ef.".$key]['checked'])) print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,"",$sortfield,$sortorder); - } + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } } } - // Hook fields + // Hook fields $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -313,7 +324,14 @@ if ($result) { print ''; } - + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) print ''; + } + } // Fields from hook $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook @@ -480,11 +498,28 @@ if ($result) print ''; } + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + } + } + } // Fields from hook $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - // Date creation + // Date creation if (! empty($arrayfields['u.datec']['checked'])) { print '
'.dol_print_date($db->jdate($obj->datepreviouslogin),"dayhour").''; From 6cc3df7e71931c3016a51e08229c6216ce106ba4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Oct 2015 08:35:56 +0100 Subject: [PATCH 19/22] NEW Quick searh filter works on invoice, proposal, order, intervention, contract --- htdocs/core/ajax/selectsearchbox.php | 50 ++++++++++++++----- htdocs/fourn/commande/list.php | 2 +- .../install/mysql/migration/3.8.0-3.9.0.sql | 30 ++++++++++- htdocs/install/mysql/tables/llx_budget.sql | 33 ++++++++++++ .../mysql/tables/llx_budget_lines.key.sql | 27 ++++++++++ .../install/mysql/tables/llx_budget_lines.sql | 3 +- htdocs/langs/en_US/main.lang | 20 +++++--- 7 files changed, 143 insertions(+), 22 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_budget.sql create mode 100644 htdocs/install/mysql/tables/llx_budget_lines.key.sql diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index a7149400f80..f4db125ca78 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -42,47 +42,73 @@ $arrayresult=array(); // Define $searchform if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) { - $langs->load("companies"); - //$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'sall', 'T', 'searchleftt', img_object('','company')); $arrayresult['searchintothirdparty']=array('text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire) { - $langs->load("companies"); - //$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'sall', 'A', 'searchleftc', img_object('','contact')); $arrayresult['searchintocontact']=array('text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue)); } if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) { - $langs->load("products"); - //$searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', $langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P', 'searchleftp', img_object('','product')); $arrayresult['searchintoproduct']=array('text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire) { - $langs->load("projects"); - //$searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub')); $arrayresult['searchintoprojects']=array('text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue)); } if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) { - $langs->load("members"); - //$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', $langs->trans("Members"), 'member', 'sall', 'M', 'searchleftm', img_object('','user')); $arrayresult['searchintomember']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->user->user->lire) { - $langs->load("users"); - //$searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub')); $arrayresult['searchintouser']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue)); } +if (! empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) +{ + $arrayresult['searchintoinvoice']=array('text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode($search_boxvalue)); +} + +if (! empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire) +{ + $arrayresult['searchintoorder']=array('text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php?sall='.urlencode($search_boxvalue)); +} + +if (! empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire) +{ + $arrayresult['searchintopropal']=array('text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode($search_boxvalue)); +} + +if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire) +{ + $arrayresult['searchintosupplierinvoice']=array('text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode($search_boxvalue)); +} +if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire) +{ + $arrayresult['searchintosupplierorder']=array('text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode($search_boxvalue)); +} +if (! empty($conf->askpricesupplier->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->askpricesupplier->lire) +{ + $arrayresult['searchintosupplierpropal']=array('text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/askpricesupplier/list.php?sall='.urlencode($search_boxvalue)); +} + +if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire) +{ + $arrayresult['searchintointervention']=array('text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue)); +} +if (! empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire) +{ + $arrayresult['searchintocontract']=array('text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode($search_boxvalue)); +} + + /* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLOYEE) && $user->rights->hrm->employee->read) { diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 768854063dd..6681b580861 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -38,13 +38,13 @@ $langs->load("orders"); $langs->load("sendings"); +$sall=GETPOST('search_all'); $search_ref=GETPOST('search_ref'); $search_refsupp=GETPOST('search_refsupp'); $search_company=GETPOST('search_company'); $search_user=GETPOST('search_user'); $search_ht=GETPOST('search_ht'); $search_ttc=GETPOST('search_ttc'); -$sall=GETPOST('search_all'); $search_status=(GETPOST('search_status','alpha')!=''?GETPOST('search_status','alpha'):GETPOST('statut','alpha')); // alpha and not intbecause it can be '6,7' $optioncss = GETPOST('optioncss','alpha'); diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 82dff688eda..dac62a2a4b8 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -210,11 +210,28 @@ create table llx_stock_lotserial ) ENGINE=innodb; -create table llx_budget_lines + +create table llx_budget ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer NOT NULL DEFAULT 1, label varchar(255) NOT NULL, + status integer, + note text, + date_start date, + date_end date, + datec datetime, + tms timestamp, + fk_user_creat integer, + fk_user_modif integer, + import_key integer +)ENGINE=innodb; + + +create table llx_budget_lines +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_budget integer NOT NULL, fk_project integer NOT NULL, amount double(24,8) NOT NULL, datec datetime, @@ -224,6 +241,17 @@ create table llx_budget_lines import_key integer )ENGINE=innodb; +ALTER TABLE llx_budget_lines ADD UNIQUE INDEX uk_budget_lines (fk_budget, fk_project); + +-- Supprime orphelins pour permettre montee de la cle +-- MYSQL V4 DELETE llx_budget_lines FROM llx_budget_lines LEFT JOIN llx_budget ON llx_budget.rowid = llx_budget_lines.fk_budget WHERE llx_budget_lines.rowid IS NULL; +-- POSTGRESQL V8 DELETE FROM llx_budget_lines USING llx_budget WHERE llx_budget_lines.fk_budget NOT IN (SELECT llx_budget.rowid FROM llx_budget); + +ALTER TABLE llx_budget_lines ADD INDEX idx_budget_lines (fk_projet); +ALTER TABLE llx_budget_lines ADD CONSTRAINT fk_budget_lines_budget FOREIGN KEY (fk_budget) REFERENCES llx_budget (rowid); + + + ALTER TABLE llx_c_typent ADD COLUMN position integer NOT NULL DEFAULT 0; ALTER TABLE llx_c_forme_juridique ADD COLUMN position integer NOT NULL DEFAULT 0; ALTER TABLE llx_c_type_fees ADD COLUMN position integer NOT NULL DEFAULT 0; diff --git a/htdocs/install/mysql/tables/llx_budget.sql b/htdocs/install/mysql/tables/llx_budget.sql new file mode 100644 index 00000000000..aeb60cd1ce5 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_budget.sql @@ -0,0 +1,33 @@ +-- ============================================================================ +-- Copyright (C) 2015 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =========================================================================== + +create table llx_budget +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer NOT NULL DEFAULT 1, + label varchar(255) NOT NULL, + status integer, + note text, + date_start date, + date_end date, + datec datetime, + tms timestamp, + fk_user_creat integer, + fk_user_modif integer, + import_key integer +)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_budget_lines.key.sql b/htdocs/install/mysql/tables/llx_budget_lines.key.sql new file mode 100644 index 00000000000..9a9771570b1 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_budget_lines.key.sql @@ -0,0 +1,27 @@ +-- =================================================================== +-- Copyright (C) 2015 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_budget_lines ADD UNIQUE INDEX uk_budget_lines (fk_budget, fk_project); + +-- Supprime orphelins pour permettre montee de la cle +-- MYSQL V4 DELETE llx_budget_lines FROM llx_budget_lines LEFT JOIN llx_budget ON llx_budget.rowid = llx_budget_lines.fk_budget WHERE llx_budget_lines.rowid IS NULL; +-- POSTGRESQL V8 DELETE FROM llx_budget_lines USING llx_budget WHERE llx_budget_lines.fk_budget NOT IN (SELECT llx_budget.rowid FROM llx_budget); + +ALTER TABLE llx_budget_lines ADD INDEX idx_budget_lines (fk_project); +ALTER TABLE llx_budget_lines ADD CONSTRAINT fk_budget_lines_budget FOREIGN KEY (fk_budget) REFERENCES llx_budget (rowid); diff --git a/htdocs/install/mysql/tables/llx_budget_lines.sql b/htdocs/install/mysql/tables/llx_budget_lines.sql index 58d900a3e14..c5d3d3a4bf2 100644 --- a/htdocs/install/mysql/tables/llx_budget_lines.sql +++ b/htdocs/install/mysql/tables/llx_budget_lines.sql @@ -19,8 +19,7 @@ create table llx_budget_lines ( rowid integer AUTO_INCREMENT PRIMARY KEY, - entity integer NOT NULL DEFAULT 1, - label varchar(255) NOT NULL, + fk_budget integer NOT NULL, fk_project integer NOT NULL, amount double(24,8) NOT NULL, datec datetime, diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 648ce25b9ce..4837a966394 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -752,9 +752,17 @@ ShortSaturday=S ShortSunday=S SelectMailModel=Select email template SetRef=Set ref -SearchIntoThirdparties=Search %s into thirdparties -SearchIntoContacts=Search %s into contacts -SearchIntoMembers=Search %s into members -SearchIntoUsers=Search %s into users -SearchIntoProductsOrServices=Search %s into products or services -SearchIntoProjects=Search %s into projects \ No newline at end of file +SearchIntoThirdparties=Thirdparties +SearchIntoContacts=Contacts +SearchIntoMembers=Members +SearchIntoUsers=Users +SearchIntoProductsOrServices=Products or services +SearchIntoProjects=Projects +SearchIntoCustomerInvoices=Customer invoices +SearchIntoSupplierInvoices=Supplier invoices +SearchIntoCustomerOrders=Customer orders +SearchIntoSupplierOrders=Supplier orders +SearchIntoCustomerProposals=Customer proposals +SearchIntoSupplierProposals=Supplier proposals +SearchIntoInterventions=Interventions +SearchIntoContracts=Contracts From 2c682022cf843d879a3e181ac73fae85a5317a68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Oct 2015 09:36:57 +0100 Subject: [PATCH 20/22] NEW The search box and the bookmarks are now rendered by the menu manager. --- htdocs/comm/propal/index.php | 6 ++-- htdocs/commande/index.php | 6 ++-- htdocs/contrat/index.php | 8 ++--- htdocs/core/menus/standard/auguria.lib.php | 36 +++++++++++++++++---- htdocs/core/menus/standard/auguria_menu.php | 5 +-- htdocs/core/menus/standard/eldy.lib.php | 29 ++++++++++++++--- htdocs/core/menus/standard/eldy_menu.php | 5 +-- htdocs/core/menus/standard/empty.php | 13 +++++--- htdocs/fichinter/index.php | 8 ++--- htdocs/fourn/commande/index.php | 6 ++-- htdocs/main.inc.php | 33 ++++++++----------- 11 files changed, 96 insertions(+), 59 deletions(-) diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 1bcbec9723d..4b03cb48429 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -66,11 +66,9 @@ $var=false; print ''; print ''; print ''; -print ''; +print ''; print ''; -print ''; -print ''; +print $langs->trans("Proposal").':'; print "
'.$langs->trans("SearchPropal").'
'.$langs->trans("Search").'
'; -print $langs->trans("Ref").':
'.$langs->trans("Other").':

\n"; diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index f9fe17ac1c2..8aa5ce64655 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -67,11 +67,9 @@ $var=false; print '
'; print ''; print ''; -print ''; +print ''; print ''; -print ''; -print ''; +print $langs->trans("CustomerOrder").':'; print "
'.$langs->trans("SearchOrder").'
'.$langs->trans("Search").'
'; -print $langs->trans("Ref").':
'.$langs->trans("Other").':

\n"; diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 3a7b5667db5..c3972bab2f7 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -79,12 +79,10 @@ if (! empty($conf->contrat->enabled)) print '
'; print ''; print ''; - print ''; + print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; print "
'.$langs->trans("SearchAContract").'
'.$langs->trans("Search").'
'.$langs->trans("Ref").':
'.$langs->trans("Other").':
'.$langs->trans("Contract").':
\n"; print "
"; } diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 1cafd091521..9623958188d 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -205,14 +205,15 @@ function print_end_menu_array_auguria() * @param DoliDB $db Database handler * @param array $menu_array_before Table of menu entries to show before entries of menu handler * @param array $menu_array_after Table of menu entries to show after entries of menu handler - * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all) + * @param array $moredata An array with more data to output * @return int Nb of entries */ -function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu,$noout=0,$forcemainmenu='',$forceleftmenu='') +function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu,$noout=0,$forcemainmenu='',$forceleftmenu='',$moredata=null) { global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc; @@ -245,6 +246,16 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM print ''."\n"; } + if (is_array($moredata) && ! empty($moredata['searchform'])) + { + print "\n"; + print "\n"; + print '
'."\n"; + print $moredata['searchform']; + print '
'."\n"; + print "\n"; + } + // We update newmenu with entries found into database $menuArbo = new Menubase($db,'auguria'); $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu); @@ -348,7 +359,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM // Show menu if (empty($noout)) { - $alt=0; $blockvmenuopened=false; + $alt=0; $altok=0; $blockvmenuopened=false; $num=count($menu_array); for ($i = 0; $i < $num; $i++) { @@ -358,14 +369,15 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM $alt++; if (empty($menu_array[$i]['level']) && $showmenu) { + $altok++; $blockvmenuopened=true; - if (($alt%2==0)) + if ($altok % 2 == 0) { - print '
'."\n"; + print '
'."\n"; } else { - print '
'."\n"; + print '
'."\n"; } } @@ -437,8 +449,20 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM if ($blockvmenuopened) { print "
\n"; $blockvmenuopened=false; } } } + + if ($altok) print '
'; } + if (is_array($moredata) && ! empty($moredata['bookmarks'])) + { + print "\n"; + print "\n"; + print '
'."\n"; + print $moredata['bookmarks']; + print '
'."\n"; + print "\n"; + } + return count($menu_array); } diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index b54c746388e..a7c701aaeff 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -158,9 +158,10 @@ class MenuManager * Show menu * * @param string $mode 'top', 'left', 'jmobile' + * @param array $moredata An array with more data to output * @return string */ - function showmenu($mode) + function showmenu($mode, $moredata=null) { global $conf, $langs, $user; @@ -176,7 +177,7 @@ class MenuManager $this->menu=new Menu(); if ($mode == 'top') print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0); - if ($mode == 'left') print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0); + if ($mode == 'left') print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0,'','',$moredata); if ($mode == 'jmobile') { print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 49c076de4c8..099d65f7f95 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -409,14 +409,15 @@ function print_end_menu_array() * @param DoliDB $db Database handler * @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) * @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) - * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all) + * @param array $moredata An array with more data to output * @return int nb of menu entries */ -function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu,$noout=0,$forcemainmenu='',$forceleftmenu='') +function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu,$noout=0,$forcemainmenu='',$forceleftmenu='',$moredata=null) { global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc; @@ -449,6 +450,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu print '
'."\n"; } + if (is_array($moredata) && ! empty($moredata['searchform'])) + { + print "\n"; + print "\n"; + print '
'."\n"; + print $moredata['searchform']; + print '
'."\n"; + print "\n"; + } + /** * We update newmenu with entries found into database * -------------------------------------------------- @@ -1407,11 +1418,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $blockvmenuopened=true; if ($altok % 2 == 0) { - print '
'."\n"; + print '
'."\n"; } else { - print '
'."\n"; + print '
'."\n"; } } @@ -1484,6 +1495,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if ($altok) print '
'; } + if (is_array($moredata) && ! empty($moredata['bookmarks'])) + { + print "\n"; + print "\n"; + print '
'."\n"; + print $moredata['bookmarks']; + print '
'."\n"; + print "\n"; + } + return count($menu_array); } diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index fc66eef7fd6..4326de6d98f 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -112,9 +112,10 @@ class MenuManager * Show menu * * @param string $mode 'top', 'left', 'jmobile' + * @param array $moredata An array with more data to output * @return string */ - function showmenu($mode) + function showmenu($mode, $moredata=null) { global $conf, $langs, $user; @@ -132,7 +133,7 @@ class MenuManager if (empty($conf->global->MAIN_MENU_INVERT)) { if ($mode == 'top') print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0); - if ($mode == 'left') print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0); + if ($mode == 'left') print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0,'','',$moredata); } else { diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 5c428ca9f13..e1b240a8e5e 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -61,9 +61,10 @@ class MenuManager * Show menu * * @param string $mode 'top', 'left', 'jmobile' + * @param array $moredata An array with more data to output * @return string */ - function showmenu($mode) + function showmenu($mode, $moredata=null) { global $user,$conf,$langs,$dolibarr_main_db_name; @@ -133,20 +134,22 @@ class MenuManager if (empty($noout)) { - $alt=0; + $alt=0; $altok=0; $blockvmenuopened=false; $num=count($this->menu->liste); for ($i = 0; $i < $num; $i++) { $alt++; if (empty($this->menu->liste[$i]['level'])) { + $altok++; + $blockvmenuopened=true; if (($alt%2==0)) { - print '
'."\n"; + print '
'."\n"; } else { - print '
'."\n"; + print '
'."\n"; } } @@ -201,6 +204,8 @@ class MenuManager print "
\n"; } } + + if ($altok) print '
'; } if ($mode == 'jmobile') diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 81a2db9621c..03b217f9a91 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Charlie Benke @@ -67,11 +67,9 @@ $var=false; print ''; print ''; print ''; -print ''; +print ''; print ''; -print ''; -print ''; +print $langs->trans("Intervention").':'; print "
'.$langs->trans("SearchAnIntervention").'
'.$langs->trans("Search").'
'; -print $langs->trans("Ref").':
'.$langs->trans("Other").':

\n"; diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index cb91a65b341..c9de3c6a340 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -61,11 +61,9 @@ $var=false; print '
'; print ''; print ''; -print ''; +print ''; print ''; -print ''; -print ''; +print $langs->trans("SupplierOrder").':'; print "
'.$langs->trans("SearchOrder").'
'.$langs->trans("Search").'
'; -print $langs->trans("Ref").':
'.$langs->trans("Other").':

\n"; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index dd4cd684970..b15cc6af213 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1543,13 +1543,13 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a * @param string $helppagename Name of wiki page for help ('' by default). * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage * For other external page: http://server/url - * @param string $moresearchform Search Form Permanent Supplemental + * @param string $notused Deprecated. Used in past to add content into left menu. Hooks can be used now. * @param array $menu_array_after Table of menu entries to show after entries of menu handler * @param int $leftmenuwithoutmainarea Must be set to 1. 0 by default for backward compatibility with old modules. * @param string $title Title of web page * @return void */ -function left_menu($menu_array_before, $helppagename='', $moresearchform='', $menu_array_after='', $leftmenuwithoutmainarea=0, $title='') +function left_menu($menu_array_before, $helppagename='', $notused='', $menu_array_after='', $leftmenuwithoutmainarea=0, $title='') { global $user, $conf, $langs, $db, $form; global $hookmanager, $menumanager; @@ -1644,13 +1644,8 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me print '
'."\n\n"; - $menumanager->menu_array = $menu_array_before; - $menumanager->menu_array_after = $menu_array_after; - $menumanager->showmenu('left'); // output menu_array and menu found in database - - - // Show other forms - if ($searchform) + // Show other forms + /*if ($searchform) { print "\n"; print "\n"; @@ -1658,15 +1653,14 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me print $searchform; print '
'."\n"; print "\n"; - } + }*/ - // More search form - if ($moresearchform) - { - print $moresearchform; - } + $menumanager->menu_array = $menu_array_before; + $menumanager->menu_array_after = $menu_array_after; + $menumanager->showmenu('left', array('searchform'=>$searchform, 'bookmarks'=>$bookmarks)); // output menu_array and menu found in database // Bookmarks + /* if ($bookmarks) { print "\n"; @@ -1675,13 +1669,14 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me print $bookmarks; print '
'."\n"; print "\n"; - } + }*/ - print "\n"; - print "\n"; + // Dolibarr version + help + bug report link + print "\n"; + print "\n"; print '
'."\n"; - //Dolibarr version + // Version $doliurl='http://www.dolibarr.org'; //local communities if (preg_match('/fr/i',$langs->defaultlang)) $doliurl='http://www.dolibarr.fr'; From 59714e4b32dae41aaa63f2945c4f82a9366d03ab Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 30 Oct 2015 12:41:36 +0100 Subject: [PATCH 21/22] Fix : migration wrong index --- htdocs/install/mysql/migration/3.8.0-3.9.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index dac62a2a4b8..4f1e308b370 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -247,7 +247,7 @@ ALTER TABLE llx_budget_lines ADD UNIQUE INDEX uk_budget_lines (fk_budget, fk_pro -- MYSQL V4 DELETE llx_budget_lines FROM llx_budget_lines LEFT JOIN llx_budget ON llx_budget.rowid = llx_budget_lines.fk_budget WHERE llx_budget_lines.rowid IS NULL; -- POSTGRESQL V8 DELETE FROM llx_budget_lines USING llx_budget WHERE llx_budget_lines.fk_budget NOT IN (SELECT llx_budget.rowid FROM llx_budget); -ALTER TABLE llx_budget_lines ADD INDEX idx_budget_lines (fk_projet); +ALTER TABLE llx_budget_lines ADD INDEX idx_budget_lines (fk_project); ALTER TABLE llx_budget_lines ADD CONSTRAINT fk_budget_lines_budget FOREIGN KEY (fk_budget) REFERENCES llx_budget (rowid); From 975fe064ae812eb68fc63916ef8aac8dd3677dc9 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Fri, 30 Oct 2015 21:59:22 +0100 Subject: [PATCH 22/22] [Qual] Uniformize code --- htdocs/barcode/codeinit.php | 6 +++--- htdocs/barcode/printsheet.php | 10 +++++----- htdocs/bookmarks/admin/bookmark.php | 4 ++-- htdocs/bookmarks/card.php | 8 ++++---- htdocs/bookmarks/list.php | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 9251b5e7ac9..db662b6d9e4 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -92,7 +92,7 @@ if ($action == 'initbarcodeproducts') if (! is_object($modBarCodeProduct)) { $error++; - setEventMessage($langs->trans("NoBarcodeNumberingTemplateDefined"),'errors'); + setEventMessages($langs->trans("NoBarcodeNumberingTemplateDefined"), null, 'errors'); } if (! $error) @@ -109,7 +109,7 @@ if ($action == 'initbarcodeproducts') $resql=$db->query($sql); if ($resql) { - setEventMessage($langs->trans("AllBarcodeReset"),'mesgs'); + setEventMessages($langs->trans("AllBarcodeReset"), null, 'mesgs'); } else { @@ -160,7 +160,7 @@ if ($action == 'initbarcodeproducts') if (! $error) { - setEventMessage($langs->trans("RecordsModified",$nbok),'mesgs'); + setEventMessages($langs->trans("RecordsModified",$nbok), null, 'mesgs'); } } diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index f974bbec897..5cd45467f01 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -68,7 +68,7 @@ if (GETPOST('submitproduct') && GETPOST('submitproduct')) if (empty($forbarcode) || empty($fk_barcode_type)) { - setEventMessage($langs->trans("DefinitionOfBarCodeForProductNotComplete",$producttmp->getNomUrl()), 'warnings'); + setEventMessages($langs->trans("DefinitionOfBarCodeForProductNotComplete",$producttmp->getNomUrl()), null, 'warnings'); } } } @@ -85,7 +85,7 @@ if (GETPOST('submitthirdparty') && GETPOST('submitthirdparty')) if (empty($forbarcode) || empty($fk_barcode_type)) { - setEventMessage($langs->trans("DefinitionOfBarCodeForProductNotComplete",$thirdpartytmp->getNomUrl()), 'warnings'); + setEventMessages($langs->trans("DefinitionOfBarCodeForProductNotComplete",$thirdpartytmp->getNomUrl()), null, 'warnings'); } } } @@ -114,7 +114,7 @@ if ($action == 'builddoc') if ($result <= 0) { $error++; - setEventMessage('Failed to get bar code type information '.$stdobject->error, 'errors'); + setEventMessages('Failed to get bar code type information '.$stdobject->error, $stdobject->errors, 'errors'); } } @@ -158,13 +158,13 @@ if ($action == 'builddoc') if ($result <= 0 || ! dol_is_file($barcodeimage)) { $error++; - setEventMessage('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), 'errors'); + setEventMessages('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), null, 'errors'); } } else { $error++; - setEventMessage("Error, encoding ".$encoding." is not supported by encoder ".$generator.'. You must choose another barcode type or install a barcode generation engine that support '.$encoding, 'errors'); + setEventMessages("Error, encoding ".$encoding." is not supported by encoder ".$generator.'. You must choose another barcode type or install a barcode generation engine that support '.$encoding, null, 'errors'); } } else { $template = 'tcpdflabel'; diff --git a/htdocs/bookmarks/admin/bookmark.php b/htdocs/bookmarks/admin/bookmark.php index 05691a227b7..bd249055773 100644 --- a/htdocs/bookmarks/admin/bookmark.php +++ b/htdocs/bookmarks/admin/bookmark.php @@ -42,12 +42,12 @@ if ($action == 'setvalue') if (! $error) { $db->commit(); - setEventMessage($langs->trans("SetupSaved")); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessage($langs->trans("Error"), 'errors'); + setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 33a0f383fde..daacc4ca4da 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -78,12 +78,12 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update') if (! $title) { $error++; - setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->trans("BookmarkTitle")), 'errors'); + setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("BookmarkTitle")), null, 'errors'); } if (! $url) { $error++; - setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->trans("UrlOrLink")), 'errors'); + setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("UrlOrLink")), null, 'errors'); } if (! $error) @@ -104,11 +104,11 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update') if ($bookmark->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - setEventMessage($langs->transnoentities("WarningBookmarkAlreadyExists"), 'warnings'); + setEventMessages($langs->transnoentities("WarningBookmarkAlreadyExists"), null, 'warnings'); } else { - setEventMessage($bookmark->error, 'errors'); + setEventMessages($bookmark->error, $bookmark->errors, 'errors'); } $action = $invertedaction; } diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index f8b7c21863d..425ae0079b6 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -60,7 +60,7 @@ if ($_GET["action"] == 'delete') } else { - setEventMessage($bookmark->error, 'errors'); + setEventMessages($bookmark->error, $bookmark->errors, 'errors'); } }