From 3bb1756a13c75de13643a475c5031bc60a3dc778 Mon Sep 17 00:00:00 2001 From: KiteAtao Date: Sat, 7 Jan 2017 21:37:45 +0100 Subject: [PATCH 01/97] Fix Contact Api for REST WebServices --- htdocs/societe/class/api_contact.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_contact.class.php b/htdocs/societe/class/api_contact.class.php index 884653e044d..211792a2628 100644 --- a/htdocs/societe/class/api_contact.class.php +++ b/htdocs/societe/class/api_contact.class.php @@ -17,7 +17,7 @@ use Luracast\Restler\RestException; -//require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; /** * API class for contact object From 5c76229cdf0c296cca52c375deeae3779be21a0b Mon Sep 17 00:00:00 2001 From: KiteAtao Date: Sat, 7 Jan 2017 21:46:49 +0100 Subject: [PATCH 02/97] Fix Commands Api for REST WebServices --- htdocs/commande/class/api_commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/api_commande.class.php b/htdocs/commande/class/api_commande.class.php index 3a029bc0d00..45ef2d4b4f2 100644 --- a/htdocs/commande/class/api_commande.class.php +++ b/htdocs/commande/class/api_commande.class.php @@ -193,7 +193,7 @@ class CommandeApi extends DolibarrApi * @return array Array of order objects */ function getListForSoc($socid = 0) { - return getList(0,"s.rowid","ASC",0,0,$socid); + return $this->getList(0,"s.rowid","ASC",0,0,$socid); } From 70e6c2d41fbdcba739635b046cee7c53081e7351 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2017 00:42:28 +0100 Subject: [PATCH 03/97] Fix bad count of nb of contacts in statistics --- htdocs/contact/class/contact.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 67039fb2bef..d785a58597f 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -130,6 +130,7 @@ class Contact extends CommonObject $clause = "AND"; } $sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element, 1).')'; + $sql.= " AND (sp.priv='0' OR (sp.priv='1' AND sp.fk_user_creat=".$user->id."))"; if ($user->societe_id > 0) $sql.=" AND sp.fk_soc = ".$user->societe_id; $resql=$this->db->query($sql); From 1559c45a61afe687136e28909b6a52364d244dea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jan 2017 09:24:55 +0100 Subject: [PATCH 04/97] FIX link for not found photo when using gravatar. Must use external url --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f8fd30b15e3..3f8ed836f44 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5812,7 +5812,7 @@ class Form */ global $dolibarr_main_url_root; $ret.=''; - $ret.='Gravatar avatar'; // gravatar need md5 hash + $ret.='Gravatar avatar'; // gravatar need md5 hash } else { From 5898d27609b78c3f31182cc68a6ad46a9464c506 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 11 Jan 2017 16:47:17 +0100 Subject: [PATCH 05/97] Fix: avoid errors if constants values not exists --- htdocs/core/class/CMailFile.class.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 52cce35f0d2..6b42ba73381 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -153,7 +153,7 @@ class CMailFile } if (! empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) $this->msgishtml=1; // To force to send everything with content type html. - + // Detect images if ($this->msgishtml) { @@ -210,7 +210,7 @@ class CMailFile $this->trackid = $trackid; $smtp_headers = $this->write_smtpheaders(); if (! empty($moreinheader)) $smtp_headers.=$moreinheader; - + // Define mime_headers $mime_headers = $this->write_mimeheaders($filename_list, $mimefilename_list); @@ -270,7 +270,7 @@ class CMailFile $smtps->setFrom($this->getValidAddress($from,0,1)); $smtps->setTrackId($trackid); $smtps->setReplyTo($this->getValidAddress($from,0,1)); // Set property with this->smtps->setReplyTo after constructor if you want to use another value than the From - + if (! empty($this->html)) { if (!empty($css)) @@ -473,16 +473,16 @@ class CMailFile 'maildao' )); $reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if (! empty($reshook)) + if (! empty($reshook)) { $this->error = "Error in hook maildao doactions " . $reshook; dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR); - + return $reshook; } // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10; + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=6; $tmparray1 = explode(',', $this->addr_to); if (count($tmparray1) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL) { @@ -490,6 +490,7 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); return false; } + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL=2; $tmparray2 = explode(',', $this->addr_cc); if (count($tmparray2) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL) { @@ -497,6 +498,7 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); return false; } + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL=2; $tmparray3 = explode(',', $this->addr_bcc); if (count($tmparray3) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL) { @@ -504,14 +506,14 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); return false; } + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10; if ((count($tmparray1)+count($tmparray2)+count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) { $this->error = 'Too much recipients in to:, cc:, bcc:'; dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); return false; } - - + // Action according to choosed sending method if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') { @@ -553,7 +555,7 @@ class CMailFile $bounce .= ($bounce?' ':'').'-ba'; } dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$bounce, LOG_DEBUG); - + $this->message=stripslashes($this->message); if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); @@ -873,7 +875,7 @@ class CMailFile // Receiver if (isset($this->addr_cc) && $this->addr_cc) $out.= "Cc: ".$this->getValidAddress($this->addr_cc,2).$this->eol2; - if (isset($this->addr_bcc) && $this->addr_bcc) $out.= "Bcc: ".$this->getValidAddress($this->addr_bcc,2).$this->eol2; // Question: bcc must not be into header, only into SMTP command "RCPT TO". Does php mail support this ? + if (isset($this->addr_bcc) && $this->addr_bcc) $out.= "Bcc: ".$this->getValidAddress($this->addr_bcc,2).$this->eol2; // Question: bcc must not be into header, only into SMTP command "RCPT TO". Does php mail support this ? // Delivery receipt if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $out.= "Disposition-Notification-To: ".$this->getValidAddress($this->addr_from,2).$this->eol2; From eb2ea07c763a7bec83ef01d601e41c41aa66fa65 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 11 Jan 2017 20:32:39 +0100 Subject: [PATCH 06/97] FIX #6245 Thirdparty link in supplier invoices list, links to "comm/card" instead of "fourn/card" page --- htdocs/fourn/facture/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 89dfb083ea0..f2c42c3b14f 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -6,7 +6,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Marcos García - * Copyright (C) 2015 juanjo Menent + * Copyright (C) 2015-2007 Juanjo Menent * Copyright (C) 2015 Abbes Bahfir * Copyright (C) 2015-2016 Ferran Marcet * @@ -788,7 +788,7 @@ if ($resql) $thirdparty->name=$obj->name; $thirdparty->client=$obj->client; $thirdparty->code_client=$obj->code_client; - print $thirdparty->getNomUrl(1,'customer'); + print $thirdparty->getNomUrl(1,'supplier'); print ''; if (! $i) $totalarray['nbfield']++; } From ac58fd91af93883ce6207147e934ce7f7f8f1d1a Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 11 Jan 2017 20:46:50 +0100 Subject: [PATCH 07/97] FIX #6253 Supplier invoice list filter does not respect "thirdparty" filter --- htdocs/fourn/facture/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index f2c42c3b14f..19f3f8ecbd7 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -434,6 +434,7 @@ if ($resql) print ''; print ''; print ''; + print ''; print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy',0,'','',$limit); From bcba4a1a38a37869c55f58dff8c7c66eb2ad8895 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 11 Jan 2017 20:48:32 +0100 Subject: [PATCH 08/97] FIX #6253 Supplier invoice list filter does not respect "thirdparty" filter --- htdocs/fourn/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 19f3f8ecbd7..27c14f2a8d4 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -434,7 +434,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy',0,'','',$limit); From 94f14f529bd0b33c773b23d84ba04a5aa77962a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Jan 2017 22:02:08 +0100 Subject: [PATCH 09/97] Fix pb with double quote --- dev/initdemo/initdemo.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/initdemo/initdemo.sh b/dev/initdemo/initdemo.sh index 497d3abbf50..c34d9e2ffda 100755 --- a/dev/initdemo/initdemo.sh +++ b/dev/initdemo/initdemo.sh @@ -162,7 +162,7 @@ export res=$? # ---------------------------- copy demo files -export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" ` +export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" | sed -e 's/"//g' ` if [ "x$documentdir" != "x" ] then echo cp -pr $mydir/documents_demo/* "$documentdir/" @@ -174,7 +174,7 @@ then echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images" cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images" else - echo Detection of documents directory failed so demo files were not copied. + echo Detection of documents directory $documentdir failed so demo files were not copied. fi From 3d8c5b377b83fb84e5cf6200ec0d651b4782760a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2017 10:16:19 +0100 Subject: [PATCH 10/97] Fix string not translated --- htdocs/core/tpl/login.tpl.php | 2 +- htdocs/langs/en_US/main.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 5e79b71ee34..77422d317e5 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -89,7 +89,7 @@ $(document).ready(function () {
- +
"> '; // Batch number if ($conf->productbatch->enabled) From 3a2f44adaca76269c8883461e554e1c27deb377d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2017 13:43:09 +0100 Subject: [PATCH 16/97] Fix security permissions to edit/delete time spent --- htdocs/projet/tasks/time.php | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index f6da55731fc..aa572966321 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -128,7 +128,7 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) } } -if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->creer) +if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->lire) { $error=0; @@ -141,7 +141,8 @@ if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->cree if (! $error) { $object->fetch($id, $ref); - + // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) + $object->timespent_id = $_POST["lineid"]; $object->timespent_note = $_POST["timespent_note_line"]; $object->timespent_old_duration = $_POST["old_duration"]; @@ -175,9 +176,10 @@ if ($action == 'updateline' && ! $_POST["cancel"] && $user->rights->projet->cree } } -if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->creer) +if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->lire) { $object->fetchTimeSpent($_GET['lineid']); + // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) $result = $object->delTimeSpent($user); if ($result < 0) @@ -585,6 +587,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $tasktmp = new Task($db); + $childids = $user->getAllChildIds(); + $total = 0; $totalvalue = 0; foreach ($tasks as $task_time) @@ -688,17 +692,20 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print ''; } - else if ($user->rights->projet->creer) + else if ($user->rights->projet->lire) // Read project and enter time consumed on assigned tasks { - print ' '; - print 'rowid.($withproject?'&withproject=1':'').'">'; - print img_edit(); - print ''; - - print ' '; - print 'rowid.($withproject?'&withproject=1':'').'">'; - print img_delete(); - print ''; + if ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) + { + print ' '; + print 'rowid.($withproject?'&withproject=1':'').'">'; + print img_edit(); + print ''; + + print ' '; + print 'rowid.($withproject?'&withproject=1':'').'">'; + print img_delete(); + print ''; + } } print ''; From 31818e8816337a35561f47e7c3b629bf866739fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2017 15:32:20 +0100 Subject: [PATCH 17/97] Fix missing translation --- htdocs/comm/mailing/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 3660b560f78..74ed28ba268 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -755,7 +755,7 @@ else // MAILING_NO_USING_PHPMAIL may be defined or not. // MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden). - // MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0=no limit). + // MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0 or undefined=no limit). if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. @@ -769,8 +769,8 @@ else } else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1') { - if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings'); - if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); // The feature is forbidden from GUI, we show just message to use from command line. setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); @@ -783,8 +783,8 @@ else } else { - if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings'); - if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); $text=''; if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) From 487b5b25dbf9457228e1ad55c737de9dd927714f Mon Sep 17 00:00:00 2001 From: altatof Date: Fri, 13 Jan 2017 15:37:33 +0100 Subject: [PATCH 18/97] FIX: extrafield input for varchar was not working with special char within (ie double quotes) --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 496a8f2e251..63621d56a82 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -763,7 +763,7 @@ class ExtraFields } elseif ($type == 'phone') { - $out=''; + $out=''; } elseif ($type == 'price') { From 55c0a99bce46ae767e86069cc7823b307f0f1654 Mon Sep 17 00:00:00 2001 From: altatof Date: Fri, 13 Jan 2017 15:42:07 +0100 Subject: [PATCH 19/97] fix was not at the right place --- htdocs/core/class/extrafields.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 63621d56a82..cc6b61b236e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -739,7 +739,7 @@ class ExtraFields } elseif ($type == 'varchar') { - $out=''; + $out=''; } elseif ($type == 'text') { @@ -763,7 +763,7 @@ class ExtraFields } elseif ($type == 'phone') { - $out=''; + $out=''; } elseif ($type == 'price') { From 1fd9f5e1fbcb3f7ca1b6c1e501aefa9b88c98995 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2017 13:27:44 +0100 Subject: [PATCH 20/97] Fix: host was twice into message id for smtp driver and swiftmailer was not using dol_getprefix() to build host. --- htdocs/core/class/CMailFile.class.php | 6 ++++-- htdocs/core/class/smtps.class.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 26f8a4b88f2..44df05a4d6c 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -365,7 +365,9 @@ class CMailFile { // Use Swift Mailer library // ------------------------------------------ - + + $host = dol_getprefix('email'); + require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php'; // Create the message $this->message = Swift_Message::newInstance(); @@ -373,7 +375,7 @@ class CMailFile // Adding a trackid header to a message $headers = $this->message->getHeaders(); $headers->addTextHeader('X-Dolibarr-TRACKID', $trackid); - $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $conf->global->MAIN_MAIL_SMTP_SERVER; + $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host; $msgid = $headers->get('Message-ID'); $msgid->setId($headerID); $headers->addIdHeader('References', $headerID); diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 0517dee30e5..37c0772093f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1190,7 +1190,7 @@ class SMTPs $host=preg_replace('@tcp://@i','',$host); // Remove prefix $host=preg_replace('@ssl://@i','',$host); // Remove prefix - $host=dol_getprefix('email').'-'.$host; + $host=dol_getprefix('email'); //NOTE: Message-ID should probably contain the username of the user who sent the msg $_header .= 'Subject: ' . $this->getSubject() . "\r\n"; From fd4a19855d3fffea2af4202de0863054adb19c6f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 15 Jan 2017 12:09:26 +0100 Subject: [PATCH 21/97] Fix: preview image not show with multicompany product sharing --- htdocs/core/class/html.formfile.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5a55b3a8a9c..d9a5e19843f 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -76,7 +76,7 @@ class FormFile global $conf,$langs, $hookmanager; $hookmanager->initHooks(array('formfile')); - + if (! empty($conf->browser->layout) && $conf->browser->layout != 'classic') $useajax=0; if ((! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax) || ($useajax==2)) @@ -276,7 +276,7 @@ class FormFile if (0 !== $iconPDF) { dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING); } - + global $langs, $conf, $user, $hookmanager; global $form, $bc; @@ -288,7 +288,7 @@ class FormFile if (! empty($iconPDF)) { return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } - + $printer=0; if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur'))) // The direct print feature is implemented only for such elements { @@ -506,7 +506,7 @@ class FormFile $addcolumforpicto=($delallowed || $printer || $morepicto); $out.= '
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 1cc51fa7037..61356f0afd7 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -447,6 +447,7 @@ DeletePicture=Picture delete ConfirmDeletePicture=Confirm picture deletion? Login=Login CurrentLogin=Current login +EnterLoginDetail=Enter login details January=January February=February March=March From 5e71ff816f2a2eafac7cad687280ffe10a536b9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2017 10:51:31 +0100 Subject: [PATCH 11/97] Increase limit for better backward compatibility without loosing minimum security. --- htdocs/core/class/CMailFile.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 6b42ba73381..26f8a4b88f2 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -482,7 +482,7 @@ class CMailFile } // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=6; + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10; $tmparray1 = explode(',', $this->addr_to); if (count($tmparray1) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL) { @@ -490,7 +490,7 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); return false; } - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL=2; + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL=10; $tmparray2 = explode(',', $this->addr_cc); if (count($tmparray2) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL) { @@ -498,7 +498,7 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); return false; } - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL=2; + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL=10; $tmparray3 = explode(',', $this->addr_bcc); if (count($tmparray3) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL) { From 8d5c85326718652d4ed5cfc4e8435c52a059b2a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2017 15:12:53 +0100 Subject: [PATCH 12/97] FIX Protection so even if link is output for external user, links is disabled. --- htdocs/societe/class/societe.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index b3205d3fb44..12d7fcd77ef 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1915,7 +1915,14 @@ class Societe extends CommonObject } $link.='>'; $linkend=''; - + + global $user; + if (! $user->rights->societe->client->voir && $user->societe_id > 0 && $this->id != $user->societe_id) + { + $link=''; + $linkend=''; + } + if ($withpicto) $result.=($link.img_object(($notooltip?'':$label), 'company', ($notooltip?'':'class="classfortooltip"')).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($name,$maxlen):$name).$linkend; From f185a09693859720e85501d9613fcdae52e92dce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2017 15:23:30 +0100 Subject: [PATCH 13/97] FIX Security access problem with external users on projects/tasks --- htdocs/langs/en_US/admin.lang | 4 ++-- htdocs/langs/en_US/errors.lang | 1 + htdocs/projet/card.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/index.php | 2 +- htdocs/projet/info.php | 2 +- htdocs/projet/list.php | 9 ++++++--- htdocs/projet/note.php | 2 +- htdocs/projet/tasks.php | 5 +++-- htdocs/projet/tasks/contact.php | 2 +- htdocs/projet/tasks/document.php | 2 +- htdocs/projet/tasks/list.php | 2 +- htdocs/projet/tasks/note.php | 2 +- htdocs/projet/tasks/task.php | 2 +- htdocs/projet/tasks/time.php | 2 +- 18 files changed, 26 insertions(+), 21 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7cb41b1d708..8aa36f0544a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -560,7 +560,7 @@ Permission34=Delete products Permission36=See/manage hidden products Permission38=Export products Permission41=Read projects and tasks (shared project and projects i'm contact for). Can also enter time consumed on assigned tasks (timesheet) -Permission42=Create/modify projects (shared project and projects i'm contact for) +Permission42=Create/modify projects (shared project and projects i'm contact for). Can also create tasks and assign users to project and tasks Permission44=Delete projects (shared project and projects i'm contact for) Permission45=Export projects Permission61=Read interventions @@ -663,7 +663,7 @@ PermissionAdvanced253=Create/modify internal/external users and permissions Permission254=Create/modify external users only Permission255=Modify other users password Permission256=Delete or disable other users -Permission262=Extend access to all third parties (not only those linked to user). Not effective for external users (always limited to themselves). +Permission262=Extend access to all third parties (not only third parties that user is a sale representative). Not effective for external users (always limited to themselves for proposals, orders, invoices, contracts, etc). Not effective for projects (only rules on project permissions, visibility and assignement matters). Permission271=Read CA Permission272=Read invoices Permission273=Issue invoices diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 6b99049e9ef..0e0b3e40960 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -176,6 +176,7 @@ ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enough for product %s t ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enough for product %s to add it into a new proposal. ErrorFailedToLoadLoginFileForMode=Failed to get the login key for mode '%s'. ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information. +ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter time consumed. # 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. diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index ad1d718fc55..8345ce69846 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -68,7 +68,7 @@ if ($id > 0 || ! empty($ref)) // Security check $socid=GETPOST('socid'); -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $object->id,'projet&project'); // fetch optionals attributes and labels diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 794e9c3af00..492578905d9 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -46,7 +46,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check $socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id,'projet&project'); diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index d59dec0dc4a..5bd46389eef 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -42,7 +42,7 @@ $mine = (GETPOST('mode','alpha') == 'mine' ? 1 : 0); // Security check $socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result=restrictedArea($user,'projet',$id,'projet&project'); $object = new Project($db); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 5673f74aa34..9fc957fa66b 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -92,7 +92,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check $socid=$object->socid; -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $projectid, 'projet&project'); diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index b86a961bd69..2b992e05ef6 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -43,7 +43,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check $socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id,'projet&project'); $langs->load("users"); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 752e3615464..20fca4b5abf 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -37,7 +37,7 @@ $mine = GETPOST('mode')=='mine' ? 1 : 0; // Security check $socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); $sortfield = GETPOST("sortfield",'alpha'); diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index c2e45560f74..281a2f8c94d 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -34,7 +34,7 @@ $langs->load("projects"); // Security check $socid=0; $id = GETPOST("id",'int'); -if ($user->societe_id) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result=restrictedArea($user,'projet',$id,''); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 6e7ccc26dd5..721baca4ced 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -40,7 +40,7 @@ $title = $langs->trans("Projects"); // Security check $socid = (is_numeric($_GET["socid"]) ? $_GET["socid"] : 0 ); -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if ($socid > 0) { $soc = new Societe($db); @@ -220,7 +220,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid"; // We'll need this table joined to the select in order to filter by sale -if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; +// For external user, no check is done on company permission because readability is managed by public status of project and assignement. +//if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; +if ($search_sale > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; if ($search_user > 0) { $sql.=", ".MAIN_DB_PREFIX."element_contact as ecp"; @@ -271,7 +273,8 @@ if ($search_opp_status) } if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale; -if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; +// For external user, no check is done on company permission because readability is managed by public status of project and assignement. +//if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; if ($search_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_user; if ($search_opp_amount != '') $sql .= natural_search('p.opp_amount', $search_opp_amount, 1); if ($search_budget_amount != '') $sql .= natural_search('p.budget_amount', $search_budget_amount, 1); diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index 43df7ce3b3d..57bc235c8d0 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -41,7 +41,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check $socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id,'projet&project'); $permissionnote=$user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 9def807c746..5d5871ec280 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -61,7 +61,7 @@ $extralabels_task=$extrafields_task->fetch_name_optionals_label($taskstatic->tab // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id,'projet&project'); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array @@ -413,7 +413,8 @@ else if ($id > 0 || ! empty($ref)) // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him). - $tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0); + $filteronthirdpartyid = $socid; + $tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0); // We load also tasks limited to a particular user $tasksrole=($mode=='mine' ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$object->id,0) : ''); //var_dump($tasksarray); diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 6689f966c15..23feb647fc8 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -42,7 +42,7 @@ $project_ref=GETPOST('project_ref','alpha'); // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. //$result = restrictedArea($user, 'projet', $id, 'projet_task'); if (! $user->rights->projet->lire) accessforbidden(); diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index c9a69fc81a4..15c73450be6 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -47,7 +47,7 @@ $project_ref = GETPOST('project_ref','alpha'); // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. //$result=restrictedArea($user,'projet',$id,''); if (!$user->rights->projet->lire) accessforbidden(); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 5573441d646..f733ab03a1c 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -75,7 +75,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 5d5cb38dbe5..880b2a25198 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -39,7 +39,7 @@ $project_ref = GETPOST('project_ref','alpha'); // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); //$result = restrictedArea($user, 'projet', $id, '', 'task'); // TODO ameliorer la verification diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 6e0648b61e6..15ef42d5c83 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -47,7 +47,7 @@ $planned_workload=((GETPOST('planned_workloadhour')!='' && GETPOST('planned_work // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (! $user->rights->projet->lire) accessforbidden(); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 96c849d8df9..f6da55731fc 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -43,7 +43,7 @@ $project_ref=GETPOST('project_ref','alpha'); // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array From edb79de54e8e0aaa2956ae3578298f0e3cc98ddf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2017 18:07:19 +0100 Subject: [PATCH 14/97] FIX javascript error --- htdocs/compta/paiement.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index fa1341dcbc6..5e73c3dd710 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -391,10 +391,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie var form = $("#payment_form"); json["invoice_type"] = $("#invoice_type").val(); - json["amountPayment"] = $("#amountpayment").attr("value"); + json["amountPayment"] = $("#amountpayment").attr("value"); json["amounts"] = _elemToJson(form.find("input.amount")); - json["remains"] = _elemToJson(form.find("input.remain]")); - + json["remains"] = _elemToJson(form.find("input.remain")); if (imgId != null) { json["imgClicked"] = imgId; } From 380b61a0e9b0e8b08094b8843883c1f7a56771d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2017 21:56:50 +0100 Subject: [PATCH 15/97] FIX Can make a stock transfert on product not on sale/purchase. --- htdocs/product/stock/massstockmove.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index b8ec52efcab..0cebc666c1e 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -372,7 +372,7 @@ else { $limit = $conf->global->PRODUIT_LIMIT_SIZE; } -print $form->select_produits($id_product,'productid',$filtertype,$limit); +print $form->select_produits($id_product,'productid',$filtertype,$limit,0,-1); print ''; - + // Model if (! empty($modellist)) { @@ -863,8 +863,8 @@ class FormFile $minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension //print $file['path'].'/'.$minifile.'
'; - print ''; - print ''; + print ''; + print ''; print ''; } else print ' '; From c3997194b21ac96016a6700a2d5e1a0101fe1369 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 15 Jan 2017 15:17:32 +0100 Subject: [PATCH 22/97] Fix: avoid foreach error --- htdocs/product/stats/card.php | 61 ++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 3ff47496409..aababfbe40b 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -44,6 +44,7 @@ $ref = GETPOST('ref'); $mode = (GETPOST('mode') ? GETPOST('mode') : 'byunit'); $error = 0; $mesg = ''; +$graphfiles=array(); $socid=''; if (! empty($user->societe_id)) $socid=$user->societe_id; @@ -57,7 +58,7 @@ $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','', /* * View */ - + $form = new Form($db); if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') @@ -68,7 +69,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') llxHeader("",$langs->trans("ProductStatistics")); $type = GETPOST('type'); - + $helpurl=''; if ($type == '0') { @@ -88,13 +89,13 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') //$title=$langs->trans("StatisticsOfProductsOrServices"); $title=$langs->trans("Statistics"); } - + print load_fiche_titre($title, $mesg,'title_products.png'); } else { $result = $object->fetch($id,$ref); - + $title = $langs->trans('ProductServiceCard'); $helpurl = ''; $shortlabel = dol_trunc($object->label,16); @@ -111,8 +112,8 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') llxHeader('', $title, $helpurl); } - - + + if ($result && (! empty($id) || ! empty($ref))) { $head=product_prepare_head($object); @@ -122,21 +123,21 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') dol_fiche_head($head, 'stats', $titre, 0, $picto); $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); - + dol_fiche_end(); } if (GETPOST('id') == 'all') { $h=0; $head = array(); - + $head[$h][0] = DOL_URL_ROOT.'/product/stats/card.php?id=all'; $head[$h][1] = $langs->trans("Chart"); $head[$h][2] = 'chart'; $h++; - + $title = $langs->trans("ListProductServiceByPopularity"); if ((string) $type == '1') { $title = $langs->trans("ListServiceByPopularity"); @@ -144,49 +145,49 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') if ((string) $type == '0') { $title = $langs->trans("ListProductByPopularity"); } - + $head[$h][0] = DOL_URL_ROOT.'/product/popuprop.php'.($type != ''?'?type='.$type:''); $head[$h][1] = $title; $head[$h][2] = 'popularityprop'; $h++; - - dol_fiche_head($head,'chart',$langs->trans("Statistics")); + + dol_fiche_head($head,'chart',$langs->trans("Statistics")); } - - + + if ($result || GETPOST('id') == 'all') { if (GETPOST('id') == 'all') { // Choice of type of product if (! empty($conf->dol_use_jmobile)) print "\n".'
'."\n".'
'."\n"; else print '   /   '; - + if ((string) $type != '1') print 'id).'&type=1'.($mode?'&mode='.$mode:'').'">'; else print img_picto('','tick').' '; print $langs->trans("Services"); if ((string) $type != '1') print ''; - + if (! empty($conf->dol_use_jmobile)) print '
'."\n".'
'."\n"; else print '   /   '; - + if ((string) $type == '0' || (string) $type == '1') print 'id).($mode?'&mode='.$mode:'').'">'; else print img_picto('','tick').' '; print $langs->trans("ProductsAndServices"); if ((string) $type == '0' || (string) $type == '1') print ''; - + if (! empty($conf->dol_use_jmobile)) print '
'; else print '
'; print '
'; } - + // Choice of stats mode (byunit or bynumber) if (! empty($conf->dol_use_jmobile)) print "\n".'
'."\n"; @@ -222,25 +223,25 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') } } } - + if($conf->propal->enabled) { $graphfiles['propal']=array('modulepart'=>'productstats_proposals', 'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsProposals"):$langs->transnoentitiesnoconv("NumberOfProposals"))); } - + if($conf->supplier_proposal->enabled) { $graphfiles['proposalssuppliers']=array('modulepart'=>'productstats_proposalssuppliers', 'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierProposals"):$langs->transnoentitiesnoconv("NumberOfSupplierProposals"))); } - + if($conf->order->enabled) { $graphfiles['orders']=array('modulepart'=>'productstats_orders', 'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders"):$langs->transnoentitiesnoconv("NumberOfCustomerOrders"))); } - + if($conf->fournisseur->enabled) { $graphfiles['orderssuppliers']=array('modulepart'=>'productstats_orderssuppliers', 'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', @@ -251,7 +252,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') $graphfiles['invoices']=array('modulepart'=>'productstats_invoices', 'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices"):$langs->transnoentitiesnoconv("NumberOfCustomerInvoices"))); - + $graphfiles['invoicessuppliers']=array('modulepart'=>'productstats_invoicessuppliers', 'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png', 'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices"):$langs->transnoentitiesnoconv("NumberOfSupplierInvoices"))); @@ -282,10 +283,10 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') if ($key == 'proposalssuppliers') $graph_data = $object->get_nb_propalsupplier($socid,$mode,((string) $type != '' ? $type : -1)); if ($key == 'invoicessuppliers') $graph_data = $object->get_nb_achat($socid,$mode,((string) $type != '' ? $type : -1)); if ($key == 'orderssuppliers') $graph_data = $object->get_nb_ordersupplier($socid,$mode,((string) $type != '' ? $type : -1)); - + // TODO Save cachefile $graphfiles[$key]['file'] } - + if (is_array($graph_data)) { $px->SetData($graph_data); @@ -383,7 +384,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') print '

