From 04228cca82989ccf79c116805aec09521c33471d Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Fri, 4 May 2018 12:20:29 +0200 Subject: [PATCH 001/156] NEW triggers add commercial and del commercial --- htdocs/societe/class/societe.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 32f29522268..05e15b9cb03 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1909,6 +1909,11 @@ class Societe extends CommonObject */ function add_commercial(User $user, $commid) { + $error=0; + + + + if ($this->id > 0 && $commid > 0) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux"; @@ -1924,6 +1929,12 @@ class Societe extends CommonObject { dol_syslog(get_class($this)."::add_commercial Erreur"); } + else { + $this->commercial_modified = $commid; + + $result=$this->call_trigger('COMPANY_ADD_COMMERCIAL',$user); + if ($result < 0) $error++; + } } } @@ -1936,6 +1947,12 @@ class Societe extends CommonObject */ function del_commercial(User $user, $commid) { + $error=0; + $this->commercial_modified = $commid; + + $result=$this->call_trigger('COMPANY_DEL_COMMERCIAL',$user); + if ($result < 0) $error++; + if ($this->id > 0 && $commid > 0) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux "; From 9012a77a5213a910aba25e074412de671d624a1a Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Fri, 4 May 2018 17:59:48 +0100 Subject: [PATCH 002/156] Prepare report generation for the warehouse module --- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 3ca87e97053..cf81fba6ff7 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -451,3 +451,6 @@ ALTER TABLE llx_accounting_journal ADD UNIQUE INDEX uk_accounting_journal_code ( UPDATE llx_c_email_templates SET lang = '' WHERE lang IS NULL; +-- Warehouse +ALTER TABLE `llx_entrepot` ADD `model_pdf` VARCHAR(255) AFTER `fk_user_author`; +ALTER TABLE `llx_stock_mouvement` ADD `model_pdf` VARCHAR(255) AFTER `origintype`; From dd330fce2e8884e7678c0c990452aa154942d803 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 May 2018 13:52:18 +0200 Subject: [PATCH 003/156] Update 7.0.0-8.0.0.sql --- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index cf81fba6ff7..5aae97a408f 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -452,5 +452,5 @@ ALTER TABLE llx_accounting_journal ADD UNIQUE INDEX uk_accounting_journal_code ( UPDATE llx_c_email_templates SET lang = '' WHERE lang IS NULL; -- Warehouse -ALTER TABLE `llx_entrepot` ADD `model_pdf` VARCHAR(255) AFTER `fk_user_author`; -ALTER TABLE `llx_stock_mouvement` ADD `model_pdf` VARCHAR(255) AFTER `origintype`; +ALTER TABLE llx_entrepot ADD model_pdf VARCHAR(255) AFTER fk_user_author; +ALTER TABLE llx_stock_mouvement ADD model_pdf VARCHAR(255) AFTER origintype; From ad7f604306a0b4219d0947543096278b7c2e757b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 May 2018 13:52:39 +0200 Subject: [PATCH 004/156] Update 7.0.0-8.0.0.sql --- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 5aae97a408f..38e7c734777 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -452,5 +452,5 @@ ALTER TABLE llx_accounting_journal ADD UNIQUE INDEX uk_accounting_journal_code ( UPDATE llx_c_email_templates SET lang = '' WHERE lang IS NULL; -- Warehouse -ALTER TABLE llx_entrepot ADD model_pdf VARCHAR(255) AFTER fk_user_author; -ALTER TABLE llx_stock_mouvement ADD model_pdf VARCHAR(255) AFTER origintype; +ALTER TABLE llx_entrepot ADD COLUMN model_pdf VARCHAR(255) AFTER fk_user_author; +ALTER TABLE llx_stock_mouvement ADD COLUMN model_pdf VARCHAR(255) AFTER origintype; From 5802eb63ecf07f5100e697cc471272429b1043db Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Mon, 7 May 2018 11:36:34 +0200 Subject: [PATCH 005/156] FIX name of trigger and use of context --- htdocs/societe/class/societe.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 05e15b9cb03..69812787b8c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1930,9 +1930,9 @@ class Societe extends CommonObject dol_syslog(get_class($this)."::add_commercial Erreur"); } else { - $this->commercial_modified = $commid; + $this->context=array('commercial_modified'=>$commid); - $result=$this->call_trigger('COMPANY_ADD_COMMERCIAL',$user); + $result=$this->call_trigger('COMPANY_LINK_SALE_REPRESENTATIVE',$user); if ($result < 0) $error++; } } @@ -1948,9 +1948,9 @@ class Societe extends CommonObject function del_commercial(User $user, $commid) { $error=0; - $this->commercial_modified = $commid; + $this->context=array('commercial_modified'=>$commid); - $result=$this->call_trigger('COMPANY_DEL_COMMERCIAL',$user); + $result=$this->call_trigger('COMPANY_UNLINK_SALE_REPRESENTATIVE',$user); if ($result < 0) $error++; if ($this->id > 0 && $commid > 0) From 85469438981f29cf13e2caa7bb641f04055d0d5e Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 7 May 2018 22:30:40 +0200 Subject: [PATCH 006/156] Create index.html --- htdocs/core/modules/holiday/index.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 htdocs/core/modules/holiday/index.html diff --git a/htdocs/core/modules/holiday/index.html b/htdocs/core/modules/holiday/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/core/modules/holiday/index.html @@ -0,0 +1 @@ + From ffaff97af121e56f82b2da8096fadb930c8a2f12 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 7 May 2018 22:33:14 +0200 Subject: [PATCH 007/156] Create modules_holiday.php --- .../core/modules/holiday/modules_holiday.php | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 htdocs/core/modules/holiday/modules_holiday.php diff --git a/htdocs/core/modules/holiday/modules_holiday.php b/htdocs/core/modules/holiday/modules_holiday.php new file mode 100644 index 00000000000..7e7865c87e8 --- /dev/null +++ b/htdocs/core/modules/holiday/modules_holiday.php @@ -0,0 +1,146 @@ + + * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2014 Marcos García + * Copyright (C) 2018 Charlene Benke + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/modules/holiday/modules_holiday.php + * \ingroup contract + * \brief File with parent class for generating holiday to PDF and File of class to manage contract numbering + */ + + require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + + +/** + * Parent class to manage intervention document templates + */ +abstract class ModelePDFHoliday extends CommonDocGenerator +{ + var $error=''; + + + /** + * Return list of active generation modules + * + * @param DoliDB $db Database handler + * @param integer $maxfilenamelength Max length of value to show + * @return array List of templates + */ + static function liste_modeles($db,$maxfilenamelength=0) + { + global $conf; + + $type='contract'; + $liste=array(); + + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $liste=getListOfModels($db,$type,$maxfilenamelength); + + return $liste; + } +} + + +/** + * Parent class for all contract numbering modules + */ +class ModelNumRefHolidays +{ + var $error=''; + + /** + * Return if a module can be used or not + * + * @return boolean true if module can be used + */ + function isEnabled() + { + return true; + } + + /** + * Return default description of numbering model + * + * @return string text description + */ + function info() + { + global $langs; + $langs->load("holidays"); + return $langs->trans("NoDescription"); + } + + /** + * Return numbering example + * + * @return string Example + */ + function getExample() + { + global $langs; + $langs->load("holidays"); + return $langs->trans("NoExample"); + } + + /** + * Test if existing numbers make problems with numbering + * + * @return boolean false if conflict, true if ok + */ + function canBeActivated() + { + return true; + } + + /** + * Return next value + * + * @param Societe $objsoc third party object + * @param Object $contract contract object + * @return string Value + */ + function getNextValue($objsoc, $contract) + { + global $langs; + return $langs->trans("NotAvailable"); + } + + /** + * Return numbering version module + * + * @return string Value + */ + function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'development') return $langs->trans("VersionDevelopment"); + if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); + if ($this->version == 'dolibarr') return DOL_VERSION; + if ($this->version) return $this->version; + return $langs->trans("NotAvailable"); + } +} From a20632d31d401e3e346c441f1ff4fa64fa81c85b Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 7 May 2018 22:34:26 +0200 Subject: [PATCH 008/156] Create mod_holiday_immaculate.php --- .../holiday/mod_holiday_immaculate.php | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 htdocs/core/modules/holiday/mod_holiday_immaculate.php diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php new file mode 100644 index 00000000000..1355ba90302 --- /dev/null +++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php @@ -0,0 +1,132 @@ + + * Copyright (C) 2018 Charlene Benke + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/modules/holiday/mod_holiday_immaculate.php + * \ingroup contract + * \brief File of class to manage contract numbering rules Magre + */ + +require_once DOL_DOCUMENT_ROOT .'/core/modules/holiday/modules_holiday.php'; + +/** + * Class to manage contract numbering rules Magre + */ +class mod_holiday_immaculate extends ModelNumRefHolidays +{ + var $version='dolibarr'; + var $error = ''; + var $nom = 'Immaculate'; + var $code_auto=1; + + /** + * Return default description of numbering model + * + * @return string text description + */ + function info() + { + global $conf,$langs; + + $langs->load("bills"); + + $form = new Form($this->db); + + $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; + $texte.= '
'; + $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= ''; + + $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Holiday"),$langs->transnoentities("Holiday")); + $tooltip.=$langs->trans("GenericMaskCodes2"); + $tooltip.=$langs->trans("GenericMaskCodes3"); + $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Holiday"),$langs->transnoentities("Holiday")); + $tooltip.=$langs->trans("GenericMaskCodes5"); + + $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= '
'.$langs->trans("Mask").':'.$form->textwithpicto('',$tooltip,1,1).' 
'; + $texte.= '
'; + + return $texte; + } + + /** + * Return numbering example + * + * @return string Example + */ + function getExample() + { + global $conf,$langs,$user; + + $old_login=$user->login; + $user->login='UUUUUUU'; + $numExample = $this->getNextValue($user, ''); + $user->login=$old_login; + + if (! $numExample) + { + $numExample = $langs->trans('NotConfigured'); + } + return $numExample; + } + + /** + * Return next value + * + * @param Societe $user user object + * @param Object $holiday holiday object + * @return string Value if OK, 0 if KO + */ + function getNextValue($user, $holiday) + { + global $db,$conf; + + require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; + + $mask=$conf->global->HOLIDAY_IMMACULATE_MASK; + + if (! $mask) + { + $this->error='NotConfigured'; + return 0; + } + + $numFinal=get_next_value($db,$mask,'holiday','ref','', $user, $holiday->date_create); + + return $numFinal; + } + + /** + * Return next value + * + * @param Societe $objsoc third party object + * @param Object $objforref contract object + * @return string Value if OK, 0 if KO + */ + function holiday_get_num($user, $objforref) + { + return $this->getNextValue($user, $objforref); + } +} From 3d268933a43f56929a72d9b139f6d9a1cf043202 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 7 May 2018 22:35:19 +0200 Subject: [PATCH 009/156] Create mod_holiday_madonna.php --- .../modules/holiday/mod_holiday_madonna.php | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 htdocs/core/modules/holiday/mod_holiday_madonna.php diff --git a/htdocs/core/modules/holiday/mod_holiday_madonna.php b/htdocs/core/modules/holiday/mod_holiday_madonna.php new file mode 100644 index 00000000000..b5848263c98 --- /dev/null +++ b/htdocs/core/modules/holiday/mod_holiday_madonna.php @@ -0,0 +1,148 @@ + + * Copyright (C) 2018 Charlene Benke + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/modules/holiday/mod_holiday_madonna.php + * \ingroup contract + * \brief File of class to manage contract numbering rules Serpis + */ +require_once DOL_DOCUMENT_ROOT .'/core/modules/holiday/modules_holiday.php'; + +/** + * Class to manage contract numbering rules madonna + */ +class mod_holiday_madonna extends ModelNumRefHolidays +{ + var $version='dolibarr'; + var $prefix='HL'; + var $error=''; + var $nom='Madonna'; + var $code_auto=1; + + + /** + * Return default description of numbering model + * + * @return string text description + */ + function info() + { + global $langs; + return $langs->trans("SimpleNumRefModelDesc",$this->prefix); + } + + + /** + * Return numbering example + * + * @return string Example + */ + function getExample() + { + return $this->prefix."0501-0001"; + } + + + /** + * Test if existing numbers make problems with numbering + * + * @return boolean false if conflit, true if ok + */ + function canBeActivated() + { + global $conf,$langs,$db; + + $coyymm=''; $max=''; + + $posindice=8; + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; + $sql.= " FROM ".MAIN_DB_PREFIX."holiday"; + $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; + $sql.= " AND entity = ".$conf->entity; + + $resql=$db->query($sql); + if ($resql) + { + $row = $db->fetch_row($resql); + if ($row) { $coyymm = substr($row[0],0,6); $max=$row[0]; } + } + if ($coyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$coyymm)) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorNumRefModel', $max); + return false; + } + + return true; + } + + /** + * Return next value + * + * @param Societe $objsoc third party object + * @param Object $contract contract object + * @return string Value if OK, 0 if KO + */ + function getNextValue($objsoc,$contract) + { + global $db,$conf; + + $posindice=8; + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; + $sql.= " FROM ".MAIN_DB_PREFIX."holiday"; + $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; + $sql.= " AND entity = ".$conf->entity; + + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($obj) $max = intval($obj->max); + else $max=0; + } + else + { + dol_syslog("mod_holiday_madonna::getNextValue", LOG_DEBUG); + return -1; + } + + $date=$contract->date_contrat; + $yymm = strftime("%y%m",$date); + + if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is + else $num = sprintf("%04s",$max+1); + + dol_syslog("mod_holiday_madonna::getNextValue return ".$this->prefix.$yymm."-".$num); + return $this->prefix.$yymm."-".$num; + } + + + /** + * Return next value + * + * @param Societe $objsoc third party object + * @param Object $objforref contract object + * @return string Value if OK, 0 if KO + */ + function holiday_get_num($objsoc,$objforref) + { + return $this->getNextValue($objsoc,$objforref); + } + +} From 79bb8ef6c7adbb37b1ee867e8014004b9107aff8 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 7 May 2018 22:47:24 +0200 Subject: [PATCH 010/156] Update modHoliday.class.php --- htdocs/core/modules/modHoliday.class.php | 31 ++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 3fd056b525e..4f41f2eae2d 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2011 Dimitri Mouillard * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2018 Charlene Benke * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,9 +70,13 @@ class modHoliday extends DolibarrModules // Data directories to create when module is enabled. // Example: this->dirs = array("/mymodule/temp"); - $this->dirs = array(); + $this->dirs = array("/holiday/temp"); $r=0; + // Config pages + $this->config_page_url = array("holiday.php"); + + // Config pages. Put here list of php page names stored in admmin directory used to setup module. // $this->config_page_url = array("holiday.php?leftmenu=setup@holiday"); @@ -87,7 +92,29 @@ class modHoliday extends DolibarrModules // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) ); // 2=>array('MAIN_MODULE_MYMODULE_NEEDSMARTY','chaine',1,'Constant to say module need smarty',0) $this->const = array(); // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 0 or 'allentities') - + $r=0; + + $this->const[$r][0] = "HOLIDAY_ADDON"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "mod_holiday_madonna"; + $this->const[$r][3] = 'Nom du gestionnaire de numerotation des congés'; + $this->const[$r][4] = 0; + $r++; + + $this->const[$r][0] = "HOLIDAY_ADDON_PDF"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "celebrate"; + $this->const[$r][3] = 'Name of PDF model of holiday'; + $this->const[$r][4] = 0; + $r++; + + $this->const[$r][0] = "HOLIDAY_ADDON_PDF_ODT_PATH"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/holiday"; + $this->const[$r][3] = ""; + $this->const[$r][4] = 0; + $r++; + // Array to add new pages in new tabs $this->tabs[] = array('data'=>'user:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=hrm&id=__ID__'); // To add a new tab identified by code tabname1 From e3963c3518cf87023d666b9a80992c95b136856c Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 7 May 2018 22:48:43 +0200 Subject: [PATCH 011/156] Create holiday.php --- htdocs/admin/holiday.php | 521 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 521 insertions(+) create mode 100644 htdocs/admin/holiday.php diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php new file mode 100644 index 00000000000..b199505d214 --- /dev/null +++ b/htdocs/admin/holiday.php @@ -0,0 +1,521 @@ + + * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2018 Charlene Benke + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * 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/admin/contract.php + * \ingroup contract + * \brief Setup page of module Contracts + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php'; + +$langs->load("admin"); +$langs->load("errors"); +$langs->load("holiday"); + +if (!$user->admin) accessforbidden(); + +$action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); +$label = GETPOST('label','alpha'); +$scandir = GETPOST('scan_dir','alpha'); +$type='contract'; + +if (empty($conf->global->HOLIDAY_ADDON)) +{ + $conf->global->HOLIDAY_ADDON='mod_holiday_madona'; +} + + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + +if ($action == 'updateMask') +{ + $maskconst = GETPOST('maskconstholidaty','alpha'); + $maskvalue = GETPOST('maskholiday','alpha'); + if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +else if ($action == 'specimen') // For contract +{ + $modele= GETPOST('module','alpha'); + + $contract = new Contrat($db); + $contract->initAsSpecimen(); + + // Search template files + $file=''; $classname=''; $filefound=0; + $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + foreach($dirmodels as $reldir) + { + $file=dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php",0); + if (file_exists($file)) + { + $filefound=1; + $classname = "pdf_".$modele; + break; + } + } + + if ($filefound) + { + require_once $file; + + $module = new $classname($db); + + if ($module->write_file($contract,$langs) > 0) + { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=holiday&file=SPECIMEN.pdf"); + return; + } + else + { + setEventMessages($obj->error, $obj->errors, 'errors'); + dol_syslog($obj->error, LOG_ERR); + } + } + else + { + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); + } +} + +// Activate a model +else if ($action == 'set') +{ + $ret = addDocumentModel($value, $type, $label, $scandir); +} + +else if ($action == 'del') +{ + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + if ($conf->global->HOLIDAY_ADDON_PDF == "$value") dolibarr_del_const($db, 'HOLIDAY_ADDON_PDF',$conf->entity); + } +} + +// Set default model +else if ($action == 'setdoc') +{ + if (dolibarr_set_const($db, "HOLIDAY_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) + { + // La constante qui a ete lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage coherent + $conf->global->HOLIDAY_ADDON_PDF = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } +} + +else if ($action == 'setmod') +{ + // TODO Verifier si module numerotation choisi peut etre active + // par appel methode canBeActivated + + dolibarr_set_const($db, "HOLIDAY_ADDON",$value,'chaine',0,'',$conf->entity); +} + +else if ($action == 'set_other') +{ + $freetext= GETPOST('HOLIDAY_FREE_TEXT','none'); // No alpha here, we want exact string + $res1 = dolibarr_set_const($db, "HOLIDAY_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); + + $draft= GETPOST('HOLIDAY_DRAFT_WATERMARK','alpha'); + $res2 = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); + + if (! $res1 > 0 || ! $res2 > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + + +/* + * View + */ + +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + +llxHeader(); + +$form=new Form($db); + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("HolidaySetup"),$linkback,'title_setup'); + +$head=holiday_admin_prepare_head(); + +dol_fiche_head($head, 'holiday', $langs->trans("Holidays"), -1, 'holiday'); + +/* + * Holiday Numbering model + */ + +print load_fiche_titre($langs->trans("HolidaysNumberingModules"),'',''); + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +clearstatcache(); + +foreach ($dirmodels as $reldir) +{ + $dir = dol_buildpath($reldir."core/modules/holiday/"); + + if (is_dir($dir)) + { + $handle = opendir($dir); + if (is_resource($handle)) + { + $var=true; + + while (($file = readdir($handle))!==false) + { + if (substr($file, 0, 12) == 'mod_holiday_' && substr($file, dol_strlen($file)-3, 3) == 'php') + { + $file = substr($file, 0, dol_strlen($file)-4); + + require_once $dir.$file.'.php'; + + $module = new $file($db); + + // Show modules according to features level + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + + if ($module->isEnabled()) + { + + print ''; + + // Show example of numbering model + print ''."\n"; + + print ''; + + $holiday=new Holiday($db); + $holiday->initAsSpecimen(); + + // Info + $htmltooltip=''; + $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; + $nextval=$module->getNextValue($mysoc,$contract); + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip.=''.$langs->trans("NextValue").': '; + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip.=$nextval.'
'; + } else { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } + + print ''; + + print ''; + } + } + } + closedir($handle); + } + } +} + +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'.$module->nom."\n"; + print $module->info(); + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) { $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; } + elseif ($tmp=='NotConfigured') print $langs->trans($tmp); + else print $tmp; + print '
'; + if ($conf->global->HOLIDAY_ADDON == "$file") + { + print img_picto($langs->trans("Activated"),'switch_on'); + } + else + { + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print '

