From 76b1f0ca86a72faaf72eb5195ef3e571658caa84 Mon Sep 17 00:00:00 2001 From: abb Date: Sat, 28 Nov 2015 22:16:45 +0100 Subject: [PATCH 001/120] modifs to fichinter/card.php FICHINTER_EMPTY_LINE_DESC --- htdocs/fichinter/card.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 3cb613934b9..d0535d81c50 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -6,6 +6,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Ferran Marcet * Copyright (C) 201 Charlie Benke + * Copyright (C) 2015 Abbes Bahfir * * 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 @@ -465,7 +466,7 @@ if (empty($reshook)) // Add line else if ($action == "addline" && $user->rights->ficheinter->creer) { - if (!GETPOST('np_desc')) + if (!GETPOST('np_desc')&&($conf->global->FICHINTER_EMPTY_LINE_DESC!=1)) { $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Description")).'
'; $error++; @@ -1568,10 +1569,12 @@ else if ($id > 0 || ! empty($ref)) print '\n"; print ''; // editeur wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('np_desc',GETPOST('np_desc','alpha'),'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,ROWS_2,70); - $doleditor->Create(); - print ''; + if ($conf->global->FICHINTER_EMPTY_LINE_DESC != 1) { + require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; + $doleditor = new DolEditor('np_desc', GETPOST('np_desc', 'alpha'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, ROWS_2, 70); + $doleditor->Create(); + } + print ''; // Date intervention print ''; From 05258172aac57f3db17cec11a4ca0c1c5f548858 Mon Sep 17 00:00:00 2001 From: abb Date: Wed, 2 Dec 2015 19:08:14 +0100 Subject: [PATCH 002/120] update product.lang --- htdocs/langs/en_US/products.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index b21fd88539e..f4cd0824d70 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -297,3 +297,4 @@ PropalMergePdfProductChooseFile=Select PDF files IncludingProductWithTag=Including product with tag DefaultPriceRealPriceMayDependOnCustomer=Default price, real price may depend on customer WarningSelectOneDocument=Please select at least one document +DefaultUnitToShow=Units \ No newline at end of file From 613209eadb9aa9bdd876c5207568d26a5595e420 Mon Sep 17 00:00:00 2001 From: abb Date: Fri, 11 Dec 2015 12:14:46 +0100 Subject: [PATCH 003/120] confs sur filefunc --- htdocs/filefunc.inc.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 415a7addf4a..e4fbb602156 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -80,6 +80,12 @@ if (! empty($_GET['conf'])) $conffile = 'conf/'.$confname.'.php'; } */ +if (!empty($_GET['conf'])) { + setcookie('dolconf', $_GET['conf']); + $conffile = 'conf/' . $_GET['conf'] . '.php'; +} else { + $conffile = 'conf/' . (!empty($_COOKIE['dolconf']) ? $_COOKIE['dolconf'] : 'conf') . '.php'; +} // Include configuration $result=@include_once $conffile; // Keep @ because with some error reporting this break the redirect From 1bde35f98e0ad8c2316085014a96b487a56b0985 Mon Sep 17 00:00:00 2001 From: abb Date: Sun, 13 Dec 2015 12:10:43 +0100 Subject: [PATCH 004/120] add change customer function in customer orders --- htdocs/commande/card.php | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 8748b283abe..2b9163886f4 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1149,7 +1149,16 @@ if (empty($reshook)) $action = 'edit_extras'; } - include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + if ($action == 'set_thirdparty' && $user->rights->commande->creer) + { + $object->fetch($id); + $object->setValueFrom('fk_soc', $socid); + + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); + exit(); + } + + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; /* @@ -1812,8 +1821,19 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; // Third party - print '' . $langs->trans('Company') . ''; - print '' . $soc->getNomUrl(1) . ''; + print ''; + print ''; + print ''; + print ''; + print '
' . $langs->trans('Company') . ''; + if (! empty($conf->global->COMMANDE_CHANGE_THIRDPARTY) && $action != 'editthirdparty' && $object->brouillon && $user->rights->commande->creer) + print 'id . '">' . img_edit($langs->trans('SetLinkToThirdParty'), 1) . '
'; + print ''; + if ($action == 'editthirdparty') { + $form->form_thirdparty($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, 'socid','client>0'); + } else { + print '  ' . $soc->getNomUrl(1, 'compta'); + } print ''; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { From 1baf25de3c279f3b2663238d7aecd0fc355cab07 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 27 Jan 2016 12:04:00 +0100 Subject: [PATCH 005/120] FIX ISSUE #4506 : make working the PROPAL_CLONE_ON_CREATE_PAGE hidden constant --- htdocs/comm/propal.php | 3 ++- htdocs/comm/propal/class/propal.class.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 08106bc2151..a637e4a87fa 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -293,7 +293,8 @@ if (empty($reshook)) $object->note = GETPOST('note'); $object->statut = 0; - $id = $object->create_from($user); + // the create is done below and further more the existing create_from function is quite hilarating + //$id = $object->create_from($user); } else { setEventMessage($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_propal')), 'errors'); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 372ac5d5a61..c7e4724d027 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -946,6 +946,7 @@ class Propal extends CommonObject */ function create_from($user) { + // i love this function because $this->products is not used in create function... $this->products=$this->lines; return $this->create($user); From 32b6f207549b7e221abb5c465b2955602017be97 Mon Sep 17 00:00:00 2001 From: Bahfir Abbes Date: Sat, 30 Jan 2016 17:13:58 +0100 Subject: [PATCH 006/120] Update smtps.class.php Set mail reply-to field to sender --- htdocs/core/class/smtps.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index dd2726d2306..8b8e9e4905c 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1159,7 +1159,7 @@ class SMTPs $_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n"; if ( $this->getErrorsTo() ) $_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n"; - + $_header .= "Reply-To: ".$this->getFrom('addr') ."\r\n"; $_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n" . 'Mime-Version: 1.0' . "\r\n"; From 2f40233e014574b7a35aafb05ceb7ed8aa2ca441 Mon Sep 17 00:00:00 2001 From: abb Date: Sun, 31 Jan 2016 10:10:30 +0100 Subject: [PATCH 007/120] fix : handle case of non existing third party field in object in fecth_thirdparty function --- htdocs/core/class/commonobject.class.php | 34 +++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 005f4684322..f0b0568d2f7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1001,26 +1001,30 @@ abstract class CommonObject { global $conf; - if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty) && empty($force_thirdparty_id)) return 0; + if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty) && empty($force_thirdparty_id)) + return 0; - require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; - $idtofetch=isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty); - if ($force_thirdparty_id) $idtofetch=$force_thirdparty_id; + $idtofetch = isset($this->socid) ? $this->socid : (isset($this->fk_soc) ? $this->fk_soc : $this->fk_thirdparty); + if ($force_thirdparty_id) + $idtofetch = $force_thirdparty_id; - $thirdparty = new Societe($this->db); - $result=$thirdparty->fetch($idtofetch); - $this->client = $thirdparty; // deprecated - $this->thirdparty = $thirdparty; + if ($idtofetch) { + $thirdparty = new Societe($this->db); + $result = $thirdparty->fetch($idtofetch); + $this->client = $thirdparty; // deprecated + $this->thirdparty = $thirdparty; - // Use first price level if level not defined for third party - if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($this->thirdparty->price_level)) - { - $this->client->price_level=1; // deprecated - $this->thirdparty->price_level=1; - } + // Use first price level if level not defined for third party + if (!empty($conf->global->PRODUIT_MULTIPRICES) && empty($this->thirdparty->price_level)) { + $this->client->price_level = 1; // deprecated + $this->thirdparty->price_level = 1; + } - return $result; + return $result; + } else + return -1; } From e22664b8cfce36e9d173e57448190ce5f734d33e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Feb 2016 01:00:10 +0100 Subject: [PATCH 008/120] FIX #4528 --- htdocs/core/lib/admin.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index e7630756127..12470310ae4 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -587,9 +587,11 @@ function listOfSessions() if(! @is_dir($fullpath) && is_readable($fullpath)) { $sessValues = file_get_contents($fullpath); // get raw session data - + // Example of possible value + //$sessValues = 'newtoken|s:32:"1239f7a0c4b899200fe9ca5ea394f307";dol_loginmesg|s:0:"";newtoken|s:32:"1236457104f7ae0f328c2928973f3cb5";dol_loginmesg|s:0:"";token|s:32:"123615ad8d650c5cc4199b9a1a76783f";dol_login|s:5:"admin";dol_authmode|s:8:"dolibarr";dol_tz|s:1:"1";dol_tz_string|s:13:"Europe/Berlin";dol_dst|i:0;dol_dst_observed|s:1:"1";dol_dst_first|s:0:"";dol_dst_second|s:0:"";dol_screenwidth|s:4:"1920";dol_screenheight|s:3:"971";dol_company|s:12:"MyBigCompany";dol_entity|i:1;mainmenu|s:4:"home";leftmenuopened|s:10:"admintools";idmenu|s:0:"";leftmenu|s:10:"admintools";'; + if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session - preg_match('/dol_entity\|s:([0-9]+):"('.$conf->entity.')"/i',$sessValues) && // limit to current entity + (preg_match('/dol_entity\|i:'.$conf->entity.';/i',$sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i',$sessValues)) && // limit to current entity preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name { $tmp=explode('_', $file); From 6260c1ae9e259f25d14cfc109ad4e6eed3184e37 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Wed, 3 Feb 2016 11:33:13 +0100 Subject: [PATCH 009/120] FIX: Check stock of batch on shippment --- htdocs/expedition/card.php | 3 ++- htdocs/expedition/class/expedition.class.php | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3bf17f76a4f..c7d91a28ce5 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -8,6 +8,7 @@ * Copyright (C) 2013 Marcos García * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2014 Francis Appels + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -237,7 +238,7 @@ if (empty($reshook)) $ret=$object->addline_batch($batch_line[$i]); if ($ret < 0) { - $mesg='
'.$object->error.'
'; + $mesg='
'.$object->errorsToString().'
'; $error++; } } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index cb77607261b..7dcf66d28ec 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2014-2015 Francis Appels + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -857,6 +858,7 @@ class Expedition extends CommonObject */ function addline_batch($dbatch) { + global $conf,$langs; $num = count($this->lines); if ($dbatch['qty']>0) { @@ -882,7 +884,17 @@ class Expedition extends CommonObject if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) { - // TODO + require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; + $prod_batch = new Productbatch($this->db); + $prod_batch->fetch($value['id_batch']); + + if ($prod_batch->qty < $linebatch->dluo_qty) + { + $this->errors[] = $langs->trans('ErrorStockIsNotEnough'); + dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR); + $this->db->rollback(); + return -1; + } } //var_dump($linebatch); @@ -895,6 +907,7 @@ class Expedition extends CommonObject //var_dump($line); $this->lines[$num] = $line; + return 1; } } From 5f7cb75518168d679657b110eec382c26f529b54 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 3 Feb 2016 19:52:09 +0100 Subject: [PATCH 010/120] Fix #4556 desiredstock and seuil_stock_alerte cleared on modify product card removed inputs from update form also removed from update action --- htdocs/product/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index dbadd69cdcb..e6b48974d0b 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -321,8 +321,11 @@ if (empty($reshook)) $object->status = GETPOST('statut'); $object->status_buy = GETPOST('statut_buy'); $object->status_batch = GETPOST('status_batch'); + // removed from update view + /* $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte'); $object->desiredstock = GETPOST('desiredstock'); + */ $object->duration_value = GETPOST('duration_value'); $object->duration_unit = GETPOST('duration_unit'); $object->canvas = GETPOST('canvas'); From a65660712267f780dc47d812fe5e3e4679263c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 4 Feb 2016 17:12:58 +0100 Subject: [PATCH 011/120] Update CMailFile.class.php --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index b3da46ff366..9f6f0995ded 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -375,7 +375,7 @@ class CMailFile if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { - dol_include_once('/core/class/hookmanager.class.php'); + require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array( 'maildao' From 69e0f1ebc3405af903067c49a32582ec7b741265 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Feb 2016 17:55:30 +0100 Subject: [PATCH 012/120] Add log to help debug --- htdocs/main.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 25176c6bc93..39fd1a8eb1a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1501,7 +1501,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a /** * Show left menu bar * - * @param array $menu_array_before Table of menu entries to show before entries of menu handler + * @param array $menu_array_before Table of menu entries to show before entries of menu handler. This param is deprectaed and must be provided to ''. * @param string $helppagename Name of wiki page for help ('' by default). * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage * For other external page: http://server/url @@ -1519,6 +1519,8 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me $searchform=''; $bookmarks=''; + if (! empty($menu_array_before)) dol_syslog("Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING); + if (empty($conf->dol_hide_leftmenu)) { // Instantiate hooks of thirdparty module From 70e051a1bf01c953e6e474f85719376e5a8aee1b Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 4 Feb 2016 18:05:35 +0100 Subject: [PATCH 013/120] Add goods customers boxes --- htdocs/core/boxes/box_bonsclients.php | 168 ++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 htdocs/core/boxes/box_bonsclients.php diff --git a/htdocs/core/boxes/box_bonsclients.php b/htdocs/core/boxes/box_bonsclients.php new file mode 100644 index 00000000000..0f650e6775c --- /dev/null +++ b/htdocs/core/boxes/box_bonsclients.php @@ -0,0 +1,168 @@ + + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic France + * Copyright (C) 2016 Charlie Benke + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/boxes/box_clients.php + * \ingroup societes + * \brief Module de generation de l'affichage de la box clients + */ + +include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; + + +/** + * Class to manage the box to show last thirdparties + */ +class box_bonsclients extends ModeleBoxes +{ + var $boxcode="goodcustomers"; + var $boximg="object_company"; + var $boxlabel="BoxGoodCustomers"; + var $depends = array("societe"); + + var $db; + var $enabled = 1; + + var $info_box_head = array(); + var $info_box_contents = array(); + + + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + function __construct($db,$param='') + { + global $conf, $user; + + $this->db = $db; + + // disable box for such cases + if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option + } + + /** + * Load data for box to show them later + * + * @param int $max Maximum number of records to load + * @return void + */ + function loadBox($max=5) + { + global $user, $langs, $db, $conf; + $langs->load("boxes"); + + $this->max=$max; + + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + $thirdpartystatic=new Societe($db); + + $this->info_box_head = array('text' => $langs->trans("BoxTitleGoodCustomers",$max)); + + if ($user->rights->societe->lire) + { + + $sql = "SELECT s.rowid, s.nom as name, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms as datem, s.status as status,"; + $sql.= " count(*) as nbfact, sum(if (f.paye=1,1,0)) as nbfactpaye"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; + $sql.= ' WHERE s.entity IN ('.getEntity('societe', 1).')'; + $sql.= ' AND s.rowid = f.fk_soc'; + $sql.= " GROUP BY s.rowid, s.nom, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms, s.status"; + $sql.= $db->order("nbfact","DESC"); + $sql.= $db->plimit($max,0); + + dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + + $line = 0; + while ($line < $num) + { + $objp = $db->fetch_object($result); + $datem=$db->jdate($objp->tms); + $thirdpartystatic->id = $objp->rowid; + $thirdpartystatic->name = $objp->name; + $thirdpartystatic->code_client = $objp->code_client; + $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->client = $objp->client; + $thirdpartystatic->fournisseur = $objp->fournisseur; + $thirdpartystatic->logo = $objp->logo; + $nbfact = $objp->nbfact; + $nbimpaye = $objp->nbfact - $objp->nbfactpaye; + + $this->info_box_contents[$line][] = array( + 'td' => 'align="left"', + 'text' => $thirdpartystatic->getNomUrl(1), + 'asis' => 1, + ); + + $this->info_box_contents[$line][] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datem, "day") + ); + + $this->info_box_contents[$line][] = array( + 'td' => 'align="right"', + 'text' => $nbfact.( $nbimpaye != 0 ? ' ('.$nbimpaye.')':'') + ); + + $this->info_box_contents[$line][] = array( + 'td' => 'align="right" width="18"', + 'text' => $thirdpartystatic->LibStatut($objp->status,3) + ); + + $line++; + } + + if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers")); + + $db->free($result); + } + else { + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); + } + } + else { + $this->info_box_contents[0][0] = array('align' => 'left', + 'text' => $langs->trans("ReadPermissionNotAllowed")); + } + + } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @return void + */ + function showBox($head = null, $contents = null) + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } +} + From 5498b1cd5a9362b61e0950c5006db874af235d5b Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 4 Feb 2016 18:06:43 +0100 Subject: [PATCH 014/120] Update modSociete.class.php --- htdocs/core/modules/modSociete.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 41fd00e5463..b8032cca13e 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -131,7 +131,9 @@ class modSociete extends DolibarrModules $this->boxes[$r][1] = "box_activity.php"; $this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)'; $r++; - + $this->boxes[$r][1] = "box_bonsclients.php"; + $this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)'; + $r++; // Permissions $this->rights = array(); $this->rights_class = 'societe'; From 9c896b18699834f331dbccb1bf404b042e8e41b1 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 4 Feb 2016 18:10:28 +0100 Subject: [PATCH 015/120] translations too --- htdocs/langs/en_US/boxes.lang | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 796c058e3b5..6afc6d7b7b2 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -60,6 +60,8 @@ BoxTitleLastContracts=Last %s contracts BoxTitleLastModifiedDonations=Last %s modified donations BoxTitleLastModifiedExpenses=Last %s modified expense reports BoxGlobalActivity=Global activity (invoices, proposals, orders) +BoxGoodCustomers=Good Customers +BoxTitleGoodCustomers= %s Good Customers FailedToRefreshDataInfoNotUpToDate=Failed to refresh RSS flux. Last successfull refresh date: %s LastRefreshDate=Last refresh date NoRecordedBookmarks=No bookmarks defined. @@ -95,4 +97,4 @@ ForCustomersInvoices=Customers invoices ForCustomersOrders=Customers orders ForProposals=Proposals LastXMonthRolling=The last %s month rolling -ChooseBoxToAdd=Add a box to your dashboard... \ No newline at end of file +ChooseBoxToAdd=Add a box to your dashboard... From a8e480e392fd8b26300d1568aab5a3f4af5478ff Mon Sep 17 00:00:00 2001 From: phf Date: Thu, 4 Feb 2016 23:15:06 +0100 Subject: [PATCH 016/120] FIX #3509 payment ref for suppliers --- htdocs/admin/supplier_payment.php | 220 ++++++++++++++++++ htdocs/core/lib/fourn.lib.php | 5 + .../mod_supplier_payment_brodator.php | 140 +++++++++++ .../mod_supplier_payment_bronan.php | 150 ++++++++++++ .../modules_supplier_payment.php | 101 ++++++++ htdocs/fourn/class/paiementfourn.class.php | 120 +++++++++- .../install/mysql/migration/3.8.0-3.9.0.sql | 3 + .../mysql/tables/llx_paiementfourn.sql | 2 + 8 files changed, 737 insertions(+), 4 deletions(-) create mode 100644 htdocs/admin/supplier_payment.php create mode 100644 htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php create mode 100644 htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php create mode 100644 htdocs/core/modules/supplier_payment/modules_supplier_payment.php diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php new file mode 100644 index 00000000000..41737f7a9d5 --- /dev/null +++ b/htdocs/admin/supplier_payment.php @@ -0,0 +1,220 @@ + + * + * 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/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.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'); + + +/* + * Actions + */ + +if ($action == 'updateMask') +{ + $maskconstsupplierpayment=GETPOST('maskconstsupplierpayment','alpha'); + $masksupplierpayment=GETPOST('masksupplierpayment','alpha'); + if ($maskconstsupplierpayment) $res = dolibarr_set_const($db,$maskconstsupplierpayment,$masksupplierpayment,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + + if ($action == 'setmod') +{ + dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON",$value,'chaine',0,'',$conf->entity); +} + +/* + * View + */ + +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + +llxHeader("",$langs->trans("SupplierPaymentSetup"),'EN:Supplier_Payment_Configuration|FR:Configuration_module_paiement_fournisseur'); + +$form=new Form($db); + + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("SupplierPaymentSetup"),$linkback,'title_setup'); + +print "
"; + +$head = supplierorder_admin_prepare_head(); +dol_fiche_head($head, 'supplierpayment', $langs->trans("SupplierPayment"), 0, 'invoice'); + +/* + * Numbering module + */ + +print load_fiche_titre($langs->trans("SupplierPaymentsNumberingModule")); + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''."\n"; + +clearstatcache(); + +foreach ($dirmodels as $reldir) +{ + $dir = dol_buildpath($reldir."core/modules/supplier_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_supplier_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') + { + // Charging the numbering class + 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 PaiementFourn($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_supplier_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->SUPPLIER_PAYMENT_ADDON." - ".$file; + if ($conf->global->SUPPLIER_PAYMENT_ADDON == $file || $conf->global->SUPPLIER_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/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index fdeece84d52..19d6429cc6e 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -178,6 +178,11 @@ function supplierorder_admin_prepare_head() $head[$h][1] = $langs->trans("SuppliersInvoice"); $head[$h][2] = 'invoice'; $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/supplier_payment.php"; + $head[$h][1] = $langs->trans("SuppliersPayment"); + $head[$h][2] = 'supplierpayment'; + $h++; complete_head_from_modules($conf,$langs,null,$head,$h,'supplierorder_admin'); diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php new file mode 100644 index 00000000000..fb06c028aed --- /dev/null +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.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/supplier_payment/mod_supplier_payment_brodator.php + * \ingroup supplier_payment + * \brief File containing class for numbering module Brodator + */ + +require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_payment/modules_supplier_payment.php'; + + +/** + * Class to manage customer payment numbering rules Ant + */ +class mod_supplier_payment_brodator extends ModeleNumRefPayments +{ + var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' + var $error = ''; + var $nom = 'Brodator'; + + + /** + * 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->SUPPLIER_PAYMENT_BRODATOR_MASK; + + if (! $mask) + { + $this->error='NotConfigured'; + return 0; + } + + $numFinal=get_next_value($db,$mask,'paiementfourn','ref','',$objsoc,$object->datepaye); + + 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/supplier_payment/mod_supplier_payment_bronan.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php new file mode 100644 index 00000000000..e7146e2e1fd --- /dev/null +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.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_bronan.php + * \ingroup supplier_payment + * \brief File containing class for numbering module Bronan + */ + +require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_payment/modules_supplier_payment.php'; + +/** + * Class to manage customer payment numbering rules Cicada + */ +class mod_supplier_payment_bronan extends ModeleNumRefPayments +{ + var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' + var $prefix='SPAY'; + var $error=''; + var $nom='Bronan'; + + + /** + * 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=9; + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; + $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn"; + $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=10; + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; + $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn"; + $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->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 + 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 payment_get_num($objsoc,$objforref) + { + return $this->getNextValue($objsoc,$objforref); + } + +} diff --git a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php new file mode 100644 index 00000000000..c9023a9fc65 --- /dev/null +++ b/htdocs/core/modules/supplier_payment/modules_supplier_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/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index bfdfea41fe4..bb84f8ca917 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -74,7 +74,7 @@ class PaiementFourn extends Paiement { $error=0; - $sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,'; + $sql = 'SELECT p.rowid, p.ref, p.entity, p.datep as dp, p.amount, p.statut, p.fk_bank,'; $sql.= ' c.code as paiement_code, c.libelle as paiement_type,'; $sql.= ' p.num_paiement, p.note, b.fk_account'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiementfourn as p'; @@ -95,7 +95,8 @@ class PaiementFourn extends Paiement { $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; - $this->ref = $obj->rowid; + $this->ref = $obj->ref; + $this->entity = $obj->entity; $this->date = $this->db->jdate($obj->dp); $this->numero = $obj->num_paiement; $this->bank_account = $obj->fk_account; @@ -149,11 +150,12 @@ class PaiementFourn extends Paiement if ($this->total <> 0) // On accepte les montants negatifs { + $ref = $this->getNextNumRef(''); $now=dol_now(); $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn ('; - $sql.= 'datec, datep, amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)'; - $sql.= " VALUES ('".$this->db->idate($now)."',"; + $sql.= 'ref, entity, datec, datep, amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)'; + $sql.= " VALUES ('".$this->db->escape($ref)."', ".$conf->entity.", '".$this->db->idate($now)."',"; $sql.= " '".$this->db->idate($this->datepaye)."', '".$this->total."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.", 0)"; dol_syslog("PaiementFourn::create", LOG_DEBUG); @@ -513,4 +515,114 @@ class PaiementFourn extends Paiement if ($withpicto != 2) $result.=$link.$text.$linkend; return $result; } + + /** + * 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 next reference of supplier invoice not already used (or last reference) + * according to numbering module defined into constant SUPPLIER_PAYMENT_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->SUPPLIER_PAYMENT_ADDON)) $conf->global->SUPPLIER_PAYMENT_ADDON='mod_supplier_payment_bronan'; + else if ($conf->global->SUPPLIER_PAYMENT_ADDON=='brodator') $conf->global->SUPPLIER_PAYMENT_ADDON='mod_supplier_payment_brodator'; + else if ($conf->global->SUPPLIER_PAYMENT_ADDON=='bronan') $conf->global->SUPPLIER_PAYMENT_ADDON='mod_supplier_payment_bronan'; + + if (! empty($conf->global->SUPPLIER_PAYMENT_ADDON)) + { + $mybool=false; + + $file = $conf->global->SUPPLIER_PAYMENT_ADDON.".php"; + $classname = $conf->global->SUPPLIER_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/supplier_payment/"); + + // 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->SUPPLIER_PAYMENT_ADDON.".php"; + $classname = "mod_supplier_payment_".$conf->global->SUPPLIER_PAYMENT_ADDON; + $classname = preg_replace('/\-.*$/','',$classname); + // Include file with class + foreach ($conf->file->dol_document_root as $dirroot) + { + $dir = $dirroot."/core/modules/supplier_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); + + /** + * $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,"SupplierPayment::getNextNumRef ".$obj->error); + return ""; + } + + return $numref; + } + else + { + $langs->load("errors"); + print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete"); + return ""; + } + } } 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 7c372a5c394..24fd141a217 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 @@ -583,3 +583,6 @@ ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN doc_ref varchar(300) NOT NU ALTER TABLE llx_holiday ADD COLUMN tms timestamp; ALTER TABLE llx_holiday ADD COLUMN entity integer DEFAULT 1 NOT NULL; + +ALTER TABLE llx_paiementfourn ADD COLUMN ref varchar(30) AFTER rowid; +ALTER TABLE llx_paiementfourn ADD COLUMN entity integer AFTER ref; diff --git a/htdocs/install/mysql/tables/llx_paiementfourn.sql b/htdocs/install/mysql/tables/llx_paiementfourn.sql index 701899d5a2f..cbcc93d9b0f 100644 --- a/htdocs/install/mysql/tables/llx_paiementfourn.sql +++ b/htdocs/install/mysql/tables/llx_paiementfourn.sql @@ -20,6 +20,8 @@ create table llx_paiementfourn ( rowid integer AUTO_INCREMENT PRIMARY KEY, + ref varchar(30), + entity integer DEFAULT 1, tms timestamp, datec datetime, -- date de creation de l'enregistrement datep datetime, -- date de paiement From 0ae8a3398d5b0158ae97a80ba7e1e84e65fa5f9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Feb 2016 10:56:45 +0100 Subject: [PATCH 017/120] Fix sql error when extrafields on contact --- htdocs/contact/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index c916710e087..b319072dc68 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -218,7 +218,7 @@ $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p"; -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contact_extrafields as ef on (p.rowid = ef.fk_object)"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (p.rowid = ef.fk_object)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cs ON p.rowid = cs.fk_socpeople"; // We need this table joined to the select in order to filter by categ From 713050bd57e618f71debed9a81a0d70fe9665274 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Feb 2016 12:46:41 +0100 Subject: [PATCH 018/120] Fix style on payment page --- htdocs/fourn/facture/paiement.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index c4b2e4c01f6..253b55b4659 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -283,10 +283,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; + dol_fiche_head(''); + print ''; - print ''; - print ''; } print '
'.$langs->trans('Payment').'
'.$langs->trans('Company').''; + print '
'.$langs->trans('Company').''; $supplierstatic->id=$obj->socid; $supplierstatic->name=$obj->name; print $supplierstatic->getNomUrl(1,'supplier'); @@ -312,7 +313,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print '
 
'; - + dol_fiche_end(); $parameters=array('facid'=>$facid, 'ref'=>$ref, 'objcanvas'=>$objcanvas); $reshook=$hookmanager->executeHooks('paymentsupplierinvoices',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -339,7 +340,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { $i = 0; print '
'; - print $langs->trans('Invoices').'
'; if(!empty($conf->global->FAC_AUTO_FILLJS)){ //Add js for AutoFill @@ -351,15 +351,15 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ' });'."\n"; print ' '."\n"; } - print ''; + print '
'; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; $var=True; @@ -425,7 +425,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($action != 'add_paiement') { print '
'.$langs->trans("ClosePaidInvoicesAutomatically"); - print '
'; + print '
'; } // Form to confirm payment From ede4453164c2432d1145626a8c5a4cf9335d07e2 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Fri, 5 Feb 2016 12:59:32 +0100 Subject: [PATCH 019/120] Fix: Avoid errors when batch stock is negative --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c7d91a28ce5..ea82a63732a 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -882,7 +882,7 @@ if ($action == 'create') if ($defaultqty<=0) { $defaultqty=0; } else { - $defaultqty -= min($defaultqty,$substock); + $defaultqty -= ($substock > 0 ? min($defaultqty,$substock) : 0); } $subj++; } From 36c7697b63ef561f261853327fd0ef98aa49562f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 5 Feb 2016 13:43:06 +0100 Subject: [PATCH 020/120] FIX: retrieve correct pu_ttc (set by printObjectLine function) like in 3.7 --- htdocs/core/tpl/objectline_edit.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index d61831cfec2..7d570531213 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -124,7 +124,7 @@ $coldisplay=-1; // We remove first td if ($inputalsopricewithtax) { $coldisplay++; - print ''; } From f0aef885893cd217904eddb63c7a907e76abed4b Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 5 Feb 2016 13:49:19 +0100 Subject: [PATCH 021/120] better fix --- htdocs/core/class/commonobject.class.php | 4 +++- htdocs/core/tpl/objectline_edit.tpl.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1cf042e9d13..a78a1cfea49 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3051,6 +3051,8 @@ abstract class CommonObject $text.= ' - '.(! empty($line->label)?$line->label:$label); $description.=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc. } + + $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU'); // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer @@ -3074,7 +3076,7 @@ abstract class CommonObject if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("Label").'"'; else $placeholder=' title="'.$langs->trans("Label").'"'; - $pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU'); + $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU'); // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 7d570531213..d61831cfec2 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -124,7 +124,7 @@ $coldisplay=-1; // We remove first td if ($inputalsopricewithtax) { $coldisplay++; - print ''; } From bf7181a0640df531b033c507e501bb206392733f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Feb 2016 18:37:01 +0100 Subject: [PATCH 022/120] All messages separated with , into errorsToString --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c281d9bebbd..019be7fcc09 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -381,7 +381,7 @@ abstract class CommonObject */ function errorsToString() { - return $this->error.(is_array($this->errors)?(($this->error!=''?' ':'').join(',',$this->errors)):''); + return $this->error.(is_array($this->errors)?(($this->error!=''?', ':'').join(', ',$this->errors)):''); } /** From 7a6c7f10a6c14bcd93003a0e7ee29277d9d65535 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 5 Feb 2016 19:14:40 +0100 Subject: [PATCH 023/120] FIX: add missing global def for ttc column --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 99e497046e0..704bc097db7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2540,7 +2540,7 @@ abstract class CommonObject */ function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0) { - global $conf,$langs,$user,$object,$hookmanager; + global $conf,$langs,$user,$object,$hookmanager,$inputalsopricewithtax; print ''; From fd7a05490d429ac032574f4e1d64b00b55528908 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Feb 2016 20:06:07 +0100 Subject: [PATCH 024/120] DiscountOffered text was too long --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- .../core/modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- htdocs/langs/en_US/bills.lang | 1 + htdocs/langs/fr_FR/bills.lang | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 7a4621cc396..796e225b268 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1253,7 +1253,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFillColor(255,255,255); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOffered"), $useborder, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 8266efe74a5..22bfcb6e6d8 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1184,7 +1184,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetFillColor(255,255,255); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOffered"), $useborder, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle, 0, $outputlangs), $useborder, 'R', 1); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 4a14998d0c4..cc7123bba7e 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -1051,7 +1051,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetFillColor(255,255,255); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOffered"), $useborder, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle, 0, $outputlangs), $useborder, 'R', 1); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 20f6fe0619c..392050c6cd5 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -196,6 +196,7 @@ Rest=Pending AmountExpected=Amount claimed ExcessReceived=Excess received EscompteOffered=Discount offered (payment before term) +EscompteOfferedShort=Discount SendBillRef=Submission of invoice %s SendReminderBillRef=Submission of invoice %s (reminder) StandingOrders=Standing orders diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 86019a751ab..ccd0160bf09 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -199,6 +199,7 @@ Rest=Créance AmountExpected=Montant réclamé ExcessReceived=Trop perçu EscompteOffered=Escompte (règlement avant échéance) +EscompteOfferedShort=Escompte SendBillRef=Envoi de la facture %s SendReminderBillRef=Relance de la facture %s (rappel) StandingOrders=Prélèvements From eb48e84b34217167d18d84534d2c3d353b148d17 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 5 Feb 2016 23:37:04 +0100 Subject: [PATCH 025/120] name of boxe file changed --- .../core/boxes/{box_bonsclients.php => box_goodcustomers.php} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename htdocs/core/boxes/{box_bonsclients.php => box_goodcustomers.php} (99%) diff --git a/htdocs/core/boxes/box_bonsclients.php b/htdocs/core/boxes/box_goodcustomers.php similarity index 99% rename from htdocs/core/boxes/box_bonsclients.php rename to htdocs/core/boxes/box_goodcustomers.php index 0f650e6775c..734d1885824 100644 --- a/htdocs/core/boxes/box_bonsclients.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -31,7 +31,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; /** * Class to manage the box to show last thirdparties */ -class box_bonsclients extends ModeleBoxes +class box_goodcustomers extends ModeleBoxes { var $boxcode="goodcustomers"; var $boximg="object_company"; From e2afe5460e1fb6210b7ae6bad8a566da88d00aa1 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 5 Feb 2016 23:37:31 +0100 Subject: [PATCH 026/120] Update modSociete.class.php --- htdocs/core/modules/modSociete.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index b8032cca13e..f0d04d30990 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -131,7 +131,7 @@ class modSociete extends DolibarrModules $this->boxes[$r][1] = "box_activity.php"; $this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)'; $r++; - $this->boxes[$r][1] = "box_bonsclients.php"; + $this->boxes[$r][1] = "box_goodcustomers.php"; $this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)'; $r++; // Permissions From 59c9d8527509cb2141118d9ac509a60826d48951 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 5 Feb 2016 23:38:04 +0100 Subject: [PATCH 027/120] Update boxes.lang --- htdocs/langs/en_US/boxes.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 6afc6d7b7b2..57bfc174ec5 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -61,7 +61,7 @@ BoxTitleLastModifiedDonations=Last %s modified donations BoxTitleLastModifiedExpenses=Last %s modified expense reports BoxGlobalActivity=Global activity (invoices, proposals, orders) BoxGoodCustomers=Good Customers -BoxTitleGoodCustomers= %s Good Customers +BoxTitleGoodCustomers=%s Good Customers FailedToRefreshDataInfoNotUpToDate=Failed to refresh RSS flux. Last successfull refresh date: %s LastRefreshDate=Last refresh date NoRecordedBookmarks=No bookmarks defined. From 806d3642d8cd2b732cbde46781eca5f55105887a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Feb 2016 15:06:37 +0100 Subject: [PATCH 028/120] FIX Bad filter on opportunities Conflicts: htdocs/core/class/html.formprojet.class.php --- build/debian/README.howto | 13 +++++++++++++ htdocs/core/class/html.formprojet.class.php | 9 +++++---- htdocs/langs/en_US/projects.lang | 3 +++ htdocs/projet/list.php | 1 + 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/build/debian/README.howto b/build/debian/README.howto index 28f5ed6e2b1..859c571e7c5 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -136,6 +136,19 @@ With only message tag 729538 +pending +To remove status of a bug without "moreinfo" (bug can be processed) + +or replay to email 999999@bugs.debian.org + submitter of bug +With a message starting with: + +Control: tag -1 -moreinfo +Thanks. Fixed into git. + +or replay to email control@bugs.debian.org +With only message +tag 729538 -moreinfo + + ##### Testing a package into unstable env diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 498604d9307..977b792568b 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -535,13 +535,13 @@ class FormProjets * Build a HTML select list of element of same thirdparty to suggest to link them to project * * @param string $htmlname HTML name - * @param int $preselected Preselected + * @param string $preselected Preselected (int or 'all' or 'none') * @param int $showempty Add an empty line * @param int $useshortlabel Use short label * @param int $showallnone Add choice "All" and "None" * @return int|string The HTML select list of element or '' if nothing or -1 if KO */ - function selectOpportunityStatus($htmlname, $preselected=0, $showempty=1, $useshortlabel=0, $showallnone=0) + function selectOpportunityStatus($htmlname, $preselected='-1', $showempty=1, $useshortlabel=0, $showallnone=0) { global $conf, $langs; @@ -559,8 +559,9 @@ class FormProjets { $sellist = '
'.$langs->trans('Ref').''.$langs->trans('Invoice').''.$langs->trans('RefSupplier').''.$langs->trans('Date').''.$langs->trans('AmountTTC').''.$langs->trans('AlreadyPaid').''.$langs->trans('RemainderToPay').''.$langs->trans('Amount').''.$langs->trans('PaymentAmount').'
situation_counter > 1) print ' readonly'; print '>situation_counter > 1) print ' readonly'; print '>
'; + + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + } + + $moreforfilter=''; + + //$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + //$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print '
'; print ''; print_liste_field_titre($langs->trans("Group"),$_SERVER["PHP_SELF"],"g.nom",$param,"","",$sortfield,$sortorder); //multicompany diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 22b6d54adda..e9d9fb6c489 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2015 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -63,31 +63,23 @@ print '
'; // Search User $var=false; -print '
'; +print ''; print ''; print '
'; -print ''; +print ''; print ''; -print ''; -print "
'.$langs->trans("SearchAUser").'
'.$langs->trans("Search").'
'; -print $langs->trans("Ref").':
'.$langs->trans("Other").':