'."\n"; } } - + if (GETPOST('id') == 'all') { dol_fiche_end(); From f9ed1592e15a39909827ae31d14e37853314426a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 15 Jan 2017 16:07:04 +0100 Subject: [PATCH 23/97] Fix: search problem if name contains accents --- htdocs/admin/modules.php | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 113d12570cb..f3aeb780f76 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -193,7 +193,7 @@ foreach ($modulesdir as $dir) } ksort($arrayofnatures); } - + // Define array $categ with categ with at least one qualified module if ($modulequalified > 0) { @@ -315,13 +315,13 @@ if ($mode != 'marketplace') print ''; print ''; print ''; - + $moreforfilter = ''; $moreforfilter.='
'; $moreforfilter.= $langs->trans('Keyword') . ': '; $moreforfilter.= '
'; $moreforfilter.='
'; - $moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, $search_nature, 1); + $moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1); $moreforfilter.= '
'; if (! empty($conf->global->MAIN_FEATURES_LEVEL)) { @@ -342,7 +342,7 @@ if ($mode != 'marketplace') $moreforfilter.=' '; $moreforfilter.=''; $moreforfilter.= '
'; - + if (! empty($moreforfilter)) { //print '
'; @@ -351,11 +351,11 @@ if ($mode != 'marketplace') $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; //print '
'; - } - + } + print '