'; + +/* + * Documents models for Contracts + */ + +print load_fiche_titre($langs->trans("TemplatePDFHolidays"),'',''); + +// Defini tableau def des modeles +$def = array(); +$sql = "SELECT nom"; +$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; +$sql.= " WHERE type = '".$type."'"; +$sql.= " AND entity = ".$conf->entity; +$resql=$db->query($sql); +if ($resql) +{ + $i = 0; + $num_rows=$db->num_rows($resql); + while ($i < $num_rows) + { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } +} +else +{ + dol_print_error($db); +} + + +print ''; +print ''; +print ''; +print ''; +print '\n"; +print '\n"; +print ''; +print ''; +print "\n"; + +clearstatcache(); + +$var=true; +foreach ($dirmodels as $reldir) +{ + foreach (array('','/doc') as $valdir) + { + $dir = dol_buildpath($reldir."core/modules/holiday".$valdir); + + if (is_dir($dir)) + { + $handle=opendir($dir); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) + { + + if (file_exists($dir.'/'.$file)) + { + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); + + require_once $dir.'/'.$file; + $module = new $classname($db); + + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + + if ($modulequalified) + { + $var = !$var; + print ''; + + // Active + if (in_array($name, $def)) + { + print ''; + } + else + { + print '"; + } + + // Defaut + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + if ($module->type == 'pdf') + { + $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); + $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); + $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); + $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); + + + print ''; + + // Preview + print ''; + + print "\n"; + } + } + } + } + } + } + } +} + +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print ''."\n"; + print ''; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print ''."\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print "'; + if ($conf->global->HOLIDAY_ADDON_PDF == $name) + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'contract').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print '
'; +print "
"; + +/* + * Other options + * + */ + +print '
'; +print ''; +print ''; + +print load_fiche_titre($langs->trans("OtherOptions"),'',''); +print ''; +print ''; +print ''; +print ''; +print "\n"; +$var=true; + +$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + +$var=! $var; +print ''."\n"; + +//Use draft Watermark + +print ''."\n"; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; +print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp'); +print '
'; +$variablename='HOLIDAY_FREE_TEXT'; +if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) +{ + print ''; +} +else +{ + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes'); + print $doleditor->Create(); +} +print '
'; +print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; +print '
'; +print ''; +print '
'; + +print '
'; +print ''; +print '
'; + +print '
'; + +dol_fiche_end(); + +llxFooter(); +$db->close(); From 468635867db6fc93ad983bb2c9a6ccae98952bd8 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sat, 12 May 2018 17:52:56 +0200 Subject: [PATCH 012/156] Add dateemployementend --- htdocs/install/mysql/tables/llx_user.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 2ecb52511d4..7ae732d51e6 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -84,6 +84,7 @@ create table llx_user salary double(24,8), -- denormalized value coming from llx_user_employment salaryextra double(24,8), -- denormalized value coming from llx_user_employment dateemployment date, -- denormalized value coming from llx_user_employment + dateemploymentend date, -- denormalized value coming from llx_user_employment weeklyhours double(16,8), -- denormalized value coming from llx_user_employment import_key varchar(14), -- import key From fcf6ab6ee5d8872ba02aa51dd65fa8afd78c74ce Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sat, 12 May 2018 17:55:14 +0200 Subject: [PATCH 013/156] Update 7.0.0-8.0.0.sql --- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index a57e02455cc..d259da1fe55 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -44,6 +44,7 @@ ALTER TABLE llx_website_page ADD COLUMN type_container varchar(16) NOT NULL DEFA DROP TABLE llx_c_accountancy_category; DROP TABLE llx_c_accountingaccount; + update llx_propal set fk_statut = 1 where fk_statut = -1; ALTER TABLE llx_inventory ADD COLUMN fk_user_creat integer; @@ -79,6 +80,10 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE -- For 8.0 + +ALTER TABLE llx_user ADD COLUMN dateemploymentend date after dateemployment; + + -- delete old permission no more used DELETE FROM llx_rights_def WHERE perms = 'main' and module = 'commercial'; From caa35e03590fb51dc2dcf5ed3b0b20efd599503b Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sat, 12 May 2018 17:59:43 +0200 Subject: [PATCH 014/156] Update user.class.php --- htdocs/user/class/user.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 8ac4963f5b5..77b4a59df7a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2013-2014 Philippe Grand * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García + * Copyright (C) 2018 charlene Benke * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -131,6 +132,7 @@ class User extends CommonObject public $color; // Define background color for user in agenda public $dateemployment; // Define date of employment by company + public $dateemploymentend; // Define date of employment end by company public $default_c_exp_tax_cat; public $default_range; @@ -201,7 +203,7 @@ class User extends CommonObject $sql.= " u.salaryextra,"; $sql.= " u.weeklyhours,"; $sql.= " u.color,"; - $sql.= " u.dateemployment,"; + $sql.= " u.dateemployment, u.dateemploymentend,"; $sql.= " u.ref_int, u.ref_ext,"; $sql.= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode $sql.= " c.code as country_code, c.label as country,"; @@ -304,6 +306,7 @@ class User extends CommonObject $this->weeklyhours = $obj->weeklyhours; $this->color = $obj->color; $this->dateemployment = $this->db->jdate($obj->dateemployment); + $this->dateemploymentend = $this->db->jdate($obj->dateemploymentend); $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); @@ -1376,6 +1379,7 @@ class User extends CommonObject $this->accountancy_code = trim($this->accountancy_code); $this->color = empty($this->color)?'':$this->color; $this->dateemployment = empty($this->dateemployment)?'':$this->dateemployment; + $this->dateemploymentend = empty($this->dateemploymentend)?'':$this->dateemploymentend; // Check parameters if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email)) @@ -1418,6 +1422,7 @@ class User extends CommonObject $sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'"; $sql.= ", color = '".$this->db->escape($this->color)."'"; $sql.= ", dateemployment=".(strval($this->dateemployment)!='' ? "'".$this->db->idate($this->dateemployment)."'" : 'null'); + $sql.= ", dateemploymentend=".(strval($this->dateemploymentend)!='' ? "'".$this->db->idate($this->dateemploymentend)."'" : 'null'); $sql.= ", note = '".$this->db->escape($this->note)."'"; $sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null"); $sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"null"); From 0dad083cb529999cd15e29605ace10768406be3b Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sat, 12 May 2018 18:05:06 +0200 Subject: [PATCH 015/156] Update card.php --- htdocs/user/card.php | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 48dc1049706..1823adc8044 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -11,7 +11,7 @@ * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2015-2017 Jean-François Ferry * Copyright (C) 2015 Ari Elbaz (elarifr) - * Copyright (C) 2015 Charlie Benke + * Copyright (C) 2015-2018 Charlene Benke * Copyright (C) 2016 Raphaël Doursenaud * * This program is free software; you can redistribute it and/or modify @@ -222,6 +222,9 @@ if (empty($reshook)) { $dateemployment = dol_mktime(0, 0, 0, GETPOST('dateemploymentmonth'), GETPOST('dateemploymentday'), GETPOST('dateemploymentyear')); $object->dateemployment = $dateemployment; + $dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth'), GETPOST('dateemploymentendday'), GETPOST('dateemploymentendyear')); + $object->dateemploymentend = $dateemploymentend; + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) { @@ -364,6 +367,8 @@ if (empty($reshook)) { $object->color = GETPOST("color",'alpha') != '' ? GETPOST("color",'alpha') : ''; $dateemployment = dol_mktime(0, 0, 0, GETPOST('dateemploymentmonth','int'), GETPOST('dateemploymentday','int'), GETPOST('dateemploymentyear','int')); $object->dateemployment = $dateemployment; + $dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth','int'), GETPOST('dateemploymentendday','int'), GETPOST('dateemploymentendyear','int')); + $object->dateemploymentend = $dateemploymentend; if (! empty($conf->multicompany->enabled)) { @@ -1159,6 +1164,13 @@ if ($action == 'create' || $action == 'adduserldap') print ''; print "\n"; + // Date employment END + print ''.$langs->trans("DateEmploymentEnd").''; + print ''; + echo $form->select_date(GETPOST('dateemploymentend'),'dateemploymentend',0,0,1,'form'.'dateemploymentend',1,0,1); + print ''; + print "\n"; + // Date birth print ''.$langs->trans("DateToBirth").''; print ''; @@ -1505,6 +1517,13 @@ else print ''; print "\n"; + // Date employment + print ''.$langs->trans("DateEmploymentEnd").''; + print ''; + print dol_print_date($object->dateemploymentend); + print ''; + print "\n"; + // Date of birth print ''.$langs->trans("DateToBirth").''; print ''; @@ -2430,6 +2449,14 @@ else print ''; print "\n"; + // Date employmentEnd + print ''.$langs->trans("DateEmploymentEnd").''; + print ''; + echo $form->select_date(GETPOST('dateemploymentend')?GETPOST('dateemploymentend'):$object->dateemploymentend,'dateemploymentend',0,0,1,'form'.'dateemploymentend',1,0,1); + print ''; + print "\n"; + + // Date birth print ''.$langs->trans("DateToBirth").''; print ''; From 537048a10a37c8cee123722112835c6193524be0 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sun, 13 May 2018 15:30:32 +0200 Subject: [PATCH 016/156] Update html.formcontract.class.php --- htdocs/core/class/html.formcontract.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index f4902e4912e..c6cf20dd5f1 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2012-2018 Charlene BENKE * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ class FormContract global $db,$user,$conf,$langs; $hideunselectables = false; - if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->SELECT_HIDE_UNSELECTABLES)) $hideunselectables = true; // Search all contacts $sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut'; From 2f1800f3e23dd2fd03d7182c95cfac48efb8ded9 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sun, 13 May 2018 15:34:26 +0200 Subject: [PATCH 017/156] Update html.formprojet.class.php --- htdocs/core/class/html.formprojet.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index a572d546ca7..75ccc1d8245 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 Marcos García + * Copyright (C) 2018 Charlene Benke * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -139,10 +140,10 @@ class FormProjets if (empty($htmlid)) $htmlid = $htmlname; $out=''; - $outarray=array(); + $outarray=array(); $hideunselectables = false; - if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->SELECT_HIDE_UNSELECTABLES)) $hideunselectables = true; $projectsListId = false; if (empty($user->rights->projet->all->lire)) @@ -317,7 +318,7 @@ class FormProjets $out=''; $hideunselectables = false; - if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->SELECT_HIDE_UNSELECTABLES)) $hideunselectables = true; if (empty($projectsListId)) { From b0757916c4731fea9e04048fffb88e08b2d1ee45 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sun, 13 May 2018 16:59:03 +0200 Subject: [PATCH 018/156] Update html.formcontract.class.php --- htdocs/core/class/html.formcontract.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index c6cf20dd5f1..28b256e32ef 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -64,8 +64,18 @@ class FormContract $sql.= ' FROM '.MAIN_DB_PREFIX .'contrat as c'; $sql.= " WHERE c.entity = ".$conf->entity; //if ($contratListId) $sql.= " AND c.rowid IN (".$contratListId.")"; + if ($socid > 0) + { + // CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma. + if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) + $sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)"; + else if ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') + { + $sql.= " AND (c.fk_soc IN (".$socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") "; + $sql.= " OR p.fk_soc IS NULL)"; + } + } if ($socid == 0) $sql.= " AND (c.fk_soc = 0 OR c.fk_soc IS NULL)"; - if ($socid > 0) $sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)"; $sql.= " ORDER BY c.ref "; dol_syslog(get_class($this)."::select_contract", LOG_DEBUG); From f4af9ec22f9b2c55fb9cf73523cb4d8ae05a7bff Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sun, 13 May 2018 19:38:30 +0200 Subject: [PATCH 019/156] Update html.formcontract.class.php --- htdocs/core/class/html.formcontract.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index 28b256e32ef..64d28e6b281 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -72,7 +72,7 @@ class FormContract else if ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') { $sql.= " AND (c.fk_soc IN (".$socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") "; - $sql.= " OR p.fk_soc IS NULL)"; + $sql.= " OR c.fk_soc IS NULL)"; } } if ($socid == 0) $sql.= " AND (c.fk_soc = 0 OR c.fk_soc IS NULL)"; From 4bebc8149baae5a744159a046e8a2c074794ec9e Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sun, 13 May 2018 21:17:15 +0200 Subject: [PATCH 020/156] Update html.formcontract.class.php --- htdocs/core/class/html.formcontract.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index 64d28e6b281..01ebe66666b 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -108,12 +108,12 @@ class FormContract else { $disabled=0; - if (! $obj->statut > 0) + if ( $obj->statut == 0) { $disabled=1; $labeltoshow.=' ('.$langs->trans("Draft").')'; } - if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) + if ( empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) && $socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) { $disabled=1; $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany"); From 90881fe488df4bfebcf3c1d43b926de6a5e5b99a Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Fri, 18 May 2018 16:32:46 +0100 Subject: [PATCH 021/156] Add link to inventory code --- htdocs/product/stock/mouvement.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index edabf9184da..19aaa6c1289 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -1067,7 +1067,15 @@ if ($resql) if (! empty($arrayfields['m.inventorycode']['checked'])) { // Inventory code - print ''.$objp->inventorycode.''; + print ''.'' + .$objp->inventorycode + .'' + .''; } if (! empty($arrayfields['m.label']['checked'])) { From 2ccaf1ad956813a88be718c7d734ca4fe79d869b Mon Sep 17 00:00:00 2001 From: patrick Delcroix Date: Tue, 22 May 2018 22:00:20 +0200 Subject: [PATCH 022/156] New: support sellist in modulebuilder --- htdocs/core/class/commonobject.class.php | 165 ++++++++++++----------- htdocs/core/lib/modulebuilder.lib.php | 12 +- 2 files changed, 92 insertions(+), 85 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0e9deeade80..750ddd8337c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4969,8 +4969,7 @@ abstract class CommonObject * @param string|int $showsize Value for css to define size. May also be a numeric. * @return string */ - function showInputField($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0) - { + function showInputField($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $morecss=0){ global $conf,$langs,$form; if (! is_object($form)) @@ -4979,38 +4978,36 @@ abstract class CommonObject $form=new Form($this->db); } - $objectid = $this->id; + $out=''; + $type=''; + $param['options']=array(); + $keyprefix = $keyprefix.'options_'; // Because we work on extrafields + if(preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)){ + $param['options']=array($reg[1].':'.$reg[2]=>'N'); + $type ='link'; + }else if(preg_match('/^link:(.*):(.*)/i', $val['type'], $reg)){ + $param['options']=array($reg[1].':'.$reg[2]=>'N'); + $type ='link'; + }else if(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)){ + + $param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4]=>'N'); + $type ='sellist'; + }else { + $param['options']=array(); + $type =$this->fields[$key]['type']; + } - $label= $val['label']; - $type = $val['type']; - $size = $val['css']; - - // Convert var to be able to share same code than showInputField of extrafields - if (preg_match('/varchar\((\d+)\)/', $type, $reg)) - { - $type = 'varchar'; // convert varchar(xx) int varchar - $size = $reg[1]; - } - elseif (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) int varchar - if (is_array($val['arrayofkeyval'])) $type='select'; - if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type='link'; - - //$elementtype=$this->attribute_elementtype[$key]; // seems to not be used - $default=$val['default']; - $computed=$val['computed']; - $unique=$val['unique']; - $required=$val['required']; - $param=$val['param']; - if (is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval']; - if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) - { - $type='link'; - $param['options']=array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]); - } - $langfile=$val['langfile']; - $list=$val['list']; - $hidden=(abs($val['visible'])!=1 ? 1 : 0); - $help=$val['help']; + $label=$this->fields[$key]['label']; + $size =$this->fields[$key]['size']; + //$elementtype=$this->fields[$key]['elementtype']; // Seems not used + $default=$this->fields[$key]['default']; + $computed=$this->fields[$key]['computed']; + //$unique=$this->fields[$key]['unique']; + $required=$this->fields[$key]['required']; + + //$langfile=$this->fields[$key]['label']; + //$list=$this->fields[$key]['arrayofkeyval']; + $hidden=!$this->fields[$key]['visible']; if ($computed) { @@ -5018,54 +5015,44 @@ abstract class CommonObject else return ''; } - // Use in priorit showsize from parameters, then $val['css'] then autodefine - if (empty($showsize) && ! empty($val['css'])) - { - $showsize = $val['css']; - } - if (empty($showsize)) + if (empty($morecss)) { if ($type == 'date') { - //$showsize=10; - $showsize = 'minwidth100imp'; + $morecss = 'minwidth100imp'; } elseif ($type == 'datetime') { - //$showsize=19; - $showsize = 'minwidth200imp'; + $morecss = 'minwidth200imp'; } - elseif (in_array($type,array('int','double','price'))) + elseif (in_array($type,array('int','integer','double','price'))) { - //$showsize=10; - $showsize = 'maxwidth75'; + $morecss = 'maxwidth75'; } elseif ($type == 'url') { - $showsize='minwidth400'; + $morecss='minwidth400'; } elseif ($type == 'boolean') { - $showsize=''; + $morecss=''; } else { if (round($size) < 12) { - $showsize = 'minwidth100'; + $morecss = 'minwidth100'; } else if (round($size) <= 48) { - $showsize = 'minwidth200'; + $morecss = 'minwidth200'; } else { - //$showsize=48; - $showsize = 'minwidth400'; + $morecss = 'minwidth400'; } } } - //var_dump($showsize.' '.$size); if (in_array($type,array('date','datetime'))) { @@ -5078,33 +5065,47 @@ abstract class CommonObject if (!$required && $value == '') $value = '-1'; // TODO Must also support $moreparam - $out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, ($keyprefix != 'search_' ? 1 : 0), 1, 0, 1); + $out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0, 1); } elseif (in_array($type,array('int','integer'))) { $tmp=explode(',',$size); $newsize=$tmp[0]; - $out=''; + $out=''; } elseif (preg_match('/varchar/', $type)) { - $out=''; + $out=''; } elseif (in_array($type, array('mail', 'phone', 'url'))) { - $out=''; + $out=''; } elseif ($type == 'text') { - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,0,ROWS_5,'90%'); - $out=$doleditor->Create(1); + if (! preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field + { + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,false,ROWS_5,'90%'); + $out=$doleditor->Create(1); + } + else + { + $out=''; + } } elseif ($type == 'html') { - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%'); - $out=$doleditor->Create(1); + if (! preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field + { + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%'); + $out=$doleditor->Create(1); + } + else + { + $out=''; + } } elseif ($type == 'boolean') { @@ -5114,21 +5115,21 @@ abstract class CommonObject } else { $checked=' value="1" '; } - $out=''; + $out=''; } elseif ($type == 'price') { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value=price($value); } - $out=' '.$langs->getCurrencySymbol($conf->currency); + $out=' '.$langs->getCurrencySymbol($conf->currency); } elseif ($type == 'double') { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value=price($value); } - $out=' '; + $out=' '; } elseif ($type == 'select') { @@ -5139,8 +5140,8 @@ abstract class CommonObject $out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); } - $out.=''; + $out.=''; foreach ($param['options'] as $key => $val) { if ((string) $key == '') continue; @@ -5161,11 +5162,13 @@ abstract class CommonObject $out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); } - $out.=''; if (is_array($param['options'])) { $param_list=array_keys($param['options']); $InfoFieldList = explode(":", $param_list[0]); + $parentName=''; + $parentField=''; // 0 : tableName // 1 : label field name // 2 : key fields name (if differ of rowid) @@ -5250,8 +5253,9 @@ abstract class CommonObject $obj = $this->db->fetch_object($resql); // Several field into label (eq table:code|libelle:rowid) + $notrans = false; $fields_label = explode('|',$InfoFieldList[1]); - if(is_array($fields_label)) + if (is_array($fields_label)) { $notrans = true; foreach ($fields_label as $field_toshow) @@ -5265,7 +5269,7 @@ abstract class CommonObject } $labeltoshow=dol_trunc($labeltoshow,45); - if ($value==$obj->rowid) + if ($value == $obj->rowid) { foreach ($fields_label as $field_toshow) { @@ -5280,7 +5284,7 @@ abstract class CommonObject } else { - if(!$notrans) + if (! $notrans) { $translabel=$langs->trans($obj->{$InfoFieldList[1]}); if ($translabel!=$obj->{$InfoFieldList[1]}) { @@ -5296,7 +5300,7 @@ abstract class CommonObject $out.=''; } - if (!empty($InfoFieldList[3])) + if (!empty($InfoFieldList[3]) && $parentField) { $parent = $parentName.':'.$obj->{$parentField}; } @@ -5327,7 +5331,7 @@ abstract class CommonObject $out=''; foreach ($param['options'] as $keyopt => $val) { - $out.='db->fetch_object($resql); + $notrans = false; // Several field into label (eq table:code|libelle:rowid) $fields_label = explode('|', $InfoFieldList[1]); if (is_array($fields_label)) { @@ -5459,7 +5466,7 @@ abstract class CommonObject $data[$obj->rowid]=$labeltoshow; } - if (! empty($InfoFieldList[3])) { + if (! empty($InfoFieldList[3]) && $parentField) { $parent = $parentName . ':' . $obj->{$parentField}; } @@ -5476,18 +5483,17 @@ abstract class CommonObject print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.
'; } } - $out .= ''; } elseif ($type == 'link') { $param_list=array_keys($param['options']); // $param_list='ObjectName:classPath' - $showempty=(($val['notnull'] == 1 && $val['default'] != '')?0:1); + $showempty=(($required && $default != '')?0:1); $out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty); } elseif ($type == 'password') { // If prefix is 'search_', field is used as a filter, we use a common text field. - $out=''; + $out=''; } if (!empty($hidden)) { $out=''; @@ -5498,8 +5504,7 @@ abstract class CommonObject */ return $out; } - - + /** * Return HTML string to show a field into a page * Code very similar with showOutputField of extra fields diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 8e2cba43097..343b596d66b 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -63,7 +63,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir=' setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors'); return -2; } - if (! preg_match('/^(integer|date|timestamp|varchar|double)/', $addfieldentry['type'])) + if (! preg_match('/^(boolean|sellist|integer|date|timestamp|varchar|double)/', $addfieldentry['type'])) { setEventMessages($langs->trans('BadFormatForType', $objectname), null, 'errors'); return -2; @@ -253,10 +253,12 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='', foreach($object->fields as $key => $val) { $i++; - - $type = $val['type']; + + $type = $val['type']; $type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php' - if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database + if ($type == 'html') $type = 'text'; + else if ($type=='link'||$type=='sellist')$type='integer'; +// html modulebuilder type is a text type in database $texttoinsert.= "\t".$key." ".$type; if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; @@ -265,7 +267,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='', if ($val['default'] != '') { if (preg_match('/^null$/i', $val['default'])) $texttoinsert.= " DEFAULT NULL"; - else if (preg_match('/varchar/', $val['type'])) $texttoinsert.= " DEFAULT '".$db->escape($val['default'])."'"; + else if (preg_match('/varchar/', $type )) $texttoinsert.= " DEFAULT '".$db->escape($val['default'])."'"; else $texttoinsert.= (($val['default'] > 0)?' DEFAULT '.$val['default']:''); } } From 29d26b6e89dda4b1d7648a445c54c25ea3ac5b72 Mon Sep 17 00:00:00 2001 From: patrick Delcroix Date: Tue, 22 May 2018 22:16:25 +0200 Subject: [PATCH 023/156] New: support sellist in modulebuilder --- htdocs/core/class/commonobject.class.php | 27 ++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 750ddd8337c..c90c5c43283 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4981,7 +4981,9 @@ abstract class CommonObject $out=''; $type=''; $param['options']=array(); - $keyprefix = $keyprefix.'options_'; // Because we work on extrafields + $size =$this->fields[$key]['size']; + $keyprefix = $keyprefix.'options_'; + // Because we work on extrafields if(preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)){ $param['options']=array($reg[1].':'.$reg[2]=>'N'); $type ='link'; @@ -4992,6 +4994,19 @@ abstract class CommonObject $param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4]=>'N'); $type ='sellist'; + }else if(preg_match('/varchar\((\d+)\)/', $val['type'],reg)){ + + $param['options']=array(); + $type ='varchar'; + $size=$reg[1]; + }else if(preg_match('/varchar/', $val['type'])){ + + $param['options']=array(); + $type ='varchar'; + }else if(is_array($this->fields[$key]['arrayofkeyval'])){ + + $param['options']=$this->fields[$key]['arrayofkeyval']; + $type ='select'; }else { $param['options']=array(); $type =$this->fields[$key]['type']; @@ -5002,12 +5017,12 @@ abstract class CommonObject //$elementtype=$this->fields[$key]['elementtype']; // Seems not used $default=$this->fields[$key]['default']; $computed=$this->fields[$key]['computed']; - //$unique=$this->fields[$key]['unique']; + $unique=$this->fields[$key]['unique']; $required=$this->fields[$key]['required']; - //$langfile=$this->fields[$key]['label']; - //$list=$this->fields[$key]['arrayofkeyval']; - $hidden=!$this->fields[$key]['visible']; + $langfile=$this->fields[$key]['langfile']; + $list=$this->fields[$key]['list']; + $hidden=abs($this->fields[$key]['visible'])!=1?1:0; if ($computed) { @@ -5141,7 +5156,7 @@ abstract class CommonObject } $out.=' '.$langs->getCurrencySymbol($conf->currency); } - elseif ($type == 'double') + elseif (preg_match('/^double(\([0-9],[0-9]\)){0,1}/',$type)) { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value=price($value); diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 81cf2b99c55..978e3bdf246 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -263,8 +263,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='', $type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php' if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database - if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database - + else if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database + else if ($type == 'link' || $type == 'sellist') $type = 'integer'; $texttoinsert.= "\t".$key." ".$type; if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; From 4a7ac774f7e328c25775e30e810cd79613d280e2 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 28 May 2018 16:38:11 +0200 Subject: [PATCH 030/156] introduce fichinter rec models --- htdocs/core/lib/fichinter.lib.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 8507a85292a..fcb14be9c67 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -2,8 +2,9 @@ /* Copyright (C) 2006-2007 Laurent Destailleur * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2016 Gilles Poirier - + * Copyright (C) 2016 Gilles Poirier + * Copyright (C) 2018 charlene Benke + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -162,4 +163,23 @@ function fichinter_admin_prepare_head() return $head; } +function fichinter_rec_prepare_head ($object) +{ + global $langs, $conf; //, $user; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id; + $head[$h][1] = $langs->trans("CardFichinter"); + $head[$h][2] = 'card'; + $h++; + + complete_head_from_modules($conf, $langs, $object, $head, $h, 'intervention-rec'); + + complete_head_from_modules($conf, $langs, $object, $head, $h,'intervention-rec','remove'); + + + return $head; +} From eef8249ad7189ecdb36633879da061fad4a19405 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 28 May 2018 16:39:40 +0200 Subject: [PATCH 031/156] Create llx_fichinter_rec.sql --- htdocs/install/llx_fichinter_rec.sql | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 htdocs/install/llx_fichinter_rec.sql diff --git a/htdocs/install/llx_fichinter_rec.sql b/htdocs/install/llx_fichinter_rec.sql new file mode 100644 index 00000000000..fa50540ae9f --- /dev/null +++ b/htdocs/install/llx_fichinter_rec.sql @@ -0,0 +1,48 @@ +-- =========================================================================== +-- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2012-2014 Laurent Destailleur +-- Copyright (C) 2009 Regis Houssin +-- Copyright (C) 2010 Juanjo Menent +-- Copyright (C) 2016 Charlie Benke +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- 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_fichinter_rec +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + titre varchar(50) NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + fk_soc integer DEFAULT NULL, + datec datetime, -- date de creation + + fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche + fk_user_author integer, -- createur + fk_projet integer, -- projet auquel est associe la facture + duree real, -- duree totale de l'intervention + description text, + modelpdf varchar(50), + note_private text, + note_public text, + + frequency integer, -- frequency (for example: 3 for every 3 month) + unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ... + date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date) + date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice) + nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented) + nb_gen_max integer DEFAULT NULL, -- maximum number of generation + auto_validate integer NULL DEFAULT NULL -- statut of the generated intervention + +)ENGINE=innodb; From 8124ea15225797f1cdd3498386a4ba6a035f1b42 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 28 May 2018 16:39:56 +0200 Subject: [PATCH 032/156] Delete llx_fichinter_rec.sql --- htdocs/install/llx_fichinter_rec.sql | 48 ---------------------------- 1 file changed, 48 deletions(-) delete mode 100644 htdocs/install/llx_fichinter_rec.sql diff --git a/htdocs/install/llx_fichinter_rec.sql b/htdocs/install/llx_fichinter_rec.sql deleted file mode 100644 index fa50540ae9f..00000000000 --- a/htdocs/install/llx_fichinter_rec.sql +++ /dev/null @@ -1,48 +0,0 @@ --- =========================================================================== --- Copyright (C) 2003 Rodolphe Quiedeville --- Copyright (C) 2012-2014 Laurent Destailleur --- Copyright (C) 2009 Regis Houssin --- Copyright (C) 2010 Juanjo Menent --- Copyright (C) 2016 Charlie Benke --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- 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_fichinter_rec -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - titre varchar(50) NOT NULL, - entity integer DEFAULT 1 NOT NULL, -- multi company id - fk_soc integer DEFAULT NULL, - datec datetime, -- date de creation - - fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche - fk_user_author integer, -- createur - fk_projet integer, -- projet auquel est associe la facture - duree real, -- duree totale de l'intervention - description text, - modelpdf varchar(50), - note_private text, - note_public text, - - frequency integer, -- frequency (for example: 3 for every 3 month) - unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ... - date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date) - date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice) - nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented) - nb_gen_max integer DEFAULT NULL, -- maximum number of generation - auto_validate integer NULL DEFAULT NULL -- statut of the generated intervention - -)ENGINE=innodb; From 17016d03fe5b68793f307f1df738126569054159 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 28 May 2018 16:40:36 +0200 Subject: [PATCH 033/156] Create llx_fichinter_rec.sql --- .../mysql/tables/llx_fichinter_rec.sql | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_fichinter_rec.sql diff --git a/htdocs/install/mysql/tables/llx_fichinter_rec.sql b/htdocs/install/mysql/tables/llx_fichinter_rec.sql new file mode 100644 index 00000000000..10dacbde4ee --- /dev/null +++ b/htdocs/install/mysql/tables/llx_fichinter_rec.sql @@ -0,0 +1,48 @@ +-- =========================================================================== +-- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2012-2014 Laurent Destailleur +-- Copyright (C) 2009 Regis Houssin +-- Copyright (C) 2010 Juanjo Menent +-- Copyright (C) 2018 Charlene Benke +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- 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_fichinter_rec +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + titre varchar(50) NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + fk_soc integer DEFAULT NULL, + datec datetime, -- date de creation + + fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche + fk_user_author integer, -- createur + fk_projet integer, -- projet auquel est associe la facture + duree real, -- duree totale de l'intervention + description text, + modelpdf varchar(50), + note_private text, + note_public text, + + frequency integer, -- frequency (for example: 3 for every 3 month) + unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ... + date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date) + date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice) + nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented) + nb_gen_max integer DEFAULT NULL, -- maximum number of generation + auto_validate integer NULL DEFAULT NULL -- statut of the generated intervention + +)ENGINE=innodb; From 0b7342f34b833f2376f61241f0dc8c993cd9a7eb Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 28 May 2018 16:41:45 +0200 Subject: [PATCH 034/156] Create llx_fichinter_rec.key.sql --- .../mysql/tables/llx_fichinter_rec.key.sql | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_fichinter_rec.key.sql diff --git a/htdocs/install/mysql/tables/llx_fichinter_rec.key.sql b/htdocs/install/mysql/tables/llx_fichinter_rec.key.sql new file mode 100644 index 00000000000..0c420fd6395 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_fichinter_rec.key.sql @@ -0,0 +1,30 @@ +-- ============================================================================ +-- Copyright (C) 2002-2004 Rodolphe Quiedeville +-- Copyright (C) 2004-2006 Laurent Destailleur +-- Copyright (C) 2009 Regis Houssin +-- Copyright (C) 2018 Charlene Benke +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- 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_fichinter_rec ADD UNIQUE INDEX idx_fichinter_rec_uk_titre (titre, entity); + +ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_soc (fk_soc); +ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_user_author (fk_user_author); +ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_projet (fk_projet); + +ALTER TABLE llx_fichinter_rec ADD CONSTRAINT fk_fichinter_rec_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); +ALTER TABLE llx_fichinter_rec ADD CONSTRAINT fk_fichinter_rec_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); From a85ba00d2e5bdf7c387c7f204289eb1aea777a58 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 28 May 2018 16:42:19 +0200 Subject: [PATCH 035/156] Create llx_fichinterdet_rec.sql --- .../mysql/tables/llx_fichinterdet_rec.sql | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_fichinterdet_rec.sql diff --git a/htdocs/install/mysql/tables/llx_fichinterdet_rec.sql b/htdocs/install/mysql/tables/llx_fichinterdet_rec.sql new file mode 100644 index 00000000000..682453f2dfd --- /dev/null +++ b/htdocs/install/mysql/tables/llx_fichinterdet_rec.sql @@ -0,0 +1,63 @@ +-- =================================================================== +-- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2009-2014 Laurent Destailleur +-- Copyright (C) 2010 Juanjo Menent +-- Copyright (C) 2010-2012 Regis Houssin +-- Copyright (C) 2012 Cédric Salvador +-- Copyright (C) 2016-2018 Charlene Benke +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- 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_fichinterdet_rec +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_fichinter integer NOT NULL, + date datetime, -- date de la ligne d'intervention + description text, -- description de la ligne d'intervention + duree integer, -- duree de la ligne d'intervention + rang integer DEFAULT 0, -- ordre affichage sur la fiche + total_ht DOUBLE(24, 8) NULL DEFAULT NULL, + subprice DOUBLE(24, 8) NULL DEFAULT NULL, + fk_parent_line integer NULL DEFAULT NULL, + fk_product integer NULL DEFAULT NULL, + label varchar(255) NULL DEFAULT NULL, + tva_tx DOUBLE(6, 3) NULL DEFAULT NULL, + localtax1_tx DOUBLE(6, 3) NULL DEFAULT 0, + localtax1_type VARCHAR(1) NULL DEFAULT NULL, + localtax2_tx DOUBLE(6, 3) NULL DEFAULT 0, + localtax2_type VARCHAR(1) NULL DEFAULT NULL, + qty double NULL DEFAULT NULL, + remise_percent double NULL DEFAULT 0, + remise double NULL DEFAULT 0, + fk_remise_except integer NULL DEFAULT NULL, + price DOUBLE(24, 8) NULL DEFAULT NULL, + total_tva DOUBLE(24, 8) NULL DEFAULT NULL, + total_localtax1 DOUBLE(24, 8) NULL DEFAULT 0, + total_localtax2 DOUBLE(24, 8) NULL DEFAULT 0, + total_ttc DOUBLE(24, 8) NULL DEFAULT NULL, + product_type INTEGER NULL DEFAULT 0, + date_start datetime NULL DEFAULT NULL, + date_end datetime NULL DEFAULT NULL, + info_bits INTEGER NULL DEFAULT 0, + buy_price_ht DOUBLE(24, 8) NULL DEFAULT 0, + fk_product_fournisseur_price integer NULL DEFAULT NULL, + fk_code_ventilation integer NOT NULL DEFAULT 0, + fk_export_commpta integer NOT NULL DEFAULT 0, + special_code integer UNSIGNED NULL DEFAULT 0, + fk_unit integer NULL DEFAULT NULL, + import_key varchar(14) NULL DEFAULT NULL + +)ENGINE=innodb; From 0e7c82af95fdb0055fa7622439fa1f71ebc644f5 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 28 May 2018 16:43:23 +0200 Subject: [PATCH 036/156] Update eldy.lib.php --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 448d3d4870c..876780c1243 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -784,7 +784,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200); $newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201); $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202); - + $newmenu->add("/fichinter/card-red.php?leftmenu=ficheinter", $langs->trans("ModelList"), 1, $user->rights->ficheinter->lire, '', '', '', 203); $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire); } From 991c6d97c07a9626a34ee3a8f2e36d9f427b2a25 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 28 May 2018 16:44:49 +0200 Subject: [PATCH 037/156] Update card.php --- htdocs/fichinter/card.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 540f897ffe5..dbd1d3bd71b 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2018 Ferran Marcet - * Copyright (C) 2014-2015 Charlie Benke + * Copyright (C) 2014-2018 Charlene Benke * Copyright (C) 2015-2016 Abbes Bahfir * * This program is free software; you can redistribute it and/or modify @@ -1645,6 +1645,14 @@ else if ($id > 0 || ! empty($ref)) else print ''; } + // create interventional model + if ($object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) { + print ''; + } + // Proposal if ($conf->service->enabled && ! empty($conf->propal->enabled) && $object->statut > Fichinter::STATUS_DRAFT) { From 7f8132e9715c138c987174fefdec9855e9874330 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Mon, 28 May 2018 16:46:34 +0200 Subject: [PATCH 038/156] Create card-rec.php --- htdocs/fichinter/card-rec.php | 976 ++++++++++++++++++++++++++++++++++ 1 file changed, 976 insertions(+) create mode 100644 htdocs/fichinter/card-rec.php diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php new file mode 100644 index 00000000000..96d7e106b5a --- /dev/null +++ b/htdocs/fichinter/card-rec.php @@ -0,0 +1,976 @@ + + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2016-2018 Charlie Benke + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * 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 fichinter/card-rec.php + * \ingroup fichinter + * \brief Page to show predefined fichinter + */ + +$res=0; +if (! $res && file_exists("../../main.inc.php")) + $res=@include("../../main.inc.php"); // For root directory +if (! $res && file_exists("../../../main.inc.php")) + $res=@include("../../../main.inc.php"); // For "custom" directory + +require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinterrec.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; + +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +if (! empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; +} +if (! empty($conf->contrat->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcontract.class.php'; +} + + +$langs->load('bills'); +$langs->load('compta'); +$langs->load('admin'); +$langs->load("interventions"); + +// Security check +$id=(GETPOST('fichinterid', 'int')?GETPOST('fichinterid', 'int'):GETPOST('id', 'int')); +$action=GETPOST('action', 'alpha'); +if ($user->societe_id) $socid=$user->societe_id; +$objecttype = 'fichinter_rec'; +if ($action == "create" || $action == "add") $objecttype = ''; +$result = restrictedArea($user, 'ficheinter', $id, $objecttype); + +if ($page == -1) + $page = 0 ; + +$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit; +$offset = $limit * $page ; + +if ($sortorder == "") + $sortorder="DESC"; + +if ($sortfield == "") + $sortfield="f.datec"; + +$object = new FichinterRec($db); + + +$arrayfields=array( + 'f.titre'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), + 'f.fk_contrat'=>array('label'=>$langs->trans("Contract"), 'checked'=>1), + 'f.duree'=>array('label'=>$langs->trans("Duration"), 'checked'=>1), + 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1), + 'f.frequency'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1), + 'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDone"), 'checked'=>1), + 'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1), + 'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1), + 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), +); + + +/* + * Actions + */ + + +// Create predefined intervention +if ($action == 'add') { + if (! GETPOST('titre')) { + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors'); + $action = "create"; + $error++; + } + + if (! GETPOST('socid')) { + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Customer")), null, 'errors'); + $action = "create"; + $error++; + } + + // gestion des fréquences et des échéances + $frequency=GETPOST('frequency', 'int'); + $reyear=GETPOST('reyear'); + $remonth=GETPOST('remonth'); + $reday=GETPOST('reday'); + $rehour=GETPOST('rehour'); + $remin=GETPOST('remin'); + $nb_gen_max = (GETPOST('nb_gen_max', 'int')?GETPOST('nb_gen_max', 'int'):0); + if (GETPOST('frequency')) { + if (empty($reyear) || empty($remonth) || empty($reday)) { + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); + $action = "create"; + $error++; + } + if ($nb_gen_max === '') { + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("MaxPeriodNumber")), null, 'errors'); + $action = "create"; + $error++; + } + } + + if (! $error) { + $object->id_origin = $id; + $object->titre = GETPOST('titre', 'alpha'); + $object->description = GETPOST('description', 'alpha'); + $object->socid = GETPOST('socid', 'alpha'); + $object->fk_project = GETPOST('projectid', 'int'); + $object->fk_contract = GETPOST('contractid', 'int'); + + $object->frequency = $frequency; + $object->unit_frequency = GETPOST('unit_frequency', 'alpha'); + $object->nb_gen_max = $nb_gen_max; + $object->auto_validate = GETPOST('auto_validate', 'int'); + + $date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear); + $object->date_when = $date_next_execution; + + if ($object->create($user) > 0) { + $id = $object->id; + $action = ''; + } else { + setEventMessages($object->error, $object->errors, 'errors'); + $action = "create"; + } + } +} elseif ($action == 'createfrommodel') { + $newinter = new fichinter($db); + + // on récupère les enregistrements + $object->fetch($id); + + + // on transfert les données de l'un vers l'autre + if ($object->socid > 0) { + $newinter->socid=$object->socid; + $newinter->fk_projet=$object->fk_projet; + $newinter->fk_contrat=$object->fk_contrat; + } else + $newinter->socid=GETPOST("socid"); + + $newinter->entity=$object->entity; + $newinter->duree=$object->duree; + + $newinter->description=$object->description; + $newinter->note_private=$object->note_private; + $newinter->note_public=$object->note_public; + + // on créer un nouvelle intervention + $extrafields = new ExtraFields($db); + $extralabels = $extrafields->fetch_name_optionals_label($newinter->table_element); + $array_options = $extrafields->getOptionalsFromPost($extralabels); + $newinter->array_options = $array_options; + + $newfichinterid = $newinter->create($user); + + if ($newfichinterid > 0) { + // on ajoute les lignes de détail ensuite + foreach ($object->lines as $ficheinterligne) + $newinter->addline($user, $newfichinterid, $ficheinterligne->desc, "", $ficheinterligne->duree, ''); + + // on update le nombre d'inter crée à partir du modèle + $object->updateNbGenDone(); + //on redirige vers la fiche d'intervention nouvellement crée + header('Location: '.DOL_URL_ROOT.'/fichinter/card.php?id='.$newfichinterid); + exit; + } else { + setEventMessages($newinter->error, $newinter->errors, 'errors'); + $action=''; + } +} elseif ($action == 'delete' && $user->rights->ficheinter->supprimer) { + // delete modele + $object->fetch($id); + $object->delete(); + $id = 0 ; + header('Location: '.$_SERVER["PHP_SELF"]); + exit; +} elseif ($action == 'setfrequency' && $user->rights->ficheinter->creer) { + // Set frequency and unit frequency + $object->fetch($id); + $object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha')); +} elseif ($action == 'setdate_when' && $user->rights->ficheinter->creer) { + // Set next date of execution + $object->fetch($id); + $date = dol_mktime( + GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, + GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear') + ); + if (!empty($date)) $object->setNextDate($date); +} elseif ($action == 'setnb_gen_max' && $user->rights->ficheinter->creer) { +// Set max period + $object->fetch($id); + $object->setMaxPeriod(GETPOST('nb_gen_max', 'int')); +} + + +/* + * View + */ + +llxHeader('', $langs->trans("RepeatableInterventional"), 'ch-fichinter.html#s-fac-fichinter-rec'); + +$form = new Form($db); +$companystatic = new Societe($db); +if (! empty($conf->contrat->enabled)) + $contratstatic = new Contrat($db); +if (! empty($conf->projet->enabled)) + $projectstatic = new Project($db); + +$now = dol_now(); +$tmparray=dol_getdate($now); +$today = dol_mktime( + 23, 59, 59, + $tmparray['mon'], $tmparray['mday'], $tmparray['year'] +); // Today is last second of current day + + + +/* + * Create mode + */ +if ($action == 'create') { + print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'title_commercial.png'); + + $object = new Fichinter($db); // Source invoice + //$object = new Managementfichinter($db); // Source invoice + + if ($object->fetch($id, $ref) > 0) { + print '
'; + print ''; + print ''; + print ''; + + dol_fiche_head(); + + $rowspan=4; + if (! empty($conf->projet->enabled) && $object->fk_project > 0) $rowspan++; + if (! empty($conf->contrat->enabled) && $object->fk_contrat > 0) $rowspan++; + + print ''; + + $object->fetch_thirdparty(); + + // Third party + print ''; + + // Title + print ''; + + // Note + print ''; + + // Author + print ""; + + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { + // Duration + print ''; + print ''; + print ''; + } + + // Project + if (! empty($conf->projet->enabled)) { + $formproject = new FormProjets($db); + print ""; + } + + // Contrat + if (! empty($conf->contrat->enabled)) { + $formcontract = new FormContract($db); + print ""; + } + print "
'.$langs->trans("Customer").''; + print $form->select_company($object->thirdparty->id, 'socid', '', 0, 1); + +// .$object->thirdparty->getNomUrl(1,'customer'). + print ''; + print $langs->trans("Comment"); + print '
'.$langs->trans("Title").''; + print ''; + print ''; + print ''; + print '
".$langs->trans("Author")."".$user->getFullName($langs)."
'.$langs->trans("TotalDuration").''.convertSecondToTime( + $object->duration, 'all', + $conf->global->MAIN_DURATION_OF_WORKDAY + ).'
".$langs->trans("Project").""; + $projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project; + + $numprojet = $formproject->select_projects( + $object->thirdparty->id, $projectid, 'projectid', + 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '' + ); + print '   '; + print $langs->trans("AddProject").''; + print "
".$langs->trans("Contract").""; + $contractid = GETPOST('contractid')?GETPOST('contractid'):$object->fk_contract; + $numcontract = $formcontract->select_contract($object->thirdparty->id, $contractid, 'contracttid'); + print "
"; + + print '

'; + + /// frequency & duration + // Autogeneration + $title = $langs->trans("Recurrence"); + print load_fiche_titre($title, '', 'calendar'); + + print ''; + + // Frequency + print '"; + + // First date of execution for cron + print ""; + + // Number max of generation + print ""; + + print "
'; + print $form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')); + print ""; + print " "; + print $form->selectarray( + 'unit_frequency', + array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), + (GETPOST('unit_frequency')?GETPOST('unit_frequency'):'m') + ); + print "
".$langs->trans('NextDateToExecution').""; + if ($date_next_execution != "") + $date_next_execution = (GETPOST('remonth') ? dol_mktime( + 12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear') + ) : -1); + print $form->select_date($date_next_execution, '', 1, 1, '', "add", 1, 1, 1); + print "
".$langs->trans("MaxPeriodNumber").""; + print ''; + print "
"; + + print '
'; + + $title = $langs->trans("ProductsAndServices"); + if (empty($conf->service->enabled)) + $title = $langs->trans("Products"); + else if (empty($conf->product->enabled)) + $title = $langs->trans("Services"); + + print load_fiche_titre($title, '', ''); + + /* + * Invoice lines + */ + print ''; + print ''; + + print "
'; + + $sql = 'SELECT l.*'; + $sql.= " FROM ".MAIN_DB_PREFIX."fichinterdet as l"; + $sql.= " WHERE l.fk_fichinter= ".$object->id; + $sql.= " AND l.fk_product is null "; + $sql.= " ORDER BY l.rang"; + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $i = 0; $total = 0; + + echo ''; + if ($num) { + print ''; + print ''; + print ''; + print "\n"; + } + $var=true; + while ($i < $num) { + $objp = $db->fetch_object($result); + $var=!$var; + print ""; + + // Show product and description + + print ''; + print ""; + + $i++; + } + $db->free($result); + + } else + print $db->error(); + print "
'.$langs->trans("Description").''.$langs->trans("Duration").'
'; + print ''; // ancre pour retourner sur la ligne + + $text = img_object($langs->trans('Service'), 'service'); + + print $text.' '.nl2br($objp->description); + + // Qty + print ''.convertSecondToTime($objp->duree).'
"; + + print '
\n"; + + dol_fiche_end(); + + print '
'; + print '     '; + print ''; + print '
'; + print "
\n"; + } + else + dol_print_error('', "Error, no invoice ".$object->id); + +} elseif ($action == 'selsocforcreatefrommodel') { + print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'title_commercial.png'); + dol_fiche_head(''); + + print '
'; + print ''; + print ''; + print '
'.$langs->trans("ThirdParty").''; + print $form->select_company('', 'socid', '', 1, 1); + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; + print ''; + print ''; + print '
'; + + print '
'; +} else { + /* + * View mode + * + */ + if ($id > 0) { + if ($object->fetch($id) > 0) { + $object->fetch_thirdparty(); + + $author = new User($db); + $author->fetch($object->user_author); + + $head = fichinter_rec_prepare_head($object); + + dol_fiche_head($head, 'card', $langs->trans("PredefinedInterventional"), 0, 'intervention'); + + // Intervention card + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Thirdparty + + $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) { + $formproject = new FormProjets($db); + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->ficheinter->creer) { + if ($action != 'classify') { + $morehtmlref.=''; + $morehtmlref.=img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + } + if ($action == 'classify') { + + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects( + $object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1 + ); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project( + $_SERVER['PHP_SELF'].'?id='.$object->id, + $object->socid, $object->fk_project, + 'none', 0, 0, 0, 1 + ); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.='trans('ShowProject').'">'; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + print '
'; + + print ''; + + print ""; + + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { + // Duration + print ''; + print ''; + } + + print '"; + + // Contrat + if (! empty($conf->contrat->enabled)) { + $langs->load('contrat'); + print ''; + print ''; + print ''; + + } + print "
".$langs->trans("Author").''.$author->getFullName($langs)."
'.$langs->trans("TotalDuration").''; + print convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + print '
'.$langs->trans("Description").''.nl2br($object->description)."
'; + + print ''; + if ($action != 'contrat') { + print ''; + } + print '
'; + print $langs->trans('Contract'); + print 'id.'">'; + print img_edit($langs->trans('SetContract'), 1); + print '
'; + print '
'; + if ($action == 'contrat') { + $formcontract= new Formcontract($db); + $formcontract->formSelectContract( + $_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, + $object->fk_contrat, 'contratid', 0, 1 + ); + } else { + if ($object->fk_contrat) { + $contratstatic = new Contrat($db); + $contratstatic->fetch($object->fk_contrat); + print $contratstatic->getNomUrl(0, '', 1); + } else + print " "; + + } + print '
"; + print '
'; + + print '
'; + print '
'; + print '
'; + + print ''; + + $title = $langs->trans("Recurrence"); + print load_fiche_titre($title, '', 'calendar'); + + print '
'; + + // if "frequency" is empty or = 0, the reccurence is disabled + print ''; + + // Date when + print ''; + print ''; + + // Max period / Rest period + print ''; + print ''; + + print '
'; + print ''; + if ($action != 'editfrequency' && $user->rights->ficheinter->creer) { + print ''; + } + print '
'; + print $langs->trans('Frequency'); + print ''; + print img_edit($langs->trans('Edit'), 1) . '
'; + print '
'; + if ($action == 'editfrequency') { + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print " "; + print $form->selectarray( + 'unit_frequency', + array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), + ($object->unit_frequency?$object->unit_frequency:'m') + ); + print '
'; + } else { + if ($object->frequency > 0) + print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); + else + print $langs->trans("NotARecurringInterventionalTemplate"); + } + print '
'; + if ( $user->rights->ficheinter->creer && ($action == 'date_when' || $object->frequency > 0)) { + print $form->editfieldkey( + $langs->trans("NextDateToExecution"), 'date_when', $object->date_when, + $object, $user->rights->facture->creer, 'day' + ); + } else { + print $langs->trans("NextDateToExecution"); + } + print ''; + if ($action == 'date_when' || $object->frequency > 0) { + print $form->editfieldval( + $langs->trans("NextDateToExecution"), 'date_when', $object->date_when, + $object, $user->rights->facture->creer, 'day' + ); + } + print '
'; + if ($user->rights->ficheinter->creer && ($action == 'nb_gen_max' || $object->frequency > 0)) { + print $form->editfieldkey( + $langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, + $object, $user->rights->facture->creer + ); + } else + print $langs->trans("MaxPeriodNumber"); + + print ''; + if ($action == 'nb_gen_max' || $object->frequency > 0) { + print $form->editfieldval( + $langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max?$object->nb_gen_max:'', + $object, $user->rights->facture->creer + ); + } + else + print ''; + + print '
'; + + // Frequencry/Recurring section + if ($object->frequency > 0) { + print '
'; + if (empty($conf->cron->enabled)) { + $txtinfoadmin=$langs->trans( + "EnableAndSetupModuleCron", + $langs->transnoentitiesnoconv("Module2300Name") + ); + print info_admin($txtinfoadmin); + } + print '
'; + print ''; + + // Nb of generation already done + print ''; + print ''; + print ''; + + // Date last + print ''; + print ''; + print '
'.$langs->trans("NbOfGenerationDone").''; + print $object->nb_gen_done?$object->nb_gen_done:'0'; + print '
'; + print $langs->trans("DateLastGeneration"); + print ''; + print dol_print_date($object->date_last_gen, 'dayhour'); + print '
'; + print '
'; + } + + print '
'; + print '
'; + print '
'; + + print '