\n"; -print ''; +print $langs->trans("User").':'; // Search Group if ($canreadperms) { $var=false; - print '
'; - print ''; - print ''; - print ''; print ''; - print ''; - print "
'.$langs->trans("SearchAGroup").'
'; - print $langs->trans("Ref").':
'.$langs->trans("Other").':

\n"; - print '
'; + print $langs->trans("Group").':'; } +print "
\n"; +print ''; //print ''; print '
'; From 9d427d224811ca9d93a6692c02047ffdcfcc5530 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 7 Feb 2016 07:41:53 +0100 Subject: [PATCH 038/120] Fixed: Missing link in eldy menu to init accountancy --- htdocs/core/menus/standard/eldy.lib.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index e72ec0d23c3..0497b50308f 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -555,6 +555,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("products"); $newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ProductVatMassChange"), 1, $user->admin); + + if (! empty($conf->accounting->enabled)) + { + $langs->load("accountancy"); + $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("InitAccountancy"), 1, $user->admin); + } } } } From eaca582cb5364257dfa2403954071891004a22e5 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 7 Feb 2016 08:47:02 +0100 Subject: [PATCH 039/120] Fixed: Problem of merging - Review page init accountancy again --- htdocs/accountancy/admin/productaccount.php | 93 ++++++++++----------- htdocs/langs/en_US/accountancy.lang | 18 +++- 2 files changed, 56 insertions(+), 55 deletions(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 8f3e178b525..bb1ab366427 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -1,6 +1,6 @@ - - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) @@ -20,13 +20,14 @@ */ /** - * \file htdocs/accountancy/admin/productaccount.php + * \file htdocs/accountancy/admin/productaccount.php * \ingroup Accounting Expert - * \brief Onglet de gestion de parametrages des ventilations + * \brief To define accounting account on product / service */ require '../../main.inc.php'; // Class +require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; @@ -40,7 +41,11 @@ $langs->load("compta"); $langs->load("main"); $langs->load("accountancy"); -// search & action GETPOST +// Security check +if (!$user->admin) accessforbidden(); +if (empty($conf->accounting->enabled)) accessforbidden(); + +// Search & action GETPOST $action = GETPOST('action'); $codeventil_buy = GETPOST('codeventil_buy', 'array'); $codeventil_sell = GETPOST('codeventil_sell', 'array'); @@ -76,8 +81,8 @@ if (! $sortfield) $sortfield = "p.ref"; if (! $sortorder) $sortorder = "ASC"; - - // sales or purchase + +// Sales or Purchase mode ? if ($action == 'update') { if (! empty($btn_changetype)) { $error = 0; @@ -129,9 +134,9 @@ if ($action == 'update') { dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG); if ($db->query($sql)) { - $msg .= '
' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '
'; + $msg .= '
' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '
'; } else { - $msg .= '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $accounting->account_number . '
' . $sql . '
'; + $msg .= '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '
' . $sql . '
'; } } @@ -144,13 +149,6 @@ if ($action == 'update') { } } -// Security check -if ($user->societe_id > 0) - accessforbidden(); - // TODO after adding menu - // if (! $user->rights->accounting->ventilation->dispatch) - // accessforbidden(); - $form = new FormVentilation($db); // Defaut AccountingAccount RowId Product / Service @@ -176,12 +174,11 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_desc = ''; } -// debug move header to top -llxHeader('', $langs->trans("Accounts")); - /* * View */ + +llxHeader('', $langs->trans("Accounts")); print ' '; From 9b41e11a1ef09094a211d3f007bcd8364b504776 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2016 19:28:10 +0100 Subject: [PATCH 065/120] NEW Can select dynamicaly number of lines to show on page --- htdocs/compta/facture/list.php | 1 + htdocs/core/lib/functions.lib.php | 59 +++++++++++++++++++++--------- htdocs/public/test/test_arrays.php | 4 +- htdocs/societe/list.php | 32 ++++++++-------- 4 files changed, 62 insertions(+), 34 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 5068306646b..38d1ce96f59 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -695,6 +695,7 @@ if ($resql) } $param='&socid='.$socid; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($month) $param.='&month='.$month; if ($year) $param.='&year=' .$year; if ($search_ref) $param.='&search_ref=' .$search_ref; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 26f549fab1f..efa80e70554 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2961,25 +2961,26 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois * @param string $options parametres complementaires lien ('' par defaut) * @param string $sortfield champ de tri ('' par defaut) * @param string $sortorder ordre de tri ('' par defaut) - * @param string $center chaine du centre ('' par defaut) + * @param string $center chaine du centre ('' par defaut). We often find here string $massaction comming from $form->selectMassAction() * @param int $num number of records found by select with limit+1 * @param int $totalnboflines Total number of records/lines for all pages (if known) * @param string $picto Icon to use before title (should be a 32x32 transparent png file) * @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param string $morehtml More html to show * @param string $morecss More css to the table - * @param int $limit Max number of lines + * @param int $limit Max number of lines (-1 = use default, 0 = no limit, > 0 = limit) * @return void */ -function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=0) +function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1) { global $conf,$langs; - + + $savlimit = $limit; + if ($picto == 'setup') $picto='title_setup.png'; if (($conf->browser->name == 'ie') && $picto=='title_generic.png') $picto='title.gif'; - if ($limit < 1) $limit = $conf->liste_limit; - - if (($num > $limit) || ($num == -1)) + if ($limit < 0) $limit = $conf->liste_limit; + if ($savlimit >= 0 && (($num > $limit) || ($num == -1) || ($limit == 0))) { $nextpage = 1; } @@ -3012,13 +3013,14 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so if ($sortorder) $options .= "&sortorder=".$sortorder; // Show navigation bar $pagelist = ''; - if ($page > 0 || $num > $limit) + if ($savlimit != 0 && ($page > 0 || $num > $limit)) { if ($totalnboflines) // If we know total nb of lines { - $maxnbofpage=(empty($conf->dol_optimize_smallscreen) ? 6 : 3); // page nb before and after selected page + ... + first or last + $maxnbofpage=(empty($conf->dol_optimize_smallscreen) ? 4 : 2); // page nb before and after selected page + ... + first or last - $nbpages=ceil($totalnboflines/$limit); + if ($limit > 0) $nbpages=ceil($totalnboflines/$limit); + else $nbpages=1; $cpt=($page-$maxnbofpage); if ($cpt < 0) { $cpt=0; } @@ -3055,7 +3057,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so $pagelist.= 'dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'class="active"':'data-role="button"').'>'.($page+1).""; } } - print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtml, $limit, $totalnboflines); // output the div and ul for previous/last completed with page numbers into $pagelist + print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtml, $savlimit, $totalnboflines); // output the div and ul for previous/last completed with page numbers into $pagelist print ''; print ''."\n"; @@ -3071,22 +3073,30 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so * @param integer $nextpage Do we show a next page button * @param string $betweenarrows HTML content to show between arrows. MUST contains '
  • ' tags or '
  • '. * @param string $afterarrows HTML content to show after arrows. Must NOT contains '
  • ' tags. - * @param string $limit Max nb of record to show ('' = unknown = default, '0' = no limit, 'x' = limit) + * @param int $limit Max nb of record to show (-1 = no combo with limit, 0 = no limit, > 0 = limit) * @param int $totalnboflines Total number of records/lines for all pages (if known) * @return void */ -function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='', $limit='', $totalnboflines=0) +function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='', $limit=-1, $totalnboflines=0) { global $conf, $langs; print '