'; - - + + // Show list of modules print ''."\n"; @@ -370,7 +370,7 @@ if ($mode != 'marketplace') $modName = $filename[$key]; $objMod = $modules[$key]; $dirofmodule = $dirmod[$key]; - + $special = $objMod->special; //print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."
"; @@ -383,9 +383,9 @@ if ($mode != 'marketplace') dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING); continue; } - + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); - + // Check filters $modulename=$objMod->getName(); $moduledesc=$objMod->getDesc(); @@ -396,7 +396,7 @@ if ($mode != 'marketplace') if ($search_keyword) { $qualified=0; - if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) + if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong) || preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor) @@ -415,7 +415,7 @@ if ($mode != 'marketplace') { //print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher()); $publisher=dol_escape_htmltag($objMod->getPublisher()); - if ($reg[1] && $reg[1] != $publisher) continue; + if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) continue; if (! $reg[1] && ! empty($publisher)) continue; } if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') continue; @@ -496,7 +496,7 @@ if ($mode != 'marketplace') $text=''; if ($objMod->getDescLong()) $text.=$objMod->getDesc().'
'.$objMod->getDescLong().'
'; else $text.=$objMod->getDesc().'
'; - + $textexternal=''; if ($objMod->isCoreOrExternalModule() == 'external') { @@ -522,7 +522,7 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddDictionaries").': '; if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib'])) { @@ -534,7 +534,7 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddBoxes").': '; if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) { @@ -553,14 +553,14 @@ if ($mode != 'marketplace') $text.=$langs->trans("Yes"); } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddSubstitutions").': '; if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions']) { $text.=$langs->trans("Yes"); } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddSheduledJobs").': '; if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs)) { @@ -572,14 +572,14 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddTriggers").': '; if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) { $text.=$langs->trans("Yes"); } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddHooks").': '; if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks'])) { @@ -603,14 +603,14 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddMenus").': '; if (isset($objMod->menu) && is_array($objMod->menu) && ! empty($objMod->menu)) { $text.=$langs->trans("Yes"); } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddExportProfiles").': '; if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label)) { @@ -622,7 +622,7 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddImportProfiles").': '; if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label)) { @@ -634,25 +634,25 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddOtherPagesOrServices").': '; $text.=$langs->trans("DetectionNotPossible"); - + print $form->textwithpicto('', $text, 1, 'help', 'minheight20'); - // Picto warning + // Picto warning $version=$objMod->getVersion(0); $versiontrans=$objMod->getVersion(1); if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: right"'); if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: right"'); if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: right"'); - + // Picto external if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: right"'); - - + + print ''; - + // Version print ''; + print ''; } } From fdbe4051f135d5cda58314721a1c8d5774f45d99 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 12:54:51 +0100 Subject: [PATCH 26/97] FIX #6230 --- htdocs/user/class/user.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index fb27aef9d2e..cd0000c1e60 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1050,7 +1050,8 @@ class User extends CommonObject $this->town = $contact->town; $this->state_id = $contact->state_id; $this->country_id = $contact->country_id; - + $this->employee = 0; + if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); $this->login = $login; From d21bb1e6b1ebea6efa3f9460ee908441440b792f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 13:10:54 +0100 Subject: [PATCH 27/97] FIX #6237 --- htdocs/fichinter/card.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 290f650faa1..d81f25b0c71 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -583,7 +583,7 @@ if (empty($reshook)) } } - // Classify Billed + // Classify unbilled else if ($action == 'classifyunbilled' && $user->rights->ficheinter->creer) { $result=$object->setStatut(1); @@ -598,6 +598,21 @@ if (empty($reshook)) } } + // Classify Done + else if ($action == 'classifydone' && $user->rights->ficheinter->creer) + { + $result=$object->setStatut(3); + if ($result > 0) + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + /* * Mise a jour d'une ligne d'intervention */ From 39f35bbaab2ae4771320b2c4d3aba5a37aa20ad9 Mon Sep 17 00:00:00 2001 From: arnaud Date: Tue, 17 Jan 2017 11:17:40 +0100 Subject: [PATCH 28/97] FIX all dolibarr versions about project list and ajax completion bug --- htdocs/core/class/html.formprojet.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 4c094061ee4..ba4d2bac3ff 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -127,13 +127,15 @@ class FormProjets // Search all projects $sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public'; $sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p'; - $sql.= " WHERE p.entity = ".$conf->entity; + $sql.= " WHERE p.entity IN (".getEntity('project',1).")"; if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; if (!empty($filterkey)) { - $sql .= ' AND p.title LIKE "%'.$this->db->escape($filterkey).'%"'; + $sql .= ' AND ('; + $sql .= ' p.title LIKE "%'.$this->db->escape($filterkey).'%"'; $sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"'; + $sql .= ')'; } $sql.= " ORDER BY p.ref ASC"; From 2cedcfece2c3a9f41c5385176e6e66d72969dd55 Mon Sep 17 00:00:00 2001 From: arnaud Date: Fri, 20 Jan 2017 12:01:20 +0100 Subject: [PATCH 29/97] FIX bug margin calcul by user with multicompany --- htdocs/margin/agentMargins.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index f9189ed7e97..d023720a875 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -126,6 +126,7 @@ $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE f.fk_soc = s.rowid"; +$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND sc.fk_soc = f.fk_soc"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; if (! empty($conf->global->AGENT_CONTACT_TYPE)) From 2be601106918c58a75216c8df441cdcffdb88a9f Mon Sep 17 00:00:00 2001 From: fappels Date: Mon, 23 Jan 2017 20:59:32 +0100 Subject: [PATCH 30/97] Fix product elephant verify for service --- htdocs/core/modules/product/mod_codeproduct_elephant.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 517cd0a7ce9..bb7eb09abf4 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -252,7 +252,7 @@ class mod_codeproduct_elephant extends ModeleProductCode // Get Mask value $mask = ''; if ($type==0) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT)?'':$conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT; - if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SSERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE; + if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE; if (! $mask) { $this->error='NotConfigured'; From fd55ded9966754d77a7de18ebe319b01d5a685f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jan 2017 18:45:57 +0100 Subject: [PATCH 31/97] Prepare 4.0.4 version --- ChangeLog | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index 553e5327366..cc6f1364f17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,25 @@ Upgrading to any other version or any other database system is abolutely require make a Dolibarr upgrade. +***** ChangeLog for 4.0.4 to 4.0.3 ***** +FIX: #6227 Document models table header "Unit" is shown in 2 lines in Spanish +FIX: #6230 +FIX: #6237 +FIX: #6245 Thirdparty link in supplier invoices list, links to "comm/card" instead of "fourn/card" page +FIX: #6253 Supplier invoice list filter does not respect "thirdparty" filter +FIX: #6277 +FIX: project list and ajax completion return wrong list. +FIX: bug margin calculation by user with multicompany +FIX: Can make a stock transfert on product not on sale/purchase. +FIX: extrafield input for varchar was not working with special char within (ie double quotes) +FIX: javascript error +FIX: link for not found photo when using gravatar. Must use external url. +FIX: Protection so even if link is output for external user, links is disabled. +FIX: repair tool was ko to restore extrafields with type select. +FIX: Security access problem with external users on projects/tasks +FIX: We must not drop extrafield column if there is still record on other entities. +FIX: regression with sedning email when introducing security options to restrict nb of email sending. +t ***** ChangeLog for 4.0.3 to 4.0.2 ***** FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1 FIX: #5958 no discount on supplier command made by replenishment From d65cb29536b8b6271df64c110e1b3fd90bbc2985 Mon Sep 17 00:00:00 2001 From: altatof Date: Wed, 25 Jan 2017 09:25:06 +0100 Subject: [PATCH 32/97] FIX: use param for http links --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5a55b3a8a9c..d94354df68b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -604,7 +604,7 @@ class FormFile // Show file name with link to download $out.= ''; From 089aa1df330925bea40c15075cdc2ac282a472bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Feb 2017 23:22:47 +0100 Subject: [PATCH 60/97] FIX If bank module on, field must be required to register payment of expense report. --- htdocs/expensereport/payment/payment.php | 38 +++++++++++------------- htdocs/main.inc.php | 2 ++ htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index e361a9954c0..c957b171e79 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class. require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("bills"); +$langs->load("banks"); $chid=GETPOST("id"); $action=GETPOST('action'); @@ -62,22 +63,22 @@ if ($action == 'add_payment') $datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - if (! $_POST["fk_typepayment"] > 0) + if (! ($_POST["fk_typepayment"] > 0)) { - $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")); + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")), null, 'errors'); $error++; } if ($datepaid == '') { - $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Date")); + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("Date")), null, 'errors'); $error++; } - if (! empty($conf->banque->enabled) && ! $accountid > 0) + if (! empty($conf->banque->enabled) && ! ($accountid > 0)) { - $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToCredit")); + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToDebit")), null, 'errors'); $error++; } - + if (! $error) { $paymentid = 0; @@ -163,7 +164,6 @@ $form=new Form($db); // Form to create expense report payment if (GETPOST("action") == 'create') { - $expensereport = new ExpenseReport($db); $expensereport->fetch($chid); @@ -171,11 +171,6 @@ if (GETPOST("action") == 'create') print load_fiche_titre($langs->trans("DoPayment")); - if ($mesg) - { - print "
$mesg
"; - } - print '
'; print ''; print ''; @@ -222,12 +217,15 @@ if (GETPOST("action") == 'create') print "\n"; print ''; - print '
'; - print ''; - print ''; - + if (! empty($conf->banque->enabled)) + { + print ''; + print ''; + print ''; + } + // Number print '
'; print $versiontrans; From 3dd160c6635ebd7eb69bf9defc194eb442229db6 Mon Sep 17 00:00:00 2001 From: altatof Date: Mon, 16 Jan 2017 09:17:37 +0100 Subject: [PATCH 24/97] use dol_escape_htmltag --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index cc6b61b236e..0c9e4f3226e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -739,7 +739,7 @@ class ExtraFields } elseif ($type == 'varchar') { - $out=''; + $out=''; } elseif ($type == 'text') { From 9c60474953b5aa0d393d4d93d1fb3abafcf405d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 11:06:17 +0100 Subject: [PATCH 25/97] FIX #6277 --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 51b6aa48e84..960c0db42c4 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -314,7 +314,7 @@ if ($id > 0 || ! empty($ref)) if ($commande->methode_commande) { - print '
'.$langs->trans("Method").''.$commande->methode_commande.'
'.$langs->trans("Method").''.$commande->getInputMethod().'
'; - $out.= ' Date: Wed, 25 Jan 2017 09:26:26 +0100 Subject: [PATCH 33/97] FIX: add entity param to document link --- htdocs/societe/soc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 181f95e43c6..f3f87ba6f79 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -2524,7 +2524,7 @@ else $var=true; - print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang); + print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang); print '
'; From eac6ac024770b668f4e8f60b006c96d1d63d5aa9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Jan 2017 10:41:02 +0100 Subject: [PATCH 34/97] Fix fields into projet export --- htdocs/core/modules/modProjet.class.php | 19 ++++++++++++------- htdocs/filefunc.inc.php | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index c21390c3ece..67ee51a56a9 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -213,18 +213,23 @@ class modProjet extends DolibarrModules $this->export_dependencies_array[$r]=array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid'); $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label', - 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', - 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", + 's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', + 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text", 'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text", 'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text"); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', - 's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company'); + 's.phone'=>'company','s.email'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company'); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', - 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', - 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description"); - + 's.phone'=>'Phone','s.email'=>'Email','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', + 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.opp_amount'=>'OpportunityAmount','p.description'=>"Description"); + if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + unset($this->export_fields_array[$r]['p.opp_percent']); + unset($this->export_fields_array[$r]['p.opp_amount']); + unset($this->export_fields_array[$r]['cls.code']); + } + // Add fields for project $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array()); $keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra'; diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index eddcf1ebbdf..c0f95fe76f7 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.4'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.5'); if (! defined('EURO')) define('EURO',chr(128)); From 4839d06fc3249c077a788c51c518301eaa1e1e62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Jan 2017 12:48:32 +0100 Subject: [PATCH 35/97] Fix log --- dev/initdemo/initdemo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/initdemo/initdemo.sh b/dev/initdemo/initdemo.sh index c34d9e2ffda..940f0b59467 100755 --- a/dev/initdemo/initdemo.sh +++ b/dev/initdemo/initdemo.sh @@ -174,7 +174,7 @@ then echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images" cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images" else - echo Detection of documents directory $documentdir failed so demo files were not copied. + echo Detection of documents directory from $mydir failed so demo files were not copied. fi From 7b6488b1c79a9b1fdcd5d1a3cc9b5cadd27c2ace Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 27 Jan 2017 10:05:57 +0100 Subject: [PATCH 36/97] Fix numbering was disaplying technical error instead of error message --- htdocs/commande/class/commande.class.php | 3 ++- htdocs/compta/facture/class/facture.class.php | 3 ++- htdocs/fourn/class/fournisseur.facture.class.php | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index e554990892c..268459a3c12 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -239,7 +239,8 @@ class Commande extends CommonOrder } else { - dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); + $this->error=$obj->error; + //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); return ""; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f15526f34ba..623a355023e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3003,7 +3003,8 @@ class Facture extends CommonInvoice * set up mask. */ if ($mode != 'last' && !$numref) { - dol_print_error($this->db,"Facture::getNextNumRef ".$obj->error); + $this->error=$obj->error; + //dol_print_error($this->db,"Facture::getNextNumRef ".$obj->error); return ""; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index bc7f5bfdca6..27b7627f450 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1627,6 +1627,7 @@ class FactureFournisseur extends CommonInvoice } else { + $this->error=$obj->error; //dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); return false; } From 4bce208035259953b39f580063bf2c9908d36a77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 12:42:02 +0100 Subject: [PATCH 37/97] FIX detail of deposit and credit not was not visible into final invoice --- htdocs/core/tpl/objectline_view.tpl.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 559cae91464..fabba837e21 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -69,19 +69,20 @@ if (empty($usemargins)) $usemargins=0; description) { - if ($line->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) + if ($line->description == '(CREDIT_NOTE)' && $line->fk_remise_except > 0) { $discount=new DiscountAbsolute($this->db); $discount->fetch($line->fk_remise_except); echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); } - elseif ($line->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) + elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) { $discount=new DiscountAbsolute($this->db); $discount->fetch($line->fk_remise_except); echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); // Add date of deposit - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) + echo ' ('.dol_print_date($discount->datec).')'; } else { From 1e78c4c4182906599b464360aa40517d8324b776 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 14:54:06 +0100 Subject: [PATCH 38/97] FIX Change the customer code only if error on duplicate --- htdocs/societe/soc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index f3f87ba6f79..d3c8240417f 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -509,8 +509,8 @@ if (empty($reshook)) } else { - - if($result == -3) { + if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') // TODO Sometime errors on duplicate on profid and not on code, so + { $duplicate_code_error = true; $object->code_fournisseur = null; $object->code_client = null; From e2ce31e1a7ed7dd9023825dd7566c2642c92415f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 14:54:51 +0100 Subject: [PATCH 39/97] Add code comment --- htdocs/margin/lib/margins.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index 84d7945ec0d..d7dbd5d81eb 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -109,7 +109,7 @@ function marges_prepare_head() * @param float $localtax2_tx Vat rate special 2 (not used) * @param int $fk_pa Id of buying price (prefer set this to 0 and provide $paht instead. With id, buying price may have change) * @param float $paht Buying price without tax - * @return array Array of margin info + * @return array Array of margin info (buying price, marge rate, marque rate) */ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $paht) { @@ -134,7 +134,7 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta } else { - $paht_ret = $paht; + $paht_ret = $paht; } // Calculate selling unit price including line discount From c88e63ecc972eafaf70752144c4f5735529ca47e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 15:01:17 +0100 Subject: [PATCH 40/97] FIX #6259 --- htdocs/compta/facture/class/facture.class.php | 15 +++++- htdocs/core/class/html.formmargin.class.php | 49 ++++++++++--------- 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f15526f34ba..2d76242ccc4 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1164,7 +1164,7 @@ class Facture extends CommonInvoice { $this->lines=array(); - $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, '; + $sql = 'SELECT l.rowid, l.fk_facture, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, '; $sql.= ' l.situation_percent, l.fk_prev_id,'; $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,'; $sql.= ' l.rang, l.special_code,'; @@ -1191,6 +1191,7 @@ class Facture extends CommonInvoice $line->id = $objp->rowid; $line->rowid = $objp->rowid; // deprecated + $line->fk_facture = $objp->fk_facture; $line->label = $objp->custom_label; // deprecated $line->desc = $objp->description; // Description line $line->description = $objp->description; // Description line @@ -1443,6 +1444,18 @@ class Facture extends CommonInvoice $facligne->rang=-1; $facligne->info_bits=2; + // Get buy/cost price of invoice that is source of discount + if ($remise->fk_facture_source > 0) + { + $srcinvoice=new Facture($this->db); + $srcinvoice->fetch($remise->fk_facture_source); + $totalcostpriceofinvoice=0; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; // TODO Move this into commonobject + $formmargin=new FormMargin($this->db); + $arraytmp=$formmargin->getMarginInfosArray($srcinvoice, false); + $facligne->pa_ht = $arraytmp['pa_total']; + } + $facligne->total_ht = -$remise->amount_ht; $facligne->total_tva = -$remise->amount_tva; $facligne->total_ttc = -$remise->amount_ttc; diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 6678d87ca60..6d29125df6c 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -48,6 +48,7 @@ class FormMargin /** * get array with margin information from lines of object + * TODO Move this in common class. * * @param CommonObject $object Object we want to get margin information for * @param boolean $force_price True of not @@ -92,19 +93,23 @@ class FormMargin $line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100)); } + $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); + $pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign + $pa = $line->qty * $pa_ht; + // calcul des marges if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise - $pa = $line->qty * $line->pa_ht; - $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit $marginInfos['pa_products'] += $pa; $marginInfos['pv_products'] += $pv; $marginInfos['pa_total'] += $pa; $marginInfos['pv_total'] += $pv; // if credit note, margin = -1 * (abs(selling_price) - buying_price) - if ($pv < 0) - $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa); - else + //if ($pv < 0) + //{ + // $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa); + //} + //else $marginInfos['margin_on_products'] += $pv - $pa; } elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service @@ -113,9 +118,9 @@ class FormMargin $marginInfos['pa_total'] += $pa; $marginInfos['pv_total'] += $pv; // if credit note, margin = -1 * (abs(selling_price) - buying_price) - if ($pv < 0) - $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); - else + //if ($pv < 0) + // $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); + //else $marginInfos['margin_on_services'] += $pv - $pa; } elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total @@ -126,29 +131,29 @@ class FormMargin else { $type=$line->product_type?$line->product_type:$line->fk_product_type; if ($type == 0) { // product - $pa = $line->qty * $line->pa_ht; - $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pa_products'] += $pa; $marginInfos['pv_products'] += $pv; $marginInfos['pa_total'] += $pa; $marginInfos['pv_total'] += $pv; // if credit note, margin = -1 * (abs(selling_price) - buying_price) - if ($pv < 0) - $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa); - else - $marginInfos['margin_on_products'] += $pv - $pa; + //if ($pv < 0) + //{ + // $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa); + //} + //else + //{ + $marginInfos['margin_on_products'] += $pv - $pa; + //} } elseif ($type == 1) { // service - $pa = $line->qty * $line->pa_ht; - $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pa_services'] += $pa; $marginInfos['pv_services'] += $pv; $marginInfos['pa_total'] += $pa; $marginInfos['pv_total'] += $pv; // if credit note, margin = -1 * (abs(selling_price) - buying_price) - if ($pv < 0) - $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); - else + //if ($pv < 0) + // $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); + //else $marginInfos['margin_on_services'] += $pv - $pa; } } @@ -164,9 +169,9 @@ class FormMargin $marginInfos['mark_rate_services'] = 100 * $marginInfos['margin_on_services'] / $marginInfos['pv_services']; // if credit note, margin = -1 * (abs(selling_price) - buying_price) - if ($marginInfos['pv_total'] < 0) - $marginInfos['total_margin'] = -1 * (abs($marginInfos['pv_total']) - $marginInfos['pa_total']); - else + //if ($marginInfos['pv_total'] < 0) + // $marginInfos['total_margin'] = -1 * (abs($marginInfos['pv_total']) - $marginInfos['pa_total']); + //else $marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total']; if ($marginInfos['pa_total'] > 0) $marginInfos['total_margin_rate'] = 100 * $marginInfos['total_margin'] / $marginInfos['pa_total']; From 2c07d2df22d08cf7a866323cf667d5ce6278eaaf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 15:08:46 +0100 Subject: [PATCH 41/97] Add comments --- htdocs/margin/agentMargins.php | 1 + htdocs/margin/customerMargins.php | 1 + htdocs/margin/productMargins.php | 1 + 3 files changed, 3 insertions(+) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 66bdbb26f8e..d5f50d7529c 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -115,6 +115,7 @@ $sql = "SELECT"; if ($agentid > 0) $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; $sql.= " u.rowid as agent, u.login, u.lastname, u.firstname,"; $sql.= " sum(d.total_ht) as selling_price,"; +// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this) $sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; $sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge" ; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 7f6d5a951c2..3d95d2ae091 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -164,6 +164,7 @@ $sql = "SELECT"; $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; if ($client) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; $sql.= " sum(d.total_ht) as selling_price,"; +// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this) $sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; $sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index b4609633447..ac9d61fb814 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -166,6 +166,7 @@ $sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity," if ($id > 0) $sql.= " d.fk_product,"; if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; $sql.= " SUM(d.total_ht) as selling_price,"; +// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this) $sql.= " SUM(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; $sql.= " SUM(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; From 4f76626f51adf5e4e07569c19d74e4d4a6030c6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 15:55:44 +0100 Subject: [PATCH 42/97] FIX Creation of credit note on invoice with deposit stole the discount. --- htdocs/compta/facture.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 22 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index abce93d9d90..f900e2889a3 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -812,14 +812,14 @@ if (empty($reshook)) $line->fk_parent_line = $fk_parent_line; $line->subprice =-$line->subprice; // invert price for object - $line->pa_ht = -$line->pa_ht; + $line->pa_ht = $line->pa_ht; // we choosed to have buy/cost price always positive, so no revert of sign here $line->total_ht=-$line->total_ht; $line->total_tva=-$line->total_tva; $line->total_ttc=-$line->total_ttc; $line->total_localtax1=-$line->total_localtax1; $line->total_localtax2=-$line->total_localtax2; - $result = $line->insert(); + $result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked $object->lines[] = $line; // insert new line in current object diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2d76242ccc4..36046fa8010 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4096,10 +4096,11 @@ class FactureLigne extends CommonInvoiceLine /** * Insert line into database * - * @param int $notrigger 1 no triggers - * @return int <0 if KO, >0 if OK + * @param int $notrigger 1 no triggers + * @param int $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another + * @return int <0 if KO, >0 if OK */ - function insert($notrigger=0) + function insert($notrigger=0, $noerrorifdiscountalreadylinked=0) { global $langs,$user,$conf; @@ -4243,13 +4244,16 @@ class FactureLigne extends CommonInvoiceLine // Check if discount was found if ($result > 0) { - // Check if discount not already affected to another invoice - if ($discount->fk_facture) + // Check if discount not already affected to another invoice + if ($discount->fk_facture_line > 0) { - $this->error=$langs->trans("ErrorDiscountAlreadyUsed",$discount->id); - dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); - $this->db->rollback(); - return -3; + if (empty($noerrorifdiscountalreadylinked)) + { + $this->error=$langs->trans("ErrorDiscountAlreadyUsed",$discount->id); + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); + $this->db->rollback(); + return -3; + } } else { From c79137d14cae26a33711b0fc689c2172d547db00 Mon Sep 17 00:00:00 2001 From: arnaud Date: Mon, 30 Jan 2017 17:29:01 +0100 Subject: [PATCH 43/97] FIX Supplier Order list filter by project --- htdocs/fourn/commande/list.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index c8d333f578d..33b9c81fd0c 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -77,6 +77,7 @@ $search_total_vat=GETPOST('search_total_vat','alpha'); $search_total_ttc=GETPOST('search_total_ttc','alpha'); $optioncss = GETPOST('optioncss','alpha'); $billed = GETPOST('billed','int'); +$search_project_ref=GETPOST('search_project_ref','alpha'); $page = GETPOST('page','int'); $sortorder = GETPOST('sortorder','alpha'); @@ -204,6 +205,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $deliverymonth=''; $deliveryyear=''; $billed=''; + $search_project_ref=''; $search_array_options=array(); } @@ -350,6 +352,7 @@ if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.elemen if ($search_total_ht != '') $sql.= natural_search('cf.total_ht', $search_total_ht, 1); if ($search_total_vat != '') $sql.= natural_search('cf.tva', $search_total_vat, 1); if ($search_total_ttc != '') $sql.= natural_search('cf.total_ttc', $search_total_ttc, 1); +if ($search_project_ref != '') $sql.= natural_search("p.ref",$search_project_ref); // Add where from extra fields foreach ($search_array_options as $key => $val) From 90e8f062e93c6ef1cdc294272fa158183d82cd6f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 31 Jan 2017 10:23:03 +0100 Subject: [PATCH 44/97] Fix : link to user in bank was wrong regarding expensereport payment --- .../expensereport/class/paymentexpensereport.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 4c9c5843a49..9b05313a581 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -527,13 +527,14 @@ class PaymentExpenseReport extends CommonObject { if ($mode == 'payment_expensereport') { - $euser = new User($this->db); - $euser->fetch($key); + $er = new ExpenseReport($this->db); + $er->fetch($key); + $er->fetch_user($er->fk_user_author); $result=$acc->add_url_line( $bank_line_id, - $euser->id, + $er->user->id, DOL_URL_ROOT.'/user/card.php?id=', - $euser->getFullName($langs), + $er->user->getFullName($langs), 'user' ); if ($result <= 0) From d7060b0c4b8c53a578da5933d336eeee9b534579 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Feb 2017 03:14:21 +0100 Subject: [PATCH 45/97] FIX #6360 --- htdocs/societe/class/societe.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 12d7fcd77ef..7df273b7bf8 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3428,7 +3428,9 @@ class Societe extends CommonObject */ public function setCategories($categories, $type) { - // Decode type + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + + // Decode type if ($type == 'customer') { $type_id = Categorie::TYPE_CUSTOMER; $type_text = 'customer'; @@ -3446,7 +3448,6 @@ class Societe extends CommonObject } // Get current categories - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $c = new Categorie($this->db); $existing = $c->containing($this->id, $type_id, 'id'); From 480d099d81764beb334d0c14fe2e998d7d5240d2 Mon Sep 17 00:00:00 2001 From: arnaud Date: Fri, 3 Feb 2017 16:19:13 +0100 Subject: [PATCH 46/97] Fix project filter traduction --- htdocs/fourn/facture/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 27c14f2a8d4..66411dc8422 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -46,6 +46,7 @@ if (!$user->rights->fournisseur->facture->lire) accessforbidden(); $langs->load("bills"); $langs->load("companies"); $langs->load('products'); +$langs->load('projects'); $socid = GETPOST('socid','int'); From d56b5f30c88818d1f844279aeb046f0b897ff7c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Feb 2017 01:34:21 +0100 Subject: [PATCH 47/97] FIX #6330 --- htdocs/admin/external_rss.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index f18a3fe86b6..8e550f98c99 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -46,14 +46,17 @@ $action=GETPOST('action'); */ // positionne la variable pour le nombre de rss externes -$sql ="SELECT MAX(".$db->decrypt('name').") as name FROM ".MAIN_DB_PREFIX."const"; +$sql ="SELECT ".$db->decrypt('name')." as name FROM ".MAIN_DB_PREFIX."const"; $sql.=" WHERE ".$db->decrypt('name')." LIKE 'EXTERNAL_RSS_URLRSS_%'"; -$result=$db->query($sql); +//print $sql; +$result=$db->query($sql); // We can't use SELECT MAX() because EXTERNAL_RSS_URLRSS_10 is lower than EXTERNAL_RSS_URLRSS_9 if ($result) { - $obj = $db->fetch_object($result); - preg_match('/([0-9]+)$/i',$obj->name,$reg); - if ($reg[1]) $lastexternalrss = $reg[1]; + while ($obj = $db->fetch_object($result)) + { + preg_match('/([0-9]+)$/i',$obj->name,$reg); + if ($reg[1] && $reg[1] > $lastexternalrss) $lastexternalrss = $reg[1]; + } } else { From d5978a5092b36b3669fd019174d89da533ec52c2 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Tue, 7 Feb 2017 14:02:27 +0100 Subject: [PATCH 48/97] Fix: Wrong vat calculation when split discounts --- htdocs/comm/remx.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index e358b842d2d..408135b552b 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -109,7 +109,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') $newdiscount2->amount_ttc=price2num($discount->amount_ttc-$newdiscount1->amount_ttc); $newdiscount1->amount_ht=price2num($newdiscount1->amount_ttc/(1+$newdiscount1->tva_tx/100),'MT'); $newdiscount2->amount_ht=price2num($newdiscount2->amount_ttc/(1+$newdiscount2->tva_tx/100),'MT'); - $newdiscount1->amount_tva=price2num($newdiscount1->amount_ttc-$newdiscount2->amount_ht); + $newdiscount1->amount_tva=price2num($newdiscount1->amount_ttc-$newdiscount1->amount_ht); $newdiscount2->amount_tva=price2num($newdiscount2->amount_ttc-$newdiscount2->amount_ht); $db->begin(); From ab0783edcc90b6316ed40f315e5233a5293ddf16 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 8 Feb 2017 17:18:06 +0100 Subject: [PATCH 49/97] FIX #6234 --- htdocs/compta/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 8d0cc61d5d6..59061042e7e 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -703,7 +703,7 @@ if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); -if ($search_montant_vat != '') $sql.= natural_search('f.total_vat', $search_montant_vat, 1); +if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); if ($search_status != '' && $search_status >= 0) { From c01988ba438e1e74f6b88b8a1d4929682ab728a5 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 9 Feb 2017 17:28:37 +0100 Subject: [PATCH 50/97] FIX : delete bank class lines when we delete bank_categ --- htdocs/compta/bank/categ.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 00755959ab9..176f8d6101b 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -87,6 +87,17 @@ if ($action == 'delete') { if (GETPOST('categid')) { + // Delete bank class + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class"; + $sql.= " WHERE fk_categ = '".GETPOST('categid')."'"; + + $result = $db->query($sql); + if (!$result) + { + dol_print_error($db); + } + + // Delete bank categ $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ"; $sql.= " WHERE rowid = '".GETPOST('categid')."'"; $sql.= " AND entity = ".$conf->entity; From d463511cffc222dc86f2246bd3e7945c65322923 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2017 17:24:47 +0100 Subject: [PATCH 51/97] Fix: no way to know type of invoice. --- htdocs/core/modules/modFacture.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 9ba9fae7322..a83f581a276 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -192,11 +192,11 @@ class modFacture extends DolibarrModules $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='bill'; $this->export_permission[$r]=array(array("facture","facture","export","other")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.type'=>"Type",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode'); //Add 'fd.label'=>"Label" to export_fields_array if you use it. Not used by dolibarr currently. //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text", 'pj.ref'=>'Text', 'fd.label'=>'Text', 'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice", 'pj.ref'=>'project', 'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user'); + $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.type'=>"Numeric",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text", 'pj.ref'=>'Text', 'fd.label'=>'Text', 'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text'); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.type'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice", 'pj.ref'=>'project', 'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user'); $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; @@ -224,10 +224,10 @@ class modFacture extends DolibarrModules $this->export_label[$r]='CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='bill'; $this->export_permission[$r]=array(array("facture","facture","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'IdPaymentMode','pt.libelle'=>'LabelPaymentMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.type'=>"Type",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'IdPaymentMode','pt.libelle'=>'LabelPaymentMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Numeric','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric'); - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pj.ref'=>'Text','p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','pt.libelle'=>'text','ba.ref'=>'Text'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'pj.ref'=>'project','p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','pt.libelle'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account'); + $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.type'=>"Numeric",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pj.ref'=>'Text','p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','pt.libelle'=>'text','ba.ref'=>'Text'); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.type'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'pj.ref'=>'project','p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','pt.libelle'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account'); $this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; From b356c34dc47d1ba00bb25e8f0e865d727f7f0eb5 Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Sun, 12 Feb 2017 17:22:06 +0100 Subject: [PATCH 52/97] [mail; password; forgotten][#6334] - Fix mail url Fix the mail url on password generation --- htdocs/user/class/user.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index cd0000c1e60..79e17fd3f81 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1653,12 +1653,12 @@ class User extends CommonObject // Define $urlwithroot //$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current if (! $changelater) { - $url = $urlwithroot.'/'; + $url = $dolibarr_main_url_root.'/'; $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n"; @@ -1674,7 +1674,7 @@ class User extends CommonObject } else { - $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); + $url = $dolibarr_main_url_root.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n"; From bf32acaadda0a8c0908387bb95f9c0df9c6a2109 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2017 01:13:41 +0100 Subject: [PATCH 53/97] Fix control of module format. --- htdocs/admin/tools/update.php | 12 +++++++++--- htdocs/langs/en_US/errors.lang | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index e306862b67a..b062f509388 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -69,12 +69,18 @@ if ($action=='install') } else { - if (! preg_match('/\.zip/i',$original_file)) + if (! preg_match('/\.zip$/i',$original_file)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), null, 'errors'); $error++; } + if (! preg_match('/module_.*\-[\d]+\.[\d]+.*$/i',$original_file)) + { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules",$original_file, 'module_*-x.y*.zip'), null, 'errors'); + $error++; + } } if (! $error) @@ -117,7 +123,7 @@ if ($action=='install') //var_dump($modulenamedir); if (! dol_is_dir($modulenamedir)) { - setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat"), null, 'errors'); + setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'
Dir not found: '.$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename.'
'.$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename, null, 'errors'); $error++; } } @@ -168,7 +174,7 @@ print load_fiche_titre($langs->trans("Upgrade"),'','title_setup'); print $langs->trans("CurrentVersion").' : '.DOL_VERSION.'
'; -if (function_exists('curl_init')) +if (!function_exists('curl_init')) { $result = getURLContent('http://sourceforge.net/projects/dolibarr/rss'); //var_dump($result['content']); diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 0e0b3e40960..2596aef5ee8 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -177,6 +177,8 @@ ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enough for product %s t ErrorFailedToLoadLoginFileForMode=Failed to get the login key for mode '%s'. ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information. ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter time consumed. +ErrorModuleFileSeemsToHaveAWrongFormat=The module package seems to have a wrong format. +ErrorFilenameDosNotMatchDolibarrPackageRules=The name of the module package (%s) does not match expected name syntax: %s # 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 25e8caa64efac4a15c4e51eece7e429c6cb30e5c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2017 01:37:12 +0100 Subject: [PATCH 54/97] Fix reversing test for a test --- htdocs/admin/tools/update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index b062f509388..c4f63c21c8c 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -174,7 +174,7 @@ print load_fiche_titre($langs->trans("Upgrade"),'','title_setup'); print $langs->trans("CurrentVersion").' : '.DOL_VERSION.'
'; -if (!function_exists('curl_init')) +if (function_exists('curl_init')) { $result = getURLContent('http://sourceforge.net/projects/dolibarr/rss'); //var_dump($result['content']); From 294517a8e0b1bd525d5d49e2fd99f84ae8a8254c Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Mon, 13 Feb 2017 16:49:10 +0100 Subject: [PATCH 55/97] use already existing variable --- htdocs/user/class/user.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 79e17fd3f81..ab76948fea4 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1652,13 +1652,12 @@ class User extends CommonObject $subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword", $appli); // Define $urlwithroot - //$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); - //$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); + $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file if (! $changelater) { - $url = $dolibarr_main_url_root.'/'; + $url = $urlwithroot.'/'; $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n"; @@ -1674,7 +1673,7 @@ class User extends CommonObject } else { - $url = $dolibarr_main_url_root.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); + $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n"; From e903bf2b5c8fecd35478cd4ca323710f7d03985a Mon Sep 17 00:00:00 2001 From: fmarcet Date: Tue, 14 Feb 2017 18:55:39 +0100 Subject: [PATCH 56/97] Fix: Bad code makes don't work for external modules numeration model --- htdocs/comm/propal/class/propal.class.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index d94932d10c8..68966bae711 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1138,12 +1138,6 @@ class Propal extends CommonObject $clonedObj->id=0; $clonedObj->statut=self::STATUS_DRAFT; - if (empty($conf->global->PROPALE_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php")) - { - $this->error='ErrorSetupNotComplete'; - return -1; - } - // Clear fields $clonedObj->user_author = $user->id; $clonedObj->user_valid = ''; @@ -1152,12 +1146,6 @@ class Propal extends CommonObject $clonedObj->fin_validite = $clonedObj->date + ($clonedObj->duree_validite * 24 * 3600); if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $clonedObj->ref_client = ''; - // Set ref - require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.'.php'; - $obj = $conf->global->PROPALE_ADDON; - $modPropale = new $obj; - $clonedObj->ref = $modPropale->getNextValue($objsoc,$clonedObj); - // Create clone $result=$clonedObj->create($user); From 89e6d86bf7d9073e6a63234561f5edba3a92553d Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 15 Feb 2017 09:08:27 +0100 Subject: [PATCH 57/97] FIX #6411 --- htdocs/core/boxes/box_services_contracts.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 9f71a98e77f..752509a0616 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -70,15 +70,12 @@ class box_services_contracts extends ModeleBoxes $sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut, cd.label, cd.description, cd.product_type as type,"; $sql.= " p.rowid as product_id, p.ref as product_ref"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s"; - $sql.= ", ".MAIN_DB_PREFIX."contrat as c"; - $sql.= ", ".MAIN_DB_PREFIX."contratdet as cd"; + $sql.= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc"; + $sql.= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= "INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= ")"; $sql.= " WHERE c.entity = ".$conf->entity; - $sql.= " AND s.rowid = c.fk_soc"; - $sql.= " AND c.rowid = cd.fk_contrat"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; $sql.= $db->order("c.tms","DESC"); $sql.= $db->plimit($max, 0); From c175dfe68bdfa20c12bea5aac5b1046ce7f20208 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Wed, 15 Feb 2017 09:47:18 +0100 Subject: [PATCH 58/97] Fix: Bad code makes don't work for external modules numeration model --- htdocs/comm/propal/class/propal.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 68966bae711..f272120477f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1136,6 +1136,7 @@ class Propal extends CommonObject } $clonedObj->id=0; + $clonedObj->ref=''; $clonedObj->statut=self::STATUS_DRAFT; // Clear fields From 0a9ffa58c1d749cea2bf8214972fbd21a3964c25 Mon Sep 17 00:00:00 2001 From: jfefe Date: Mon, 20 Feb 2017 09:00:39 +0100 Subject: [PATCH 59/97] FIX : event status is not modified when assign an user --- htdocs/comm/action/card.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index cd1c9ecfd1b..a6878473fea 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -853,6 +853,9 @@ if ($id > 0) $result3=$object->fetch_contact(); $result4=$object->fetch_userassigned(); $result5=$object->fetch_optionals($id,$extralabels); + + $percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):(in_array(GETPOST('complete'),array(-1,100))?GETPOST('complete'):GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status + if($listUserAssignedUpdated || $donotclearsession) { @@ -1030,7 +1033,7 @@ if ($id > 0) // Status print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; - $percent=GETPOST("percentage")?GETPOST("percentage"):$object->percentage; + $percent = GETPOST("percentage") ? GETPOST("percentage"): $object->percentage; $formactions->form_select_status_action('formaction',$percent,1); print '
'.$langs->trans('AccountToDebit').''; - $form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$expensereport->accountid, "accountid", 0, '',1); // Show open bank account list - print '
'.$langs->trans('AccountToDebit').''; + $form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$expensereport->accountid, "accountid", 0, '',1); // Show open bank account list + print '
'.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; @@ -243,9 +241,7 @@ if (GETPOST("action") == 'create') dol_fiche_end(); - /* - * Autres charges impayees - */ + // List of expenses ereport not already paid completely $num = 1; $i = 0; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5105a8eef32..40d1326c45e 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1700,8 +1700,10 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra else $appli.=" ".DOL_VERSION; print '
'; if ($doliurl) print ''; + else print ''; print $appli; if ($doliurl) print ''; + else print ''; print '
'."\n"; // Link to bugtrack diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 72d63b55ff6..76cbad28f00 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1475,7 +1475,7 @@ font.vsmenudisabled { font-size:px; font-family: ; white-space: nowrap; } font.vsmenudisabledmargin { margin: 1px 1px 1px 8px; } -a.help:link, a.help:visited, a.help:hover, a.help:active { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #666666; text-decoration: none; } +a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #666666; text-decoration: none; } .vmenu div.blockvmenufirst, .vmenu div.blockvmenulogo, .vmenu div.blockvmenusearchphone, .vmenu div.blockvmenubookmarks { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index ad9bda1b4dd..32c0604386c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1512,7 +1512,7 @@ font.vsmenudisabled { font-size:px; font-family: ; white-space: nowrap; } font.vsmenudisabledmargin { margin: 1px 1px 1px 8px; } -a.help:link, a.help:visited, a.help:hover, a.help:active { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #666666; text-decoration: none; } +a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #666666; text-decoration: none; } div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks From 32678015c98b49dc190e4af09ca86346439397ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2017 23:52:13 +0100 Subject: [PATCH 61/97] FIX protection against infinite loop on hierarchy --- htdocs/core/lib/treeview.lib.php | 9 ++++++--- htdocs/user/class/user.class.php | 28 ++++++++++++++++++++-------- htdocs/user/hierarchy.php | 10 +++++++++- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index 6fc0c9f013f..db0fcd07fae 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -97,7 +97,7 @@ function tree_showpad(&$fulltree,$key,$silent=0) // ------------------------------- Used by menu editor, category view, ... ----------------- /** - * Recursive function to output menu tree.
  • ...