'; + + /* + * Lines + */ + + $title = $langs->trans("ProductsAndServices"); + if (empty($conf->service->enabled)) + $title = $langs->trans("Products"); + else if (empty($conf->product->enabled)) + $title = $langs->trans("Services"); + + print load_fiche_titre($title); + + print ''; + print ''; + print ''; + print ''; + print ''; + + $num = count($object->lines); + $i = 0; + $var=true; + while ($i < $num) { + $var=!$var; + + // Show product and description + if (isset($object->lines[$i]->product_type)) + $type=$object->lines[$i]->product_type; + else + $object->lines[$i]->fk_product_type; + // Try to enhance type detection using date_start and date_end for free lines when type + // was not saved. + if (! empty($objp->date_start)) $type=1; + if (! empty($objp->date_end)) $type=1; + + // Show line + print ""; + print ''; + + print ''; + print "\n"; + $i++; + } + print '
'.$langs->trans("Description").''.$langs->trans("Duration").'
'; + $text = img_object($langs->trans('Service'), 'service'); + print $text.' '.nl2br($object->lines[$i]->desc); + print ''.convertSecondToTime($object->lines[$i]->duree).'
'; + + /** + * Barre d'actions + */ + print '
'; + + if ($user->rights->ficheinter->creer) { + print ''; + } + + if ($user->rights->ficheinter->supprimer) { + print ''; + } + print '
'; + } else + print $langs->trans("ErrorRecordNotFound"); + + } else { + /* + * List mode + */ + $sql = "SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, "; + $sql.= " f.duree, f.fk_contrat, f.fk_projet, f.frequency, f.nb_gen_done, f.nb_gen_max,"; + $sql.= " f.date_last_gen, f.date_when, f.datec"; + + $sql.= " FROM ".MAIN_DB_PREFIX."fichinter_rec as f"; + $sql.= " , ".MAIN_DB_PREFIX."societe as s "; + if (! $user->rights->societe->client->voir && ! $socid) { + $sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql.= " WHERE f.fk_soc = s.rowid"; + $sql.= " AND f.entity = ".$conf->entity; + if ($socid) $sql .= " AND s.rowid = ".$socid; + if (! $user->rights->societe->client->voir && ! $socid) { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + } + if ($search_ref) $sql .= natural_search('f.titre', $search_ref); + if ($search_societe) $sql .= natural_search('s.nom', $search_societe); + if ($search_frequency == '1') $sql.= ' AND f.frequency > 0'; + if ($search_frequency == '0') $sql.= ' AND (f.frequency IS NULL or f.frequency = 0)'; + + + //$sql .= " ORDER BY $sortfield $sortorder, rowid DESC "; + // $sql .= $db->plimit($limit + 1, $offset); + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + print_barre_liste( + $langs->trans("RepeatableInterventional"), $page, + $_SERVER['PHP_SELF'], "&socid=$socid", $sortfield, $sortorder, + '', $num, '', 'title_commercial.png' + ); + + print $langs->trans("ToCreateAPredefinedInterventional").'

