From d9acf328610e8023b516fa25317b3b1076c58017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 17 Sep 2015 19:26:52 +0200 Subject: [PATCH 01/34] Fix Do not always append htdocs to include path Serving the htdocs directly is a best practice. The old code generates a bogus include path in that case. This code mitigates the issue by setting an include path only when needed. --- htdocs/main.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7c682756edd..62f0271ebd0 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -164,7 +164,10 @@ if (! defined('NOSCANPOSTFORINJECTION')) } // This is to make Dolibarr working with Plesk -if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +if (! empty($_SERVER['DOCUMENT_ROOT']) && substr($_SERVER['DOCUMENT_ROOT'], -6) !== 'htdocs') { + set_include_path($_SERVER['DOCUMENT_ROOT'] . '/htdocs'); + } +} // Include the conf.php and functions.lib.php require_once 'filefunc.inc.php'; From 342e3413db9d54be30120548534616f3d2777e65 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 23 Sep 2015 22:48:48 +0200 Subject: [PATCH 02/34] Issue 3509: Init works --- .../core/modules/payment/mod_payment_ant.php | 140 ++++++++++++++++ .../modules/payment/mod_payment_cicada.php | 150 ++++++++++++++++++ .../core/modules/payment/modules_payment.php | 101 ++++++++++++ .../install/mysql/migration/3.8.0-3.9.0.sql | 1 + htdocs/install/mysql/tables/llx_paiement.sql | 1 + 5 files changed, 393 insertions(+) create mode 100644 htdocs/core/modules/payment/mod_payment_ant.php create mode 100644 htdocs/core/modules/payment/mod_payment_cicada.php create mode 100644 htdocs/core/modules/payment/modules_payment.php diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php new file mode 100644 index 00000000000..8cc74a299b3 --- /dev/null +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -0,0 +1,140 @@ + + * + * 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/payment/mod_payment_ant.php + * \ingroup payment + * \brief File containing class for numbering module Ant + */ + +require_once DOL_DOCUMENT_ROOT .'/core/modules/payment/modules_payment.php'; + + +/** + * Class to manage customer order numbering rules Saphir + */ +class mod_payment_ant extends ModeleNumRefPayments +{ + var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' + var $error = ''; + var $nom = 'Ant'; + + + /** + * Renvoi la description du modele de numerotation + * + * @return string Texte descripif + */ + 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("Order"),$langs->transnoentities("Order")); + $tooltip.=$langs->trans("GenericMaskCodes2"); + $tooltip.=$langs->trans("GenericMaskCodes3"); + $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Order"),$langs->transnoentities("Order")); + $tooltip.=$langs->trans("GenericMaskCodes5"); + + // Parametrage du prefix + $texte.= ''; + $texte.= ''; + + $texte.= ''; + + $texte.= ''; + + $texte.= '
'.$langs->trans("Mask").':'.$form->textwithpicto('',$tooltip,1,1).' 
'; + $texte.= '
'; + + return $texte; + } + + /** + * Renvoi un exemple de numerotation + * + * @return string Example + */ + function getExample() + { + global $conf,$langs,$mysoc; + + $old_code_client=$mysoc->code_client; + $mysoc->code_client='CCCCCCCCCC'; + $numExample = $this->getNextValue($mysoc,''); + $mysoc->code_client=$old_code_client; + + if (! $numExample) + { + $numExample = $langs->trans('NotConfigured'); + } + return $numExample; + } + + /** + * Return next free value + * + * @param Societe $objsoc Object thirdparty + * @param Object $object Object we need next value for + * @return string Value if KO, <0 if KO + */ + function getNextValue($objsoc,$object) + { + global $db,$conf; + + require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; + + // We get cursor rule + $mask=$conf->global->PAYMENT_ANT_MASK; + + if (! $mask) + { + $this->error='NotConfigured'; + return 0; + } + + $numFinal=get_next_value($db,$mask,'payment','ref','',$objsoc,$object->date); + + return $numFinal; + } + + + /** + * Return next free value + * + * @param Societe $objsoc Object third party + * @param string $objforref Object for number to search + * @return string Next free value + */ + function commande_get_num($objsoc,$objforref) + { + return $this->getNextValue($objsoc,$objforref); + } + +} + diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php new file mode 100644 index 00000000000..8b3bebfd760 --- /dev/null +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -0,0 +1,150 @@ + + * + * 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/payment/mod_payment_cicada.php + * \ingroup payment + * \brief File containing class for numbering module Cicada + */ + +require_once DOL_DOCUMENT_ROOT .'/core/modules/payment/modules_payment.php'; + +/** + * Class to manage customer order numbering rules Marbre + */ +class mod_commande_cicada extends ModeleNumRefPayments +{ + var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' + var $prefix='PAY'; + var $error=''; + var $nom='Cicada'; + + + /** + * Return description of numbering module + * + * @return string Text with description + */ + function info() + { + global $langs; + return $langs->trans("SimpleNumRefModelDesc",$this->prefix); + } + + + /** + * Renvoi un exemple de numerotation + * + * @return string Example + */ + function getExample() + { + return $this->prefix."0501-0001"; + } + + + /** + * Test si les numeros deje en vigueur dans la base ne provoquent pas de + * de conflits qui empechera cette numerotation de fonctionner. + * + * @return boolean false si conflit, true si ok + */ + function canBeActivated() + { + global $conf,$langs,$db; + + $payyymm=''; $max=''; + + $posindice=8; + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; + $sql.= " FROM ".MAIN_DB_PREFIX."payment"; + $sql.= " WHERE ref LIKE '".$this->prefix."____-%'"; + $sql.= " AND entity = ".$conf->entity; + + $resql=$db->query($sql); + if ($resql) + { + $row = $db->fetch_row($resql); + if ($row) { $payyymm = substr($row[0],0,6); $max=$row[0]; } + } + if ($payyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$payyymm)) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorNumRefModel', $max); + return false; + } + + return true; + } + + /** + * Return next free value + * + * @param Societe $objsoc Object thirdparty + * @param Object $object Object we need next value for + * @return string Value if KO, <0 if KO + */ + function getNextValue($objsoc,$object) + { + global $db,$conf; + + // D'abord on recupere la valeur max + $posindice=8; + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; + $sql.= " FROM ".MAIN_DB_PREFIX."payment"; + $sql.= " WHERE ref like '".$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(__METHOD__, LOG_DEBUG); + return -1; + } + + //$date=time(); + $date=$object->date; + $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(__METHOD__." return ".$this->prefix.$yymm."-".$num); + return $this->prefix.$yymm."-".$num; + } + + + /** + * Return next free value + * + * @param Societe $objsoc Object third party + * @param string $objforref Object for number to search + * @return string Next free value + */ + function commande_get_num($objsoc,$objforref) + { + return $this->getNextValue($objsoc,$objforref); + } + +} diff --git a/htdocs/core/modules/payment/modules_payment.php b/htdocs/core/modules/payment/modules_payment.php new file mode 100644 index 00000000000..c9023a9fc65 --- /dev/null +++ b/htdocs/core/modules/payment/modules_payment.php @@ -0,0 +1,101 @@ + + * + * 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/ + */ + +/** + * \class ModeleNumRefPayments + * \brief Payment numbering references mother class + */ + +abstract class ModeleNumRefPayments +{ + var $error=''; + + /** + * Return if a module can be used or not + * + * @return boolean true if module can be used + */ + function isEnabled() + { + return true; + } + + /** + * Return the default description of numbering module + * + * @return string Texte descripif + */ + function info() + { + global $langs; + $langs->load("bills"); + return $langs->trans("NoDescription"); + } + + /** + * Return numbering example + * + * @return string Example + */ + function getExample() + { + global $langs; + $langs->load("bills"); + return $langs->trans("NoExample"); + } + + /** + * Test if the existing numbers in the database do not cause conflicts that would prevent this numbering run. + * + * @return boolean false si conflit, true si ok + */ + function canBeActivated() + { + return true; + } + + /** + * Returns the next value + * + * @param Societe $objsoc Object thirdparty + * @param Object $object Object we need next value for + * @return string Valeur + */ + function getNextValue($objsoc,$object) + { + global $langs; + return $langs->trans("NotAvailable"); + } + + /** + * Returns the module numbering version + * + * @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"); + } +} diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index c2a1d7eb5ec..3a8c6293d0c 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -42,3 +42,4 @@ create table llx_overwrite_trans transvalue text )ENGINE=innodb; +ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL AFTER rowid; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_paiement.sql b/htdocs/install/mysql/tables/llx_paiement.sql index 00680f29d69..a82d5eb40e8 100644 --- a/htdocs/install/mysql/tables/llx_paiement.sql +++ b/htdocs/install/mysql/tables/llx_paiement.sql @@ -21,6 +21,7 @@ create table llx_paiement ( rowid integer AUTO_INCREMENT PRIMARY KEY, + ref varchar(30) NOT NULL, -- payment reference number entity integer DEFAULT 1 NOT NULL, -- Multi company id datec datetime, -- date de creation tms timestamp, From 2a84afeee40e44ff540dff2d9ae5e8b6c0fd9dd1 Mon Sep 17 00:00:00 2001 From: All-3kcis Date: Fri, 25 Sep 2015 16:31:55 +0200 Subject: [PATCH 03/34] fix dangerous sql injection #3327 --- htdocs/user/card.php | 4 ++-- htdocs/user/class/user.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 5724101ec1b..3762b85775a 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -384,12 +384,12 @@ if ($action == 'update' && ! $_POST["cancel"]) } else { - $object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]); + $object->entity = (GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int')); } } else { - $object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]); + $object->entity = (GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int')); } if (GETPOST('deletephoto')) $object->photo=''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 34c3084e12d..db92c7f243a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1217,7 +1217,7 @@ class User extends CommonObject if (isset($this->salary) || $this->salary != '') $sql.= ", salary= ".($this->salary != ''?"'".$this->db->escape($this->salary)."'":"null"); if (isset($this->salaryextra) || $this->salaryextra != '') $sql.= ", salaryextra= ".($this->salaryextra != ''?"'".$this->db->escape($this->salaryextra)."'":"null"); $sql.= ", weeklyhours= ".($this->weeklyhours != ''?"'".$this->db->escape($this->weeklyhours)."'":"null"); - $sql.= ", entity = '".$this->entity."'"; + $sql.= ", entity = '".$this->db->escape($this->entity)."'"; $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); From 4fa1be0e3591e18710e1ebbbee39cd2487e6692b Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 26 Sep 2015 10:37:36 +0200 Subject: [PATCH 04/34] Issue #3509: Init works --- htdocs/admin/payment.php | 219 ++++++++++++++++++ .../compta/paiement/class/paiement.class.php | 27 ++- htdocs/core/lib/invoice.lib.php | 6 + .../core/modules/payment/mod_payment_ant.php | 8 +- .../modules/payment/mod_payment_cicada.php | 8 +- htdocs/langs/en_US/admin.lang | 1 + 6 files changed, 260 insertions(+), 9 deletions(-) create mode 100644 htdocs/admin/payment.php diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php new file mode 100644 index 00000000000..1bf794d52f8 --- /dev/null +++ b/htdocs/admin/payment.php @@ -0,0 +1,219 @@ + + * + * 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/payment.php + * \ingroup facture + * \brief Page to setup invoices payments + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; + +$langs->load("admin"); +$langs->load("errors"); +$langs->load('other'); +$langs->load('bills'); + +if (! $user->admin) accessforbidden(); + +$action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); +$label = GETPOST('label','alpha'); +$scandir = GETPOST('scandir','alpha'); +$type='invoice'; + + +/* + * Actions + */ + +if ($action == 'updateMask') +{ + $maskconstpayment=GETPOST('maskconstpayment','alpha'); + $maskpayment=GETPOST('maskpayment','alpha'); + if ($maskconstpayment) $res = dolibarr_set_const($db,$maskconstpayment,$maskpayment,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } +} + + if ($action == 'setmod') +{ + dolibarr_set_const($db, "PAYMENT_ADDON",$value,'chaine',0,'',$conf->entity); +} + +/* + * View + */ + +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + +llxHeader("",$langs->trans("BillsSetup"),'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'); + +$form=new Form($db); + + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup'); + +$head = invoice_admin_prepare_head(); +dol_fiche_head($head, 'payment', $langs->trans("Invoices"), 0, 'invoice'); + +/* + * Numbering module + */ + +print load_fiche_titre($langs->trans("PaymentsNumberingModule")); + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''."\n"; + +clearstatcache(); + +foreach ($dirmodels as $reldir) +{ + $dir = dol_buildpath($reldir."core/modules/payment/"); + if (is_dir($dir)) + { + $handle = opendir($dir); + if (is_resource($handle)) + { + $var=true; + + while (($file = readdir($handle))!==false) + { + if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')) + { + $filebis = $file; + $classname = preg_replace('/\.php$/','',$file); + // For compatibility + if (! is_file($dir.$filebis)) + { + $filebis = $file."/".$file.".modules.php"; + $classname = "mod_payment_".$file; + } + // Check if there is a filter on country + preg_match('/\-(.*)_(.*)$/',$classname,$reg); + if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue; + + $classname = preg_replace('/\-.*$/','',$classname); + if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php') + { + // Chargement de la classe de numerotation + require_once $dir.$filebis; + + $module = new $classname($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()) + { + $var = !$var; + print ''; + + // Show example of numbering module + print ''."\n"; + + print ''; + + $payment=new Paiement($db); + $payment->initAsSpecimen(); + + // Example + $htmltooltip=''; + $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; + $nextval=$module->getNextValue($mysoc,$payment); + 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 "\n"; + + } + } + } + } + closedir($handle); + } + } +} + +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + echo preg_replace('/\-.*$/','',preg_replace('/mod_payment_/','',preg_replace('/\.php$/','',$file))); + print "\n"; + + print $module->info(); + + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print '
'.$langs->trans($tmp).'
'; + elseif ($tmp=='NotConfigured') print $langs->trans($tmp); + else print $tmp; + print '
'; + //print "> ".$conf->global->PAYMENT_ADDON." - ".$file; + if ($conf->global->PAYMENT_ADDON == $file || $conf->global->PAYMENT_ADDON.'.php' == $file) + { + print img_picto($langs->trans("Activated"),'switch_on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + + if ($conf->global->PAYMENT_ADDON.'.php' == $file) // If module is the one used, we show existing errors + { + if (! empty($module->error)) dol_htmloutput_mesg($module->error,'','error',1); + } + + print '
'; + +dol_fiche_end(); + + +llxFooter(); + +$db->close(); diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 9baa15a417f..2d8154c7b9e 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -4,7 +4,8 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2014 Raphaël Doursenaud - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 Marcos García + * Copyright (C) 2015 Juanjo Menent * * 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 @@ -777,6 +778,30 @@ class Paiement extends CommonObject } } + /** + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines + * @return void + */ + function initAsSpecimen($option='') + { + global $user,$langs,$conf; + + $now=dol_now(); + $arraynow=dol_getdate($now); + $nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); + + // Initialize parameters + $this->id=0; + $this->ref = 'SPECIMEN'; + $this->specimen=1; + $this->facid = 1; + $this->datepaye = $nownotime; + } + /** * Return clicable name (with picto eventually) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index ac9da88bdc2..be73dd12b37 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry + * Copyright (C) 2015 Juanjo Menent * * 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 @@ -120,6 +121,11 @@ function invoice_admin_prepare_head() $head[$h][2] = 'general'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/admin/payment.php'; + $head[$h][1] = $langs->trans("Payments"); + $head[$h][2] = 'payment'; + $h++; + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 8cc74a299b3..b4f90906c67 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/payment/modules_payment.php'; /** - * Class to manage customer order numbering rules Saphir + * Class to manage customer payment numbering rules Ant */ class mod_payment_ant extends ModeleNumRefPayments { @@ -52,7 +52,7 @@ class mod_payment_ant extends ModeleNumRefPayments $texte.= '
'; $texte.= ''; $texte.= ''; - $texte.= ''; + $texte.= ''; $texte.= ''; $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Order"),$langs->transnoentities("Order")); @@ -63,7 +63,7 @@ class mod_payment_ant extends ModeleNumRefPayments // Parametrage du prefix $texte.= ''; - $texte.= ''; + $texte.= ''; $texte.= ''; @@ -118,7 +118,7 @@ class mod_payment_ant extends ModeleNumRefPayments return 0; } - $numFinal=get_next_value($db,$mask,'payment','ref','',$objsoc,$object->date); + $numFinal=get_next_value($db,$mask,'paiement','ref','',$objsoc,$object->date); return $numFinal; } diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index 8b3bebfd760..fb54a5fb568 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -25,9 +25,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/payment/modules_payment.php'; /** - * Class to manage customer order numbering rules Marbre + * Class to manage customer payment numbering rules Cicada */ -class mod_commande_cicada extends ModeleNumRefPayments +class mod_payment_cicada extends ModeleNumRefPayments { var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' var $prefix='PAY'; @@ -72,7 +72,7 @@ class mod_commande_cicada extends ModeleNumRefPayments $posindice=8; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; - $sql.= " FROM ".MAIN_DB_PREFIX."payment"; + $sql.= " FROM ".MAIN_DB_PREFIX."paiement"; $sql.= " WHERE ref LIKE '".$this->prefix."____-%'"; $sql.= " AND entity = ".$conf->entity; @@ -106,7 +106,7 @@ class mod_commande_cicada extends ModeleNumRefPayments // D'abord on recupere la valeur max $posindice=8; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; - $sql.= " FROM ".MAIN_DB_PREFIX."payment"; + $sql.= " FROM ".MAIN_DB_PREFIX."paiement"; $sql.= " WHERE ref like '".$this->prefix."____-%'"; $sql.= " AND entity = ".$conf->entity; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 062beed5760..fdc4817dd8a 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1179,6 +1179,7 @@ SuggestPaymentByRIBOnAccount=Suggest payment by withdraw on account SuggestPaymentByChequeToAddress=Suggest payment by cheque to FreeLegalTextOnInvoices=Free text on invoices WatermarkOnDraftInvoices=Watermark on draft invoices (none if empty) +PaymentsNumberingModule=Payments numbering model ##### Proposals ##### PropalSetup=Commercial proposals module setup CreateForm=Create forms From e17b3529ab8b2ecf9afb3ca39ac8e0081bd51eb5 Mon Sep 17 00:00:00 2001 From: All-3kcis Date: Sat, 26 Sep 2015 15:12:32 +0200 Subject: [PATCH 05/34] Correct error --- htdocs/user/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 3762b85775a..1d35a75cd24 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -384,12 +384,12 @@ if ($action == 'update' && ! $_POST["cancel"]) } else { - $object->entity = (GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int')); + $object->entity = (! GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int')); } } else { - $object->entity = (GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int')); + $object->entity = (! GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int')); } if (GETPOST('deletephoto')) $object->photo=''; From 8a9c9f49d5d20af141d7587eff867d6f97564e76 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Fri, 2 Oct 2015 12:37:13 +0200 Subject: [PATCH 06/34] fix : Typo --- ChangeLog | 2 +- htdocs/comm/askpricesupplier/card.php | 2 +- htdocs/comm/propal.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture.php | 2 +- htdocs/fourn/commande/card.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index e079038cd01..adf616485b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -344,7 +344,7 @@ For users: Use accesskey on form search. - New: Intervention documents are now available in ECM module. - New: Add attachments on user card + in ECM module. -- New: Can add __PROJECT_REF__ and __TIHRPARTY_NAME__ into email topic or content template. +- New: Can add __PROJECT_REF__ and __THIRDPARTY_NAME__ into email topic or content template. - New: [ task #1204 ] add Numering contrat module free (like leopard in product module). - New: [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice. - New: Enable supplier price log table. diff --git a/htdocs/comm/askpricesupplier/card.php b/htdocs/comm/askpricesupplier/card.php index 22732c1a19d..101160cf482 100644 --- a/htdocs/comm/askpricesupplier/card.php +++ b/htdocs/comm/askpricesupplier/card.php @@ -1800,7 +1800,7 @@ if ($action == 'create') // Tableau des substitutions $formmail->substit['__ASKREF__'] = $object->ref; $formmail->substit['__SIGNATURE__'] = $user->signature; - $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit['__CONTACTCIVNAME__'] = ''; $formmail->substit['__PERSONALIZED__'] = ''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 31603acc5a1..b6ef394a188 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2367,7 +2367,7 @@ if ($action == 'create') $formmail->substit['__PROPREF__'] = $object->ref; $formmail->substit['__SIGNATURE__'] = $user->signature; $formmail->substit['__REFCLIENT__'] = $object->ref_client; - $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit['__PERSONALIZED__'] = ''; $formmail->substit['__CONTACTCIVNAME__'] = ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 109746b4e64..6117a013e8b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2405,7 +2405,7 @@ if ($action == 'create' && $user->rights->commande->creer) $formmail->substit ['__ORDERREF__'] = $object->ref; $formmail->substit ['__SIGNATURE__'] = $user->signature; $formmail->substit ['__REFCLIENT__'] = $object->ref_client; - $formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit ['__THIRDPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit ['__PERSONALIZED__'] = ''; $formmail->substit ['__CONTACTCIVNAME__'] = ''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 86d3af1fcf8..b96edc31b2c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3857,7 +3857,7 @@ else if ($id > 0 || ! empty($ref)) $formmail->substit['__FACREF__'] = $object->ref; $formmail->substit['__SIGNATURE__'] = $user->signature; $formmail->substit['__REFCLIENT__'] = $object->ref_client; - $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:''); $formmail->substit['__PERSONALIZED__'] = ''; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 9b0001e79d6..fccd2652ed3 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2330,7 +2330,7 @@ elseif (! empty($object->id)) // Tableau des substitutions $formmail->substit['__ORDERREF__']=$object->ref; $formmail->substit['__ORDERSUPPLIERREF__']=$object->ref_supplier; - $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; From 379ebba8ac360a97e52f4972e626becde7fde8a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 2 Oct 2015 13:12:35 +0200 Subject: [PATCH 07/34] Update files.lib.php --- htdocs/core/lib/files.lib.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c1b68d0f1b7..d0af25d385e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1926,6 +1926,16 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $sqlprotectagainstexternals = "SELECT rowid as fk_soc FROM ".MAIN_DB_PREFIX."societe WHERE rowid='".$db->escape($refname)."' AND entity IN (".getEntity('societe', 1).")"; } + // Wrapping for contact + else if ($modulepart == 'contact') + { + if ($fuser->rights->societe->lire) + { + $accessallowed=1; + } + $original_file=$conf->societe->multidir_output[$entity].'/contact/'.$original_file; + } + // Wrapping for invoices else if ($modulepart == 'facture' || $modulepart == 'invoice') { From ac7ee86da3bacb5286bd4da751d21788dc30fbb8 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Fri, 2 Oct 2015 13:41:07 +0200 Subject: [PATCH 08/34] fix : Typo --- ChangeLog | 2 +- htdocs/comm/askpricesupplier/card.php | 2 +- htdocs/comm/propal.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture.php | 2 +- htdocs/fourn/commande/card.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9bd9ffe3b3..0b6a4a5b871 100644 --- a/ChangeLog +++ b/ChangeLog @@ -351,7 +351,7 @@ For users: Use accesskey on form search. - New: Intervention documents are now available in ECM module. - New: Add attachments on user card + in ECM module. -- New: Can add __PROJECT_REF__ and __TIHRPARTY_NAME__ into email topic or content template. +- New: Can add __PROJECT_REF__ and __THIRDPARTY_NAME__ into email topic or content template. - New: [ task #1204 ] add Numering contrat module free (like leopard in product module). - New: [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice. - New: Enable supplier price log table. diff --git a/htdocs/comm/askpricesupplier/card.php b/htdocs/comm/askpricesupplier/card.php index 5b8bd88a920..66f19044cee 100644 --- a/htdocs/comm/askpricesupplier/card.php +++ b/htdocs/comm/askpricesupplier/card.php @@ -1802,7 +1802,7 @@ if ($action == 'create') // Tableau des substitutions $formmail->substit['__ASKREF__'] = $object->ref; $formmail->substit['__SIGNATURE__'] = $user->signature; - $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit['__CONTACTCIVNAME__'] = ''; $formmail->substit['__PERSONALIZED__'] = ''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index e05c5a63dd9..9bf0cce30c1 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2324,7 +2324,7 @@ if ($action == 'create') $formmail->substit['__PROPREF__'] = $object->ref; $formmail->substit['__SIGNATURE__'] = $user->signature; $formmail->substit['__REFCLIENT__'] = $object->ref_client; - $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit['__PERSONALIZED__'] = ''; $formmail->substit['__CONTACTCIVNAME__'] = ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d5f3427b77c..70eab52db53 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2410,7 +2410,7 @@ if ($action == 'create' && $user->rights->commande->creer) $formmail->substit ['__ORDERREF__'] = $object->ref; $formmail->substit ['__SIGNATURE__'] = $user->signature; $formmail->substit ['__REFCLIENT__'] = $object->ref_client; - $formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit ['__THIRDPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit ['__PERSONALIZED__'] = ''; $formmail->substit ['__CONTACTCIVNAME__'] = ''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index e23f1f9414a..c7e6efc1a11 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3840,7 +3840,7 @@ else if ($id > 0 || ! empty($ref)) $formmail->substit['__FACREF__'] = $object->ref; $formmail->substit['__SIGNATURE__'] = $user->signature; $formmail->substit['__REFCLIENT__'] = $object->ref_client; - $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:''); $formmail->substit['__PERSONALIZED__'] = ''; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 4667200fdfc..d69c86eb1ea 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2333,7 +2333,7 @@ elseif (! empty($object->id)) // Tableau des substitutions $formmail->substit['__ORDERREF__']=$object->ref; $formmail->substit['__ORDERSUPPLIERREF__']=$object->ref_supplier; - $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; From 418bcf8d36b6229818a99a2fcc815079aa600358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 3 Oct 2015 10:00:06 +0200 Subject: [PATCH 09/34] Update style.css.php --- htdocs/theme/eldy/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c9294837f14..9d2e130c77c 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -158,7 +158,7 @@ $colorbacklinepair1=join(',',colorStringToArray($colorbacklinepair1)); $colorbacklinepair2=join(',',colorStringToArray($colorbacklinepair2)); if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',',colorStringToArray($colorbacklinepairhover)); $colorbackbody=join(',',colorStringToArray($colorbackbody)); -$colortext=join(',',colorStringToArray($colorbackvmenu1)); +$colortext=join(',',colorStringToArray($colortext)); // Set text color to black or white $tmppart=explode(',',$colorbackhmenu1); From 471e75f0291ff53fb874a17ac8b18b58e0de9e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 3 Oct 2015 10:15:07 +0200 Subject: [PATCH 10/34] Lost search_status on next page button --- htdocs/compta/facture/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 83066e21df6..2a7429c9951 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -270,6 +270,7 @@ if ($resql) if ($search_user > 0) $param.='&search_user=' .$search_user; if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht; if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc; + if ($search_status > 0) $param.='&search_status='.$search_status; print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png'); $i = 0; From 7da49a3592c8a18d83110936f19062a4070cdbcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 3 Oct 2015 12:09:42 +0200 Subject: [PATCH 11/34] Add badge for number of files in bank's tab --- htdocs/core/lib/bank.lib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 66dab46b47a..7bfc2b160f6 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -72,8 +72,13 @@ function bank_prepare_head(Account $object) $h++; } + // Attached files + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $upload_dir = $conf->bank->dir_output . "/" . dol_sanitizeFileName($object->ref); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT . "/compta/bank/document.php?account=" . $object->id; $head[$h][1] = $langs->trans("Documents"); + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'document'; $h++; From 82c7022e20cc918aaa88e1e10beaa923649d8b4b Mon Sep 17 00:00:00 2001 From: philippe grand Date: Sat, 3 Oct 2015 14:47:11 +0200 Subject: [PATCH 12/34] Fix : internationalization --- htdocs/admin/propal.php | 10 +++++----- .../propale/doc/doc_generic_proposal_odt.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 1294888ceb1..b9242bd0c4e 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -129,11 +129,11 @@ if ($action == 'set_PROPALE_DRAFT_WATERMARK') } } -if ($action == 'set_PROPALE_FREE_TEXT') +if ($action == 'set_PROPOSAL_FREE_TEXT') { - $freetext = GETPOST('PROPALE_FREE_TEXT'); // No alpha here, we want exact string + $freetext = GETPOST('PROPOSAL_FREE_TEXT'); // No alpha here, we want exact string - $res = dolibarr_set_const($db, "PROPALE_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PROPOSAL_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; @@ -575,10 +575,10 @@ print ''; $var=! $var; print '
'; print ''; -print ''; +print ''; print '
'.$langs->trans("Mask").':'.$form->textwithpicto('',$tooltip,1,1).''.$form->textwithpicto('',$tooltip,1,1).' 
'; print $langs->trans("FreeLegalTextOnProposal").' ('.$langs->trans("AddCRIfTooLong").')
'; -$variablename='PROPALE_FREE_TEXT'; +$variablename='PROPOSAL_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 8f79094befc..80ec0ba6fe0 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -324,7 +324,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales // Line of free text $newfreetext=''; - $paramfreetext='PROPALE_FREE_TEXT'; + $paramfreetext='PROPOSAL_FREE_TEXT'; if (! empty($conf->global->$paramfreetext)) { $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 7fb02fe0514..21820e42a66 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1541,7 +1541,7 @@ class pdf_azur extends ModelePDFPropales function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { $showdetails=0; - return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); + return pdf_pagefoot($pdf,$outputlangs,'PROPOSAL_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } /** From b6de2a954cdacb3d99129fd5c5a70e5007ba64c3 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Sat, 3 Oct 2015 15:04:03 +0200 Subject: [PATCH 13/34] fix : internationalization --- htdocs/admin/commande.php | 10 +++++----- .../commande/doc/doc_generic_order_odt.modules.php | 2 +- .../core/modules/commande/doc/pdf_einstein.modules.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index c83247a9bbf..b2d44047d77 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -204,11 +204,11 @@ else if ($action == 'set_COMMANDE_DRAFT_WATERMARK') } } -else if ($action == 'set_COMMANDE_FREE_TEXT') +else if ($action == 'set_ORDER_FREE_TEXT') { - $freetext = GETPOST("COMMANDE_FREE_TEXT"); // No alpha here, we want exact string + $freetext = GETPOST("ORDER_FREE_TEXT"); // No alpha here, we want exact string - $res = dolibarr_set_const($db, "COMMANDE_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "ORDER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; @@ -552,10 +552,10 @@ $var=true; $var=! $var; print ''; print ''; -print ''; +print ''; print '
'; print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')
'; -$variablename='COMMANDE_FREE_TEXT'; +$variablename='ORDER_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 1b7da875073..61aba27a6b8 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -290,7 +290,7 @@ class doc_generic_order_odt extends ModelePDFCommandes // Line of free text $newfreetext=''; - $paramfreetext='COMMANDE_FREE_TEXT'; + $paramfreetext='ORDER_FREE_TEXT'; if (! empty($conf->global->$paramfreetext)) { $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 0716519457c..d9fe45831cf 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1350,7 +1350,7 @@ class pdf_einstein extends ModelePDFCommandes function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { $showdetails=0; - return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); + return pdf_pagefoot($pdf,$outputlangs,'ORDER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } From 298fafd7d2f59cb53c8665c7ab59175ce87a8622 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Sat, 3 Oct 2015 15:10:53 +0200 Subject: [PATCH 14/34] fix : internationalization --- htdocs/admin/facture.php | 10 +++++----- .../facture/doc/doc_generic_invoice_odt.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index b77df2a7f12..07b00e5133f 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -226,11 +226,11 @@ if ($action == 'set_FACTURE_DRAFT_WATERMARK') } } -if ($action == 'set_FACTURE_FREE_TEXT') +if ($action == 'set_INVOICE_FREE_TEXT') { - $freetext = GETPOST('FACTURE_FREE_TEXT'); // No alpha here, we want exact string + $freetext = GETPOST('INVOICE_FREE_TEXT'); // No alpha here, we want exact string - $res = dolibarr_set_const($db, "FACTURE_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "INVOICE_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; @@ -753,10 +753,10 @@ print ''; $var=! $var; print '
'; print ''; -print ''; +print ''; print '
'; print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')
'; -$variablename='FACTURE_FREE_TEXT'; +$variablename='INVOICE_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 2ca90b13ace..12ea7aa7b08 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -298,7 +298,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures // Line of free text $newfreetext=''; - $paramfreetext='FACTURE_FREE_TEXT'; + $paramfreetext='INVOICE_FREE_TEXT'; if (! empty($conf->global->$paramfreetext)) { $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index ecedfd2092a..a0514c001e9 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1637,7 +1637,7 @@ class pdf_crabe extends ModelePDFFactures function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { $showdetails=0; - return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); + return pdf_pagefoot($pdf,$outputlangs,'INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } From 8da8b66693d39725e6d78bd8aa0b5bf250a65e4b Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 3 Oct 2015 15:53:36 +0200 Subject: [PATCH 15/34] Issue #3509: Init works --- .../compta/paiement/class/paiement.class.php | 92 ++++++++++++++++++- 1 file changed, 90 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 0b60ac6f2a9..7064cde6e2b 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -174,8 +174,10 @@ class Paiement extends CommonObject $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)"; - $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$totalamount."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.")"; + $ref = $this->getNextNumRef(''); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)"; + $sql.= " VALUES (".$conf->entity.", '".$ref."', ". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$totalamount."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.")"; dol_syslog(get_class($this)."::Create insert paiement", LOG_DEBUG); $resql = $this->db->query($sql); @@ -774,6 +776,92 @@ class Paiement extends CommonObject } } + /** + * Return next reference of customer invoice not already used (or last reference) + * according to numbering module defined into constant FACTURE_ADDON + * + * @param Societe $soc object company + * @param string $mode 'next' for next value or 'last' for last value + * @return string free ref or last ref + */ + function getNextNumRef($soc,$mode='next') + { + global $conf, $db, $langs; + $langs->load("bills"); + + // Clean parameters (if not defined or using deprecated value) + if (empty($conf->global->PAYMENT_ADDON)) $conf->global->PAYMENT_ADDON='mod_payment_ant'; + else if ($conf->global->PAYMENT_ADDON=='ant') $conf->global->PAYMENT_ADDON='mod_payment_ant'; + else if ($conf->global->PAYMENT_ADDON=='cicada') $conf->global->PAYMENT_ADDON='mod_payment_cicada'; + + if (! empty($conf->global->PAYMENT_ADDON)) + { + $mybool=false; + + $file = $conf->global->PAYMENT_ADDON.".php"; + $classname = $conf->global->PAYMENT_ADDON; + + // Include file with class + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + + foreach ($dirmodels as $reldir) { + + $dir = dol_buildpath($reldir."core/modules/facture/"); + + // Load file with numbering class (if found) + if (is_file($dir.$file) && is_readable($dir.$file)) + { + $mybool |= include_once $dir . $file; + } + } + + // For compatibility + if (! $mybool) + { + $file = $conf->global->FACTURE_ADDON."/".$conf->global->PAYMENT_ADDON.".modules.php"; + $classname = "mod_facture_".$conf->global->PAYMENT_ADDON; + $classname = preg_replace('/\-.*$/','',$classname); + // Include file with class + foreach ($conf->file->dol_document_root as $dirroot) + { + $dir = $dirroot."/core/modules/payment/"; + + // Load file with numbering class (if found) + if (is_file($dir.$file) && is_readable($dir.$file)) { + $mybool |= include_once $dir . $file; + } + } + } + + if (! $mybool) + { + dol_print_error('',"Failed to include file ".$file); + return ''; + } + + $obj = new $classname(); + $numref = ""; + $numref = $obj->getNextValue($soc,$this,$mode); + + /** + * $numref can be empty in case we ask for the last value because if there is no invoice created with the + * set up mask. + */ + if ($mode != 'last' && !$numref) { + dol_print_error($db,"Payment::getNextNumRef ".$obj->error); + return ""; + } + + return $numref; + } + else + { + $langs->load("errors"); + print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete"); + return ""; + } + } + /** * Initialise an instance with random values. * Used to build previews or test instances. From 03a2fd740dd5eca71f5d1d6052579f5e5aad38cc Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 3 Oct 2015 16:58:46 +0200 Subject: [PATCH 16/34] Issue #3509: Ready for customers --- htdocs/compta/paiement.php | 3 ++- htdocs/compta/paiement/card.php | 3 ++- htdocs/compta/paiement/class/paiement.class.php | 14 +++++++------- htdocs/compta/paiement/list.php | 9 +++++---- htdocs/core/modules/payment/mod_payment_ant.php | 2 +- htdocs/core/modules/payment/mod_payment_cicada.php | 6 +++--- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 5534468da35..7466686239a 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -7,6 +7,7 @@ * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> + * Copyright (C) 2015 Juanjo Menent * * 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 @@ -658,7 +659,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $text.='
'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed"); print ''; } - $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('ReceivedCustomersPayments'),$text,'confirm_paiement',$formquestion,$preselectedchoice); + print $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('ReceivedCustomersPayments'),$text,'confirm_paiement',$formquestion,$preselectedchoice); } print "\n"; diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 71d32404c94..51a899c0748 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Marcos García + * Copyright (C) 2015 Juanjo Menent * * 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 @@ -201,7 +202,7 @@ if ($action == 'valide') print ''; // Ref -print ''; +print ''; // Date payment print ''; diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index b4f90906c67..a09ad2355e4 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -118,7 +118,7 @@ class mod_payment_ant extends ModeleNumRefPayments return 0; } - $numFinal=get_next_value($db,$mask,'paiement','ref','',$objsoc,$object->date); + $numFinal=get_next_value($db,$mask,'paiement','ref','',$objsoc,$object->datepaye); return $numFinal; } diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index fb54a5fb568..aea1fb38360 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -104,7 +104,7 @@ class mod_payment_cicada extends ModeleNumRefPayments global $db,$conf; // D'abord on recupere la valeur max - $posindice=8; + $posindice=9; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement"; $sql.= " WHERE ref like '".$this->prefix."____-%'"; @@ -124,7 +124,7 @@ class mod_payment_cicada extends ModeleNumRefPayments } //$date=time(); - $date=$object->date; + $date=$object->datepaye; $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 @@ -142,7 +142,7 @@ class mod_payment_cicada extends ModeleNumRefPayments * @param string $objforref Object for number to search * @return string Next free value */ - function commande_get_num($objsoc,$objforref) + function payment_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); } From 9d60dee781e38d566bf43a26eaee0326630ebcc9 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 3 Oct 2015 17:15:25 +0200 Subject: [PATCH 17/34] Issue #3509: Ready for customers --- htdocs/compta/paiement/class/paiement.class.php | 2 +- htdocs/core/modules/payment/mod_payment_cicada.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 04617cabd64..45c9d0b526b 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -790,7 +790,7 @@ class Paiement extends CommonObject $langs->load("bills"); // Clean parameters (if not defined or using deprecated value) - if (empty($conf->global->PAYMENT_ADDON)) $conf->global->PAYMENT_ADDON='mod_payment_ant'; + if (empty($conf->global->PAYMENT_ADDON)) $conf->global->PAYMENT_ADDON='mod_payment_cicada'; else if ($conf->global->PAYMENT_ADDON=='ant') $conf->global->PAYMENT_ADDON='mod_payment_ant'; else if ($conf->global->PAYMENT_ADDON=='cicada') $conf->global->PAYMENT_ADDON='mod_payment_cicada'; diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index aea1fb38360..482261e9fe1 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -70,7 +70,7 @@ class mod_payment_cicada extends ModeleNumRefPayments $payyymm=''; $max=''; - $posindice=8; + $posindice=9; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement"; $sql.= " WHERE ref LIKE '".$this->prefix."____-%'"; From 31acab92a6628bbe433770cb8ec54fc9e343cb3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Oct 2015 18:48:51 +0200 Subject: [PATCH 18/34] Doc comments --- htdocs/commande/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 109746b4e64..c271fc1e6b6 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1427,6 +1427,8 @@ if ($action == 'create' && $user->rights->commande->creer) $form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1); print ''; + // TODO How record was recorded OrderMode (llx_c_input_method) + // Project if (! empty($conf->projet->enabled) && $socid > 0) { @@ -1968,7 +1970,7 @@ if ($action == 'create' && $user->rights->commande->creer) } print ''; - // Source + // Origin print ''; - print ''; + print ''; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { - print ''; + print ''; } + // Photo + if ($object->photo) + { + print ''; + } else { + print ''; + } + + print ''; + // Civility - print ''; // Role - print ''; + print ''; // Address - print ''; // Zip/Town - print ''; // Country - print ''; + print ''; } // Phone diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 0f9f74a6dbc..33864376ac3 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -73,6 +73,7 @@ class Contact extends CommonObject var $code; var $email; var $skype; + var $photo; var $jabberid; var $phone_pro; var $phone_perso; @@ -240,6 +241,7 @@ class Contact extends CommonObject $this->phone_mobile=trim($this->phone_mobile); $this->jabberid=trim($this->jabberid); $this->skype=trim($this->skype); + $this->photo=trim($this->photo); $this->fax=trim($this->fax); $this->zip=(empty($this->zip)?'':$this->zip); $this->town=(empty($this->town)?'':$this->town); @@ -264,6 +266,7 @@ class Contact extends CommonObject $sql .= ", fax='".$this->db->escape($this->fax)."'"; $sql .= ", email='".$this->db->escape($this->email)."'"; $sql .= ", skype='".$this->db->escape($this->skype)."'"; + $sql .= ", photo='".$this->db->escape($this->photo)."'"; $sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); $sql .= ", note_public = ".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null"); $sql .= ", phone = ".(isset($this->phone_pro)?"'".$this->db->escape($this->phone_pro)."'":"null"); @@ -392,7 +395,7 @@ class Contact extends CommonObject if ($this->phone_perso && ! empty($conf->global->LDAP_CONTACT_FIELD_HOMEPHONE)) $info[$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE] = $this->phone_perso; if ($this->phone_mobile && ! empty($conf->global->LDAP_CONTACT_FIELD_MOBILE)) $info[$conf->global->LDAP_CONTACT_FIELD_MOBILE] = $this->phone_mobile; if ($this->fax && ! empty($conf->global->LDAP_CONTACT_FIELD_FAX)) $info[$conf->global->LDAP_CONTACT_FIELD_FAX] = $this->fax; - if ($this->skype && ! empty($conf->global->LDAP_CONTACT_FIELD_SKYPE)) $info[$conf->global->LDAP_CONTACT_FIELD_SKYPE] = $this->skype; + if ($this->skype && ! empty($conf->global->LDAP_CONTACT_FIELD_SKYPE)) $info[$conf->global->LDAP_CONTACT_FIELD_SKYPE] = $this->skype; if ($this->note_private && ! empty($conf->global->LDAP_CONTACT_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_CONTACT_FIELD_DESCRIPTION] = $this->note_private; if ($this->email && ! empty($conf->global->LDAP_CONTACT_FIELD_MAIL)) $info[$conf->global->LDAP_CONTACT_FIELD_MAIL] = $this->email; @@ -518,6 +521,7 @@ class Contact extends CommonObject $sql.= " c.fk_departement,"; $sql.= " c.birthday,"; $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype,"; + $sql.= " c.photo,"; $sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,"; $sql.= " c.import_key,"; $sql.= " co.label as country, co.code as country_code,"; @@ -573,6 +577,7 @@ class Contact extends CommonObject $this->email = $obj->email; $this->jabberid = $obj->jabberid; $this->skype = $obj->skype; + $this->photo = $obj->photo; $this->priv = $obj->priv; $this->mail = $obj->email; @@ -909,12 +914,12 @@ class Contact extends CommonObject $label = '' . $langs->trans("ShowContact") . ''; $label.= '
' . $langs->trans("Name") . ': '.$this->getFullName($langs); //if ($this->civility_id) $label.= '
' . $langs->trans("Civility") . ': '.$this->civility_id; // TODO Translate cibilty_id code - $label.= '
' . $langs->trans("Poste") . ': '.$this->poste; - $label.= '
' . $langs->trans("EMail") . ': '.$this->email; + if (! empty($this->poste)) $label.= '
' . $langs->trans("Poste") . ': '.$this->poste; + if (! empty($this->email)) $label.= '
' . $langs->trans("EMail") . ': '.$this->email; $phonelist=array(); if ($this->phone_pro) $phonelist[]=$this->phone_pro; if ($this->phone_mobile) $phonelist[]=$this->phone_mobile; - if ($this->phone_pesro) $phonelist[]=$this->phone_perso; + if ($this->phone_perso) $phonelist[]=$this->phone_perso; $label.= '
' . $langs->trans("Phone") . ': '.join(', ',$phonelist); $label.= '
' . $langs->trans("Address") . ': '.dol_format_address($this, 1, ' ', $langs); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 40d68bec667..8d69e58bad3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5155,6 +5155,11 @@ class Form $smallfile=preg_replace('/(\.png|\.gif|\.jpg|\.jpeg|\.bmp)/i','_small\\1',$smallfile); if ($object->logo) $file=$id.'/logos/thumbs/'.$smallfile; } + if ($modulepart=='contact') + { + $dir=$conf->societe->multidir_output[$entity].'/contact'; + $file=$id.'/photos/'.$object->photo; + } else if ($modulepart=='userphoto') { $dir=$conf->user->dir_output; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index f9b6bbf8b61..2f49b37f716 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1926,6 +1926,16 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $sqlprotectagainstexternals = "SELECT rowid as fk_soc FROM ".MAIN_DB_PREFIX."societe WHERE rowid='".$db->escape($refname)."' AND entity IN (".getEntity('societe', 1).")"; } + // Wrapping for contact + else if ($modulepart == 'contact') + { + if ($fuser->rights->societe->lire) + { + $accessallowed=1; + } + $original_file=$conf->societe->multidir_output[$entity].'/contact/'.$original_file; + } + // Wrapping for invoices else if ($modulepart == 'facture' || $modulepart == 'invoice') { diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 8bda380c0dd..d8b6ce12ea4 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -52,5 +52,6 @@ ALTER TABLE llx_payment_salary CHANGE COLUMN fk_user_creat fk_user_author intege ALTER TABLE llx_adherent ADD COLUMN pass_crypted varchar(128) after pass; +ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL AFTER rowid; -ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL AFTER rowid; \ No newline at end of file +ALTER TABLE llx_socpeople ADD COLUMN photo varchar(255) AFTER skype; diff --git a/htdocs/install/mysql/tables/llx_socpeople.sql b/htdocs/install/mysql/tables/llx_socpeople.sql index 4b99598a3b9..b9aad05b956 100644 --- a/htdocs/install/mysql/tables/llx_socpeople.sql +++ b/htdocs/install/mysql/tables/llx_socpeople.sql @@ -43,6 +43,7 @@ create table llx_socpeople email varchar(255), jabberid varchar(255), skype varchar(255), + photo varchar(255), no_email smallint NOT NULL DEFAULT 0, priv smallint NOT NULL DEFAULT 0, fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement
'.$langs->trans('Ref').''.$object->id.'
'.$langs->trans('Ref').''.$object->ref.'
'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).''; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 7064cde6e2b..04617cabd64 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -82,7 +82,7 @@ class Paiement extends CommonObject */ function fetch($id, $ref='', $fk_bank='') { - $sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,'; + $sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.fk_bank,'; $sql.= ' c.code as type_code, c.libelle as type_libelle,'; $sql.= ' p.num_paiement, p.note,'; $sql.= ' b.fk_account'; @@ -105,7 +105,7 @@ class Paiement extends CommonObject { $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; - $this->ref = $obj->rowid; + $this->ref = $obj->ref; $this->date = $this->db->jdate($obj->dp); $this->datepaye = $this->db->jdate($obj->dp); $this->numero = $obj->num_paiement; @@ -177,7 +177,7 @@ class Paiement extends CommonObject $ref = $this->getNextNumRef(''); $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)"; - $sql.= " VALUES (".$conf->entity.", '".$ref."', ". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$totalamount."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.")"; + $sql.= " VALUES (".$conf->entity.", '".$ref."', '". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$totalamount."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.")"; dol_syslog(get_class($this)."::Create insert paiement", LOG_DEBUG); $resql = $this->db->query($sql); @@ -806,7 +806,7 @@ class Paiement extends CommonObject foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/facture/"); + $dir = dol_buildpath($reldir."core/modules/payment/"); // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) @@ -818,8 +818,8 @@ class Paiement extends CommonObject // For compatibility if (! $mybool) { - $file = $conf->global->FACTURE_ADDON."/".$conf->global->PAYMENT_ADDON.".modules.php"; - $classname = "mod_facture_".$conf->global->PAYMENT_ADDON; + $file = $conf->global->PAYMENT_ADDON.".php"; + $classname = "mod_payment_".$conf->global->PAYMENT_ADDON; $classname = preg_replace('/\-.*$/','',$classname); // Include file with class foreach ($conf->file->dol_document_root as $dirroot) @@ -841,7 +841,7 @@ class Paiement extends CommonObject $obj = new $classname(); $numref = ""; - $numref = $obj->getNextValue($soc,$this,$mode); + $numref = $obj->getNextValue($soc,$this); /** * $numref can be empty in case we ask for the last value because if there is no invoice created with the diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index c688ca780d4..8231f607ef7 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Juanjo Menent * * 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 @@ -95,7 +96,7 @@ $formother=new FormOther($db); if (GETPOST("orphelins")) { // Paiements lies a aucune facture (pour aide au diagnostic) - $sql = "SELECT p.rowid, p.datep as dp, p.amount,"; + $sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,"; $sql.= " p.statut, p.num_paiement,"; $sql.= " c.code as paiement_code"; // Add fields for extrafields @@ -117,7 +118,7 @@ if (GETPOST("orphelins")) } else { - $sql = "SELECT DISTINCT p.rowid, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives + $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives $sql.= " p.statut, p.num_paiement,"; $sql.= " c.code as paiement_code,"; $sql.= " ba.rowid as bid, ba.label,"; @@ -164,7 +165,7 @@ else { $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } - if ($search_ref > 0) $sql .=" AND p.rowid=".$search_ref; + if ($search_ref) $sql .=natural_search('p.ref', $search_ref); if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'"; if ($search_amount) $sql .=" AND p.amount='".$db->escape(price2num($search_amount))."'"; @@ -253,7 +254,7 @@ if ($resql) print ''; $paymentstatic->id=$objp->rowid; - $paymentstatic->ref=$objp->rowid; + $paymentstatic->ref=$objp->ref; print $paymentstatic->getNomUrl(1); print '
'; print ''; + // TODO How record was recorded OrderMode (llx_c_input_method) + // Project if (! empty($conf->projet->enabled)) { From bea789edfef5ee16f22ece7b20e9145b1f5d2f22 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Oct 2015 20:09:54 +0200 Subject: [PATCH 19/34] Make process to update launchpad easier. --- build/launchpad/README | 48 +++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/build/launchpad/README b/build/launchpad/README index 03ddc7fd4e6..b2db1d18894 100644 --- a/build/launchpad/README +++ b/build/launchpad/README @@ -41,23 +41,21 @@ If you want to build/test package locally: # Push/declare Dolibarr sources to Launchpad #---------------------------------- - From Launchpad project (https://launchpad.net/dolibarr), register a series: - Call it 'trunk' or 'beta' or 'stable' + Call it 'trunk' or 'stable' Use branch (dev): - ~eldy/dolibarr/develop - ~eldy/dolibarr/beta - ~eldy/dolibarr/stable + https://launchpad.net/~eldy/dolibarr/develop + https://launchpad.net/~eldy/dolibarr/stable or - Use URL pattern (beta or stable): + Use URL pattern (stable): For stable: http://www.dolibarr.org/files/lastbuild/package_debian-ubuntu/dolibarr_x.z.*.tar.gz - For beta: http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_x.y.*.tar.gz - For Dev, you can also add link serie to GIT HEAD. -- For beta and stable, you can init from command line - cd bzr/dolibarr-[beta|stable] +- For stable, you can init from command line + cd bzr/dolibarr-stable bzr init bzr add bzr commit -m "Init" - bzr push lp:~yourlogin/dolibarr/[beta|stable] + bzr push lp:~yourlogin/dolibarr/stable - List of series are visible here: https://launchpad.net/dolibarr/+series @@ -65,19 +63,19 @@ If you want to build/test package locally: #---------------------------------- # create local repository cd bzr - bzr branch lp:~yourlogin/dolibarr/[develop|beta|stable] dolibarr-[dev|beta|stable] - cd dolibarr-[dev|beta|stable] + bzr branch lp:~yourlogin/dolibarr/[develop|stable] dolibarr-[dev|stable] + cd dolibarr-[dev|stable] # Update bzr update - -- Update files here. Remove all and overwrite -- + -- Update files here: Remove all (except .bzr dir) and overwrite -- bzr status bzr add * - bzr commit -m "Description of change" + bzr commit -m "Upstream version x.y" bzr push # Init debian dir repository into launchpad (when repository for sources does not exist) #---------------------------------- -- Create debian directory and upload it onto bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable] +- Create debian directory and upload it onto bzr branch lp:~yourlogin/+junk/debian-[dev|stable] cd bzr mkdir debian cd debian @@ -85,25 +83,25 @@ If you want to build/test package locally: bzr init bzr add bzr commit -m "Init control files" - bzr push lp:~yourlogin/+junk/debian-[dev|beta|stable] (put here any branch name or just bzr push if into a known branch) + bzr push lp:~yourlogin/+junk/debian-[dev|stable] (put here any branch name or just bzr push if into a known branch) - or download it from launchpad bazaar: cd bzr - bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable] + bzr branch lp:~yourlogin/+junk/debian-[dev|stable] # Get debian dir repository from launchpad (when repository for sources already exists) #---------------------------------- cd bzr - bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable] + bzr branch lp:~yourlogin/+junk/debian-[dev|stable] # To update debian dir into launchpad (when repository for sources already exists) #---------------------------------- cd bzr - bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable] - cd debian-[dev|beta|stable] + bzr branch lp:~yourlogin/+junk/debian-[dev|stable] + cd debian-[dev|stable] bzr status -- Update files here -- bzr commit -m "Description of change" - bzr push lp:~yourlogin/+junk/debian-[dev|beta|stable] + bzr push lp:~yourlogin/+junk/debian-[dev|stable] # Define a recipe into launchpad (a rule to build packages into a PPA) @@ -115,10 +113,6 @@ If you want to build/test package locally: # bzr-builder format 0.3 deb-version {debupstream}-0~{revno} lp:dolibarr merge packaging lp:~yourlogin/+junk/debian-dev - For beta: - # bzr-builder format 0.3 deb-version {debupstream}-1~{revno} - lp:dolibarr/beta - merge packaging lp:~yourlogin/+junk/debian-beta For stable: # bzr-builder format 0.3 deb-version {debupstream}-2~{revno} lp:dolibarr/stable @@ -126,13 +120,12 @@ If you want to build/test package locally: - Run command cd bzr bzr dailydeb dolibarr.recipe working-dir - This will create a directory "working-dir" with dolibarr sources and will add sources from ~yourlogin/+junk/debian-[dev|beta|stable] + This will create a directory "working-dir" with dolibarr sources and will add sources from ~yourlogin/+junk/debian-[dev|stable] - Test package sources sudo pbuilder build /_.dsc List of recipes created https://code.launchpad.net/~eldy/+recipe/dolibarr-dev -https://code.launchpad.net/~eldy/+recipe/dolibarr-beta https://code.launchpad.net/~eldy/+recipe/dolibarr-stable @@ -147,9 +140,6 @@ https://code.launchpad.net/~eldy/+recipe/dolibarr-stable For the development snapshot version: deb http://ppa.launchpad.net/yourlogin/dolibarr-dev/ubuntu precise main deb-src http://ppa.launchpad.net/yourlogin/dolibarr-dev/ubuntu precise main -For the beta version: -deb http://ppa.launchpad.net/yourlogin/dolibarr-beta/ubuntu precise main -deb-src http://ppa.launchpad.net/yourlogin/dolibarr-beta/ubuntu precise main For the stable version: deb http://ppa.launchpad.net/yourlogin/dolibarr-stable/ubuntu precise main deb-src http://ppa.launchpad.net/yourlogin/dolibarr-stable/ubuntu precise main From c077e69047a8d0e34c63b10cf0327375612a2af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 3 Oct 2015 20:54:27 +0200 Subject: [PATCH 20/34] Autocomplete with last conciliate number --- htdocs/compta/bank/rappro.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php index aa9f043b2d5..2bafa7e780e 100644 --- a/htdocs/compta/bank/rappro.php +++ b/htdocs/compta/bank/rappro.php @@ -198,10 +198,14 @@ if ($resql) { $numr=$db->num_rows($resqlr); $i=0; + $last_ok=0; while (($i < $numr) && ($i < $nbmax)) { $objr = $db->fetch_object($resqlr); + if (! $last_ok) { $last_releve = $objr->num_releve; + $last_ok=1; + } $i++; $liste=''.$objr->num_releve.'   '.$liste; } @@ -218,11 +222,11 @@ if ($resql) print '
'; print ''; - print ""; - print "id."\">"; + print ''; + print ''; print ''.$langs->trans("InputReceiptNumber").': '; - print ''; + print ''; print '
'; if ($options) { From ebe937f8b7fe578beb19e60738c14c89a5337529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 3 Oct 2015 21:32:43 +0200 Subject: [PATCH 21/34] Update index.php --- htdocs/comm/index.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 6aee0fe939c..37e4ee61ced 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -159,6 +159,7 @@ if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; + $sql.= ", s.code_client"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -198,6 +199,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $companystatic->id=$obj->socid; $companystatic->name=$obj->name; $companystatic->client=$obj->client; + $companystatic->code_client = $obj->code_client; + $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1,'customer',16); print ''; @@ -230,6 +233,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $langs->load("orders"); $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; + $sql.= ", s.code_client"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -269,6 +273,8 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $companystatic->id=$obj->socid; $companystatic->name=$obj->name; $companystatic->client=$obj->client; + $companystatic->code_client = $obj->code_client; + $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1,'customer',16); print ''; @@ -304,6 +310,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) $langs->load("boxes"); $sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas"; + $sql.= ", s.code_client"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (1, 2, 3)"; @@ -333,6 +340,8 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) $companystatic->id=$objp->rowid; $companystatic->name=$objp->name; $companystatic->client=$objp->client; + $companystatic->code_client = $objp->code_client; + $companystatic->code_fournisseur = $objp->code_fournisseur; $companystatic->canvas=$objp->canvas; print '
'; print ''; @@ -362,6 +371,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $langs->load("boxes"); $sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm"; + $sql.= ", s.code_fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; @@ -389,6 +399,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $objp = $db->fetch_object($result); $companystatic->id=$objp->rowid; $companystatic->name=$objp->name; + $companystatic->code_client = $objp->code_client; + $companystatic->code_fournisseur = $objp->code_fournisseur; $companystatic->canvas=$objp->canvas; print ''; print ''; @@ -434,6 +446,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO $langs->load("contracts"); $sql = "SELECT s.nom as name, s.rowid, s.canvas, "; + $sql.= ", s.code_client"; $sql.= " c.statut, c.rowid as contratid, p.ref, c.mise_en_service as datemes, c.fin_validite as datefin, c.date_cloture as dateclo"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."contrat as c"; @@ -468,6 +481,8 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO print ''."\n"; @@ -492,6 +507,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $langs->load("propal"); $sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; + $sql.= ", s.code_client"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -552,6 +568,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $companystatic->id=$obj->rowid; $companystatic->name=$obj->name; $companystatic->client=$obj->client; + $companystatic->code_client = $obj->code_client; + $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'company', 44); print ''; @@ -588,6 +606,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $langs->load("orders"); $sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed"; + $sql.= ", s.code_client"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -648,6 +667,8 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $companystatic->id=$obj->rowid; $companystatic->name=$obj->name; $companystatic->client=$obj->client; + $companystatic->code_client = $obj->code_client; + $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'company', 44); print ''; From 0cfa112cf2dcf5395391ef788811895ad5fc590f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 3 Oct 2015 22:35:26 +0200 Subject: [PATCH 22/34] Update index.php --- htdocs/societe/index.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index c8da9ae9f89..2538b105536 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -250,6 +250,8 @@ print '
'; */ $max=15; $sql = "SELECT s.rowid, s.nom as name, s.client, s.fournisseur"; +$sql.= ", s.code_client"; +$sql.= ", s.code_fournisseur"; $sql.= ", s.logo"; $sql.= ", s.canvas, s.tms as datem, s.status as status"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -298,8 +300,10 @@ if ($result) $thirdparty_static->logo = $objp->logo; $thirdparty_static->datem=$db->jdate($objp->datem); $thirdparty_static->status=$objp->status; + $thirdparty_static->code_client = $objp->code_client; + $thirdparty_static->code_fournisseur = $objp->code_fournisseur; $thirdparty_static->canvas=$objp->canvas; - print $thirdparty_static->getNomUrl(1); + print $thirdparty_static->getNomUrl(1); print "\n"; // Type print '
"; print '"; - print ''; + print $commandestatic->getNomUrl(1); + print ""; + print ''; $i++; } } @@ -216,6 +234,9 @@ $max=5; $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,"; $sql.= " s.nom as name, s.rowid as socid"; +$sql.= ", s.client"; +$sql.= ", s.code_client"; +$sql.= ", s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c,"; $sql.= " ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -250,6 +271,12 @@ if ($resql) $commandestatic->id=$obj->rowid; $commandestatic->ref=$obj->ref; + $companystatic->id=$obj->socid; + $companystatic->name=$obj->name; + $companystatic->client=$obj->client; + $companystatic->code_client=$obj->code_client; + $companystatic->canvas=$obj->canvas; + print '
'; print $langs->trans('Source'); @@ -1988,6 +1990,8 @@ if ($action == 'create' && $user->rights->commande->creer) // print ''.$langs->trans("DictionarySource").''; print '
'.$companystatic->getNomUrl(1,'customer',48).'
'.$companystatic->getNomUrl(1,'supplier',44).''; $companystatic->id=$objp->rowid; $companystatic->name=$objp->name; + $companystatic->code_client = $objp->code_client; + $companystatic->code_fournisseur = $objp->code_fournisseur; $companystatic->canvas=$objp->canvas; print $companystatic->getNomUrl(1,'customer',44); print ''; From bc01d28061fff1d8f94ff618ed07567389f007df Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 3 Oct 2015 22:59:22 +0200 Subject: [PATCH 23/34] Fix: formconfirm printing --- htdocs/fourn/facture/paiement.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index b94eceb0c1d..118cd1f4798 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Juanjo Menent * * 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 @@ -438,7 +439,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $text.='
'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed"); print ''; } - $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('PayedSuppliersPayments'),$text,'confirm_paiement',$formquestion,$preselectedchoice); + print $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('PayedSuppliersPayments'),$text,'confirm_paiement',$formquestion,$preselectedchoice); } print ''; From 85186ee1a356e0aeb2ae866c90294e8a6616d75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 3 Oct 2015 23:06:05 +0200 Subject: [PATCH 24/34] Update index.php --- htdocs/commande/index.php | 61 +++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index d6432a257ba..f9fe17ac1c2 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -26,6 +26,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php'; if (!$user->rights->commande->lire) accessforbidden(); @@ -47,6 +48,7 @@ if ($user->societe_id > 0) */ $commandestatic=new Commande($db); +$companystatic=new Societe($db); $form = new Form($db); $formfile = new FormFile($db); $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; @@ -167,6 +169,9 @@ else if (! empty($conf->commande->enabled)) { $sql = "SELECT c.rowid, c.ref, s.nom as name, s.rowid as socid"; + $sql.= ", s.client"; + $sql.= ", s.code_client"; + $sql.= ", s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -192,10 +197,23 @@ if (! empty($conf->commande->enabled)) { $var=!$var; $obj = $db->fetch_object($resql); + + $commandestatic->id=$obj->rowid; + $commandestatic->ref=$obj->ref; + + $companystatic->id=$obj->socid; + $companystatic->name=$obj->name; + $companystatic->client=$obj->client; + $companystatic->code_client=$obj->code_client; + $companystatic->canvas=$obj->canvas; + print "
'; - print "rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).'
'; + print $companystatic->getNomUrl(1,'company',16); + print '
'; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -286,6 +315,9 @@ else dol_print_error($db); if (! empty($conf->commande->enabled)) { $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; + $sql.= ", s.client"; + $sql.= ", s.code_client"; + $sql.= ", s.canvas"; $sql.=" FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -319,6 +351,12 @@ if (! empty($conf->commande->enabled)) $commandestatic->id=$obj->rowid; $commandestatic->ref=$obj->ref; + $companystatic->id=$obj->socid; + $companystatic->name=$obj->name; + $companystatic->client=$obj->client; + $companystatic->code_client=$obj->code_client; + $companystatic->canvas=$obj->canvas; + print '
'; print $commandestatic->getNomUrl(1); @@ -268,7 +295,9 @@ if ($resql) print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''; + print $companystatic->getNomUrl(1,'company',16); + print ''.dol_print_date($db->jdate($obj->datem),'day').''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'
'; print ''; - print ''; + print ''; print ''; @@ -357,6 +397,9 @@ if (! empty($conf->commande->enabled)) if (! empty($conf->commande->enabled)) { $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; + $sql.= ", s.client"; + $sql.= ", s.code_client"; + $sql.= ", s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -390,6 +433,12 @@ if (! empty($conf->commande->enabled)) $commandestatic->id=$obj->rowid; $commandestatic->ref=$obj->ref; + $companystatic->id=$obj->socid; + $companystatic->name=$obj->name; + $companystatic->client=$obj->client; + $companystatic->code_client=$obj->code_client; + $companystatic->canvas=$obj->canvas; + print '
'; print $commandestatic->getNomUrl(1); @@ -337,7 +375,9 @@ if (! empty($conf->commande->enabled)) print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).''; + print $companystatic->getNomUrl(1,'company',24); + print ''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'
'; print ''; - print ''; + print ''; print ''; From 8febf25c2360904d47362e87fe1da33a185265c2 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 3 Oct 2015 23:34:10 +0200 Subject: [PATCH 25/34] Fix: #3566 --- htdocs/fourn/class/fournisseur.facture.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index ed81f486dc1..6a209174d9f 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García @@ -986,8 +986,8 @@ class FactureFournisseur extends CommonInvoice $oldref = dol_sanitizeFileName($this->ref); $newref = dol_sanitizeFileName($num); - $dirsource = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2,0,0, $this, 'invoive_supplier').$oldref; - $dirdest = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2,0,0, $this, 'invoive_supplier').$newref; + $dirsource = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2,0,0, $this, 'invoice_supplier').$oldref; + $dirdest = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2,0,0, $this, 'invoice_supplier').$newref; if (file_exists($dirsource)) { dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest); @@ -996,7 +996,7 @@ class FactureFournisseur extends CommonInvoice { dol_syslog("Rename ok"); // Rename docs starting with $oldref with $newref - $listoffiles=dol_dir_list($conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2,0,0, $this, 'invoive_supplier').$newref, 'files', 1, '^'.preg_quote($oldref,'/')); + $listoffiles=dol_dir_list($conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2,0,0, $this, 'invoice_supplier').$newref, 'files', 1, '^'.preg_quote($oldref,'/')); foreach($listoffiles as $fileentry) { $dirsource=$fileentry['name']; From b3fb3207969e43e4b9fbe71ad24f0422dbb8c5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 3 Oct 2015 23:44:17 +0200 Subject: [PATCH 26/34] Update errors.lang --- htdocs/langs/en_US/errors.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index dfbb0b9fb35..6bf95ebe75b 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -172,6 +172,7 @@ ErrorFieldMustBeANumeric=Field %s must be a numeric value ErrorFieldMustBeAnInteger=Field %s must be an integer ErrorMandatoryParametersNotProvided=Mandatory parameter(s) not provided ErrorOppStatusRequiredIfAmount=You set an estimated amount for this opportunity/lead. So you must also enter its status +ErrorBadDefinitionOfMenuArrayInModuleDescriptor=Bad Definition Of Menu Array In Module Descriptor (bad value for key fk_menu) # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. From 6f513fabef4a4a2663ca926b3fac6c2c5920fbb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 3 Oct 2015 23:45:25 +0200 Subject: [PATCH 27/34] Update DolibarrModules.class.php --- htdocs/core/modules/DolibarrModules.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 50c93d8d432..c059ff7c2cc 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1401,7 +1401,7 @@ print $sql; } if (! $foundparent) { - $this->error="ErrorBadDefinitionOfMenuArrayInModuleDescriptor (bad value for key fk_menu)"; + $this->error="ErrorBadDefinitionOfMenuArrayInModuleDescriptor"; dol_syslog(get_class($this)."::insert_menus ".$this->error." ".$this->menu[$key]['fk_menu'], LOG_ERR); $err++; } From 9a021e6de46fd29c82ec3364b11a4cee36060370 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sun, 4 Oct 2015 10:45:57 +0200 Subject: [PATCH 28/34] Optioncss not kept in list --- htdocs/adherents/list.php | 2 ++ htdocs/bookmarks/list.php | 11 +++++++---- htdocs/comm/action/listactions.php | 2 ++ htdocs/comm/list.php | 2 ++ htdocs/comm/propal/list.php | 2 ++ htdocs/commande/list.php | 2 ++ htdocs/contact/list.php | 2 ++ htdocs/contrat/list.php | 2 ++ htdocs/don/list.php | 23 +++++++++++++---------- htdocs/expedition/list.php | 2 ++ htdocs/expensereport/list.php | 2 ++ htdocs/fichinter/list.php | 2 ++ htdocs/fourn/commande/list.php | 2 ++ htdocs/fourn/facture/list.php | 2 ++ htdocs/fourn/list.php | 2 ++ htdocs/fourn/product/list.php | 2 ++ htdocs/product/list.php | 2 ++ htdocs/projet/list.php | 2 ++ htdocs/societe/list.php | 2 ++ htdocs/user/group/index.php | 2 ++ htdocs/user/index.php | 2 ++ 21 files changed, 58 insertions(+), 14 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 9799ea2ecef..0acc9c0d795 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -48,6 +48,7 @@ $search_email=GETPOST("search_email"); $search_categ = GETPOST("search_categ",'int'); $catid = GETPOST("catid",'int'); $sall=GETPOST("sall"); +$optioncss = GETPOST('optioncss','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -176,6 +177,7 @@ if ($resql) if ($search_email) $param.="&search_email=".$search_email; if ($filter) $param.="&filter=".$filter; if ($type > 0) $param.="&type=".$type; + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); if ($sall) diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index c54111239b9..f8b7c21863d 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -31,6 +31,7 @@ $langs->load("admin"); if (! $user->rights->bookmark->lire) { restrictedArea($user, 'bookmarks'); } +$optioncss = GETPOST('optioncss','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -88,21 +89,23 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; + $param = ""; + if ($optioncss != '') $param ='&optioncss='.$optioncss; print "
'; print $commandestatic->getNomUrl(1); @@ -408,7 +457,9 @@ if (! empty($conf->commande->enabled)) print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''; + print $companystatic->getNomUrl(1,'company'); + print ''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'
"; print ""; //print ""; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bid","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Title"),'',''); print ""; print_liste_field_titre($langs->trans("Link"),'',''); print ""; print_liste_field_titre($langs->trans("Target"),'','','','','align="center"'); print ""; - print_liste_field_titre($langs->trans("Owner"),$_SERVER["PHP_SELF"],"u.lastname","","",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","","",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Position"),$_SERVER["PHP_SELF"],"b.position","","",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Owner"),$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Position"),$_SERVER["PHP_SELF"],"b.position","", $param,'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 509a9c90d77..cee81f38d25 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -43,6 +43,7 @@ $actioncode=GETPOST("actioncode","alpha",3); $pid=GETPOST("projectid",'int',3); $status=GETPOST("status",'alpha'); $type=GETPOST('type'); +$optioncss = GETPOST('optioncss','alpha'); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); $dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear')); $datestart=dol_mktime(0, 0, 0, GETPOST('datestartmonth'), GETPOST('datestartday'), GETPOST('datestartyear')); @@ -165,6 +166,7 @@ if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; if ($type) $param.="&type=".$type; if ($usergroup) $param.="&usergroup=".$usergroup; +if ($optioncss != '') $param.='&optioncss='.$optioncss; $sql = "SELECT"; if ($usergroup > 0) $sql.=" DISTINCT"; diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php index 9752abd31cb..26298743653 100644 --- a/htdocs/comm/list.php +++ b/htdocs/comm/list.php @@ -60,6 +60,7 @@ $search_compta = GETPOST("search_compta"); $search_status = GETPOST("search_status",'int'); $search_country = GETPOST("search_country",'int'); $search_type_thirdparty = GETPOST("search_type_thirdparty",'int'); +$optioncss = GETPOST('optioncss','alpha'); // Load sale and categ filters $search_sale = GETPOST("search_sale",'int'); @@ -179,6 +180,7 @@ if ($result) if ($search_status != '') $param.='&search_status='.htmlspecialchars($search_status); if ($search_country != '') $param.='&search_country='.htmlspecialchars($search_country); if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.htmlspecialchars($search_type_thirdparty); + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies.png'); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 1004986ffe5..f567f703aec 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -59,6 +59,7 @@ $search_author=GETPOST('search_author','alpha'); $search_product_category=GETPOST('search_product_category','int'); $search_town=GETPOST('search_town','alpha'); $viewstatut=GETPOST('viewstatut'); +$optioncss = GETPOST('optioncss','alpha'); $object_statut=GETPOST('propal_statut'); $sall=GETPOST("sall"); @@ -255,6 +256,7 @@ if ($result) if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht; if ($search_author) $param.='&search_author='.$search_author; if ($search_town) $param.='&search_town='.$search_town; + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->name:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_commercial.png'); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 7b431ff1944..db9387c6c5d 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -55,6 +55,7 @@ $socid=GETPOST('socid','int'); $search_user=GETPOST('search_user','int'); $search_sale=GETPOST('search_sale','int'); $search_total_ht=GETPOST('search_total_ht','alpha'); +$optioncss = GETPOST('optioncss','alpha'); // Security check $id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int')); @@ -250,6 +251,7 @@ if ($resql) if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_sale > 0) $param.='&search_sale='.$search_sale; if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht; + if ($optioncss != '') $param.='&optioncss='.$optioncss; $num = $db->num_rows($resql); print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_commercial.png'); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index cf65c1c5456..9a7849e229c 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -56,6 +56,7 @@ $search_priv=GETPOST("search_priv"); $search_categ=GETPOST("search_categ",'int'); $search_status=GETPOST("search_status",'int'); if ($search_status=='') $search_status=1; // always display activ customer first +$optioncss = GETPOST('optioncss','alpha'); $type=GETPOST("type"); @@ -261,6 +262,7 @@ if ($result) if (!empty($search_categ)) $param.='&search_categ='.htmlspecialchars($search_categ); if ($search_status != '') $param.='&search_status='.htmlspecialchars($search_status); if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".htmlspecialchars($search_priv); + if ($optioncss != '') $param.='&optioncss='.$optioncss; $num = $db->num_rows($result); $i = 0; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 669f2b09775..dfe6493aa73 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -51,6 +51,7 @@ $search_status=GETPOST('search_status'); $socid=GETPOST('socid'); $search_sale = GETPOST('search_sale','int'); +$optioncss = GETPOST('optioncss','alpha'); if (! $sortfield) $sortfield="c.rowid"; if (! $sortorder) $sortorder="DESC"; @@ -160,6 +161,7 @@ if ($resql) $param.='&search_name='.$search_name; $param.='&search_ref_supplier='.$search_ref_supplier; $param.='&search_sale=' .$search_sale; + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder); diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 2fb2e066b5b..94ac7a948ad 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -47,6 +47,7 @@ $search_ref=GETPOST('search_ref','alpha'); $search_company=GETPOST('search_company','alpha'); $search_name=GETPOST('search_name','alpha'); $search_amount = GETPOST('search_amount','alpha'); +$optioncss = GETPOST('optioncss','alpha'); if (!$user->rights->don->lire) accessforbidden(); @@ -101,34 +102,36 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; - $param="&statut=$statut&sortorder=$sortorder&sortfield=$sortfield"; + $param = '&statut='.$statut; + if ($page > 0) $param.= '&page='.$page; + if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($statut >= 0) { $donationstatic->statut=$statut; $label=$donationstatic->getLibStatut(0); - print_barre_liste($label, $page, $_SERVER["PHP_SELF"], $param, '', '', '', $num); + print_barre_liste($label, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); } else { - print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, '', '', '', $num); + print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); } print ''."\n"; print "
 
"; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","&page=$page&statut=$statut","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"d.societe","&page=$page&statut=$statut","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"d.lastname","&page=$page&statut=$statut","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.datedon","&page=$page&statut=$statut","",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","", $param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"d.societe","", $param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"d.lastname","", $param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.datedon","", $param,'align="center"',$sortfield,$sortorder); if (! empty($conf->projet->enabled)) { $langs->load("projects"); - print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"fk_projet","&page=$page&statut=$statut","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"fk_projet","", $param,"",$sortfield,$sortorder); } - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"d.amount","&page=$page&statut=$statut","",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.fk_statut","&page=$page&statut=$statut","",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"d.amount","", $param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.fk_statut","", $param,'align="right"',$sortfield,$sortorder); print "\n"; // Filters lines diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index aa629955f53..c10c589c29f 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -38,6 +38,7 @@ $result = restrictedArea($user, 'expedition',$expeditionid,''); $search_ref_exp = GETPOST("search_ref_exp"); $search_ref_liv = GETPOST('search_ref_liv'); $search_company = GETPOST("search_company"); +$optioncss = GETPOST('optioncss','alpha'); $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); @@ -114,6 +115,7 @@ if ($resql) if ($search_ref_exp) $param.= "&search_ref_exp=".$search_ref_exp; if ($search_ref_liv) $param.= "&search_ref_liv=".$search_ref_liv; if ($search_company) $param.= "&search_company=".$search_company; + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 54e372053ad..3f04290485a 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -48,6 +48,7 @@ $month_start = GETPOST("month_start","int"); $year_start = GETPOST("year_start","int"); $month_end = GETPOST("month_end","int"); $year_end = GETPOST("year_end","int"); +$optioncss = GETPOST('optioncss','alpha'); if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers { @@ -177,6 +178,7 @@ if ($resql) if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht; if ($search_amount_ttc) $param.="&search_amount_ttc=".$search_amount_ttc; if ($search_status >= 0) $param.="&search_status=".$search_status; + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print ''."\n"; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 0e9a5a8c4e0..903dc0898dc 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -62,6 +62,7 @@ $search_company=GETPOST('search_company','alpha'); $search_desc=GETPOST('search_desc','alpha'); $search_status=GETPOST('search_status'); $sall=GETPOST('sall'); +$optioncss = GETPOST('optioncss','alpha'); if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { @@ -128,6 +129,7 @@ if ($result) if ($search_company) $urlparam.="&search_company=".urlencode($search_company); if ($search_desc) $urlparam.="&search_desc=".urlencode($search_desc); if ($search_status != '' && $search_status > -1) $urlparam.="&search_status=".urlencode($search_status); + if ($optioncss != '') $urlparam.='&optioncss='.$optioncss; print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER['PHP_SELF'], $urlparam, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_commercial.png'); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index c21830e66e8..5b37229024c 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -46,6 +46,7 @@ $search_ht=GETPOST('search_ht'); $search_ttc=GETPOST('search_ttc'); $sall=GETPOST('search_all'); $search_status=(GETPOST('search_status','alpha')!=''?GETPOST('search_status','alpha'):GETPOST('statut','alpha')); // alpha and not intbecause it can be '6,7' +$optioncss = GETPOST('optioncss','alpha'); $page = GETPOST('page','int'); $socid = GETPOST('socid','int'); @@ -185,6 +186,7 @@ if ($resql) if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp; if ($socid) $param.="&socid=".$socid; if ($search_status >= 0) $param.="&search_status=".$search_status; + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index f5ed63108a6..31d8fa2968a 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -82,6 +82,7 @@ $day_lim = GETPOST('day_lim','int'); $month_lim = GETPOST('month_lim','int'); $year_lim = GETPOST('year_lim','int'); $filter = GETPOST("filtre"); +$optioncss = GETPOST('optioncss','alpha'); if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers { @@ -249,6 +250,7 @@ if ($resql) if ($search_amount_no_tax) $param.='&search_amount_no_tax='.urlencode($search_amount_no_tax); if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax); if ($filter && $filter != -1) $param.='&filtre='.urlencode($filter); + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print ''; diff --git a/htdocs/fourn/list.php b/htdocs/fourn/list.php index d05359945d1..31201acd987 100644 --- a/htdocs/fourn/list.php +++ b/htdocs/fourn/list.php @@ -49,6 +49,7 @@ $search_status = GETPOST("search_status",'int'); $catid = GETPOST("catid",'int'); $search_country = GETPOST("search_country",'int'); $search_type_thirdparty = GETPOST("search_type_thirdparty",'int'); +$optioncss = GETPOST('optioncss','alpha'); // Security check $socid = GETPOST('socid','int'); @@ -182,6 +183,7 @@ if ($resql) if ($search_status != '') $param.='&search_status='.htmlspecialchars($search_status); if ($search_country != '') $param.='&search_country='.htmlspecialchars($search_country); if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.htmlspecialchars($search_type_thirdparty); + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies'); diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 33e1ea46dd9..a97d3106c3b 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -40,6 +40,7 @@ $sref = GETPOST('sref'); $sRefSupplier = GETPOST('srefsupplier'); $snom = GETPOST('snom'); $type = GETPOST('type'); +$optioncss = GETPOST('optioncss','alpha'); $sortfield = GETPOST('sortfield'); $sortorder = GETPOST('sortorder'); @@ -150,6 +151,7 @@ if ($resql) $param="&tobuy=".$tobuy."&sref=".$sref."&snom=".$snom."&fourn_id=".$fourn_id.(isset($type)?"&type=".$type:"").(empty($sRefSupplier)?"":"&srefsupplier=".$sRefSupplier); + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index de5abca1de4..664548e4855 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -54,6 +54,7 @@ $tosell = GETPOST("tosell", 'int'); $tobuy = GETPOST("tobuy", 'int'); $fourn_id = GETPOST("fourn_id",'int'); $catid = GETPOST('catid','int'); +$optioncss = GETPOST('optioncss','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -239,6 +240,7 @@ else $param.=($fourn_id?"&fourn_id=".$fourn_id:""); $param.=($search_categ?"&search_categ=".$search_categ:""); $param.=isset($type)?"&type=".$type:""; + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($texte, $page, "list.php", $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords,'title_products.png'); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 0debcab2449..d77a190dae2 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -73,6 +73,7 @@ $search_opp_status=GETPOST("search_opp_status",'alpha'); $search_public=GETPOST("search_public",'int'); $search_user=GETPOST('search_user','int'); $search_sale=GETPOST('search_sale','int'); +$optioncss = GETPOST('optioncss','alpha'); $day = GETPOST('day','int'); $month = GETPOST('month','int'); @@ -223,6 +224,7 @@ if ($resql) if ($search_public != '') $param.='&search_public='.$search_public; if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_sale > 0) $param.='&search_sale='.$search_sale; + if ($optioncss != '') $param.='&optioncss='.$optioncss; $text=$langs->trans("Projects"); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 20d4b6c477f..5980a0a5c1d 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -60,6 +60,7 @@ $modesearch=GETPOST("mode_search"); $search_type=trim(GETPOST('search_type')); $search_country = GETPOST("search_country",'int'); $search_type_thirdparty = GETPOST("search_type_thirdparty",'int'); +$optioncss = GETPOST('optioncss','alpha'); $sortfield=GETPOST("sortfield",'alpha'); $sortorder=GETPOST("sortorder",'alpha'); @@ -281,6 +282,7 @@ if ($resql) $param.= '&search_idprof4='.htmlspecialchars($search_idprof4); if ($search_country != '') $param.='&search_country='.htmlspecialchars($search_country); if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.htmlspecialchars($search_type_thirdparty); + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies'); diff --git a/htdocs/user/group/index.php b/htdocs/user/group/index.php index b45615455d8..058f3ac92e2 100644 --- a/htdocs/user/group/index.php +++ b/htdocs/user/group/index.php @@ -36,6 +36,7 @@ $langs->load("users"); $sall=GETPOST('sall'); $search_group=GETPOST('search_group'); +$optioncss = GETPOST('optioncss','alpha'); $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); @@ -83,6 +84,7 @@ if ($resql) $i = 0; $param="&search_group=".urlencode($search_group)."&sall=".urlencode($sall); + if ($optioncss != '') $param.='&optioncss='.$optioncss; print '
'; print ''; print_liste_field_titre($langs->trans("Group"),$_SERVER["PHP_SELF"],"g.nom",$param,"","",$sortfield,$sortorder); diff --git a/htdocs/user/index.php b/htdocs/user/index.php index f2e53987ed8..7ade9f8ba4d 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -47,6 +47,7 @@ $search_lastname=GETPOST('search_lastname','alpha'); $search_firstname=GETPOST('search_firstname','alpha'); $search_statut=GETPOST('search_statut','alpha'); $search_thirdparty=GETPOST('search_thirdparty','alpha'); +$optioncss = GETPOST('optioncss','alpha'); if ($search_statut == '') $search_statut='1'; @@ -124,6 +125,7 @@ if ($result) $param="search_user=".$search_user."&sall=".$sall; $param.="&search_statut=".$search_statut; + if ($optioncss != '') $param.='&optioncss='.$optioncss; print '
'; print ''; From 835633f92a005765872fd5562c7217181a620034 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sun, 4 Oct 2015 11:17:19 +0200 Subject: [PATCH 29/34] =?UTF-8?q?Optioncss=20cotisations=20adh=C3=A9rent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/adherents/cotisations.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index 40d34f58881..82423bdeb94 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -38,6 +38,7 @@ $search_login=GETPOST('search_login'); $search_note=GETPOST('search_note'); $search_account=GETPOST('search_account','int'); $search_amount=GETPOST('search_amount','int'); +$optioncss = GETPOST('optioncss','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -139,6 +140,7 @@ if ($result) if ($search_login) $param.="&search_login=".$search_login; if ($search_acount) $param.="&search_account=".$search_account; if ($search_amount) $param.="&search_amount=".$search_amount; + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); if ($sall) @@ -146,8 +148,6 @@ if ($result) print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; } - $param=""; - $param.="&statut=$statut&date_select=$date_select"; print ''; print '
'; From ed917ab4473796d2dc990954e97aa1f5d9ff4457 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sun, 4 Oct 2015 11:30:28 +0200 Subject: [PATCH 30/34] Optioncss --- htdocs/compta/salaries/index.php | 2 ++ htdocs/fourn/facture/paiement.php | 2 ++ htdocs/loan/index.php | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 5926d42bb8e..5492c7b9e4f 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -49,6 +49,7 @@ $pagenext = $page + 1; $limit = $conf->liste_limit; if (! $sortfield) $sortfield="s.datep"; if (! $sortorder) $sortorder="DESC"; +$optioncss = GETPOST('optioncss','alpha'); $filtre=$_GET["filtre"]; @@ -120,6 +121,7 @@ if ($result) $param=''; if ($typeid) $param.='&typeid='.$typeid; + if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines, 'title_accountancy.png'); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 118cd1f4798..78044dd4ff1 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -56,6 +56,7 @@ $pagenext = $page + 1; $limit = $conf->liste_limit; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="p.rowid"; +$optioncss = GETPOST('optioncss','alpha'); $amounts = array(); @@ -531,6 +532,7 @@ if (empty($action)) $paramlist.=(! empty($search_ref)?"&search_ref=".$search_ref:""); $paramlist.=(! empty($search_company)?"&search_company=".$search_company:""); $paramlist.=(! empty($search_amount)?"&search_amount='".$search_amount:""); + if ($optioncss != '') $paramlist.='&optioncss='.$optioncss; print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num); diff --git a/htdocs/loan/index.php b/htdocs/loan/index.php index 31985251300..16cda8446a5 100644 --- a/htdocs/loan/index.php +++ b/htdocs/loan/index.php @@ -51,6 +51,7 @@ $search_ref=GETPOST('search_ref','int'); $search_label=GETPOST('search_label','alpha'); $search_amount=GETPOST('search_amount','alpha'); $filtre=GETPOST("filtre"); +$optioncss = GETPOST('optioncss','alpha'); // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers @@ -94,6 +95,9 @@ if ($resql) print load_fiche_titre($langs->trans("Loans")); + $param=""; + if ($optioncss != '') $param.='&optioncss='.$optioncss; + print ''."\n"; print '
'; print ''; From 1108458de858046bc42e3405c7a17ab4780717cf Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sun, 4 Oct 2015 11:45:02 +0200 Subject: [PATCH 31/34] Optioncss --- htdocs/adherents/cotisations.php | 1 + htdocs/adherents/list.php | 1 + htdocs/comm/action/listactions.php | 2 ++ htdocs/comm/list.php | 1 + htdocs/loan/index.php | 1 + 5 files changed, 6 insertions(+) diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index 82423bdeb94..cc8e39d32ca 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -150,6 +150,7 @@ if ($result) print ''; + if ($optioncss != '') print ''; print '
'; print ''; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 0acc9c0d795..4ffbbf33fb6 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -187,6 +187,7 @@ if ($resql) } print ''; + if ($optioncss != '') print ''; print ''; // Filter on categories diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index cee81f38d25..e9bd319f170 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -135,6 +135,7 @@ $userstatic=new User($db); $nav=''; $nav.=''; +if ($optioncss != '') $nav.= ''; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav.=''; if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.=''; if ($filter) $nav.=''; @@ -274,6 +275,7 @@ if ($resql) print ''."\n"; + if ($optioncss != '') print ''; $i = 0; print '
'; diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php index 26298743653..91f30d30887 100644 --- a/htdocs/comm/list.php +++ b/htdocs/comm/list.php @@ -187,6 +187,7 @@ if ($result) $i = 0; print ''."\n"; + if ($optioncss != '') print ''; // Filter on categories $moreforfilter=''; diff --git a/htdocs/loan/index.php b/htdocs/loan/index.php index 16cda8446a5..25d0f015253 100644 --- a/htdocs/loan/index.php +++ b/htdocs/loan/index.php @@ -99,6 +99,7 @@ if ($resql) if ($optioncss != '') $param.='&optioncss='.$optioncss; print ''."\n"; + if ($optioncss != '') print ''; print '
'; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"l.rowid","",$param,"",$sortfield,$sortorder); From f2d7523091420a6d59d70219415530e3eb37f75b Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sun, 4 Oct 2015 12:31:32 +0200 Subject: [PATCH 32/34] Optioncss --- htdocs/comm/propal/list.php | 1 + htdocs/commande/list.php | 1 + htdocs/compta/salaries/index.php | 1 + htdocs/contact/list.php | 1 + htdocs/contrat/list.php | 1 + htdocs/don/list.php | 1 + htdocs/expedition/list.php | 1 + htdocs/expensereport/list.php | 1 + htdocs/fichinter/list.php | 1 + htdocs/fourn/facture/list.php | 1 + htdocs/fourn/facture/paiement.php | 1 + 11 files changed, 11 insertions(+) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index f567f703aec..f595ad8aec0 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -262,6 +262,7 @@ if ($result) // Lignes des champs de filtre print ''; + if ($optioncss != '') print ''; $i = 0; print '
'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index db9387c6c5d..dfe5fab1217 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -259,6 +259,7 @@ if ($resql) // Lignes des champs de filtre print ''; + if ($optioncss != '') print ''; print ''; print '
'; diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 5492c7b9e4f..ddff5dad895 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -126,6 +126,7 @@ if ($result) print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines, 'title_accountancy.png'); print ''; + if ($optioncss != '') print ''; print '
'; print ''; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 9a7849e229c..300a06acca6 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -270,6 +270,7 @@ if ($result) print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords,'title_companies.png'); print ''; + if ($optioncss != '') print ''; print ''; print ''; print ''; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index dfe6493aa73..97d20e2acb1 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -135,6 +135,7 @@ if ($resql) print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_name='.$search_name, $sortfield, $sortorder,'',$num,$totalnboflines,'title_commercial.png'); print ''; + if ($optioncss != '') print ''; print '
'; // If the user can view prospects other than his' diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 94ac7a948ad..55b7d9377a3 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -119,6 +119,7 @@ if ($resql) print ''."\n"; + if ($optioncss != '') print ''; print "
"; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","", $param,"",$sortfield,$sortorder); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index c10c589c29f..6435b02bd43 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -122,6 +122,7 @@ if ($resql) $i = 0; print ''."\n"; + if ($optioncss != '') print ''; print '
'; print ''; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 3f04290485a..ba3b652a3a9 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -182,6 +182,7 @@ if ($resql) print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print ''."\n"; + if ($optioncss != '') print ''; print '
'; print ""; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 903dc0898dc..74051b5bc70 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -134,6 +134,7 @@ if ($result) print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER['PHP_SELF'], $urlparam, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_commercial.png'); print ''."\n"; + if ($optioncss != '') print ''; print '
'; print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 31d8fa2968a..05459d0bd69 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -254,6 +254,7 @@ if ($resql) print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print ''; + if ($optioncss != '') print ''; print '
'; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.ref,fac.rowid","",$param,"",$sortfield,$sortorder); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 78044dd4ff1..76497bf4300 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -537,6 +537,7 @@ if (empty($action)) print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num); print ''; + if ($optioncss != '') print ''; print '
'; print ''; print_liste_field_titre($langs->trans('RefPayment'),$_SERVER["PHP_SELF"],'p.rowid','',$paramlist,'',$sortfield,$sortorder); From 1e8ff692677a1e7401071e5717bd72abe3e1ae8f Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sun, 4 Oct 2015 13:34:55 +0200 Subject: [PATCH 33/34] Optioncss --- htdocs/fourn/list.php | 1 + htdocs/fourn/product/list.php | 1 + htdocs/product/list.php | 1 + htdocs/projet/list.php | 1 + htdocs/societe/list.php | 1 + htdocs/user/index.php | 1 + 6 files changed, 6 insertions(+) diff --git a/htdocs/fourn/list.php b/htdocs/fourn/list.php index 31201acd987..14bd6298ea8 100644 --- a/htdocs/fourn/list.php +++ b/htdocs/fourn/list.php @@ -188,6 +188,7 @@ if ($resql) print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies'); print ''."\n"; + if ($optioncss != '') print ''; // Filter on categories $moreforfilter=''; diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index a97d3106c3b..fb3ae6cea63 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -165,6 +165,7 @@ if ($resql) } print ''; + if ($optioncss != '') print ''; print ''; if ($fourn_id > 0) print ''; print ''; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 664548e4855..68e6143c48c 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -274,6 +274,7 @@ else else { print ''; + if ($optioncss != '') print ''; print ''; print ''; print ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index d77a190dae2..f46c6562ae7 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -232,6 +232,7 @@ if ($resql) print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num,'','title_project'); print ''; + if ($optioncss != '') print ''; // Show description of content if ($mine) print $langs->trans("MyProjectsDesc").'

'; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 5980a0a5c1d..06a29082f50 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -306,6 +306,7 @@ if ($resql) } print ''; + if ($optioncss != '') print ''; print ''; // Filter on categories diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 7ade9f8ba4d..921697ade51 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -122,6 +122,7 @@ if ($result) $i = 0; print ''."\n"; + if ($optioncss != '') print ''; $param="search_user=".$search_user."&sall=".$sall; $param.="&search_statut=".$search_statut; From 7f86797f7376a9fb3097091aef481db2b9b9c731 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sun, 4 Oct 2015 17:25:46 +0200 Subject: [PATCH 34/34] Add contact photo --- htdocs/contact/card.php | 112 ++++++++++++++++-- htdocs/contact/class/contact.class.php | 13 +- htdocs/core/class/html.form.class.php | 5 + htdocs/core/lib/files.lib.php | 10 ++ .../install/mysql/migration/3.8.0-3.9.0.sql | 3 +- htdocs/install/mysql/tables/llx_socpeople.sql | 1 + 6 files changed, 129 insertions(+), 15 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 4174ad16a06..2db5523c5bd 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -277,12 +278,72 @@ if (empty($reshook)) $action = 'edit'; } + if (! $error) { $contactid=GETPOST("contactid",'int'); $object->fetch($contactid); + // Photo save + $dir = $conf->societe->dir_output."/contact/".$object->id."/photos"; + $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); + if ($file_OK) + { + if (GETPOST('deletephoto')) + { + $fileimg=$dir.'/'.$object->photo; + $dirthumbs=$dir.'/thumbs'; + dol_delete_file($fileimg); + dol_delete_dir_recursive($dirthumbs); + $object->photo = ''; + } + + if (image_format_supported($_FILES['photo']['name']) > 0) + { + dol_mkdir($dir); + + if (@is_dir($dir)) + { + $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); + + if (! $result > 0) + { + $errors[] = "ErrorFailedToSaveFile"; + } + else + { + $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); + // Create small thumbs for company (Ratio is near 16/9) + // Used on logon for example + $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality); + + // Create mini thumbs for company (Ratio is near 16/9) + // Used on menu or for setup page for example + $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality); + } + } + } + else + { + $errors[] = "ErrorBadImageFormat"; + } + } + else + { + switch($_FILES['photo']['error']) + { + case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini + case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form + $errors[] = "ErrorFileSizeTooLarge"; + break; + case 3: //uploaded file was only partially uploaded + $errors[] = "ErrorFilePartiallyUploaded"; + break; + } + } + $object->oldcopy = clone$object; $object->old_lastname = GETPOST("old_lastname"); @@ -699,7 +760,7 @@ else print ''."\n"; } - print ''; + print ''; print ''; print ''; print ''; @@ -906,6 +967,23 @@ else else print $langs->trans("NoDolibarrAccess"); print '
'; + // Photo + print ''; + print ''; + print ''; + print ''; + print '
'.fieldLabel('Photo','photoinput').''; + if ($object->photo) { + print $form->showphoto('contact',$object); + print "
\n"; + } + print ''; + if ($object->photo) print ''; + //print ''; + print ''; + print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; + + print '
'; print dol_fiche_end(); @@ -973,12 +1051,12 @@ else // Name print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$object->lastname.''.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("ThirdParty").''; + print '
'.$langs->trans("ThirdParty").''; if ($object->socid > 0) { $objsoc->fetch($object->socid); @@ -988,30 +1066,44 @@ else { print $langs->trans("ContactNotLinkedToCompany"); } - print '
'; + print $form->showphoto('contact',$object); + print ''; + print ' '; + print '
'.$langs->trans("UserTitle").''; + print '
'.$langs->trans("UserTitle").''; print $object->getCivilityLabel(); print '
'.$langs->trans("PostOrFunction").''.$object->poste.'
'.$langs->trans("PostOrFunction").''.$object->poste.'
'.$langs->trans("Address").''; + print '
'.$langs->trans("Address").''; dol_print_address($object->address,'gmap','contact',$object->id); print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; + print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; print $object->zip; if ($object->zip) print ' '; print $object->town.'
'.$langs->trans("Country").''; + print '
'.$langs->trans("Country").''; $img=picto_from_langcode($object->country_code); if ($img) print $img.' '; print $object->country; @@ -1020,7 +1112,7 @@ else // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - print '
'.$langs->trans('State').''.$object->state.'
'.$langs->trans('State').''.$object->state.'