+ * Recursive function to output a tree.
  • ...
* It is also used for the tree of categories. * Note: To have this function working, check you have loaded the js and css for treeview. * $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', @@ -106,7 +106,7 @@ function tree_showpad(&$fulltree,$key,$silent=0) * TODO Replace with jstree plugin instead of treeview plugin. * * @param array $tab Array of all elements - * @param int $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>) + * @param array $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>) * @param int $rang Level of element * @param string $iddivjstree Id to use for parent ul element * @param int $donoresetalreadyloaded Do not reset global array $donoresetalreadyloaded used to avoid to go down on an aleady processed record @@ -139,7 +139,10 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal print '
    '; } - if ($rang > 50) return; // Protect against infinite loop. Max 50 depth + if ($rang > 50) + { + return; // Protect against infinite loop. Max 50 depth + } //ballayage du tableau $sizeoftab=count($tab); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ab76948fea4..c4b4ac48250 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2544,7 +2544,12 @@ class User extends CommonObject dol_syslog(get_class($this)."::get_full_tree call to build_path_from_id_user", LOG_DEBUG); foreach($this->users as $key => $val) { - $this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent) + $result = $this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent) + if ($result < 0) + { + $this->error='ErrorLoopInHierarchy'; + return -1; + } } // Exclude leaf including $deleteafterid from tree @@ -2601,10 +2606,10 @@ class User extends CommonObject * Function called by get_full_tree(). * * @param int $id_user id_user entry to update - * @param int $protection Deep counter to avoid infinite loop - * @return void + * @param int $protection Deep counter to avoid infinite loop (no more required, a protection is added with array useridfound) + * @return int < 0 if KO (infinit loop), >= 0 if OK */ - function build_path_from_id_user($id_user,$protection=1000) + function build_path_from_id_user($id_user,$protection=0) { dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG); @@ -2612,7 +2617,7 @@ class User extends CommonObject { // Already defined dol_syslog(get_class($this)."::build_path_from_id_user fullpath and fullname already defined", LOG_WARNING); - return; + return 0; } // Define fullpath and fullname @@ -2620,9 +2625,16 @@ class User extends CommonObject $this->users[$id_user]['fullname'] = $this->users[$id_user]['lastname']; $i=0; $cursor_user=$id_user; - while ((empty($protection) || $i < $protection) && ! empty($this->parentof[$cursor_user])) + $useridfound=array($id_user); + while (! empty($this->parentof[$cursor_user])) { - $this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath']; + if (in_array($this->parentof[$cursor_user], $useridfound)) + { + dol_syslog("The hierarchy of user has a recursive loop", LOG_WARNING); + return -1; // Should not happen. Protection against looping hierarchy + } + $useridfound[]=$this->parentof[$cursor_user]; + $this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath']; $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['lastname'].' >> '.$this->users[$id_user]['fullname']; $i++; $cursor_user=$this->parentof[$cursor_user]; } @@ -2630,7 +2642,7 @@ class User extends CommonObject // We count number of _ to have level $this->users[$id_user]['level']=dol_strlen(preg_replace('/[^_]/i','',$this->users[$id_user]['fullpath'])); - return; + return 1; } /** diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index 66d725b3204..11f115278ee 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -71,9 +71,15 @@ print load_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("Hierarc // Load hierarchy of users $user_arbo = $userstatic->get_full_tree(0, ($search_statut != '' && $search_statut >= 0) ? "statut = ".$search_statut : ''); +if (! is_array($user_arbo) && $user_arbo < 0) +{ + setEventMessages($userstatic->error, $userstatic->errors, 'warnings'); +} +else +{ // Define fulltree array $fulltree=$user_arbo; - +//var_dump($fulltree); // Define data (format for treeview) $data=array(); $data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); @@ -131,6 +137,7 @@ foreach($fulltree as $key => $val) ); } +//var_dump($data); print ''."\n"; @@ -185,6 +192,7 @@ else print "
"; print "\n"; +} // /*print '