'; + + $i = 0; + print ''; + print ''; + print_liste_field_titre( + $langs->trans("Ref"), $_SERVER['PHP_SELF'], "f.titre", "", "", + 'width="200px" align="left"', $sortfiled, $sortorder + ); + + print_liste_field_titre( + $langs->trans("Company"), $_SERVER['PHP_SELF'], "s.nom", "", "", + 'width="200px" align="left"', $sortfiled, $sortorder + ); + if (! empty($conf->contrat->enabled)) + print_liste_field_titre( + $langs->trans("Contract"), $_SERVER['PHP_SELF'], + "f.fk_contrat", "", "", + 'width="100px" align="left"', $sortfiled, $sortorder + ); + + if (! empty($conf->projet->enabled)) + print_liste_field_titre( + $langs->trans("Project"), $_SERVER['PHP_SELF'], + "f.fk_project", "", "", + 'width="100px" align="left"', $sortfiled, $sortorder + ); + print_liste_field_titre( + $langs->trans("Duration"), $_SERVER['PHP_SELF'], + 'f.duree', '', '', + 'width="50px" align="right"', $sortfiled, $sortorder + ); + // Recurring or not + print_liste_field_titre( + $langs->trans("Frequency"), $_SERVER['PHP_SELF'], + "f.frequency", "", "", + 'width="100px" align="center"', $sortfiled, $sortorder + ); + print_liste_field_titre( + $langs->trans("NbOfGenerationDone"), $_SERVER['PHP_SELF'], + "f.nb_gen_done", "", "", + 'width="100px" align="center"', $sortfiled, $sortorder + ); + + print_liste_field_titre( + $langs->trans("DateLastGeneration"), $_SERVER['PHP_SELF'], + "f.date_last_gen", "", "", + 'width="100px" align="center"', $sortfiled, $sortorder + ); + print_liste_field_titre( + $langs->trans("NextDateToIntervention"), $_SERVER['PHP_SELF'], + "f.date_when", "", "", + 'width="100px" align="center"', $sortfiled, $sortorder + ); + print ''; + print "\n"; + + +// les filtres à faire ensuite + + if ($num > 0) { + $var=true; + while ($i < min($num, $limit)) { + $objp = $db->fetch_object($resql); + $var=!$var; + + print ""; + print '\n"; + if ($objp->socid) { + $companystatic->id=$objp->socid; + $companystatic->name=$objp->name; + print ''; + } else + print ''; + + if (! empty($conf->contrat->enabled)) { + print ''; + } + if (! empty($conf->projet->enabled)) { + print ''; + } + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + } else { + print ''.$langs->trans('NA').''; + print ''; + print ''; + print ''; + } + + if ($user->rights->ficheinter->creer) { + // Action column + print '"; + + print "\n"; + $i++; + } + } + } else + print ''; + + print "
'; + print img_object($langs->trans("ShowIntervention"), "intervention").' '.$objp->titre; + print "'.$companystatic->getNomUrl(1, 'customer').''.$langs->trans("None").''; + if ($objp->fk_contrat >0) { + $contratstatic->fetch($objp->fk_contrat); + print $contratstatic->getNomUrl(1); + } + print ''; + if ($objp->fk_project >0) { + $projectstatic->fecth($objp->fk_projet); + print $projectstatic->getNomUrl(1); + } + print ''.convertSecondToTime($objp->duree).''.yn($objp->frequency?1:0).''; + if ($objp->frequency) { + print $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') ; + print ''; + print dol_print_date($db->jdate($objp->date_last_gen), 'day') ; + print ''; + print dol_print_date($db->jdate($objp->date_when), 'day'); + print ''; + print ''.$langs->trans('NA').''; + print ''; + print ''.$langs->trans('NA').''; + print ''; + if ($user->rights->ficheinter->creer) { + if (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { + print ''; + print $langs->trans("CreateFichInter").''; + } else + print $langs->trans("DateIsNotEnough"); + } else + print " "; + + print "
'.$langs->trans("NoneF").'
"; + $db->free($resql); + } else + dol_print_error($db); + } +} +llxFooter(); +$db->close(); From e0c1e330125287e719cd96cd27f09529d50474c7 Mon Sep 17 00:00:00 2001 From: Inovea Conseil Date: Wed, 30 May 2018 00:20:31 +0200 Subject: [PATCH 039/156] NEW: ADD url to see the last version of a external module --- htdocs/admin/modules.php | 9 ++++++++- .../template/core/modules/modMyModule.class.php | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 10a9ccb5fc3..4b9de2568c7 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -7,7 +7,8 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud - * + * Copyright (C) 2018 Nicolas ZABOURI + * * 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 @@ -666,6 +667,12 @@ if ($mode == 'common') // Version print ''; print $versiontrans; + if (!empty($objMod->url_last_version)) { + $newversion = file_get_contents($objMod->url_last_version); + if (version_compare($newversion, $versiontrans) > 0) { + print " $newversion"; + } + } print "\n"; // Activate/Disable and Setup (2 columns) diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 0ca707daa1c..1a3d8569dc8 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify @@ -73,6 +74,9 @@ class modMyModule extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' $this->version = '1.0'; + + //Url to the file with your last numberversion of this module + $this->url_last_version = 'http://www.example.com/versionmodule.txt'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of image file used for this module. From 7c57b360a301476c7451c1a9f09cac440d2645c1 Mon Sep 17 00:00:00 2001 From: Inovea Conseil Date: Wed, 30 May 2018 13:45:17 +0200 Subject: [PATCH 040/156] Auto stash before merge of "develop" and "Dolibarr/develop" --- htdocs/modulebuilder/admin/setup.php | 159 +++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 htdocs/modulebuilder/admin/setup.php diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php new file mode 100644 index 00000000000..f84bf8989ad --- /dev/null +++ b/htdocs/modulebuilder/admin/setup.php @@ -0,0 +1,159 @@ + + * + * 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/modulebuilder/admin/setup.php + * \ingroup modulebuilder + * \brief Page setup for modulebuilder module + */ +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; + +global $conf,$langs,$user, $db; +$langs->loadLangs(array("admin", "other", "modulebuilder")); + +if (!$user->admin || empty($conf->modulebuilder->enabled)) + accessforbidden(); + +$action = GETPOST('action', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + +/* + * Actions + */ +if($action=="update"){ + $res1=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_README', GETPOST('MODULEBUILDER_SPECIFIC_README'), 'chaine', 0, '', $conf->entity); + if ($res1 < 0) + { + setEventMessages('ErrorFailedToSaveDate', null, 'errors'); + $db->rollback(); + } + else + { + setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); + $db->commit(); + } +} + +if (preg_match('/set_(.*)/', $action, $reg)) { + $code = $reg[1]; + $values = GETPOST($code); + if (is_array($values)) + $values = implode(',', $values); + + if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0) { + header("Location: " . $_SERVER["PHP_SELF"]); + exit; + } else { + dol_print_error($db); + } +} + +if (preg_match('/del_(.*)/', $action, $reg)) { + $code = $reg[1]; + if (dolibarr_del_const($db, $code, 0) > 0) { + Header("Location: " . $_SERVER["PHP_SELF"]); + exit; + } else { + dol_print_error($db); + } +} + + +/* + * View + */ + +$form = new Form($db); + +llxHeader('', $langs->trans("ModulebuilderSetup")); + +$linkback = ''; +if (GETPOST('withtab', 'alpha')) { + $linkback = '' . $langs->trans("BackToModuleList") . ''; +} + +print load_fiche_titre($langs->trans("ModuleSetup") . ' ' . $langs->trans('Modulebuilder'), $linkback); + +if (GETPOST('withtab', 'alpha')) { + dol_fiche_head($head, 'modulebuilder', '', -1); +} + + +print '' . $langs->trans("ModuleBuilderDesc") . "
\n"; + +print '
'; + +print ''; +print ''; +print ''; +print ''; +print "\n"; + +print ''; +print ''; +print ''; + + + +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; +print '
' . $langs->trans("Key") . '' . $langs->trans("Value") . '
' . $langs->trans("UseAboutPage") . ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MODULEBUILDER_USE_ABOUT'); +} else { + if (empty($conf->global->MODULEBUILDER_USE_ABOUT)) { + print '' . img_picto($langs->trans("Disabled"), 'off') . ''; + } else { + print '' . img_picto($langs->trans("Enabled"), 'on') . ''; + } +} +print '
' . $langs->trans("UseDocFolder") . ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MODULEBUILDER_USE_DOCFOLDER'); +} else { + if (empty($conf->global->MODULEBUILDER_USE_DOCFOLDER)) { + print '' . img_picto($langs->trans("Disabled"), 'off') . ''; + } else { + print '' . img_picto($langs->trans("Enabled"), 'on') . ''; + } +} +print '
' . $langs->trans("UseSpecificReadme") . ''; +print ''; +print '
'; +print ''; +print '
'; + +if (GETPOST('withtab', 'alpha')) { + dol_fiche_end(); +} + +print '

'; + +llxFooter(); +$db->close(); From 78b3067de352644dd00359a691d64e4258be98d2 Mon Sep 17 00:00:00 2001 From: Inovea Conseil Date: Wed, 30 May 2018 13:54:43 +0200 Subject: [PATCH 041/156] NEW: ADD admin page for modulebuilder ADD custom README ADD choice to generate about page and documentation folder --- htdocs/core/modules/modModuleBuilder.class.php | 3 ++- htdocs/langs/en_US/modulebuilder.lang | 5 ++++- htdocs/modulebuilder/admin/setup.php | 2 +- htdocs/modulebuilder/index.php | 12 ++++++++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modModuleBuilder.class.php b/htdocs/core/modules/modModuleBuilder.class.php index 2c7b917d6d2..d5c333c4ade 100644 --- a/htdocs/core/modules/modModuleBuilder.class.php +++ b/htdocs/core/modules/modModuleBuilder.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -59,7 +60,7 @@ class modModuleBuilder extends DolibarrModules // Config pages //------------- - $this->config_page_url = array(); + $this->config_page_url = array('setup@modulebuilder'); // Dependancies //------------- diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 6638e1fa674..ed3a872d3c6 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -94,4 +94,7 @@ YouCanUseTranslationKey=You can use here a key that is the translation key found DropTableIfEmpty=(Delete table if empty) TableDoesNotExists=The table %s does not exists TableDropped=Table %s deleted -InitStructureFromExistingTable=Build the structure array string of an existing table \ No newline at end of file +InitStructureFromExistingTable=Build the structure array string of an existing table +UseAboutPage=Disallow the about page +UseDocFolder=Disallow the documentation folder +UseSpecificReadme=Use a specific ReadMe \ No newline at end of file diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php index f84bf8989ad..5bc1fb7c206 100644 --- a/htdocs/modulebuilder/admin/setup.php +++ b/htdocs/modulebuilder/admin/setup.php @@ -73,7 +73,7 @@ if (preg_match('/del_(.*)/', $action, $reg)) { } } - + /* * View */ diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index e844793b601..1d0c7960fda 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -120,6 +120,13 @@ if ($dirins && $action == 'initmodule' && $modulename) setEventMessages($langs->trans("AllFilesDidAlreadyExist", $srcdir, $destdir), null, 'warnings'); } } + + if(!empty($conf->global->MODULEBUILDER_USE_ABOUT)){ + dol_delete_file($destdir.'/admin/about.php'); + } + if(!empty($conf->global->MODULEBUILDER_USE_DOCFOLDER)){ + dol_delete_dir($destdir.'/doc/'); + } // Delete some files dol_delete_file($destdir.'/myobject_card.php'); @@ -165,6 +172,11 @@ if ($dirins && $action == 'initmodule' && $modulename) setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors'); } } + + if(!empty($conf->global->MODULEBUILDER_SPECIFIC_README)){ + dol_delete_file($destdir.'/README.md'); + file_put_contents($destdir.'/README.md', $conf->global->MODULEBUILDER_SPECIFIC_README); + } } if (! $error) From 0f9fa09d3f0a33bc6c87cfe02e41772b21f806dd Mon Sep 17 00:00:00 2001 From: Inovea Conseil Date: Thu, 31 May 2018 09:13:18 +0200 Subject: [PATCH 042/156] Fix after the comment --- htdocs/admin/modules.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 4b9de2568c7..b466a3cba54 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -667,10 +667,15 @@ if ($mode == 'common') // Version print ''; print $versiontrans; - if (!empty($objMod->url_last_version)) { - $newversion = file_get_contents($objMod->url_last_version); - if (version_compare($newversion, $versiontrans) > 0) { - print " $newversion"; + if(!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)){ + require_once(DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'); + if (!empty($objMod->url_last_version)) { + $newversion = getURLContent($objMod->url_last_version); + if(isset($newversion['content'])){ + if (version_compare($newversion['content'], $versiontrans) > 0) { + print " ".$newversion['content'].""; + } + } } } print "\n"; From 083acb1af578c7e9150b0773a1bf100ba3423ba8 Mon Sep 17 00:00:00 2001 From: Rui Strecht Date: Thu, 7 Jun 2018 16:24:45 +0100 Subject: [PATCH 043/156] Added MAIN_DOCUMENTS_DESCRIPTION_FIRST option to allow desc to appear before product/service label in documents --- htdocs/core/lib/pdf.lib.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index b0cda2ecd6a..ad2b1066fbd 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1228,7 +1228,17 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl { if ($idprod) { - if (empty($hidedesc)) $libelleproduitservice.=$desc; + if (empty($hidedesc)) + { + if (!empty($conf->global->MAIN_DOCUMENTS_DESCRIPTION_FIRST)) + { + $libelleproduitservice=$desc."\n".$libelleproduitservice; + } + else + { + $libelleproduitservice.=$desc; + } + } } else { From 74d92dd91f35a70cfec0c9806c02798ddc94930b Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Mon, 11 Jun 2018 23:09:12 +0100 Subject: [PATCH 044/156] New: Optiopn to see line numbers in modules page --- htdocs/admin/modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 588bdb856db..df1cd2a61f4 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -637,6 +637,7 @@ if ($mode == 'common') } print ''."\n"; + if(!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print ''.++$linenum.''; // Picto + Name of module print ' '; From 933a6a5ba353306fc599a27c8918ed6ff487353d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Jun 2018 22:11:44 +0200 Subject: [PATCH 045/156] Update html.formcontract.class.php --- htdocs/core/class/html.formcontract.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index 01ebe66666b..a3a3696e5f4 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -57,7 +57,7 @@ class FormContract global $db,$user,$conf,$langs; $hideunselectables = false; - if (! empty($conf->global->SELECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true; // Search all contacts $sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut'; From e18717aa8575bbc78ee334c3917c73dd470743e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Jun 2018 22:12:16 +0200 Subject: [PATCH 046/156] Update html.formprojet.class.php --- htdocs/core/class/html.formprojet.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 75ccc1d8245..f437920caf9 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -143,7 +143,7 @@ class FormProjets $outarray=array(); $hideunselectables = false; - if (! empty($conf->global->SELECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true; $projectsListId = false; if (empty($user->rights->projet->all->lire)) @@ -318,7 +318,7 @@ class FormProjets $out=''; $hideunselectables = false; - if (! empty($conf->global->SELECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true; if (empty($projectsListId)) { From 3b33dad8fdb41cdb09f77aade27c98f437cae4ee Mon Sep 17 00:00:00 2001 From: dolibarr95 <24292300+dolibarr95@users.noreply.github.com> Date: Wed, 20 Jun 2018 14:40:32 +0200 Subject: [PATCH 047/156] Add supplier ref Hi In all common case the supplier send a receipt with the parcel on which is writen his product ref (because this is his reference) with the quantity in the parcel and if he is smart/nice our reference. By adding the supplier ref column the supplier order dispatch is easier. Tks. --- htdocs/fourn/commande/dispatch.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 5b4adc39638..2c4fbe9e799 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -492,7 +492,7 @@ if ($id > 0 || ! empty($ref)) { $db->free($resql); } - $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,"; + $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty, l.ref AS sref,"; $sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse"; $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid"; @@ -514,6 +514,7 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; print ''; + print '' . $langs->trans("SupplierRef") . ''; print '' . $langs->trans("QtyOrdered") . ''; print '' . $langs->trans("QtyDispatchedShort") . ''; print '' . $langs->trans("QtyToDispatchShort") . ''; @@ -590,6 +591,9 @@ if ($id > 0 || ! empty($ref)) { if (! empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) $up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU'); + // Supplier ref + print ''.$objp->sref.''; + // Qty ordered print '' . $objp->qty . ''; From aa377865963220c73bf2d5d6659a190cb8f3806d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Jun 2018 11:51:49 +0200 Subject: [PATCH 048/156] Fix migration errors reported by Softaculous --- htdocs/install/mysql/migration/6.0.0-7.0.0.sql | 7 ++++--- htdocs/install/mysql/tables/llx_website_account.key.sql | 3 ++- htdocs/install/mysql/tables/llx_website_page.sql | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index ee4fd5f15b4..61e829d5028 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -298,6 +298,7 @@ ALTER TABLE llx_website_account ADD INDEX idx_website_account_login (login); ALTER TABLE llx_website_account ADD INDEX idx_website_account_import_key (import_key); ALTER TABLE llx_website_account ADD INDEX idx_website_account_status (status); ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_soc (fk_soc); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_website (fk_website); ALTER TABLE llx_website_account ADD UNIQUE INDEX uk_website_account_login_website_soc(login, fk_website, fk_soc); @@ -474,7 +475,7 @@ ALTER TABLE llx_extrafields MODIFY COLUMN list integer DEFAULT 1; ALTER TABLE llx_extrafields MODIFY COLUMN langs varchar(64); -ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128); +ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128) NOT NULL; ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name); ALTER TABLE llx_societe MODIFY COLUMN ref_ext varchar(255); @@ -670,9 +671,9 @@ ALTER TABLE llx_blockedlog ADD COLUMN user_fullname varchar(255); ALTER TABLE llx_blockedlog MODIFY COLUMN ref_object varchar(255); -- SPEC : use database type 'double' to store monetary values -ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8); +ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8) NOT NULL; ALTER TABLE llx_chargessociales MODIFY COLUMN amount double(24,8); -ALTER TABLE llx_commande MODIFY COLUMN amount_ht double(24,8); +ALTER TABLE llx_commande MODIFY COLUMN amount_ht double(24,8) default 0; ALTER TABLE llx_commande_fournisseur MODIFY COLUMN amount_ht double(24,8); ALTER TABLE llx_don MODIFY COLUMN amount double(24,8); ALTER TABLE llx_expensereport_rules MODIFY COLUMN amount double(24,8); diff --git a/htdocs/install/mysql/tables/llx_website_account.key.sql b/htdocs/install/mysql/tables/llx_website_account.key.sql index 1302ec50d2c..2114d3c0f85 100644 --- a/htdocs/install/mysql/tables/llx_website_account.key.sql +++ b/htdocs/install/mysql/tables/llx_website_account.key.sql @@ -17,9 +17,10 @@ -- BEGIN MODULEBUILDER INDEXES ALTER TABLE llx_website_account ADD INDEX idx_website_account_rowid (rowid); ALTER TABLE llx_website_account ADD INDEX idx_website_account_login (login); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_import_key (import_key); ALTER TABLE llx_website_account ADD INDEX idx_website_account_status (status); -ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_website (fk_website); ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_soc (fk_soc); +ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_website (fk_website); -- END MODULEBUILDER INDEXES ALTER TABLE llx_website_account ADD UNIQUE INDEX uk_website_account_login_website_soc(login, fk_website, fk_soc); diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index 5393177a3bb..e6d7616ab4e 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -21,6 +21,7 @@ CREATE TABLE llx_website_page ( rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY, fk_website integer NOT NULL, + type_container varchar(16) NOT NULL DEFAULT 'page', pageurl varchar(255) NOT NULL, title varchar(255), description varchar(255), From 775e11ce33d0cceca404301818d0d9b94318a726 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 25 Jun 2018 13:02:07 +0200 Subject: [PATCH 049/156] Fix: wrong table name --- htdocs/core/class/html.formother.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 098b75a81b6..69fe03ecaa1 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -193,7 +193,7 @@ class FormOther print ''; $i++; From 48ad03c56d80d0f31688b7428ed8315e9a071056 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 25 Jun 2018 13:39:26 +0200 Subject: [PATCH 050/156] Fix: remove unused and blocking field --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index c50985be5fc..e4f9fa1dd90 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -261,7 +261,7 @@ $tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_ $tabfield[11]= "element,source,code,libelle,position"; $tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity"; $tabfield[13]= "code,libelle,type,entity"; -$tabfield[14]= "code,label,price,organization,country_id,country"; +$tabfield[14]= "code,label,price,organization,country"; $tabfield[15]= "code,libelle,width,height,unit"; $tabfield[16]= "code,libelle,sortorder"; $tabfield[17]= "code,label,accountancy_code"; From 62f2108101b98d50853cde4617a41f85817858d9 Mon Sep 17 00:00:00 2001 From: "STAGIAIRE-PC\\Pierre" Date: Wed, 27 Jun 2018 10:33:57 +0200 Subject: [PATCH 051/156] ajout de la gestion des comptes bancaires des tiers via l'api --- .../societe/class/api_thirdparties.class.php | 172 ++++++++++++++++++ .../class/companybankaccount.class.php | 57 ++++++ 2 files changed, 229 insertions(+) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 73c782ddf7c..fa2c44078cd 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -996,6 +996,178 @@ class Thirdparties extends DolibarrApi return $result; } + /** + * Get CompanyBankAccount objects for thirdparty + * + * @param int $socid + * + * @return array + */ + function getCompanyBankAccount($socid){ + + global $db, $conf; + + if(! DolibarrApiAccess::$user->rights->facture->lire) { + throw new RestException(401); + } + if(empty($socid)) { + throw new RestException(400, 'Thirdparty ID is mandatory'); + } + + if( ! DolibarrApi::_checkAccessToResource('societe',$socid)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + /** + * On requete sur tous les enregistrements qui ont comme fk_soc, la société passée en paramètre + */ + + $sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; + $sql.= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe_rib"; + if ($socid) $sql.= " WHERE fk_soc = ".$socid." "; + + + $result = $db->query($sql); + + if($result->num_rows == 0 ){ + throw new RestException(404, 'Account not found'); + } + + $i=0; + + $accounts =[]; + + if ($result) + { + $num = $db->num_rows($result); + while ($i < $num) + { + $obj = $db->fetch_object($result); + $account = new CompanyBankAccount($db); + if($account->fetch($obj->rowid)) { + $accounts[] = $account; + } + $i++; + } + } + else{ + throw new RestException(404, 'Account not found'); + } + + + $fields = ['socid', 'default_rib', 'frstrecur', '1000110000001', 'datec', 'datem', 'label', 'bank', 'bic', 'iban', 'id']; + + $returnAccounts = []; + + foreach($accounts as $account){ + $object= []; + foreach($account as $key => $value) + if(in_array($key, $fields)){ + $object[$key] = $value; + + } + $returnAccounts[] = $object; + } + + return $returnAccounts; + } + + + /** + * Create CompanyBankAccount object for thirdparty + * @param int $socid id de l'entreprise + * @param array $request_data Request datas + * + * @return object ID of thirdparty + * + * @url POST {socid}/CompanyBankAccount + */ + function createCompanyBankAccount($socid, $request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->societe->creer) { + throw new RestException(401); + } + + $account = new CompanyBankAccount($this->db); + + $account->socid = $socid; + + foreach($request_data as $field => $value) { + $account->$field = $value; + } + + if ($account->create(DolibarrApiAccess::$user) < 0) + throw new RestException(500, 'Error creating Company Bank account'); + + + if ($account->update(DolibarrApiAccess::$user) < 0) + throw new RestException(500, 'Error updating values'); + + return $account; + } + + + /** + * Update CompanyBankAccount object for thirdparty + * @param int $id Id du compte + * @param int $socid + * @param array $request_data Request datas + * + * @return object ID of thirdparty + * + * @url PUT {socid}/CompanyBankAccount/{id} + */ + function updateCompanyBankAccount($socid, $id, $request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->societe->creer) { + throw new RestException(401); + } + + $account = new CompanyBankAccount($this->db); + + $account->fetchFromApi($id, $socid); + + + + if($account->socid != $socid){ + throw new RestException(401); + } + + + foreach($request_data as $field => $value) { + $account->$field = $value; + } + + if ($account->update(DolibarrApiAccess::$user) < 0) + throw new RestException(500, 'Error updating values'); + + return $account; + } + + /** + * @param int $id Id du compte + * @param int $socid Id de l'entreprise + * + * @return int -1 si erreur 1 si suppression + * + * @url DELETE {socid}/CompanyBankAccount/{id} + */ + function deleteCompanyBankAccount($id, $socid){ + + if(! DolibarrApiAccess::$user->rights->societe->creer) { + throw new RestException(401); + } + + $account = new CompanyBankAccount($this->db); + + $account->fetch($id); + + if(!$account->socid == $socid) + throw new RestException(401); + + return $account->delete(DolibarrApiAccess::$user); + } /** diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 187f7c5ec65..68dd8f51c3b 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -250,6 +250,63 @@ class CompanyBankAccount extends Account } } + /** + * Load record from database for the API + * + * @param int $id Id of record + * @param int $socid Id of company. If this is filled, function will return the first default RIB of company + * @return int <0 if KO, >0 if OK + */ + function fetchFromApi($id, $socid=0) + { + if (empty($id) && empty($socid)) return -1; + + $sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; + $sql.= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe_rib"; + if ($id) $sql.= " WHERE rowid = ".$id; + if ($socid) $sql.= " AND fk_soc = ".$socid; + + $resql = $this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); + + $this->ref = $obj->fk_soc.'-'.$obj->label; // Generate an artificial ref + + $this->id = $obj->rowid; + $this->type = $obj->type; + $this->socid = $obj->fk_soc; + $this->bank = $obj->bank; + $this->code_banque = $obj->code_banque; + $this->code_guichet = $obj->code_guichet; + $this->number = $obj->number; + $this->cle_rib = $obj->cle_rib; + $this->bic = $obj->bic; + $this->iban = $obj->iban; + $this->domiciliation = $obj->domiciliation; + $this->proprio = $obj->proprio; + $this->owner_address = $obj->owner_address; + $this->label = $obj->label; + $this->default_rib = $obj->default_rib; + $this->datec = $this->db->jdate($obj->datec); + $this->datem = $this->db->jdate($obj->datem); + $this->rum = $obj->rum; + $this->frstrecur = $obj->frstrecur; + } + $this->db->free($resql); + + return 1; + } + else + { + dol_print_error($this->db); + return -1; + } + } + /** * Delete a rib from database * From a94eeaa5005e71a41e5a413b86c22e8f5f0c3624 Mon Sep 17 00:00:00 2001 From: "STAGIAIRE-PC\\Pierre" Date: Wed, 27 Jun 2018 10:53:45 +0200 Subject: [PATCH 052/156] adding the possibility to personnalize ent_to_end and ustrd of a bank levy --- htdocs/admin/prelevement.php | 12 ++++++++++++ .../prelevement/class/bonprelevement.class.php | 6 ++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 6fd40cf2825..7b7bbd8e2b4 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -221,6 +221,18 @@ print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER' print ''; print ''; +//EntToEnd +print ''.$langs->trans("END_TO_END").''; +print ''; +print ''; +print ''; + +//USTRD +print ''.$langs->trans("USTRD").''; +print ''; +print ''; +print ''; + print ''; print '
'; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 245b25be3b6..a6b0ec84317 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1575,7 +1575,8 @@ class BonPrelevement extends CommonObject $XML_DEBITOR =''; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; - $XML_DEBITOR .=' '.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters + // $XML_DEBITOR .=' '.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters + $XML_DEBITOR .=' '.(($conf->global->END_TO_END != "" ) ? $conf->global->END_TO_END : ('AS-'.dol_trunc($row_facnumber,20)).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.round($row_somme, 2).''.$CrLf; $XML_DEBITOR .=' '.$CrLf; @@ -1607,7 +1608,8 @@ class BonPrelevement extends CommonObject $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; // $XML_DEBITOR .=' '.($row_facnumber.'/'.$Rowing.'/'.$Rum).''.$CrLf; - $XML_DEBITOR .=' '.dol_trunc($row_facnumber, 135).''.$CrLf; // 140 max + // $XML_DEBITOR .=' '.dol_trunc($row_facnumber, 135).''.$CrLf; // 140 max + $XML_DEBITOR .=' '.(($conf->global->USTRD != "" ) ? $conf->global->USTRD : dol_trunc($row_facnumber, 135) ).''.$CrLf; // 140 max $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; return $XML_DEBITOR; From 8a780b3910a0c94faa5008b3127c409dfecb7805 Mon Sep 17 00:00:00 2001 From: "STAGIAIRE-PC\\Pierre" Date: Wed, 27 Jun 2018 11:01:20 +0200 Subject: [PATCH 053/156] Code refactorisation --- .../societe/class/api_thirdparties.class.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index fa2c44078cd..3faf2f14994 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -999,7 +999,7 @@ class Thirdparties extends DolibarrApi /** * Get CompanyBankAccount objects for thirdparty * - * @param int $socid + * @param int $socid Thirdparty id * * @return array */ @@ -1019,7 +1019,7 @@ class Thirdparties extends DolibarrApi } /** - * On requete sur tous les enregistrements qui ont comme fk_soc, la société passée en paramètre + * We select all the records that match the socid */ $sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; @@ -1076,14 +1076,14 @@ class Thirdparties extends DolibarrApi /** * Create CompanyBankAccount object for thirdparty - * @param int $socid id de l'entreprise + * @param int $socid thirdparty id * @param array $request_data Request datas * * @return object ID of thirdparty * * @url POST {socid}/CompanyBankAccount */ - function createCompanyBankAccount($socid, $request_data = NULL) + function createCompanyBankAccount($socid, $request_data = null) { if(! DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); @@ -1110,15 +1110,16 @@ class Thirdparties extends DolibarrApi /** * Update CompanyBankAccount object for thirdparty - * @param int $id Id du compte - * @param int $socid + * + * @param int $socid Thirdparty id + * @param int $id CompanyBankAccount's id * @param array $request_data Request datas * * @return object ID of thirdparty * * @url PUT {socid}/CompanyBankAccount/{id} */ - function updateCompanyBankAccount($socid, $id, $request_data = NULL) + function updateCompanyBankAccount($socid, $id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); @@ -1146,10 +1147,10 @@ class Thirdparties extends DolibarrApi } /** - * @param int $id Id du compte - * @param int $socid Id de l'entreprise + * @param int $id CompanyBankAccount's id + * @param int $socid Thirdparty id * - * @return int -1 si erreur 1 si suppression + * @return int -1 if error 1 if correct deletion * * @url DELETE {socid}/CompanyBankAccount/{id} */ From 19eaa3df669ade3f013ab4a897750cba0a28c952 Mon Sep 17 00:00:00 2001 From: "STAGIAIRE-PC\\Pierre" Date: Wed, 27 Jun 2018 11:29:46 +0200 Subject: [PATCH 054/156] =?UTF-8?q?ajout=20de=20la=20modification=20dans?= =?UTF-8?q?=20la=20base=20de=20donn=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/prelevement.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 7b7bbd8e2b4..56e1e7f2039 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -80,6 +80,16 @@ if ($action == "set") $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"),'chaine',0,'',$conf->entity); if (! $res > 0) $error++; } + if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END")=="") + { + $res = dolibarr_set_const($db, "END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD")=="") + { + $res = dolibarr_set_const($db, "USTRD", GETPOST("PRELEVEMENT_USTRD"),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } if (! $error) { From a952b46d8b58c312ab3b39adb78d89dd9cb3b450 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 27 Jun 2018 12:37:31 +0200 Subject: [PATCH 055/156] clean and update code --- htdocs/install/repair.php | 1 - htdocs/livraison/card.php | 3 --- htdocs/loan/index.php | 2 -- htdocs/margin/admin/margin.php | 5 ----- htdocs/margin/agentMargins.php | 3 --- htdocs/printing/admin/printing.php | 4 ---- htdocs/product/admin/product.php | 8 -------- htdocs/product/admin/product_tools.php | 2 -- htdocs/product/canvas/product/tpl/list.tpl.php | 3 +-- htdocs/product/composition/card.php | 2 -- htdocs/product/fournisseurs.php | 3 --- htdocs/product/index.php | 4 ---- htdocs/product/stock/massstockmove.php | 4 ---- htdocs/product/stock/productlot_list.php | 2 -- htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php | 3 +-- 15 files changed, 2 insertions(+), 47 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 896d6964bdd..97f9a71bb87 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -648,7 +648,6 @@ if ($ok && GETPOST('clean_orphelin_dir','alpha')) $object_instance=new ChargeSociales($db); } - $var=true; foreach($filearray as $key => $file) { if (!is_dir($file['name']) diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index d6cefb24d83..072c53aa3cb 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -604,11 +604,8 @@ else print ''.$langs->trans("QtyReceived").''; print "\n"; } - $var=true; while ($i < $num_prod) { - - print ''; if ($object->lines[$i]->fk_product > 0) { diff --git a/htdocs/loan/index.php b/htdocs/loan/index.php index 03e3ab482f4..660189fbc9d 100644 --- a/htdocs/loan/index.php +++ b/htdocs/loan/index.php @@ -104,7 +104,6 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; - $var=true; $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); @@ -167,7 +166,6 @@ if ($resql) $loan_static->ref = $obj->rowid; $loan_static->label = $obj->label; - $var = !$var; print ''; // Ref diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index d37dfe0c83b..eaa53aa8490 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -129,11 +129,9 @@ print ''.$langs->trans("Value").''."\n"; print ''.$langs->trans("Description").''."\n"; print ''; -$var=true; $form = new Form($db); // GLOBAL DISCOUNT MANAGEMENT - print ''; print ''; print ""; @@ -165,7 +163,6 @@ print ''; print ''; // DISPLAY MARGIN RATES - print ''; print ''.$langs->trans("DisplayMarginRates").''; print ''; @@ -189,7 +186,6 @@ print ''.$langs->trans('MarginRate').' = '.$langs->trans('Margin').' / '.$la print ''; // DISPLAY MARK RATES - print ''; print ''.$langs->trans("DisplayMarkRates").''; print ''; @@ -259,7 +255,6 @@ print ''; print ''; // INTERNAL CONTACT TYPE USED AS COMMERCIAL AGENT - print '
'; print ''; print ""; diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 2e80fe5ced2..8c62b4dd6fe 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -208,7 +208,6 @@ if ($result) if ($num > 0) { - $var=true; while ($i < $num /*&& $i < $conf->liste_limit*/) { @@ -229,8 +228,6 @@ if ($result) $markRate = ($pv != 0)?(100 * $marge / $pv):'' ; } - - print ''; if ($agentid > 0) { $companystatic->id=$objp->socid; diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index 96b9cad3849..96dd916290e 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -127,7 +127,6 @@ if ($mode == 'setup' && $user->admin) print $langs->trans("PrintingDriverDesc".$driver)."

\n"; print ''."\n"; - $var=true; print ''; print ''; print ''; @@ -146,7 +145,6 @@ if ($mode == 'setup' && $user->admin) $submit_enabled=0; foreach ($printer->conf as $key) { - switch ($key['type']) { case "text": case "password": @@ -248,7 +246,6 @@ if ($mode == 'config' && $user->admin) print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'."\n"; - $var=true; print ''; print ''; print ''; @@ -333,7 +330,6 @@ if ($mode == 'userconf' && $user->admin) print $langs->trans('PrintUserConfDesc'.$driver)."

\n"; print '
'.$langs->trans("Description").''.$langs->trans("Active").'
'; - $var=true; print ''; print ''; print ''; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index bb214ffc06a..2e57e452928 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -401,7 +401,6 @@ print "\n"; clearstatcache(); -$var=true; foreach ($dirmodels as $reldir) { foreach (array('','/doc') as $valdir) @@ -438,7 +437,6 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { - $var = !$var; print '
'.$langs->trans("User").''.$langs->trans("PrintModule").'
'; print (empty($module->name)?$name:$module->name); print "\n"; @@ -524,12 +522,10 @@ print "
"; print load_fiche_titre($langs->trans("ProductOtherConf"), '', ''); - print ''; print ''; print ''; -$var=true; print ''; print ''; print ''."\n"; @@ -569,7 +565,6 @@ print ''; // multiprix nombre de prix a proposer if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - print ''; print ''; print ''; @@ -611,7 +606,6 @@ print ''; if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { - print ''; print ''; print ''; @@ -619,7 +613,6 @@ if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) } // Visualiser description produit dans les formulaires activation/desactivation - print ''; print ''; print ''; // View product description in thirdparty language if (! empty($conf->global->MAIN_MULTILANGS)) { - print ''; print ''; print '> + $value) { foreach($fieldlist as $field) { diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index a1cd63eea12..c3f568a958c 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -551,7 +551,6 @@ if ($id > 0 || ! empty($ref)) { $num = $db->num_rows($resql); $i=0; - $var=true; if($num == 0) print ''; @@ -655,7 +654,6 @@ if ($id > 0 || ! empty($ref)) print ''; } - } } diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index b2713d65304..ddda73d0add 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -759,12 +759,9 @@ SCRIPT; if (is_array($product_fourn_list)) { - $var=true; foreach($product_fourn_list as $productfourn) { - - print ''; // Supplier diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 9f11813fdee..89330618879 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -457,8 +457,6 @@ function activitytrim($product_type) } $i = 0; - $var=true; - while ($i < $num) { $objp = $db->fetch_object($result); @@ -466,7 +464,6 @@ function activitytrim($product_type) { if ($trim1+$trim2+$trim3+$trim4 > 0) { - print ''; print ''; print ''; @@ -500,7 +497,6 @@ function activitytrim($product_type) } if ($trim1+$trim2+$trim3+$trim4 > 0) { - print ''; print ''; print ''; diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index eae89aca648..51692a3e9a1 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -334,8 +334,6 @@ $buttonrecordnoent=$langs->transnoentitiesnoconv("RecordMovement"); print ''.$langs->trans("SelectProductInAndOutWareHouse",$titletoaddnoent,$buttonrecordnoent).'
'; print '
'."\n"; -$var=true; - // Form to add a line print ''; print ''; @@ -402,8 +400,6 @@ print ''; foreach($listofdata as $key => $val) { - - $productstatic->fetch($val['id_product']); $warehousestatics->fetch($val['id_sw']); $warehousestatict->fetch($val['id_tw']); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 7c15b3fa7c5..08289ec11e4 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -396,14 +396,12 @@ if ($resql) $productlot = new Productlot($db); $i=0; - $var=true; $totalarray=array(); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); if ($obj) { - $var = !$var; $productlot->id = $obj->rowid; $productlot->batch = $obj->batch; diff --git a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php index ca604e61fcc..794ed96f3ec 100644 --- a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php @@ -36,12 +36,11 @@ $langs = $GLOBALS['langs']; $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> From 86a58def3b659676dd9c7483e05df7d3ddd6faef Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 27 Jun 2018 17:13:50 +0200 Subject: [PATCH 056/156] FIX : getEntity project and not projet --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 551bdcb9d5f..d42c67a09dc 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1750,7 +1750,7 @@ class Project extends CommonObject $sql = "SELECT count(p.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " WHERE"; - $sql.= " p.entity IN (".getEntity('projet').")"; + $sql.= " p.entity IN (".getEntity('project').")"; if (! $user->rights->projet->all->lire) { $projectsListId = $this->getProjectsAuthorizedForUser($user,0,1); From d8ca9f2947cc3928bc02b10c5176bd9b3015d08e Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 27 Jun 2018 17:26:04 +0200 Subject: [PATCH 057/156] FIX : we must see number of all shared projects --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index d42c67a09dc..5dce267d965 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1674,7 +1674,7 @@ class Project extends CommonObject // For external user, no check is done on company permission because readability is managed by public status of project and assignement. //if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; $sql.= " WHERE p.fk_statut = 1"; - $sql.= " AND p.entity IN (".getEntity('project', 0).')'; + $sql.= " AND p.entity IN (".getEntity('project').')'; if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; From 55d5d01cfe22acdf4903911c5fea568e17f144c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jun 2018 11:53:52 +0200 Subject: [PATCH 058/156] FIX combo of stock in popup are crazy in IE --- htdocs/fourn/commande/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 9a527ec1b2b..70cfe58ca4a 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1761,11 +1761,13 @@ elseif (! empty($object->id)) $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct=new FormProduct($db); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion=array( //'text' => $langs->trans("ConfirmClone"), //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)) + array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse','int'), 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) ); } $text=$langs->trans("ConfirmApproveThisOrder",$object->ref); From 3ea2d81279249417972d955ea6d31efa2a55c374 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jun 2018 12:05:02 +0200 Subject: [PATCH 059/156] FIX combo into popup become crazy with IE10 --- htdocs/asset/card.php | 7 ---- htdocs/commande/card.php | 39 ++++++++++--------- htdocs/compta/facture/card.php | 13 ++++--- htdocs/fourn/commande/card.php | 6 +-- .../modulebuilder/template/myobject_card.php | 15 ++++--- htdocs/product/inventory/card.php | 14 ------- htdocs/website/websiteaccount_card.php | 14 ------- 7 files changed, 40 insertions(+), 68 deletions(-) diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index a34169ea0ac..1cb580c8c8d 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -218,13 +218,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'xxx') { $formquestion=array(); - /* - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); - }*/ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index b0cea3318cb..0fe49cf9f12 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1858,13 +1858,14 @@ if ($action == 'create' && $user->rights->commande->creer) $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' - // => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), - // 'value' => 1), - array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockDecrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockDecrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse','int')?GETPOST('idwarehouse','int'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220); @@ -1890,13 +1891,14 @@ if ($action == 'create' && $user->rights->commande->creer) $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' - // => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), - // 'value' => 1), - array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('UnvalidateOrder'), $text, 'confirm_modif', $formquestion, "yes", 1, 220); @@ -1931,13 +1933,14 @@ if ($action == 'create' && $user->rights->commande->creer) $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' - // => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), - // 'value' => 1), - array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Cancel'), $text, 'confirm_cancel', $formquestion, 0, 1); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 68a24a20933..902d8e52846 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3376,13 +3376,14 @@ else if ($id > 0 || ! empty($ref)) require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease"); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => - // 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' - // => 1), - array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction")))); + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"), 0, $forcecombo)) + ); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1); } else { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 70cfe58ca4a..e1670e0c4d0 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1764,9 +1764,9 @@ elseif (! empty($object->id)) $forcecombo=0; if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion=array( - //'text' => $langs->trans("ConfirmClone"), - //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + //'text' => $langs->trans("ConfirmClone"), + //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse','int'), 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) ); } diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 7b62c96ded5..a8825da56fa 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -260,13 +260,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Confirmation of action xxxx if ($action == 'xxx') { - $formquestion=array(); + $formquestion=array(); /* - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)) + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); }*/ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); } diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 8c768c67f0b..80b17a5e31d 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -224,20 +224,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1); } - // Confirmation of action xxxx - if ($action == 'xxx') - { - $formquestion=array(); - /* - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); - }*/ - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); - } - if (! $formconfirm) { $parameters = array('lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 25ff7215e5d..850888320dd 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -220,20 +220,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteWebsiteAccount'), $langs->trans('ConfirmDeleteWebsiteAccount'), 'confirm_delete', '', 0, 1); } - // Confirmation of action xxxx - if ($action == 'xxx') - { - $formquestion=array(); - /* - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); - }*/ - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); - } - if (! $formconfirm) { $parameters = array('lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook From 055d818069fa0f1840cbdfe979007401f89d6919 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jun 2018 12:09:13 +0200 Subject: [PATCH 060/156] FIX dashboard with IE10 not supporting flex --- htdocs/core/class/conf.class.php | 2 ++ htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/sendings.lang | 4 ++-- htdocs/langs/en_US/stocks.lang | 2 +- htdocs/theme/eldy/style.css.php | 9 +++++++-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 264d3e9c236..9cf51564ec0 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -39,6 +39,8 @@ class Conf var $db; //! To store properties found into database var $global; + //! To store browser info + var $browser; //! To store if javascript/ajax is enabked public $use_javascript_ajax; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c40a8541d67..1980594dff1 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1027,7 +1027,7 @@ Delays_MAIN_DELAY_ACTIONS_TODO=Delay tolerance (in days) before alert on planned Delays_MAIN_DELAY_PROJECT_TO_CLOSE=Delay tolerance (in days) before alert on project not closed in time Delays_MAIN_DELAY_TASKS_TODO=Delay tolerance (in days) before alert on planned tasks (project tasks) not completed yet Delays_MAIN_DELAY_ORDERS_TO_PROCESS=Delay tolerance (in days) before alert on orders not processed yet -Delays_MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS=Delay tolerance (in days) before alert on suppliers orders not processed yet +Delays_MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS=Delay tolerance (in days) before alert on purchase orders not processed yet Delays_MAIN_DELAY_PROPALS_TO_CLOSE=Delay tolerance (in days) before alert on proposals to close Delays_MAIN_DELAY_PROPALS_TO_BILL=Delay tolerance (in days) before alert on proposals not billed Delays_MAIN_DELAY_NOT_ACTIVATED_SERVICES=Tolerance delay (in days) before alert on services to activate diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 47012406b74..b8474775e75 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -52,8 +52,8 @@ ActionsOnShipping=Events on shipment LinkToTrackYourPackage=Link to track your package ShipmentCreationIsDoneFromOrder=For the moment, creation of a new shipment is done from the order card. ShipmentLine=Shipment line -ProductQtyInCustomersOrdersRunning=Product quantity into open customers orders -ProductQtyInSuppliersOrdersRunning=Product quantity into open suppliers orders +ProductQtyInCustomersOrdersRunning=Product quantity into open customer orders +ProductQtyInSuppliersOrdersRunning=Product quantity into open purchase orders ProductQtyInShipmentAlreadySent=Product quantity from open customer order already sent ProductQtyInSuppliersShipmentAlreadyRecevied=Product quantity from open supplier order already received NoProductToShipFoundIntoStock=No product to ship found into warehouse %s. Correct stock or go back to choose another warehouse. diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 98aae045517..0d22a3b3c75 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -67,7 +67,7 @@ DeStockOnValidateOrder=Decrease real stocks on customers orders validation DeStockOnShipment=Decrease real stocks on shipping validation DeStockOnShipmentOnClosing=Decrease real stocks on shipping classification closed ReStockOnBill=Increase real stocks on suppliers invoices/credit notes validation -ReStockOnValidateOrder=Increase real stocks on suppliers orders approbation +ReStockOnValidateOrder=Increase real stocks on purchase orders approbation ReStockOnDispatchOrder=Increase real stocks on manual dispatching into warehouses, after supplier order receipt of goods OrderStatusNotReadyToDispatch=Order has not yet or no more a status that allows dispatching of products in stock warehouses. StockDiffPhysicTeoric=Explanation for difference between physical and virtual stock diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 79aed1eaf68..49a980298ae 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -890,9 +890,14 @@ div.fiche { min-width: 170px; } .thumbstat, .thumbstat150 { - flex-grow: 1; - flex-shrink: 0; +browser->name == 'ie') { ?> min-width: 150px; + width: 100%; + display: inline; + + flex-grow: 1; + flex-shrink: 0; + } select.selectarrowonleft { From ed2ec78332d2161079f2a26ad0f56d8d271dd6bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jun 2018 11:53:52 +0200 Subject: [PATCH 061/156] FIX combo of stock in popup are crazy in IE --- htdocs/fourn/commande/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 9783fc9911e..ce89f379b15 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1740,11 +1740,13 @@ elseif (! empty($object->id)) $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct=new FormProduct($db); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion=array( //'text' => $langs->trans("ConfirmClone"), //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)) + array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse','int'), 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) ); } $text=$langs->trans("ConfirmApproveThisOrder",$object->ref); From da138db528a93f2545df81bd4af61491f2cf2253 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jun 2018 12:05:02 +0200 Subject: [PATCH 062/156] FIX combo into popup become crazy with IE10 Conflicts: htdocs/asset/card.php htdocs/modulebuilder/template/myobject_card.php --- htdocs/commande/card.php | 39 ++++++++++--------- htdocs/compta/facture/card.php | 13 ++++--- htdocs/fourn/commande/card.php | 6 +-- .../modulebuilder/template/myobject_card.php | 17 ++++---- htdocs/product/inventory/card.php | 14 ------- htdocs/website/websiteaccount_card.php | 14 ------- 6 files changed, 41 insertions(+), 62 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 9f55311444b..27fc1821a03 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1850,13 +1850,14 @@ if ($action == 'create' && $user->rights->commande->creer) $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' - // => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), - // 'value' => 1), - array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockDecrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockDecrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse','int')?GETPOST('idwarehouse','int'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220); @@ -1882,13 +1883,14 @@ if ($action == 'create' && $user->rights->commande->creer) $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' - // => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), - // 'value' => 1), - array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('UnvalidateOrder'), $text, 'confirm_modif', $formquestion, "yes", 1, 220); @@ -1923,13 +1925,14 @@ if ($action == 'create' && $user->rights->commande->creer) $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' - // => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), - // 'value' => 1), - array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Cancel'), $text, 'confirm_cancel', $formquestion, 0, 1); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 055a100848a..e846b47cb4e 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3064,13 +3064,14 @@ else if ($id > 0 || ! empty($ref)) require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease"); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => - // 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' - // => 1), - array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction")))); + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"), 0, $forcecombo)) + ); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1); } else { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', '', 1); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ce89f379b15..a6629b9bd25 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1743,9 +1743,9 @@ elseif (! empty($object->id)) $forcecombo=0; if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion=array( - //'text' => $langs->trans("ConfirmClone"), - //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + //'text' => $langs->trans("ConfirmClone"), + //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse','int'), 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) ); } diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index c4f92994d7a..3244b44d057 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -243,14 +243,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Confirmation of action xxxx if ($action == 'xxx') { - $formquestion=array(); + $formquestion=array(); /* - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); - }*/ + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); + */ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); } diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index aaba9e8cdfe..f7044cc35da 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -223,20 +223,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1); } - // Confirmation of action xxxx - if ($action == 'xxx') - { - $formquestion=array(); - /* - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); - }*/ - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); - } - if (! $formconfirm) { $parameters = array('lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 9918b0b3022..037737533b2 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -233,20 +233,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteWebsiteAccount'), $langs->trans('ConfirmDeleteWebsiteAccount'), 'confirm_delete', '', 0, 1); } - // Confirmation of action xxxx - if ($action == 'xxx') - { - $formquestion=array(); - /* - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); - }*/ - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); - } - if (! $formconfirm) { $parameters = array('lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook From a4ccb47b78f14bc45f9f93cfb6d9c668422c3c5e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 28 Jun 2018 12:18:03 +0200 Subject: [PATCH 063/156] Fix : Notice: A non well formed numeric value encountered line 509 --- htdocs/core/class/conf.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 264d3e9c236..0e2891d8d4f 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -506,7 +506,7 @@ class Conf if (! isset($this->global->MAIN_SHOW_LOGO)) $this->global->MAIN_SHOW_LOGO=1; // Default max file size for upload - $this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024); + $this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : (int)$this->global->MAIN_UPLOAD_DOC * 1024); // By default, we propagate contacts if (! isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN='*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented) From 7ebf54fbead8bae82238a754d1a26262baff162f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 28 Jun 2018 12:54:19 +0200 Subject: [PATCH 064/156] Fix : division by 0 on homepage if nothing to do --- htdocs/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/index.php b/htdocs/index.php index b01e37927c4..4d4ebb03cb9 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -526,7 +526,7 @@ foreach($valid_dashboardlines as $board) } } //var_dump($totallate, $totaltodo); -if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = round($totallate / $totaltodo * 100, 2); +if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) && !empty($totaltodo)) $totallate = round($totallate / $totaltodo * 100, 2); //var_dump($totallate); $boxwork=''; $boxwork.='
'; From 5de650435a597dc641be2648941b0bd83a53f32c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jun 2018 14:06:23 +0200 Subject: [PATCH 065/156] Fix filter on country/zip --- htdocs/contact/list.php | 67 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index d837a6c6421..30b7c5158ba 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -32,6 +32,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page @@ -76,6 +77,7 @@ $search_type=GETPOST('search_type','alpha'); $search_zip=GETPOST('search_zip','alpha'); $search_town=GETPOST('search_town','alpha'); $search_import_key=GETPOST("search_import_key","alpha"); +$search_country=GETPOST("search_country",'intcomma'); if ($search_status=='') $search_status=1; // always display activ customer first @@ -148,6 +150,7 @@ $arrayfields=array( 'p.poste'=>array('label'=>"PostOrFunction", 'checked'=>1), 'p.town'=>array('label'=>"Town", 'checked'=>0), 'p.zip'=>array('label'=>"Zip", 'checked'=>0), + 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), 'p.phone'=>array('label'=>"Phone", 'checked'=>1), 'p.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0), 'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1), @@ -203,6 +206,9 @@ if (empty($reshook)) $search_lastname=""; $search_firstname=""; $search_societe=""; + $search_town=""; + $search_zip=""; + $search_country=""; $search_poste=""; $search_phone=""; $search_phone_perso=""; @@ -298,6 +304,7 @@ if ($search_id > 0) $sql.= natural_search("p.rowid",$search_id,1 if ($search_lastname) $sql.= natural_search('p.lastname', $search_lastname); if ($search_firstname) $sql.= natural_search('p.firstname', $search_firstname); if ($search_societe) $sql.= natural_search('s.nom', $search_societe); +if ($search_country) $sql .= " AND p.fk_pays IN (".$search_country.')'; if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_poste); if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso); if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone); @@ -396,6 +403,7 @@ if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_ if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe); if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip); if ($search_town != '') $param.='&search_town='.urlencode($search_town); +if ($search_country != '') $param.= "&search_country=".urlencode($search_country); if ($search_job != '') $param.='&search_job='.urlencode($search_job); if ($search_phone_pro != '') $param.='&search_phone_pro='.urlencode($search_phone_pro); if ($search_phone_perso != '') $param.='&search_phone_perso='.urlencode($search_phone_perso); @@ -518,6 +526,12 @@ if (! empty($arrayfields['p.firstname']['checked'])) print ''; print ''; } +if (! empty($arrayfields['p.poste']['checked'])) +{ + print '
'; +} if (! empty($arrayfields['p.zip']['checked'])) { print ''; } -if (! empty($arrayfields['p.poste']['checked'])) +// State +/*if (! empty($arrayfields['state.nom']['checked'])) + { + print ''; + } + // Region + if (! empty($arrayfields['region.nom']['checked'])) + { + print ''; + }*/ +// Country +if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; } if (! empty($arrayfields['p.phone']['checked'])) @@ -630,9 +659,12 @@ print ''; if (! empty($arrayfields['p.rowid']['checked'])) print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['p.lastname']['checked'])) print_liste_field_titre($arrayfields['p.lastname']['label'],$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder); if (! empty($arrayfields['p.firstname']['checked'])) print_liste_field_titre($arrayfields['p.firstname']['label'],$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder); +if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($arrayfields['p.poste']['label'],$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder); if (! empty($arrayfields['p.zip']['checked'])) print_liste_field_titre($arrayfields['p.zip']['label'],$_SERVER["PHP_SELF"],"p.zip", $begin, $param, '', $sortfield,$sortorder); if (! empty($arrayfields['p.town']['checked'])) print_liste_field_titre($arrayfields['p.town']['label'],$_SERVER["PHP_SELF"],"p.town", $begin, $param, '', $sortfield,$sortorder); -if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($arrayfields['p.poste']['label'],$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder); +//if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); +//if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"co.code_iso","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['p.phone']['checked'])) print_liste_field_titre($arrayfields['p.phone']['label'],$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder); if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_titre($arrayfields['p.phone_perso']['label'],$_SERVER["PHP_SELF"],"p.phone_perso", $begin, $param, '', $sortfield,$sortorder); if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'],$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder); @@ -697,6 +729,12 @@ while ($i < min($num,$limit)) print ''; if (! $i) $totalarray['nbfield']++; } + // Job position + if (! empty($arrayfields['p.poste']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } // Zip if (! empty($arrayfields['p.zip']['checked'])) { @@ -709,10 +747,25 @@ while ($i < min($num,$limit)) print ''; if (! $i) $totalarray['nbfield']++; } - // Function - if (! empty($arrayfields['p.poste']['checked'])) + // State + /*if (! empty($arrayfields['state.nom']['checked'])) { - print ''; + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + // Region + if (! empty($arrayfields['region.nom']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + }*/ + // Country + if (! empty($arrayfields['country.code_iso']['checked'])) + { + print ''; if (! $i) $totalarray['nbfield']++; } // Phone From 91255866922df2d7f3de3fb8003ab286a3078263 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Thu, 28 Jun 2018 15:52:40 +0200 Subject: [PATCH 066/156] FIX need element type on select filter --- htdocs/core/tpl/advtarget.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index e1104ef84f6..a25abbdde6a 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -60,7 +60,7 @@ print '
'.$langs->trans("Parameters").'
'.$langs->trans("MultiPricesNumPrices").'
'.$langs->trans("NumberOfProductShowInSelect").'
'.$langs->trans("ViewProductDescInFormAbility").''; @@ -652,7 +645,6 @@ print '
'.$langs->trans("ViewProductDescInThirdpartyLanguageAbility").''; diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 291aba9bcf1..ed4480aeaa2 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -294,8 +294,6 @@ if (empty($mysoc->country_code)) else { - $var=true; - print ''; print ''; print ''; diff --git a/htdocs/product/canvas/product/tpl/list.tpl.php b/htdocs/product/canvas/product/tpl/list.tpl.php index e5c315e8148..070f58dd481 100644 --- a/htdocs/product/canvas/product/tpl/list.tpl.php +++ b/htdocs/product/canvas/product/tpl/list.tpl.php @@ -89,10 +89,9 @@ if (empty($conf) || ! is_object($conf)) -
'.$langs->trans("NoMatchFound").'
'.$tmpyear.''.price($trim1).''.price($trim2).'
'.$tmpyear.''.price($trim1).''.price($trim2).'
'; + print ''; + print ''; @@ -530,10 +544,25 @@ if (! empty($arrayfields['p.town']['checked'])) print ''; print ''; + print ''; + print ''; + print ''; + print ''; - print ''; + print ''; + print $form->select_country($search_country,'search_country','',0,'maxwidth100'); print '
'.$obj->firstname.''.dol_trunc($obj->poste,20).''.$obj->town.''.dol_trunc($obj->poste,20).'".$obj->state_name."".$obj->region_name."'; + $tmparray=getCountry($obj->fk_pays,'all'); + print $tmparray['label']; + print '