From 6b557fd92f75e4ce8783f2ed647658472e87546a Mon Sep 17 00:00:00 2001 From: fappels Date: Tue, 17 Oct 2017 22:19:45 +0200 Subject: [PATCH 01/76] Fix old batches not displayed in multi warehouse shipping Old batches not available in product_lot table are not shown for shipping from multiple warehouses --- htdocs/expedition/card.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f0aaad677d6..6bd275d94d2 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1212,11 +1212,16 @@ if ($action == 'create') print ''; print ''; - //print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); $productlotObject->fetch(0, $line->fk_product, $dbatch->batch); - print $langs->trans("Batch").': '.$productlotObject->getNomUrl(1); - print ' ('.$dbatch->qty.')'; - //print $langs->trans("DetailBatchFormat", 'ee'.$dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); + if (!empty($productlotObject->batch)) + { + print $langs->trans("Batch").': '.$productlotObject->getNomUrl(1); + print ' ('.$dbatch->qty.')'; + } + else + { + print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); + } $quantityToBeDelivered -= $deliverableQty; if ($quantityToBeDelivered < 0) { From 3793ae323a8bf3ad7521cd272db6f3e8ba2d3f23 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 19 Oct 2017 09:46:19 +0200 Subject: [PATCH 02/76] FIX : wrong personnal project time spent --- htdocs/core/lib/project.lib.php | 2 +- htdocs/projet/class/task.class.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index fa3967284d9..b70e037cbf4 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -762,7 +762,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ // Time spent by user print ''; - $tmptimespent=$taskstatic->getSummaryOfTimeSpent(); + $tmptimespent=$taskstatic->getSummaryOfTimeSpent('', $fuser->id); if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); else print '--:--'; print "\n"; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index ca8ed73e10d..ae257d6eff4 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -911,9 +911,10 @@ class Task extends CommonObject * Calculate total of time spent for task * * @param int $id Id of object (here task) + * @param int $user_id Filter on user time * @return array Array of info for task array('min_date', 'max_date', 'total_duration') */ - function getSummaryOfTimeSpent($id='') + function getSummaryOfTimeSpent($id='', $user_id='') { global $langs; @@ -927,6 +928,7 @@ class Task extends CommonObject $sql.= " SUM(t.task_duration) as total_duration"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql.= " WHERE t.fk_task = ".$id; + if(!empty($user_id)) $sql.= " AND t.fk_user = ".$user_id; dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG); $resql=$this->db->query($sql); From 9c3805c0d5d5b44daa4de8e4e3e51adb89e2550a Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Thu, 19 Oct 2017 14:10:58 +0200 Subject: [PATCH 03/76] Fix anchor after add line --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture.php | 2 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 407a461a1a1..e0f6b796826 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2239,7 +2239,7 @@ if ($action == 'create') // Show object lines $result = $object->getLinesArray(); - print '
+ print ' diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 9de9ffed222..67978ff99e8 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2433,7 +2433,7 @@ if ($action == 'create' && $user->rights->commande->creer) */ $result = $object->getLinesArray(); - print ' + print ' diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index b6d610c65b6..ad5f69edfc0 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3867,7 +3867,7 @@ else if ($id > 0 || ! empty($ref)) - print ' + print ' diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 74d96158f65..05bbc26e5fc 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2064,7 +2064,7 @@ elseif (! empty($object->id)) //$result = $object->getLinesArray(); - print ' + print ' diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 8402b298f93..f24ed99a9f8 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2584,7 +2584,7 @@ else /* * Lines */ - print ''; + print ''; print ''; print ''; print ''; From 08d5ff4736c799277e91fd76da9aa5e4dfa24e43 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Fri, 20 Oct 2017 12:28:33 +0200 Subject: [PATCH 04/76] Fix shipment ref is empty --- htdocs/expedition/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f0aaad677d6..a5fdbc98dba 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -212,7 +212,7 @@ if (empty($reshook)) $objectsrc->fetch($object->origin_id); $object->socid = $objectsrc->socid; - $object->ref_customer = ''; // We don't use $objectsrc->ref_client, this is ref or order not shipment + $object->ref_customer = GETPOST('ref_customer'); // We don't use $objectsrc->ref_client, this is ref or order not shipment $object->model_pdf = GETPOST('model'); $object->date_delivery = $date_delivery; // Date delivery planed $object->fk_delivery_address = $objectsrc->fk_delivery_address; @@ -692,7 +692,7 @@ if ($action == 'create') else if ($origin == 'propal') print $langs->trans('RefCustomerOrder'); else print $langs->trans('RefCustomer'); print ''; - print $object->ref_client; + print ''; print ''; print ''; From 75580f253e93898c49ff8635bf23741fb5ac02a5 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 20 Oct 2017 12:57:32 +0200 Subject: [PATCH 05/76] FIX: Agenda events are not exported in the ICAL, VCAL if begin exactly with the same $datestart --- htdocs/comm/action/class/actioncomm.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 375365eaf41..c111b8861a6 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2,8 +2,8 @@ /* Copyright (C) 2002-2004 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2015 Marcos García + * Copyright (C) 2011-2017 Juanjo Menent + * Copyright (C) 2015 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1255,6 +1255,7 @@ class ActionComm extends CommonObject { // Note: Output of sql request is encoded in $conf->file->character_set_client // This assignment in condition is not a bug. It allows walking the results. + $diff = 0; while ($obj=$this->db->fetch_object($resql)) { $qualified=true; @@ -1289,8 +1290,9 @@ class ActionComm extends CommonObject if ($qualified && $datestart) { - $eventarray[$datestart]=$event; + $eventarray[$datestart+$diff]=$event; } + $diff++; } } else From eaafe83ae4d55799c6744284f1e63e44d088f73a Mon Sep 17 00:00:00 2001 From: fappels Date: Tue, 24 Oct 2017 16:05:41 +0200 Subject: [PATCH 06/76] Only show old batch number and qty --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 6bd275d94d2..37aed77bce6 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1220,7 +1220,7 @@ if ($action == 'create') } else { - print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); + print $dbatch->batch.' ('.$dbatch->qty.')'; } $quantityToBeDelivered -= $deliverableQty; if ($quantityToBeDelivered < 0) From 08e83983d0466fc7573eb6deaaac5e31942a3369 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Thu, 26 Oct 2017 09:40:12 +0200 Subject: [PATCH 07/76] Fix empty extrafields if from origin --- htdocs/contrat/card.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index d618a7c4b1e..14571949467 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -333,6 +333,15 @@ if (empty($reshook)) $desc = dol_htmlentitiesbr($lines[$i]->desc); } + // Extrafields + $array_options = array(); + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if + // trigger used + { + $lines[$i]->fetch_optionals($lines[$i]->rowid); + $array_options = $lines[$i]->array_options; + } + $txtva = $lines[$i]->vat_src_code ? $lines[$i]->tva_tx . ' (' . $lines[$i]->vat_src_code . ')' : $lines[$i]->tva_tx; // View third's localtaxes for now @@ -355,7 +364,7 @@ if (empty($reshook)) $lines[$i]->info_bits, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, - array(), + $array_options, $lines[$i]->fk_unit ); From 1d0c93c0b6dcf2dcbafe4a17d7b8d7e675ed35cc Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 26 Oct 2017 10:31:14 +0200 Subject: [PATCH 08/76] FIX : #7458 --- htdocs/blockedlog/class/blockedlog.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 8a1508b7a04..b2178bcb039 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -153,7 +153,7 @@ class BlockedLog */ public function setObjectData(&$object) { - if($object->element=='payment') { + if($object->element=='payment' || $object->element=='payment_supplier') { $this->date_object = $object->datepaye; } else{ From 9427b2f4b1569c02dccf3612dc0d744f415d3543 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 26 Oct 2017 10:40:36 +0200 Subject: [PATCH 09/76] fix supplier payamnet blockedlog --- htdocs/blockedlog/class/blockedlog.class.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index b2178bcb039..47de8669dd5 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -119,6 +119,17 @@ class BlockedLog $this->error++; } } + else if($this->element === 'payment_supplier') { + require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; + + $object = new PaiementFourn($this->db); + if($object->fetch($this->fk_object)>0) { + return $object->getNomUrl(1); + } + else{ + $this->error++; + } + } return $langs->trans('ImpossibleToReloadObject', $this->element, $this->fk_object); @@ -511,6 +522,15 @@ class BlockedLog $this->amounts = (double) $obj->amount; } } + if($this->element === 'payment_supplier') { + $sql="SELECT amount FROM ".MAIN_DB_PREFIX."paiementfourn WHERE rowid=".$this->fk_object; + + $res = $this->db->query($sql); + + if($res && $obj = $this->db->fetch_object($res)) { + $this->amounts = (double) $obj->amount; + } + } elseif($this->element === 'facture') { $sql="SELECT total_ttc FROM ".MAIN_DB_PREFIX."facture WHERE rowid=".$this->fk_object; From 5f89b4427f05baa6163e71f2744795591e6da59f Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 26 Oct 2017 10:49:11 +0200 Subject: [PATCH 10/76] fixagain blocked log supplier --- htdocs/blockedlog/class/blockedlog.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 47de8669dd5..4e959c84b20 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -194,13 +194,11 @@ class BlockedLog $this->object_data->note_private= (double) $object->note_private; } - elseif($this->element==='payment'){ + elseif($this->element==='payment'|| $object->element=='payment_supplier'){ $this->object_data->amounts = $object->amounts; } - - } /** From ce6d1d306d4bcfd3b66319013fd5007bb9ad943e Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 26 Oct 2017 11:32:26 +0200 Subject: [PATCH 11/76] FIX : hook formObjectOptions() must use $expe and not $object which is an order here --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index b2715e7d35a..b29867da547 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -777,7 +777,7 @@ if ($action == 'create') // Other attributes $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook) && ! empty($extrafields->attribute_label)) { From a7655b69e87bb6fe0b62552b8ed74db49175b9aa Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 26 Oct 2017 12:13:47 +0200 Subject: [PATCH 12/76] agin fix blockedlog on supplier incvoive payument --- htdocs/blockedlog/class/blockedlog.class.php | 28 +++++++++++++++++++ ..._modBlockedlog_ActionsBlockedLog.class.php | 3 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 4e959c84b20..2ad4582634f 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -108,6 +108,17 @@ class BlockedLog $this->error++; } } + if($this->element === 'invoice_supplier') { + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; + + $object = new FactureFournisseur($this->db); + if($object->fetch($this->fk_object)>0) { + return $object->getNomUrl(1); + } + else{ + $this->error++; + } + } else if($this->element === 'payment') { require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; @@ -193,6 +204,23 @@ class BlockedLog $this->object_data->note_public = (double) $object->note_public; $this->object_data->note_private= (double) $object->note_private; + } + if($this->element === 'invoice_supplier') { + if(empty($object->thirdparty))$object->fetch_thirdparty(); + $this->object_data->thirdparty = new stdClass(); + + foreach($object->thirdparty as $key=>$value) { + if(!is_object($value)) $this->object_data->thirdparty->{$key} = $value; + } + + $this->object_data->total_ht = (double) $object->total_ht; + $this->object_data->total_tva = (double) $object->total_tva; + $this->object_data->total_ttc = (double) $object->total_ttc; + $this->object_data->total_localtax1= (double) $object->total_localtax1; + $this->object_data->total_localtax2= (double) $object->total_localtax2; + $this->object_data->note_public = (double) $object->note_public; + $this->object_data->note_private= (double) $object->note_private; + } elseif($this->element==='payment'|| $object->element=='payment_supplier'){ diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 39dae7c209e..367912a72ec 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -49,7 +49,8 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing if($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED' - || $action === 'BILL_SENTBYMAIL' || $action === 'DOC_DOWNLOAD' || $action === 'DOC_PREVIEW') { + || $action === 'BILL_SENTBYMAIL' || $action === 'DOC_DOWNLOAD' || $action === 'DOC_PREVIEW' + || $action === 'BILL_SUPPLIER_PAYED') { $amounts= (double) $object->total_ttc; } else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK') { From f4a95f89ac323775998dce0c349f622cfe44cf03 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 26 Oct 2017 12:26:25 +0200 Subject: [PATCH 13/76] Ok, now suppliers payment are correctly logged --- .../interface_50_modBlockedlog_ActionsBlockedLog.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 367912a72ec..fbd9469b391 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -53,7 +53,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers || $action === 'BILL_SUPPLIER_PAYED') { $amounts= (double) $object->total_ttc; } - else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK') { + else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK' || $action === 'PAYMENT_SUPPLIER_CREATE') { $amounts = 0; if(!empty($object->amounts)) { foreach($object->amounts as $amount) { From d9d4b6e06db729dbc294ff05359cfdd6d6a31b1e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 26 Oct 2017 13:03:39 +0200 Subject: [PATCH 14/76] Fix : Warning: A non-numeric value encountered in on line 57 58 59 --- htdocs/fourn/facture/document.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 6926770bd91..818c016de04 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -54,6 +54,7 @@ $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } +$page = (is_numeric($page) ? $page : 0); $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; From 0efd118d430ba3c902c570c07bc23a260deaebbe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2017 16:50:38 +0200 Subject: [PATCH 15/76] Fix hook on product list --- htdocs/product/list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 7fd4135bd4a..0beaab3c9c8 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -426,13 +426,14 @@ else $moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT,$search_categ,'search_categ',1); $moreforfilter.=''; } - if ($moreforfilter) + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $moreforfilter.=$hookmanager->resPrint; + else $moreforfilter=$hookmanager->resPrint; + if ($moreforfilter) { print '
'; print $moreforfilter; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; print '
'; } @@ -788,7 +789,7 @@ else } } // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$objp); $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation From 82231b77a246722e33bcb63f59a62d6871ab187c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Oct 2017 01:46:54 +0200 Subject: [PATCH 16/76] Fix data for supplier must be not visible if supplier module off --- htdocs/margin/tabs/thirdpartyMargins.php | 2 +- htdocs/societe/card.php | 11 +++++++---- htdocs/societe/notify/card.php | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index bc8928bdc6e..c0ec385cff6 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -109,7 +109,7 @@ if ($socid > 0) print ''; } - if ($object->fournisseur) + if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) { print ''; print $langs->trans('SupplierCode').''; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 876300aef28..4807591b9f3 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2021,10 +2021,13 @@ else print $object->getLibCustProspStatut(); print ''; - // Prospect/Customer - print ''.$langs->trans('Supplier').''; - print yn($object->fournisseur); - print ''; + // Supplier + if (! empty($conf->fournisseur->enabled)) + { + print ''.$langs->trans('Supplier').''; + print yn($object->fournisseur); + print ''; + } // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 697ae315fb3..5733ffa9568 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -180,7 +180,7 @@ if ($result > 0) print ''; } - if ($object->fournisseur) + if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) { print ''; print $langs->trans('SupplierCode').''; From 61909d842def3478e70aff51f8dfa63dfb794eb0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Oct 2017 02:18:11 +0200 Subject: [PATCH 17/76] Update document.php --- htdocs/fourn/facture/document.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 818c016de04..180e72e8262 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -51,10 +51,7 @@ $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if ($page == -1) { - $page = 0; -} -$page = (is_numeric($page) ? $page : 0); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; From 78e3c63eade6c0391daccfa7d1d7779f1e07e2d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Oct 2017 02:26:37 +0200 Subject: [PATCH 18/76] Update card.php --- htdocs/expedition/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 37aed77bce6..2dabf0dc3c4 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1218,9 +1218,9 @@ if ($action == 'create') print $langs->trans("Batch").': '.$productlotObject->getNomUrl(1); print ' ('.$dbatch->qty.')'; } - else + else // When lot not found in lot table (this can happen with old record) { - print $dbatch->batch.' ('.$dbatch->qty.')'; + print $langs->trans("Batch").': '.$dbatch->batch.' ('.$dbatch->qty.')'; } $quantityToBeDelivered -= $deliverableQty; if ($quantityToBeDelivered < 0) From bc8127d68597d6db1702687f2208260da29ab132 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Fri, 27 Oct 2017 11:52:05 +0200 Subject: [PATCH 19/76] Fix: paid supplier invoices are shown as abandoned on the consumption card. --- htdocs/societe/consumption.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index c5e9d45c53e..b686c08f579 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2013-2015 Juanjo Menent * Copyright (C) 2015 Marcos García - * Copyright (C) 2015 Ferran Marcet + * Copyright (C) 2015-2017 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -245,7 +245,7 @@ if ($type_element == 'supplier_invoice') { // Supplier : Show products from invoices. require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $documentstatic=new FactureFournisseur($db); - $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, '; + $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, '; $tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d"; $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_facture_fourn = f.rowid"; From 7c1d6251f7acc38c3a7b5b82eacfd8e4eb191467 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 27 Oct 2017 13:27:38 +0200 Subject: [PATCH 20/76] Fix : contract lines from origin were containing all lines desc --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 322220c5d4f..2409056cb1f 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -327,7 +327,7 @@ if (empty($reshook)) $label = $lines[$i]->product_label; } - $desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):''; + $desc = ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):''; } else { $desc = dol_htmlentitiesbr($lines[$i]->desc); From 92c33b76dc0e0bd5bf0b67e4d45d88d04135686e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Oct 2017 20:35:21 +0200 Subject: [PATCH 21/76] Fix position of search element in quick search --- htdocs/core/ajax/selectsearchbox.php | 64 ++++++++++++++-------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 2d92bc8f938..0861ef160b6 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -49,92 +49,92 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; //global $hookmanager; $hookmanager->initHooks(array('searchform')); -$search_boxvalue=GETPOST('q'); +$search_boxvalue=GETPOST('q', 'none'); $arrayresult=array(); // Define $searchform if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) { - $arrayresult['searchintothirdparty']=array('img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintothirdparty']=array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire) { - $arrayresult['searchintocontact']=array('img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintocontact']=array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue)); +} + +if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) +{ + $arrayresult['searchintomember']=array('position'=>20, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue)); } if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) { - $arrayresult['searchintoproduct']=array('img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoproduct']=array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire) { - $arrayresult['searchintoprojects']=array('img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue)); + $arrayresult['searchintoprojects']=array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue)); } if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire) { - $arrayresult['searchintotasks']=array('img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php?search_all='.urlencode($search_boxvalue)); -} - -if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) -{ - $arrayresult['searchintomember']=array('img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue)); -} - -if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire) -{ - $arrayresult['searchintouser']=array('img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintotasks']=array('position'=>45, 'img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php?search_all='.urlencode($search_boxvalue)); } if (! empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire) { - $arrayresult['searchintopropal']=array('img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintopropal']=array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire) { - $arrayresult['searchintoorder']=array('img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php?sall='.urlencode($search_boxvalue)); -} -if (! empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) -{ - $arrayresult['searchintoinvoice']=array('img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoorder']=array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire) { - $arrayresult['searchintoshipment']=array('img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoshipment']=array('position'=>80, 'img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php?sall='.urlencode($search_boxvalue)); +} +if (! empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) +{ + $arrayresult['searchintoinvoice']=array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire) { - $arrayresult['searchintosupplierpropal']=array('img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintosupplierpropal']=array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire) { - $arrayresult['searchintosupplierorder']=array('img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode($search_boxvalue)); + $arrayresult['searchintosupplierorder']=array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode($search_boxvalue)); } if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire) { - $arrayresult['searchintosupplierinvoice']=array('img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintosupplierinvoice']=array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire) { - $arrayresult['searchintocontract']=array('img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintocontract']=array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire) { - $arrayresult['searchintointervention']=array('img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintointervention']=array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue)); } + // HR +if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire) +{ + $arrayresult['searchintouser']=array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue)); +} if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire) { - $arrayresult['searchintoexpensereport']=array('img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoexpensereport']=array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); } if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read) { - $arrayresult['searchintoleaves']=array('img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoleaves']=array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); } @@ -147,7 +147,7 @@ if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLO */ // Execute hook addSearchEntry -$parameters=array('search_boxvalue'=>$search_boxvalue); +$parameters=array('search_boxvalue'=>$search_boxvalue, 'arrayresult'=>$arrayresult); $reshook=$hookmanager->executeHooks('addSearchEntry',$parameters); if (empty($reshook)) { @@ -155,6 +155,8 @@ if (empty($reshook)) } else $arrayresult=$hookmanager->resArray; +// Sort on position +$arrayresult = dol_sort_array($arrayresult, 'position'); // Print output if called by ajax or do nothing (var $arrayresult will be used) if called by an include if (! isset($usedbyinclude) || empty($usedbyinclude)) From 985a268477bff7479e890a4f709ba1549e32ac43 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Oct 2017 22:10:56 +0200 Subject: [PATCH 22/76] Update doc --- ChangeLog | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ChangeLog b/ChangeLog index ce7d35884fe..e0a334a9c84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,34 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 6.0.3 compared to 6.0.2 ***** + +FIX: #7211 Update qty dispatched on qty change +FIX: #7458 +FIX: #7593 +FIX: #7616 +FIX: #7619 +FIX: #7626 +FIX: #7648 +FIX: #7675 +FIX: Agenda events are not exported in the ICAL, VCAL if begin exactly with the same $datestart +FIX: API to get object does not return data of linked objects +FIX: Bad localtax apply +FIX: Bad ressource list in popup in gantt view +FIX: bankentries search conciliated if val 0 +FIX: hook formObjectOptions() must use $expe and not $object which i… +FIX: hook formObjectOptions() must use $expe and not $object which is an order here +FIX: make of link to other object during creation +FIX: Missing function getLinesArray +FIX: old batch not shown in multi shipping +FIX: paid supplier invoices are shown as abandoned +FIX: selection of thirdparty was lost on stats page of invoices +FIX: sql syntax error because of old field accountancy_journal +FIX: Stats on invoices show nothing +FIX: substitution in ODT of thirdparties documents +FIX: wrong key in selectarray +FIX: wrong personnal project time spent + ***** ChangeLog for 6.0.2 compared to 6.0.1 ***** FIX: #7148 From 0b271cca4650c94bf115854719b69f5faa3697c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Oct 2017 10:38:57 +0100 Subject: [PATCH 23/76] Prepare 5.0.7 --- ChangeLog | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index b566652226b..602f619fdcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,22 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 5.0.7 compared to 5.0.6 ***** +FIX: #7000 Dashboard link for late pending payment supplier invoices do not work +FIX: #7148 +FIX: #7325 Default VAT rate when editing template invoices is 0% +FIX: #7366 renaming table with pgsql +FIX: #7391 +FIX: #7510 Bug: extrafield content disappear when generate pdf within intervention +FIX: Agenda events are not exported in the ICAL, VCAL if begin exactly with the same $datestart +FIX: Bad link to unpayed suppliers invoices +FIX: bankentries search conciliated if val 0 +FIX: multicompany better accuracy in rounding and with revenue stamp. +FIX: PDF output was sharing 2 different currencies in same total +FIX: Upgrade missing on field +FIX: wrong key in selectarray +FIX: wrong personnal project time spent + ***** ChangeLog for 5.0.6 compared to 5.0.5 ***** FIX: Removed a bad symbolic link into custom directory. FIX: Renaming a resouce ref rename also the directory of attached files. From 78645c718f44106edd5d00398003ec77bf0e4f2c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Oct 2017 16:15:54 +0100 Subject: [PATCH 24/76] Fix position of quick search --- htdocs/core/ajax/selectsearchbox.php | 64 ++++++++++++++-------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 0861ef160b6..2d92bc8f938 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -49,92 +49,92 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; //global $hookmanager; $hookmanager->initHooks(array('searchform')); -$search_boxvalue=GETPOST('q', 'none'); +$search_boxvalue=GETPOST('q'); $arrayresult=array(); // Define $searchform if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) { - $arrayresult['searchintothirdparty']=array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintothirdparty']=array('img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire) { - $arrayresult['searchintocontact']=array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue)); -} - -if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) -{ - $arrayresult['searchintomember']=array('position'=>20, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintocontact']=array('img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue)); } if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) { - $arrayresult['searchintoproduct']=array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoproduct']=array('img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire) { - $arrayresult['searchintoprojects']=array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue)); + $arrayresult['searchintoprojects']=array('img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue)); } if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire) { - $arrayresult['searchintotasks']=array('position'=>45, 'img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php?search_all='.urlencode($search_boxvalue)); + $arrayresult['searchintotasks']=array('img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php?search_all='.urlencode($search_boxvalue)); +} + +if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) +{ + $arrayresult['searchintomember']=array('img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue)); +} + +if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire) +{ + $arrayresult['searchintouser']=array('img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire) { - $arrayresult['searchintopropal']=array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintopropal']=array('img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire) { - $arrayresult['searchintoorder']=array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php?sall='.urlencode($search_boxvalue)); -} -if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire) -{ - $arrayresult['searchintoshipment']=array('position'=>80, 'img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoorder']=array('img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) { - $arrayresult['searchintoinvoice']=array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoinvoice']=array('img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode($search_boxvalue)); +} +if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire) +{ + $arrayresult['searchintoshipment']=array('img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire) { - $arrayresult['searchintosupplierpropal']=array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintosupplierpropal']=array('img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire) { - $arrayresult['searchintosupplierorder']=array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode($search_boxvalue)); + $arrayresult['searchintosupplierorder']=array('img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode($search_boxvalue)); } if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire) { - $arrayresult['searchintosupplierinvoice']=array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintosupplierinvoice']=array('img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire) { - $arrayresult['searchintocontract']=array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintocontract']=array('img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode($search_boxvalue)); } if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire) { - $arrayresult['searchintointervention']=array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue)); + $arrayresult['searchintointervention']=array('img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue)); } - // HR -if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire) -{ - $arrayresult['searchintouser']=array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue)); -} if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire) { - $arrayresult['searchintoexpensereport']=array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoexpensereport']=array('img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); } if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read) { - $arrayresult['searchintoleaves']=array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); + $arrayresult['searchintoleaves']=array('img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue)); } @@ -147,7 +147,7 @@ if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLO */ // Execute hook addSearchEntry -$parameters=array('search_boxvalue'=>$search_boxvalue, 'arrayresult'=>$arrayresult); +$parameters=array('search_boxvalue'=>$search_boxvalue); $reshook=$hookmanager->executeHooks('addSearchEntry',$parameters); if (empty($reshook)) { @@ -155,8 +155,6 @@ if (empty($reshook)) } else $arrayresult=$hookmanager->resArray; -// Sort on position -$arrayresult = dol_sort_array($arrayresult, 'position'); // Print output if called by ajax or do nothing (var $arrayresult will be used) if called by an include if (! isset($usedbyinclude) || empty($usedbyinclude)) From 777d2f70273668cc660250602c331ec42f150832 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Oct 2017 16:17:36 +0100 Subject: [PATCH 25/76] Prepare 5.0.8 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 422a26d1866..f8190f5c8d1 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','5.0.7'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.8'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO',chr(128)); From 0de1b878bd50209849bb39b26c6df2fa8b2a4e12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Oct 2017 16:17:52 +0100 Subject: [PATCH 26/76] Prepare 6.0.4 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 624808dd0d9..7e7f2de8492 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','6.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO',chr(128)); From 007783cf76a10e9925d869ea1e339a9d1992ccd2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Oct 2017 01:32:17 +0100 Subject: [PATCH 27/76] FIX Searching translation should not be case sensitive --- htdocs/admin/translation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 7e0468107df..51a7d32522e 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -372,8 +372,8 @@ if ($mode == 'searchkey') // Now search into translation array foreach($newlang->tab_translate as $key => $val) { - if ($transkey && ! preg_match('/'.preg_quote($transkey).'/', $key)) continue; - if ($transvalue && ! preg_match('/'.preg_quote($transvalue).'/', $val)) continue; + if ($transkey && ! preg_match('/'.preg_quote($transkey).'/i', $key)) continue; + if ($transvalue && ! preg_match('/'.preg_quote($transvalue).'/i', $val)) continue; $recordtoshow[$key]=$val; } } From 892798bf79fc477cdfade20c22d8858344c13996 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Oct 2017 12:40:12 +0100 Subject: [PATCH 28/76] Code comment --- htdocs/api/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index d34a97ed298..a0e8d337f5d 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -139,14 +139,14 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' | { $module = strtolower($regmod[1]); $moduledirforclass = getModuleDirForApiClass($module); - $moduleforperm = $module; - if ($module == 'propale') { $moduleforperm='propal'; } + $modulenameforenabled = $module; + if ($module == 'propale') { $moduleforenabled='propal'; } //dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass); // Defined if module is enabled $enabled=true; - if (empty($conf->$moduleforperm->enabled)) $enabled=false; + if (empty($conf->$moduleforenabled->enabled)) $enabled=false; if ($enabled) { From 2b966e630b328df1641aeca03e9adb0b6fda68e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Oct 2017 19:49:48 +0100 Subject: [PATCH 29/76] Doc --- ChangeLog | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0a334a9c84..e0c9ad462a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,8 +18,7 @@ FIX: API to get object does not return data of linked objects FIX: Bad localtax apply FIX: Bad ressource list in popup in gantt view FIX: bankentries search conciliated if val 0 -FIX: hook formObjectOptions() must use $expe and not $object which i… -FIX: hook formObjectOptions() must use $expe and not $object which is an order here +FIX: hook formObjectOptions() must use $expe and not $object FIX: make of link to other object during creation FIX: Missing function getLinesArray FIX: old batch not shown in multi shipping From 3db101ffdda18d203133f0321b399858bd1de938 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Oct 2017 01:06:07 +0100 Subject: [PATCH 30/76] Clean packager --- build/makepack-dolibarr.pl | 4 + htdocs/includes/stripe/build.php | 0 htdocs/modulebuilder/template/.gitattributes | 2 +- .../template/dev/dolistore/README.md | 87 ------------------- .../template/dev/dolistore/keywords-de.txt | 0 .../template/dev/dolistore/keywords-en.txt | 0 .../template/dev/dolistore/keywords-es.txt | 0 .../template/dev/dolistore/keywords-fr.txt | 0 .../template/dev/dolistore/keywords-it.txt | 0 .../template/dev/dolistore/long_desc-de.html | 0 .../template/dev/dolistore/long_desc-en.html | 0 .../template/dev/dolistore/long_desc-es.html | 0 .../template/dev/dolistore/long_desc-fr.html | 0 .../template/dev/dolistore/long_desc-it.html | 0 .../template/dev/dolistore/name-de.txt | 1 - .../template/dev/dolistore/name-en.txt | 1 - .../template/dev/dolistore/name-es.txt | 1 - .../template/dev/dolistore/name-fr.txt | 1 - .../template/dev/dolistore/name-it.txt | 1 - .../template/dev/dolistore/short_desc-de.html | 0 .../template/dev/dolistore/short_desc-en.html | 0 .../template/dev/dolistore/short_desc-es.html | 0 .../template/dev/dolistore/short_desc-fr.html | 0 .../template/dev/dolistore/short_desc-it.html | 0 .../template/dev/git-hooks/post-commit | 0 .../template/dev/git-hooks/pre-commit | 0 .../template/dev/git-hooks/pre-push | 0 .../modulebuilder/template/dev/newmodule.sh | 68 --------------- .../template/scripts/myobject.php | 0 29 files changed, 5 insertions(+), 161 deletions(-) mode change 100644 => 100755 htdocs/includes/stripe/build.php delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/README.md delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/keywords-de.txt delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/keywords-en.txt delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/keywords-es.txt delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/keywords-fr.txt delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/keywords-it.txt delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/long_desc-de.html delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/long_desc-en.html delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/long_desc-es.html delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/long_desc-fr.html delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/long_desc-it.html delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/name-de.txt delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/name-en.txt delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/name-es.txt delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/name-fr.txt delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/name-it.txt delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/short_desc-de.html delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/short_desc-en.html delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/short_desc-es.html delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/short_desc-fr.html delete mode 100644 htdocs/modulebuilder/template/dev/dolistore/short_desc-it.html mode change 100644 => 100755 htdocs/modulebuilder/template/dev/git-hooks/post-commit mode change 100644 => 100755 htdocs/modulebuilder/template/dev/git-hooks/pre-commit mode change 100644 => 100755 htdocs/modulebuilder/template/dev/git-hooks/pre-push delete mode 100644 htdocs/modulebuilder/template/dev/newmodule.sh mode change 100644 => 100755 htdocs/modulebuilder/template/scripts/myobject.php diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index e0fa89d924d..2802e55c702 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -571,6 +571,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/parsedown/LICENSE.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/.gitattributes`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/license.md`; @@ -579,6 +580,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Examples`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/unitTests`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/license.md`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/LICENSE`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/ae_fonts_*`; @@ -590,6 +592,8 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`; + print "Remove subdir of custom dir\n"; print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n"; diff --git a/htdocs/includes/stripe/build.php b/htdocs/includes/stripe/build.php old mode 100644 new mode 100755 diff --git a/htdocs/modulebuilder/template/.gitattributes b/htdocs/modulebuilder/template/.gitattributes index 58065c729fc..0d2c67e38e6 100644 --- a/htdocs/modulebuilder/template/.gitattributes +++ b/htdocs/modulebuilder/template/.gitattributes @@ -13,7 +13,7 @@ *.lang text eol=lf *.txt text eol=lf *.md text eol=lf -*.bat text eol=crlf +*.bat text eol=lf # Denote all files that are truly binary and should not be modified. *.ico binary diff --git a/htdocs/modulebuilder/template/dev/dolistore/README.md b/htdocs/modulebuilder/template/dev/dolistore/README.md deleted file mode 100644 index d322d2c98fe..00000000000 --- a/htdocs/modulebuilder/template/dev/dolistore/README.md +++ /dev/null @@ -1,87 +0,0 @@ -Dolistore -========= - -[Dolistore](https://dolistore.com) is the marketplace for Dolibarr modules. - -This directory contains templates assets that may be useful for publication. - -Images ------- - -### Logo - -See [img folder README](../img/README.md). - -### Screenshots - -Texts ------ - -All texts needs 5 languages versions for: -- en (English) -- fr (Français) -- es (Español) -- it (Italiano) -- de (Deutsch) - -### Name - -The module's marketed name. - -### Price - -Expressed in Euro (€). -Keep in mind that Dolistore will keep a 20% markup. - -### Categories - -- [x] Modules/Plugins -- [ ] Skins and Templates -- [ ] Tools and documentation -- [ ] Skins -- [ ] Document templates -- [ ] System tools -- [ ] CRM -- [ ] ECM -- [ ] Human Relationship -- [ ] Products, Services or Stock -- [ ] Project or collaborative -- [ ] Interfaces -- [ ] Other -- [ ] Reporting or search -- [ ] User's interface -- [ ] 2Report sub-modules -- [ ] Accountancy - -*The list may change. Check [Dolistore](https://dolistore.com) for up-to-date information.* - -### Short description - -A short description of the modules main features. -400 characters max. - -### Keywords - -Comma separated lists. -eg: ```template,dev,module``` - -### Long description - -The long description of your module. - -Suggested technical data: - -Version: 1.0.0 -Publisher: MyCompany -Licence: GPLv3+ -User interface language(s): English -Help/Support: None / Forum www.dolibarr.org / Mail at contact@example.com -Prerequisites: -- Dolibarr min version: 3.8 -- Dolibarr max version: 3.9.* -- PHP: ≥5.3 -Install: -- Download the module's archive file (.zip file) from DoliStore.com. -- Put the file into the custom directory of Dolibarr. -- Uncompress the zip file, for example with ```unzip modulefile_version.zip``` command. -- Module is then available and can be activated. diff --git a/htdocs/modulebuilder/template/dev/dolistore/keywords-de.txt b/htdocs/modulebuilder/template/dev/dolistore/keywords-de.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/keywords-en.txt b/htdocs/modulebuilder/template/dev/dolistore/keywords-en.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/keywords-es.txt b/htdocs/modulebuilder/template/dev/dolistore/keywords-es.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/keywords-fr.txt b/htdocs/modulebuilder/template/dev/dolistore/keywords-fr.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/keywords-it.txt b/htdocs/modulebuilder/template/dev/dolistore/keywords-it.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/long_desc-de.html b/htdocs/modulebuilder/template/dev/dolistore/long_desc-de.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/long_desc-en.html b/htdocs/modulebuilder/template/dev/dolistore/long_desc-en.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/long_desc-es.html b/htdocs/modulebuilder/template/dev/dolistore/long_desc-es.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/long_desc-fr.html b/htdocs/modulebuilder/template/dev/dolistore/long_desc-fr.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/long_desc-it.html b/htdocs/modulebuilder/template/dev/dolistore/long_desc-it.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/name-de.txt b/htdocs/modulebuilder/template/dev/dolistore/name-de.txt deleted file mode 100644 index d177fbf2ba9..00000000000 --- a/htdocs/modulebuilder/template/dev/dolistore/name-de.txt +++ /dev/null @@ -1 +0,0 @@ -Mein modul diff --git a/htdocs/modulebuilder/template/dev/dolistore/name-en.txt b/htdocs/modulebuilder/template/dev/dolistore/name-en.txt deleted file mode 100644 index bf608d557d4..00000000000 --- a/htdocs/modulebuilder/template/dev/dolistore/name-en.txt +++ /dev/null @@ -1 +0,0 @@ -My module diff --git a/htdocs/modulebuilder/template/dev/dolistore/name-es.txt b/htdocs/modulebuilder/template/dev/dolistore/name-es.txt deleted file mode 100644 index a0ec54ad842..00000000000 --- a/htdocs/modulebuilder/template/dev/dolistore/name-es.txt +++ /dev/null @@ -1 +0,0 @@ -My módulo diff --git a/htdocs/modulebuilder/template/dev/dolistore/name-fr.txt b/htdocs/modulebuilder/template/dev/dolistore/name-fr.txt deleted file mode 100644 index 310ebcf10a5..00000000000 --- a/htdocs/modulebuilder/template/dev/dolistore/name-fr.txt +++ /dev/null @@ -1 +0,0 @@ -Mon module diff --git a/htdocs/modulebuilder/template/dev/dolistore/name-it.txt b/htdocs/modulebuilder/template/dev/dolistore/name-it.txt deleted file mode 100644 index a196c1511a1..00000000000 --- a/htdocs/modulebuilder/template/dev/dolistore/name-it.txt +++ /dev/null @@ -1 +0,0 @@ -Il mio modulo diff --git a/htdocs/modulebuilder/template/dev/dolistore/short_desc-de.html b/htdocs/modulebuilder/template/dev/dolistore/short_desc-de.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/short_desc-en.html b/htdocs/modulebuilder/template/dev/dolistore/short_desc-en.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/short_desc-es.html b/htdocs/modulebuilder/template/dev/dolistore/short_desc-es.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/short_desc-fr.html b/htdocs/modulebuilder/template/dev/dolistore/short_desc-fr.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/dolistore/short_desc-it.html b/htdocs/modulebuilder/template/dev/dolistore/short_desc-it.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/modulebuilder/template/dev/git-hooks/post-commit b/htdocs/modulebuilder/template/dev/git-hooks/post-commit old mode 100644 new mode 100755 diff --git a/htdocs/modulebuilder/template/dev/git-hooks/pre-commit b/htdocs/modulebuilder/template/dev/git-hooks/pre-commit old mode 100644 new mode 100755 diff --git a/htdocs/modulebuilder/template/dev/git-hooks/pre-push b/htdocs/modulebuilder/template/dev/git-hooks/pre-push old mode 100644 new mode 100755 diff --git a/htdocs/modulebuilder/template/dev/newmodule.sh b/htdocs/modulebuilder/template/dev/newmodule.sh deleted file mode 100644 index 92f4875cbf6..00000000000 --- a/htdocs/modulebuilder/template/dev/newmodule.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -# Copyright (C) 2014 Raphaël Doursenaud -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -VERSION=0.0.1 -USAGE="Usage: newmodule.sh NewName" - -# TODO: check depedencies presence (find, sed and rename) -# TODO: allow execution from build directory -# TODO: validate parameter -# TODO: use multiple word parameter, for example "My module is awesome" which should lead to "MyModuleIsAwesome" and "mymoduleisawesome" so we can also fix language strings -# TODO: add module ID management (language files…) -# TODO: add oneliner description management -# TODO: add copyright management - -if [ $# == 0 ] ; then - echo ${USAGE} - exit 1; -fi - -ToLower () { - echo $(echo $1 | tr '[:upper:]' '[:lower:]') -} -ToUpper () { - echo $(echo $1 | tr '[:lower:]' '[:upper:]') -} - -CAMELORIG="MyModule" -LOWERORIG=$(ToLower ${CAMELORIG}) -UPPERORIG=$(ToUpper ${CAMELORIG}) -cameltarget=$(echo $1) -lowertarget=$(ToLower $1) -uppertarget=$(ToUpper $1) -thisscript=`basename $0` - -# Rewrite occurences -find . -not -iwholename '*.git*' -not -name "${thisscript}" -type f -print0 | xargs -0 sed -i'' -e"s/${CAMELORIG}/${cameltarget}/g" -find . -not -iwholename '*.git*' -not -name "${thisscript}" -type f -print0 | xargs -0 sed -i'' -e"s/${LOWERORIG}/${lowertarget}/g" -find . -not -iwholename '*.git*' -not -name "${thisscript}" -type f -print0 | xargs -0 sed -i'' -e"s/${UPPERORIG}/${uppertarget}/g" - -# Rename files -for file in $(find . -not -iwholename '*.git*' -name "*${CAMELORIG}*" -type f) -do - rename ${CAMELORIG} ${cameltarget} ${file} -done -for file in $(find . -not -iwholename '*.git*' -name "*${LOWERORIG}*" -type f) -do - rename ${LOWERORIG} ${lowertarget} ${file} -done -for file in $(find . -not -iwholename '*.git*' -name "*${UPPERORIG}*" -type f) -do - rename ${UPPERORIG} ${uppertarget} ${file} -done - -# TODO: add instructions about renaming vars (ack --php -i my) -# TODO: add instructions about renaming files (ls -R|grep -i my) diff --git a/htdocs/modulebuilder/template/scripts/myobject.php b/htdocs/modulebuilder/template/scripts/myobject.php old mode 100644 new mode 100755 From a6879775bb787b34a38f055ae97c1c2eec382045 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Nov 2017 19:58:46 +0100 Subject: [PATCH 31/76] FIX Search into language is ok for file into external modules two. --- htdocs/admin/translation.php | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 51a7d32522e..651335d0a6d 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -338,6 +338,9 @@ if ($mode == 'searchkey') $recordtoshow=array(); + // Search modules dirs + $modulesdir = dolGetModulesDirs(); + $nbempty=0; /*var_dump($langcode); var_dump($transkey); @@ -351,22 +354,23 @@ if ($mode == 'searchkey') } else { - // Load all translations keys - foreach($conf->file->dol_document_root as $keydir => $searchdir) + // Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root) + foreach($modulesdir as $keydir => $tmpsearchdir) { - // Directory of translation files - $dir_lang = $searchdir."/langs/".$langcode; - $dir_lang_osencoded=dol_osencode($dir_lang); + $searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/' - $filearray=dol_dir_list($dir_lang_osencoded,'files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1); + // Directory of translation files + $dir_lang = dirname(dirname($searchdir))."/langs/".$langcode; // The 2 dirname is to go up in dir for 2 levels + $dir_lang_osencoded=dol_osencode($dir_lang); - foreach($filearray as $file) - { - $tmpfile=preg_replace('/.lang/i', '', basename($file['name'])); - $newlang->load($tmpfile, 0, 0, '', 0); // Load translation files + database overwrite - $newlangfileonly->load($tmpfile, 0, 0, '', 1); // Load translation files only - //print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records
'."\n"; - } + $filearray=dol_dir_list($dir_lang_osencoded,'files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1); + foreach($filearray as $file) + { + $tmpfile=preg_replace('/.lang/i', '', basename($file['name'])); + $newlang->load($tmpfile, 0, 0, '', 0); // Load translation files + database overwrite + $newlangfileonly->load($tmpfile, 0, 0, '', 1); // Load translation files only + //print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records
'."\n"; + } } // Now search into translation array From 91fbb4da416f774bab4df40e21eac419311d30ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Nov 2017 20:12:15 +0100 Subject: [PATCH 32/76] Fix changelog --- ChangeLog | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0c9ad462a1..e5966d0eec7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,7 +4,6 @@ English Dolibarr ChangeLog ***** ChangeLog for 6.0.3 compared to 6.0.2 ***** - FIX: #7211 Update qty dispatched on qty change FIX: #7458 FIX: #7593 @@ -31,7 +30,6 @@ FIX: wrong key in selectarray FIX: wrong personnal project time spent ***** ChangeLog for 6.0.2 compared to 6.0.1 ***** - FIX: #7148 FIX: #7288 FIX: #7366 renaming table with pgsql @@ -65,7 +63,6 @@ FIX: wrong basePath in the swagger view FIX: Implementation of a Luracast recommandation for the REST api server ***** ChangeLog for 6.0.1 compared to 6.0.* ***** - FIX: #7000 Dashboard link for late pending payment supplier invoices do not work FIX: #7325 Default VAT rate when editing template invoices is 0% FIX: #7330 @@ -107,7 +104,6 @@ FIX: CVE-2017-9840, CVE-2017-14238, CVE-2017-14239, CVE-2017-14240, CVE-2017-142 CVE-2017-14242 ***** ChangeLog for 6.0.0 compared to 5.0.* ***** - NEW: Add experimental BlockeLog module (to log business events in a non reversible log file). NEW: Add a payment module for Stripe. NEW: Add module "Product variant" (like red, blue for the product shoes) From 192dc43b876919c51be8360ea1660dd253577b50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2017 01:16:42 +0100 Subject: [PATCH 33/76] Fix regression --- htdocs/api/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index a0e8d337f5d..a102ad67539 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -128,7 +128,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' | foreach ($modulesdir as $dir) { // Search available module - dol_syslog("Scan directory ".$dir." for module descriptor to after search for API files"); + dol_syslog("Scan directory ".$dir." for module descriptor files, then search for API files"); $handle=@opendir(dol_osencode($dir)); if (is_resource($handle)) @@ -140,13 +140,13 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' | $module = strtolower($regmod[1]); $moduledirforclass = getModuleDirForApiClass($module); $modulenameforenabled = $module; - if ($module == 'propale') { $moduleforenabled='propal'; } + if ($module == 'propale') { $modulenameforenabled='propal'; } - //dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass); + dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass); // Defined if module is enabled $enabled=true; - if (empty($conf->$moduleforenabled->enabled)) $enabled=false; + if (empty($conf->$modulenameforenabled->enabled)) $enabled=false; if ($enabled) { From 59df957181506c92401e7f4c986482f1c13c1eee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2017 01:42:04 +0100 Subject: [PATCH 34/76] Fix return HTTP code 501 if calling a non existing api --- htdocs/api/index.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index a102ad67539..7bb062c03df 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -235,7 +235,13 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' if ($module == 'order') { $classname='Commande'; } //var_dump($classfile);var_dump($classname);exit; - require_once $dir_part_file; + $res = include_once $dir_part_file; + if (! $res) + { + print 'API not found (failed to include API file)'; + header('HTTP/1.1 501 API not found (failed to include API file)'); + exit(0); + } if (class_exists($classname.'Api')) $api->r->addAPIClass($classname.'Api', '/'); } else @@ -246,7 +252,14 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' $dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php'); $classname=ucwords($module); - require_once $dir_part_file; + $res = include_once $dir_part_file; + if (! $res) + { + print 'API not found (failed to include API file)'; + header('HTTP/1.1 501 API not found (failed to include API file)'); + exit(0); + } + if (class_exists($classname)) $api->r->addAPIClass($classname); } } From fb3f1ef667153943d537b88a6fe9d61c5eea20d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2017 09:49:41 +0100 Subject: [PATCH 35/76] Code comment --- htdocs/api/class/api_login.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index c6b71e8b25c..d59e0036423 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -36,7 +36,7 @@ class Login * * Request the API token for a couple username / password. * Using method POST is recommanded for security reasons (method GET is often logged by default by web servers with parameters so with login and pass into server log file). - * Both methods are provided for developer conveniance. Best is to not use at all the login API method and enter directly the "api_key" into field at the top right of page (Note: "api_key" can be found/set on the user page). + * Both methods are provided for developer conveniance. Best is to not use at all the login API method and enter directly the "DOLAPIKEY" into field at the top right of page. Note: Tha API key (DOLAPIKEY) can be found/set on the user page. * * @param string $login User login * @param string $password User password From bd68b94411a562862a9573a8349e85b53d0c3684 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 2 Nov 2017 13:27:09 +0100 Subject: [PATCH 36/76] fix : missing hook in accountancy --- htdocs/accountancy/customer/list.php | 52 +++++++++++++++++--------- htdocs/accountancy/supplier/list.php | 55 ++++++++++++++++++---------- 2 files changed, 71 insertions(+), 36 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 5e78d735523..f675c010b37 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -85,6 +85,9 @@ if ($user->societe_id > 0) if (! $user->rights->accounting->bind->write) accessforbidden(); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('accountancycustomerlist')); + $formaccounting = new FormAccounting($db); $accounting = new AccountingAccount($db); $aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1); @@ -98,26 +101,33 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOU if (GETPOST('cancel')) { $action='list'; $massaction=''; } if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } -// Purge search criteria -if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - $search_lineid = ''; - $search_ref = ''; - $search_invoice = ''; - $search_label = ''; - $search_desc = ''; - $search_amount = ''; - $search_account = ''; - $search_vat = ''; + // Purge search criteria + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers + { + $search_lineid = ''; + $search_ref = ''; + $search_invoice = ''; + $search_label = ''; + $search_desc = ''; + $search_amount = ''; + $search_account = ''; + $search_vat = ''; + } + + // Mass actions + $objectclass='AccountingAccount'; + $permtoread = $user->rights->accounting->read; + $permtodelete = $user->rights->accounting->delete; + $uploaddir = $conf->accounting->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } -// Mass actions -$objectclass='Skeleton'; -$objectlabel='Skeleton'; -$permtoread = $user->rights->accounting->read; -$permtodelete = $user->rights->accounting->delete; -$uploaddir = $conf->accounting->dir_output; -include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; if ($massaction == 'ventil') { $msg=''; @@ -182,6 +192,9 @@ $sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,"; $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,"; $sql .= " aa.rowid as aarowid"; +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; @@ -223,6 +236,11 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { } $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql .= $db->order($sortfield, $sortorder); // Count total nb of records diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 84c341400d7..541052ac9c3 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -85,6 +85,9 @@ if ($user->societe_id > 0) if (! $user->rights->accounting->bind->write) accessforbidden(); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('accountancysupplierlist')); + $formaccounting = new FormAccounting($db); $accounting = new AccountingAccount($db); // TODO: we should need to check if result is a really exist accountaccount rowid..... @@ -99,26 +102,32 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUN if (GETPOST('cancel')) { $action='list'; $massaction=''; } if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } -// Purge search criteria -if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers -{ - $search_lineid = ''; - $search_ref = ''; - $search_invoice = ''; - $search_label = ''; - $search_desc = ''; - $search_amount = ''; - $search_account = ''; - $search_vat = ''; -} +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -// Mass actions -$objectclass='Skeleton'; -$objectlabel='Skeleton'; -$permtoread = $user->rights->accounting->read; -$permtodelete = $user->rights->accounting->delete; -$uploaddir = $conf->accounting->dir_output; -include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; +if (empty($reshook)) +{ + // Purge search criteria + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers + { + $search_lineid = ''; + $search_ref = ''; + $search_invoice = ''; + $search_label = ''; + $search_desc = ''; + $search_amount = ''; + $search_account = ''; + $search_vat = ''; + } + + // Mass actions + $objectclass='AccountingAccount'; + $permtoread = $user->rights->accounting->read; + $permtodelete = $user->rights->accounting->delete; + $uploaddir = $conf->accounting->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; +} if ($massaction == 'ventil') { $msg=''; @@ -184,6 +193,9 @@ $sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_lab $sql.= " l.rowid, l.fk_product, l.description, l.total_ht as price, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,"; $sql.= " aa.rowid as aarowid"; +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; @@ -220,6 +232,11 @@ if (strlen(trim($search_vat))) { } $sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql .= $db->order($sortfield, $sortorder); // Count total nb of records From b7cf434ebd3e5870db32cfd90add74925cd8f2bc Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 2 Nov 2017 14:58:33 +0100 Subject: [PATCH 37/76] FIX : Filter type on actioncomm with multiselect doesn't work --- htdocs/comm/action/index.php | 9 +++++++-- htdocs/comm/action/listactions.php | 9 +++++++-- htdocs/comm/action/peruser.php | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index bda7dd7a594..ea6c43b89c7 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -297,7 +297,11 @@ if ($status == 'done') $title=$langs->trans("DoneActions"); if ($status == 'todo') $title=$langs->trans("ToDoActions"); $param=''; -if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; +if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) { + if(is_array($actioncode)) { + foreach($actioncode as $str_action) $param.="&actioncode[]=".$str_action; + } else $param.="&actioncode=".$actioncode; +} if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; @@ -482,7 +486,8 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; else { - $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')"; + $TActionCode=(Array)$actioncode; + $sql.=" AND ca.code IN ('".implode("','", $TActionCode)."')"; } } } diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index c77c4279439..d247e78c188 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -169,7 +169,11 @@ $listofextcals=array(); $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; -if ($actioncode != '') $param.="&actioncode=".$actioncode; +if ($actioncode != '') { + if(is_array($actioncode)) { + foreach($actioncode as $str_action) $param.="&actioncode[]=".$str_action; + } else $param.="&actioncode=".$actioncode; +} if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($status != '' && $status > -1) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; @@ -227,7 +231,8 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'"; else { - $sql.=" AND c.code IN ('".implode("','", explode(',',$actioncode))."')"; + $TActionCode=(Array)$actioncode; + $sql.=" AND c.code IN ('".implode("','", $TActionCode)."')"; } } } diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 792d4f9760d..3d551b7779b 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -203,7 +203,11 @@ if ($status == 'done') $title=$langs->trans("DoneActions"); if ($status == 'todo') $title=$langs->trans("ToDoActions"); $param=''; -if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; +if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) { + if(is_array($actioncode)) { + foreach($actioncode as $str_action) $param.="&actioncode[]=".$str_action; + } else $param.="&actioncode=".$actioncode; +} if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; @@ -394,7 +398,8 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; else { - $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')"; + $TActionCode=(Array)$actioncode; + $sql.=" AND ca.code IN ('".implode("','", $TActionCode)."')"; } } } From 323a0d7d0d65d6afc5ae996bd8e24f0e5f867cb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2017 15:48:24 +0100 Subject: [PATCH 38/76] Update index.php --- htdocs/comm/action/index.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index ea6c43b89c7..87f0e2e6ccb 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -486,8 +486,14 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; else { - $TActionCode=(Array)$actioncode; - $sql.=" AND ca.code IN ('".implode("','", $TActionCode)."')"; + if (is_array($actioncode)) + { + $sql.=" AND ca.code IN ('".implode("','", $TActionCode)."')"; + } + else + { + $sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; + } } } } From 63a363080e9966415934ba8e13e93acd868f0822 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2017 15:48:56 +0100 Subject: [PATCH 39/76] Update index.php --- htdocs/comm/action/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 87f0e2e6ccb..e2bb57c3ce4 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -488,7 +488,7 @@ if (! empty($actioncode)) { if (is_array($actioncode)) { - $sql.=" AND ca.code IN ('".implode("','", $TActionCode)."')"; + $sql.=" AND ca.code IN ('".implode("','", $actioncode)."')"; } else { From ec3a07cd52dbd921f86c733b5412a561357a2be5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2017 15:50:55 +0100 Subject: [PATCH 40/76] Try to restore compatibility when actioncode=CODE1,CODE2,... --- htdocs/comm/action/listactions.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index d247e78c188..b3d92fc8a40 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -231,8 +231,14 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'"; else { - $TActionCode=(Array)$actioncode; - $sql.=" AND c.code IN ('".implode("','", $TActionCode)."')"; + if (is_array($actioncode)) + { + $sql.=" AND ca.code IN ('".implode("','", $actioncode)."')"; + } + else + { + $sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; + } } } } From 310bf4bde4d96bb0a11d2403dbad217033cc0210 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2017 15:51:35 +0100 Subject: [PATCH 41/76] Update peruser.php --- htdocs/comm/action/peruser.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 3d551b7779b..05eba093cfd 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -398,8 +398,14 @@ if (! empty($actioncode)) elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'"; else { - $TActionCode=(Array)$actioncode; - $sql.=" AND ca.code IN ('".implode("','", $TActionCode)."')"; + if (is_array($actioncode)) + { + $sql.=" AND ca.code IN ('".implode("','", $actioncode)."')"; + } + else + { + $sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; + } } } } From 03544f783a2be5c54ebc72611371c3b3d8aab4a6 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 2 Nov 2017 16:16:29 +0100 Subject: [PATCH 42/76] FIX : Wrong alias sql --- htdocs/comm/action/listactions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index b3d92fc8a40..4540580fed8 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -233,11 +233,11 @@ if (! empty($actioncode)) { if (is_array($actioncode)) { - $sql.=" AND ca.code IN ('".implode("','", $actioncode)."')"; + $sql.=" AND c.code IN ('".implode("','", $actioncode)."')"; } else { - $sql.=" AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; + $sql.=" AND c.code IN ('".implode("','", explode(',', $actioncode))."')"; } } } From b58df17545844cb5f1d0cd2d2be4c101aeab6949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Nov 2017 18:14:55 +0100 Subject: [PATCH 43/76] default currency on propal create --- htdocs/comm/propal/class/propal.class.php | 5 +++-- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 25d488e7316..64997b4c9ea 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -836,8 +836,9 @@ class Propal extends CommonObject if (empty($this->availability_id)) $this->availability_id=0; if (empty($this->demand_reason_id)) $this->demand_reason_id=0; - // Multicurrency - if (!empty($this->multicurrency_code)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date); + // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) + if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date); + else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); if (empty($this->fk_multicurrency)) { $this->multicurrency_code = $conf->currency; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c5271c34744..56a7fe16b43 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -709,7 +709,7 @@ class Commande extends CommonOrder // $date_commande is deprecated $date = ($this->date_commande ? $this->date_commande : $this->date); - // Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate) + // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); if (empty($this->fk_multicurrency)) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c0be06da6bd..99665476a8e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -244,7 +244,7 @@ class Facture extends CommonInvoice $this->brouillon = 1; if (empty($this->entity)) $this->entity = $conf->entity; - // Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate) + // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); if (empty($this->fk_multicurrency)) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 50e805f1089..37e2d910224 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1090,7 +1090,7 @@ class CommandeFournisseur extends CommonOrder // Clean parameters if (empty($this->source)) $this->source = 0; - // Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate) + // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); if (empty($this->fk_multicurrency)) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 43f2250b508..4b5e2ca83cd 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -229,7 +229,7 @@ class FactureFournisseur extends CommonInvoice $amount = $this->amount; $remise = $this->remise; - // Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate) + // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); if (empty($this->fk_multicurrency)) From 13667e48505e2a0f68d1d8ab1983b533b82e6037 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 3 Nov 2017 08:56:23 +0100 Subject: [PATCH 44/76] Fix display of product/service list --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 0beaab3c9c8..efebf1365c3 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -220,7 +220,7 @@ else { $title=$langs->trans("ProductsAndServices"); - if (isset($type)) + if (isset($type) && $type != '') { if ($type==1) { From e992e4bea5f13f8972179feaddc67a864d49acfc Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 3 Nov 2017 09:09:07 +0100 Subject: [PATCH 45/76] Fix : type was forced to 0 so service are not in the list --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 5561d5778f6..9e100081d4f 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -66,7 +66,7 @@ $search_tobatch = GETPOST("search_tobatch",'int'); $search_accountancy_code_sell = GETPOST("search_accountancy_code_sell",'alpha'); $search_accountancy_code_buy = GETPOST("search_accountancy_code_buy",'alpha'); $optioncss = GETPOST('optioncss','alpha'); -$type=(int) GETPOST("type","int"); +$type=GETPOST("type","int"); //Show/hide child products. Hidden by default if (!$_POST) { From eb4a5f657029f6d3aab26b59c8a1618bd56bae43 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Nov 2017 18:21:29 +0100 Subject: [PATCH 46/76] Fix link can't be a htm link in innosetup --- build/exe/doliwamp/doliwamp.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 2ef8ab32f22..f10fec117a9 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -353,7 +353,7 @@ begin begin // TODO Copy file or ask to install package ? //CustomMessage('YouWillInstallDoliWamp')+#13#13 - MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from http://www.microsoft.com/en-us/download/details.aspx?id=30679 then restart DoliWamp installation/upgrade.',mbInformation,MB_OK); + MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from http://www.microsoft.com/en-us/download/details.aspx?id=30679 then restart DoliWamp installation/upgrade.',mbInformation,MB_OK); end; // Pb seems similar with msvcp110.dll //vcredist_x64.exe From 52421406ce2d8f5be48debea53940b20a399e34f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Nov 2017 18:25:33 +0100 Subject: [PATCH 47/76] FIX #7751 --- build/exe/doliwamp/doliwamp.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index f10fec117a9..cf4949fcf40 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -353,7 +353,7 @@ begin begin // TODO Copy file or ask to install package ? //CustomMessage('YouWillInstallDoliWamp')+#13#13 - MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from http://www.microsoft.com/en-us/download/details.aspx?id=30679 then restart DoliWamp installation/upgrade.',mbInformation,MB_OK); + MsgBox('The Visual C++ Redistributable package should be installed, it seems it is not. Please install the 32-bit version from http://www.microsoft.com/en-us/download/details.aspx?id=30679, then restart the DoliWAMP installation/upgrade.',mbInformation,MB_OK); end; // Pb seems similar with msvcp110.dll //vcredist_x64.exe From 864af9cc3bba5bd52b2b09aed0c0872021d09521 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2017 11:47:03 +0100 Subject: [PATCH 48/76] Fix error not returned if output directory not writable --- htdocs/core/lib/files.lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 38e8f09a3d8..165480278e2 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -968,7 +968,11 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable $file_name_osencoded=dol_osencode($file_name); // Check if destination dir is writable - // TODO + if (! is_writable(dirname($file_name_osencoded))) + { + dol_syslog("Files.lib::dol_move_uploaded_file Dir ".dirname($file_name_osencoded)." is not writable. Return 'ErrorDirNotWritable'", LOG_WARNING); + return 'ErrorDirNotWritable'; + } // Check if destination file already exists if (! $allowoverwrite) From bc9b816719211ca75a12a709b9f77dd1a6c1d1b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2017 17:54:18 +0100 Subject: [PATCH 49/76] Fix deletion of files that contains __ --- htdocs/core/actions_linkedfiles.inc.php | 2 +- htdocs/core/lib/functions.lib.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 1f47a94f6d2..ea5d6c3db26 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -56,7 +56,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') { if ($object->id) { - $urlfile = GETPOST('urlfile', 'alpha'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + $urlfile = GETPOST('urlfile', 'alpha', 0, null, null, 1); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). if (GETPOST('section', 'alpha')) $file = $upload_dir . "/" . $urlfile; // For a delete of GED module urlfile contains full path from upload_dir else // For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 288badf6285..51eb070da91 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -257,12 +257,13 @@ function dol_shutdown() * 'custom'= custom filter specify $filter and $options) * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie) * @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails) - * @param mixed $options Options to pass to filter_var when $check is set to 'custom'. + * @param mixed $options Options to pass to filter_var when $check is set to 'custom' + * @param string $noreplace Force disable of replacement of __xxx__ strings. * @return string|string[] Value found (string or array), or '' if check fails * * @TODO Set default value for check to alpha. Check all WYSIWYG edition (email and description...) is still ok with rich text. */ -function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL) +function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL, $noreplace=0) { global $mysoc,$user,$conf; @@ -366,7 +367,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL) // Substitution variables for GETPOST (used to get final url with variable parameters or final default value with variable paramaters) // Example of variables: __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__, ... // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text. - if (! is_array($out) && empty($_POST[$paramname])) + if (! is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) { $maxloop=20; $loopnb=0; // Protection against infinite loop while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side. From 1d9873e1a9edc5f107d4cca6fb050ec2b9098a7f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2017 21:17:30 +0100 Subject: [PATCH 50/76] FIX #7756 Add better error message --- htdocs/compta/bank/transfer.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 1f3ca1cde8e..c6c75e21ce0 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -83,6 +83,11 @@ if ($action == 'add_confirm') $accountto=new Account($db); $accountto->fetch(GETPOST('account_to','int')); + if ($accountto->currency_code != $accountfrom->currency_code) { + $error++; + setEventMessages($langs->trans("ErrorTransferBetweenDifferentCurrencyNotPossible"), null, 'errors'); + } + if ($accountto->id != $accountfrom->id) { $db->begin(); From 27ace14fb7598ed1f8a8cf096bb401730b91411a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Nov 2017 16:28:51 +0100 Subject: [PATCH 51/76] Fetch right account --- htdocs/compta/bank/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 1f55698d13f..54e22fbbbcb 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -656,7 +656,7 @@ else print ''; if (! empty($conf->accounting->enabled)) { $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('',$object->account_number); + $accountingaccount->fetch('',$object->account_number, 1); print $accountingaccount->getNomUrl(0,1,1,'',1); } else { From fe3ce78ae4b546099b34ef54d51d9f93acd578f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Nov 2017 11:24:33 +0100 Subject: [PATCH 52/76] Update card.php --- htdocs/accountancy/bookkeeping/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index d3252b01a18..2c574f91f8b 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -631,7 +631,7 @@ if ($action == 'create') { print "\n"; } - if ($total_debit != $total_credit) + if (price2num($total_debit) != price2num($total_credit)) { setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings'); } From 1ea6df14d04def3271354575b1cd13f5cdb3ccd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Nov 2017 11:35:15 +0100 Subject: [PATCH 53/76] Update card.php --- htdocs/compta/bank/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 1f55698d13f..c23c1b2f96b 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -99,7 +99,7 @@ if ($action == 'add') $object->owner_address = trim($_POST["owner_address"]); $account_number = GETPOST('account_number','alpha'); - if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; } + if (empty($account_number) || $account_number == '-1') { $object->account_number = ''; } else { $object->account_number = $account_number; } $fk_accountancy_journal = GETPOST('fk_accountancy_journal','int'); if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; } From 2636c2470b2dc0bf743ec14e577647406a23a180 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Fri, 10 Nov 2017 10:52:58 +0100 Subject: [PATCH 54/76] Fix width of payment term is to large --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 4 ++-- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 80c6e6680b2..abc4688ef5c 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -667,13 +667,13 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('','B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(80, 4, $titre, 0, 'L'); + $pdf->MultiCell(43, 4, $titre, 0, 'L'); $pdf->SetFont('','', $default_font_size - 2); $pdf->SetXY($posxval, $posy); $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); - $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); + $pdf->MultiCell(67, 4, $lib_condition_paiement,0,'L'); $posy=$pdf->GetY()+3; } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 98b2367db32..bfecd773b27 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -892,13 +892,13 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('','B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(80, 4, $titre, 0, 'L'); + $pdf->MultiCell(43, 4, $titre, 0, 'L'); $pdf->SetFont('','', $default_font_size - 2); $pdf->SetXY($posxval, $posy); $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); - $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); + $pdf->MultiCell(67, 4, $lib_condition_paiement,0,'L'); $posy=$pdf->GetY()+3; } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 9105a82b0d4..41e76ddbf3d 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -854,13 +854,13 @@ class pdf_azur extends ModelePDFPropales $pdf->SetFont('','B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(80, 4, $titre, 0, 'L'); + $pdf->MultiCell(43, 4, $titre, 0, 'L'); $pdf->SetFont('','', $default_font_size - 2); $pdf->SetXY($posxval, $posy); $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); - $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); + $pdf->MultiCell(67, 4, $lib_condition_paiement,0,'L'); $posy=$pdf->GetY()+3; } From 22a3721ddafdb849a560f8cbbf825078aa6fc205 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 11 Nov 2017 16:10:06 +0100 Subject: [PATCH 55/76] Fix multi VAT deposit when special lines are in origin document --- htdocs/compta/facture/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a613581f5aa..f438a5ab6b9 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1075,6 +1075,7 @@ if (empty($reshook)) $TTotalByTva = array(); foreach ($srcobject->lines as &$line) { + if(! empty($line->special_code)) continue; $TTotalByTva[$line->tva_tx] += $line->total_ttc ; } From 356525730d9e3acc9701f3711e5bd2191edd7ffe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Nov 2017 20:12:56 +0100 Subject: [PATCH 56/76] FIX #7786 --- htdocs/core/lib/pdf.lib.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 90d28b7d559..cb061bc9f2e 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1822,7 +1822,7 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0) function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null) { if (empty($hookmanager)) global $hookmanager; - + $reshook=0; $result=''; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) @@ -1841,10 +1841,14 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm if ($object->lines[$i]->special_code == 3) return ''; if (empty($hidedetails) || $hidedetails > 1) { - if($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF) + if ($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF) { - $prev_progress = $object->lines[$i]->get_prev_progress($object->id); - $result = ( $object->lines[$i]->situation_percent - $prev_progress) . '%'; + $prev_progress = 0; + if (method_exists($object, 'get_prev_progress')) + { + $prev_progress = $object->lines[$i]->get_prev_progress($object->id); + } + $result = ($object->lines[$i]->situation_percent - $prev_progress) . '%'; } else $result = $object->lines[$i]->situation_percent . '%'; @@ -1891,12 +1895,17 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0) if (empty($hidedetails) || $hidedetails > 1) { $total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht); - if ($object->lines[$i]->situation_percent > 0 ) + if ($object->lines[$i]->situation_percent > 0) { - $prev_progress = $object->lines[$i]->get_prev_progress($object->id); - $progress = ( $object->lines[$i]->situation_percent - $prev_progress) /100; - $result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs); - } + $prev_progress = 0; + $progress = 1; + if (method_exists($object, 'get_prev_progress')) + { + $prev_progress = $object->lines[$i]->get_prev_progress($object->id); + $progress = ($object->lines[$i]->situation_percent - $prev_progress) / 100; + } + $result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs); + } else $result.=price($sign * $total_ht, 0, $outputlangs); } From 36b4d50cffe3ca0ac7384d1c55cdbeedc7aa80cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Nov 2017 20:41:25 +0100 Subject: [PATCH 57/76] FIX #7737 --- htdocs/expensereport/card.php | 6 +++++- htdocs/expensereport/class/expensereport.class.php | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 5e3cb946f10..f70982fd429 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -228,8 +228,12 @@ if (empty($reshook)) $db->begin(); $id = $object->create($user); + if ($id <= 0) + { + $error++; + } - if ($id > 0) + if (! $error) { $db->commit(); Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 0ac2ce64062..40a1b3111a7 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -187,7 +187,8 @@ class ExpenseReport extends CommonObject $resql=$this->db->query($sql); if (!$resql) $error++; - if (is_array($this->lines) && count($this->lines)>0) { + if (is_array($this->lines) && count($this->lines)>0) + { foreach ($this->lines as $i => $val) { $newndfline=new ExpenseReportLine($this->db); @@ -205,6 +206,12 @@ class ExpenseReport extends CommonObject } } + if (! $error) + { + $result=$this->insertExtraFields(); + if ($result < 0) $error++; + } + if (! $error) { $result=$this->update_price(); From 90615a8682daa57a5449885ec22917824b957a89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Nov 2017 02:44:02 +0100 Subject: [PATCH 58/76] Fix busy tag not set sometimes --- htdocs/comm/action/card.php | 2 ++ htdocs/comm/action/class/actioncomm.class.php | 6 +++--- htdocs/theme/eldy/style.css.php | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 03d73635c17..c8fd5d32c2e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1329,6 +1329,8 @@ if ($id > 0) print ''; if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid))) { + //var_dump($object->userassigned); + //var_dump($listofuserid); print '
'; print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody print '
'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 00561fcd3b0..24b768397e2 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -225,11 +225,11 @@ class ActionComm extends CommonObject if ($this->elementtype=='commande') $this->elementtype='order'; if ($this->elementtype=='contrat') $this->elementtype='contract'; - if (! is_array($this->userassigned) && ! empty($this->userassigned)) // For backward compatibility + if (! is_array($this->userassigned) && ! empty($this->userassigned)) // For backward compatibility when userassigned was an int instead fo array { $tmpid=$this->userassigned; $this->userassigned=array(); - $this->userassigned[$tmpid]=array('id'=>$tmpid); + $this->userassigned[$tmpid]=array('id'=>$tmpid, 'transparency'=>$this->transparency); } if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated @@ -240,7 +240,7 @@ class ActionComm extends CommonObject // Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...). if (empty($this->userassigned) || count($this->userassigned) == 0 || ! is_array($this->userassigned)) - $this->userassigned = array($userownerid=>array('id'=>$userownerid)); + $this->userassigned = array($userownerid=>array('id'=>$userownerid, 'transparency'=>$this->transparency)); if (! $this->type_id || ! $this->type_code) { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 515015b5b5a..06d24db8948 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3401,7 +3401,7 @@ table.cal_month td:last-child { border-right: 0px; } .cal_today_peruser { background: #FDFDF0; border-right: solid 1px #E0E0E0; border-bottom: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today_peruser_peruserleft { background: #FDFDF0; border-left: solid 2px #6C7C7B; border-right: solid 1px #E0E0E0; border-bottom: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past { } -.cal_peruser { padding: 0px; } +.cal_peruser { padding-top: 0 !important; padding-bottom: 0 !important; padding-: 1px !important; padding-: 1px !important; } .cal_impair { background: #F8F8F8; } .cal_today_peruser_impair { background: #F8F8F0; } .peruser_busy { background: #CC8888; } From 05683bbf6172f91fa350161706e6bb6d6916aafe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Nov 2017 11:41:37 +0100 Subject: [PATCH 59/76] Code comment --- dev/dolibarr_changes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 3b9ef4cc447..3c2b7b3c932 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -99,7 +99,7 @@ JQUERYFILETREE: RESTLER: -------- -* Add 2 lines into function +* Add 2 lines into file AutoLoader.php to complete function private function alias($className, $currentClass) { ... From 1a5bbef2664e2307460aeae9a3bbdeff1020d182 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Nov 2017 13:07:31 +0100 Subject: [PATCH 60/76] FIX Locatax were not propagated when cloning order or proposal --- htdocs/comm/propal/class/propal.class.php | 19 +++++++++++-------- htdocs/commande/class/commande.class.php | 12 ++++++++---- htdocs/compta/facture/class/facture.class.php | 10 +++++++--- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 64997b4c9ea..ffeda27da42 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -371,12 +371,12 @@ class Propal extends CommonObject * by whose calling the method get_default_tva (societe_vendeuse, societe_acheteuse, '' product) * and desc must already have the right value (it's up to the caller to manage multilanguage) * - * @param string $desc Description de la ligne - * @param float $pu_ht Prix unitaire - * @param float $qty Quantite - * @param float $txtva Taux de tva - * @param float $txlocaltax1 Local tax 1 rate - * @param float $txlocaltax2 Local tax 2 rate + * @param string $desc Description of line + * @param float $pu_ht Unit price + * @param float $qty Quantity + * @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') + * @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside) + * @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside) * @param int $fk_product Id du produit/service predefini * @param float $remise_percent Pourcentage de remise de la ligne * @param string $price_base_type HT or TTC @@ -1018,11 +1018,15 @@ class Propal extends CommonObject $fk_parent_line = 0; } + // Complete vat rate with code + $vatrate = $this->lines[$i]->tva_tx; + if ($this->lines[$i]->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$this->lines[$i]->vat_src_code.')'; + $result = $this->addline( $this->lines[$i]->desc, $this->lines[$i]->subprice, $this->lines[$i]->qty, - $this->lines[$i]->tva_tx, + $vatrate, $this->lines[$i]->localtax1_tx, $this->lines[$i]->localtax2_tx, $this->lines[$i]->fk_product, @@ -1227,7 +1231,6 @@ class Propal extends CommonObject if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $clonedObj->ref_client = ''; // Create clone - $result=$clonedObj->create($user); if ($result < 0) $error++; else diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 56a7fe16b43..5023410cf53 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -821,11 +821,15 @@ class Commande extends CommonOrder $fk_parent_line = 0; } + // Complete vat rate with code + $vatrate = $line->tva_tx; + if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')'; + $result = $this->addline( $line->desc, $line->subprice, $line->qty, - $line->tva_tx, + $vatrate, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, @@ -1211,9 +1215,9 @@ class Commande extends CommonOrder * @param string $desc Description of line * @param float $pu_ht Unit price (without tax) * @param float $qty Quantite - * @param float $txtva Taux de tva force, sinon -1 - * @param float $txlocaltax1 Local tax 1 rate - * @param float $txlocaltax2 Local tax 2 rate + * @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') + * @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside) + * @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside) * @param int $fk_product Id of product * @param float $remise_percent Pourcentage de remise de la ligne * @param int $info_bits Bits de type de lignes diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 99665476a8e..e704a5a229a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -575,11 +575,15 @@ class Facture extends CommonInvoice $fk_parent_line = 0; } + // Complete vat rate with code + $vatrate = $line->tva_tx; + if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')'; + $result = $this->addline( $line->desc, $line->subprice, $line->qty, - $line->tva_tx, + $vatrate, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, @@ -2427,8 +2431,8 @@ class Facture extends CommonInvoice * @param double $pu_ht Unit price without tax (> 0 even for credit note) * @param double $qty Quantity * @param double $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') - * @param double $txlocaltax1 Local tax 1 rate (deprecated) - * @param double $txlocaltax2 Local tax 2 rate (deprecated) + * @param double $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside) + * @param double $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside) * @param int $fk_product Id of predefined product/service * @param double $remise_percent Percent of discount on line * @param int $date_start Date start of service From b5196b71641699b8e83ba6166a74a52081c0405e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Nov 2017 14:02:17 +0100 Subject: [PATCH 61/76] FIX A lot of several fix on local taxes and NPR tax --- htdocs/cashdesk/facturation_verif.php | 11 ++- htdocs/comm/propal/card.php | 3 + htdocs/commande/card.php | 11 ++- htdocs/compta/facture/card.php | 3 + htdocs/compta/facture/fiche-rec.php | 3 + htdocs/contrat/card.php | 3 + htdocs/core/class/commonobject.class.php | 1 + htdocs/expedition/class/expedition.class.php | 3 +- .../install/mysql/migration/5.0.0-6.0.0.sql | 2 + htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/stocks.lang | 2 +- htdocs/product/price.php | 73 ++++++++++++++----- 12 files changed, 88 insertions(+), 28 deletions(-) diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index 24876a0a8fb..25ddfd8c1f8 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -114,10 +114,13 @@ switch($action) { if (count($prodcustprice->lines) > 0) { - $pu_ht = price($prodcustprice->lines [0]->price); - $pu_ttc = price($prodcustprice->lines [0]->price_ttc); - $price_base_type = $prodcustprice->lines [0]->price_base_type; - $tva_tx = $prodcustprice->lines [0]->tva_tx; + $pu_ht = price($prodcustprice->lines[0]->price); + $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_base_type = $prodcustprice->lines[0]->price_base_type; + $tva_tx = $prodcustprice->lines[0]->tva_tx; + if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + $tva_npr = $prodcustprice->lines[0]->recuperableonly; + if (empty($tva_tx)) $tva_npr=0; } } else diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 839538f777e..c3be71c35a1 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -805,6 +805,9 @@ if (empty($reshook)) $pu_ttc = price($prodcustprice->lines[0]->price_ttc); $price_base_type = $prodcustprice->lines[0]->price_base_type; $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx . ' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); + if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + $tva_npr = $prodcustprice->lines[0]->recuperableonly; + if (empty($tva_tx)) $tva_npr=0; } } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 374ec0477fe..33048f8d470 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -766,10 +766,13 @@ if (empty($reshook)) { if (count($prodcustprice->lines) > 0) { - $pu_ht = price($prodcustprice->lines [0]->price); - $pu_ttc = price($prodcustprice->lines [0]->price_ttc); - $price_base_type = $prodcustprice->lines [0]->price_base_type; - $tva_tx = $prodcustprice->lines [0]->tva_tx; + $pu_ht = price($prodcustprice->lines[0]->price); + $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_base_type = $prodcustprice->lines[0]->price_base_type; + $tva_tx = $prodcustprice->lines[0]->tva_tx; + if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + $tva_npr = $prodcustprice->lines[0]->recuperableonly; + if (empty($tva_tx)) $tva_npr=0; } } else diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f438a5ab6b9..3bc4759e589 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1589,6 +1589,9 @@ if (empty($reshook)) $pu_ttc = price($prodcustprice->lines[0]->price_ttc); $price_base_type = $prodcustprice->lines[0]->price_base_type; $tva_tx = $prodcustprice->lines[0]->tva_tx; + if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + $tva_npr = $prodcustprice->lines[0]->recuperableonly; + if (empty($tva_tx)) $tva_npr=0; } } } diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 0bfdc134258..c748cb0a0e3 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -530,6 +530,9 @@ if (empty($reshook)) $pu_ttc = price($prodcustprice->lines[0]->price_ttc); $price_base_type = $prodcustprice->lines[0]->price_base_type; $tva_tx = $prodcustprice->lines[0]->tva_tx; + if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + $tva_npr = $prodcustprice->lines[0]->recuperableonly; + if (empty($tva_tx)) $tva_npr=0; } } } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 39a708bcdad..43f086fbab4 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -509,6 +509,9 @@ if (empty($reshook)) $pu_ttc = price($prodcustprice->lines [0]->price_ttc); $price_base_type = $prodcustprice->lines [0]->price_base_type; $tva_tx = $prodcustprice->lines [0]->tva_tx; + if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + $tva_npr = $prodcustprice->lines[0]->recuperableonly; + if (empty($tva_tx)) $tva_npr=0; } } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a97b553aed4..83c38477f28 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3748,6 +3748,7 @@ abstract class CommonObject // VAT Rate $this->tpl['vat_rate'] = vatrate($line->tva_tx, true); + $this->tpl['vat_rate'] .= (($line->info_bits & 1) == 1) ? '*' : ''; if (! empty($line->vat_src_code) && ! preg_match('/\(/', $this->tpl['vat_rate'])) $this->tpl['vat_rate'].=' ('.$line->vat_src_code.')'; $this->tpl['price'] = price($line->subprice); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 879b5745db4..bccfba4446d 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1321,7 +1321,7 @@ class Expedition extends CommonObject $sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type"; $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; - $sql.= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht"; + $sql.= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.info_bits, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht"; $sql.= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc"; $sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; @@ -1418,6 +1418,7 @@ class Expedition extends CommonObject $line->tva_tx = $obj->tva_tx; $line->localtax1_tx = $obj->localtax1_tx; $line->localtax2_tx = $obj->localtax2_tx; + $line->info_bits = $obj->info_bits; $line->price = $obj->price; $line->subprice = $obj->subprice; $line->remise_percent = $obj->remise_percent; diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 5da8799d7b3..8b68929864f 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -382,6 +382,8 @@ ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_tx d ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_price double(24,8) DEFAULT NULL; ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_price_ttc double(24,8) DEFAULT NULL; +ALTER TABLE llx_product_customer_price_log ADD COLUMN default_vat_code varchar(10); + UPDATE llx_contrat SET ref = rowid WHERE ref IS NULL OR ref = ''; ALTER TABLE llx_contratdet ADD COLUMN vat_src_code varchar(10) DEFAULT ''; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 02f3f80982e..9c53b726544 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -366,6 +366,7 @@ TotalLT1IN=Total CGST TotalLT2IN=Total SGST HT=Net of tax TTC=Inc. tax +INCVATONLY=Inc. VAT INCT=Inc. all taxes VAT=Sales tax VATIN=IGST diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index f2115666a36..a4fb098f5ac 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -133,7 +133,7 @@ MovementLabel=Label of movement InventoryCode=Movement or inventory code IsInPackage=Contained into package WarehouseAllowNegativeTransfer=Stock can be negative -qtyToTranferIsNotEnough=You don't have enough stock from your source warehouse +qtyToTranferIsNotEnough=You don't have enough stock from your source warehouse and your setup does not allow negative stocks. ShowWarehouse=Show warehouse MovementCorrectStock=Stock correction for product %s MovementTransferStock=Stock transfer of product %s into another warehouse diff --git a/htdocs/product/price.php b/htdocs/product/price.php index f16b716c9cc..b38aa15a694 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1800,8 +1800,15 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print '' . $langs->trans("PriceBase") . ''; print '' . $langs->trans("VATRate") . ''; print '' . $langs->trans("HT") . ''; - print '' . $langs->trans("TTC") . ''; - if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '' . $langs->trans("INCT") . ''; + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") + { + //print '' . $langs->trans("INCVATONLY") . ''; + print '' . $langs->trans("INCT") . ''; + } + else + { + print '' . $langs->trans("TTC") . ''; + } print '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . ''; print '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . ''; print '' . $langs->trans("ChangedBy") . ''; @@ -1843,20 +1850,28 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print "" . dol_print_date($line->datec, "dayhour") . ""; print '' . $langs->trans($line->price_base_type) . ""; print ''; -var_dump($prodcustprice);exit; + $positiverates=''; - if (price2num($objp->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($objp->tva_tx); - if (price2num($objp->localtax1_type)) $positiverates.=($positiverates?'/':'').price2num($objp->localtax1_tx); - if (price2num($objp->localtax2_type)) $positiverates.=($positiverates?'/':'').price2num($objp->localtax2_tx); + if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); + if (price2num($line->localtax1_type)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); + if (price2num($line->localtax2_type)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); if (empty($positiverates)) $positiverates='0'; - echo vatrate($positiverates.($objp->default_vat_code?' ('.$objp->default_vat_code.')':''), '%', $objp->tva_npr); + + echo vatrate($positiverates.($line->default_vat_code?' ('.$line->default_vat_code.')':''), '%', ($line->tva_npr?$line->tva_npr:$line->recuperableonly)); //. vatrate($tva_tx, true, $line->recuperableonly) . print ""; print '' . price($line->price) . ""; - print '' . price($line->price_ttc) . ""; - if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '' . price($resultarray[2]) . ''; + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") + { + //print '' . price($line->price_ttc) . ""; + print '' . price($resultarray[2]) . ''; + } + else + { + print '' . price($line->price_ttc) . ""; + } print '' . price($line->price_min) . ''; print '' . price($line->price_min_ttc) . ''; @@ -1902,7 +1917,7 @@ var_dump($prodcustprice);exit; if (count($prodcustprice->lines) > 0 || $search_soc) { $colspan=8; - if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") $colspan++; + //if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") $colspan++; print ''; print ''; @@ -1921,8 +1936,16 @@ var_dump($prodcustprice);exit; print '' . $langs->trans("PriceBase") . ''; print '' . $langs->trans("VATRate") . ''; print '' . $langs->trans("HT") . ''; - print '' . $langs->trans("TTC") . ''; - if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '' . $langs->trans("INCT") . ''; + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") + { + //print '' . $langs->trans("INCVATONLY") . ''; + print '' . $langs->trans("INCT") . ''; + } + else + { + print '' . $langs->trans("TTC") . ''; + } + print '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . ''; print '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . ''; print '' . $langs->trans("ChangedBy") . ''; @@ -1969,9 +1992,17 @@ var_dump($prodcustprice);exit; print ""; print '' . price($object->price) . ""; - print '' . price($object->price_ttc) . ""; - if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '' . price($resultarray[2]) . ''; + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") + { + //print '' . price($object->price_ttc) . ""; + print '' . price($resultarray[2]) . ''; + } + else + { + print '' . price($object->price_ttc) . ""; + } + print '' . price($object->price_min) . ''; print '' . price($object->price_min_ttc) . ''; @@ -1992,7 +2023,6 @@ var_dump($prodcustprice);exit; } print "\n"; - if (count($prodcustprice->lines) > 0) { foreach ($prodcustprice->lines as $line) @@ -2037,13 +2067,20 @@ var_dump($prodcustprice);exit; if (price2num($line->localtax1_type)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); if (price2num($line->localtax2_type)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); if (empty($positiverates)) $positiverates='0'; - echo vatrate($positiverates.($line->default_vat_code?' ('.$line->default_vat_code.')':''), '%', $line->tva_npr); + echo vatrate($positiverates.($line->default_vat_code?' ('.$line->default_vat_code.')':''), '%', ($line->tva_npr?$line->tva_npr:$line->recuperableonly)); print ""; print '' . price($line->price) . ""; - print '' . price($line->price_ttc) . ""; - if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '' . price($resultarray[2]) . ''; + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") + { + //print '' . price($line->price_ttc) . ""; + print '' . price($resultarray[2]) . ''; + } + else + { + print '' . price($line->price_ttc) . ""; + } print '' . price($line->price_min) . ''; print '' . price($line->price_min_ttc) . ''; From a2c80a704f69316e65414b3ffac9388326d2d77d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Nov 2017 19:06:58 +0100 Subject: [PATCH 62/76] Code comment --- .../modules/import/import_xlsx.modules.php | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index eff3b8f8b21..22b81fcdcbf 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -20,9 +20,9 @@ */ /** - * \file htdocs/core/modules/import/import_csv.modules.php + * \file htdocs/core/modules/import/import_xlsx.modules.php * \ingroup import - * \brief File to load import files with CSV format + * \brief File to load import files with Excel format */ require_once DOL_DOCUMENT_ROOT .'/core/modules/import/modules_import.php'; @@ -54,10 +54,10 @@ class ImportXlsx extends ModeleImports var $cacheconvert=array(); // Array to cache list of value found after a convertion var $cachefieldtable=array(); // Array to cache list of value found into fields@tables - + var $workbook; // temporary import file var $record; // current record - var $headers; + var $headers; /** @@ -95,7 +95,7 @@ class ImportXlsx extends ModeleImports if (preg_match('/^societe_/',$datatoimport)) $this->thirpartyobject=new Societe($this->db); } - + /** * Output header of an example file for this format * @@ -144,7 +144,7 @@ class ImportXlsx extends ModeleImports foreach($headerlinefields as $field) { $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($col, 1, $outputlangs->transnoentities($field)); // set autowidth - //$this->workbook->getActiveSheet()->getColumnDimension($this->column2Letter($col + 1))->setAutoSize(true); + //$this->workbook->getActiveSheet()->getColumnDimension($this->column2Letter($col + 1))->setAutoSize(true); $col++; } return ''; // final output will be generated in footer @@ -211,10 +211,10 @@ class ImportXlsx extends ModeleImports return $ret; } - + /** * Return nb of records. File must be closed. - * + * * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ @@ -222,15 +222,15 @@ class ImportXlsx extends ModeleImports { $reader = new PHPExcel_Reader_Excel2007(); $this->workbook = $reader->load($file); - + $rowcount = $this->workbook->getActiveSheet()->getHighestDataRow(); - + $this->workbook->disconnectWorksheets(); unset($this->workbook); - + return $rowcount; } - + /** * Input header line from file @@ -399,7 +399,7 @@ class ImportXlsx extends ModeleImports if (! is_numeric($newval) && $newval != '' && ! preg_match('/^id:/i',$newval)) $isidorref='ref'; $newval=preg_replace('/^(id|ref):/i','',$newval); // Remove id: or ref: that was used to force if field is id or ref //print 'Val is now '.$newval.' and is type '.$isidorref."
\n"; - + if ($isidorref == 'ref') // If value into input import file is a ref, we apply the function defined into descriptor { $file=(empty($objimport->array_import_convertvalue[0][$val]['classfile'])?$objimport->array_import_convertvalue[0][$val]['file']:$objimport->array_import_convertvalue[0][$val]['classfile']); @@ -502,9 +502,9 @@ class ImportXlsx extends ModeleImports } if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; $newval=$defaultref; - } - - + } + + elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='numeric') { $newval = price2num($newval); @@ -616,7 +616,7 @@ class ImportXlsx extends ModeleImports // We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields) if (empty($lastinsertid)) { $sqlSelect = 'SELECT rowid FROM '.$tablename; - + $data = array_combine($listfields, $listvalues); $where = array(); $filters = array(); @@ -627,7 +627,7 @@ class ImportXlsx extends ModeleImports $filters[] = $col.' = '.$data[$key]; } $sqlSelect.= ' WHERE '.implode(' AND ', $where); - + $resql=$this->db->query($sqlSelect); if($resql) { $res = $this->db->fetch_object($resql); @@ -650,23 +650,23 @@ class ImportXlsx extends ModeleImports $error++; } } - + if (!empty($lastinsertid)) { // Build SQL UPDATE request $sqlstart = 'UPDATE '.$tablename; - + $data = array_combine($listfields, $listvalues); $set = array(); foreach ($data as $key => $val) { $set[] = $key.' = '.$val; } $sqlstart.= ' SET '.implode(', ', $set); - + if(empty($keyfield)) $keyfield = 'rowid'; $sqlend = ' WHERE '.$keyfield.' = '.$lastinsertid; - + $sql = $sqlstart.$sqlend; - + // Run update request $resql=$this->db->query($sql); if($resql) { @@ -691,14 +691,14 @@ class ImportXlsx extends ModeleImports if (! empty($tablewithentity_cache[$tablename])) { $sqlstart.= ', entity'; $sqlend.= ', '.$conf->entity; - } + } if (! empty($objimport->array_import_tables_creator[0][$alias])) { $sqlstart.= ', '.$objimport->array_import_tables_creator[0][$alias]; $sqlend.=', '.$user->id; } $sql = $sqlstart.$sqlend.')'; dol_syslog("import_xlsx.modules", LOG_DEBUG); - + // Run insert request if ($sql) { From e195cf0b9566dc4fa2050cfad2f8651c230b6274 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 14 Nov 2017 09:53:06 +0100 Subject: [PATCH 63/76] fix : return vat code for supplier price --- htdocs/core/lib/functions.lib.php | 1 + htdocs/product/class/product.class.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 51eb070da91..b58d24ba028 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4306,6 +4306,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr { $product->get_buyprice($idprodfournprice,0,0,0); $ret=$product->vatrate_supplier; + if ($product->default_vat_code) $ret.=' ('.$product->default_vat_code.')'; } else { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 05adfc1b5c5..b0985f6f2e8 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1505,6 +1505,7 @@ class Product extends CommonObject // We do a first seach with a select by searching with couple prodfournprice and qty only (later we will search on triplet qty/product_id/fourn_ref) $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.remise_percent,"; $sql.= " pfp.fk_product, pfp.ref_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression"; + $sql.= " ,pfp.default_vat_code"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.rowid = ".$prodfournprice; if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty; @@ -1540,6 +1541,7 @@ class Product extends CommonObject $this->ref_supplier = $obj->ref_fourn; // Ref supplier $this->remise_percent = $obj->remise_percent; // remise percent if present and not typed $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier + $this->default_vat_code = $obj->default_vat_code; // Vat code supplier $result=$obj->fk_product; return $result; } @@ -1548,6 +1550,7 @@ class Product extends CommonObject // We do a second search by doing a select again but searching with less reliable criteria: couple qty/id product, and if set fourn_ref or fk_soc. $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,"; $sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx, pfp.fk_supplier_price_expression"; + $sql.= " ,pfp.default_vat_code"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.fk_product = ".$product_id; if ($fourn_ref != 'none') $sql.= " AND pfp.ref_fourn = '".$fourn_ref."'"; @@ -1587,6 +1590,7 @@ class Product extends CommonObject $this->ref_supplier = $obj->ref_supplier; // Ref supplier $this->remise_percent = $obj->remise_percent; // remise percent if present and not typed $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier + $this->default_vat_code = $obj->default_vat_code; // Vat code supplier $result=$obj->fk_product; return $result; } From f789714f14fa2838d210a415d341478b30f32892 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Nov 2017 18:16:01 +0100 Subject: [PATCH 64/76] Fix translation --- htdocs/langs/en_US/boxes.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 9eb795ea7d1..f5e1ee8f366 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -77,7 +77,7 @@ BoxTitleLastModifiedSupplierBills=Latest %s modified supplier bills BoxTitleLatestModifiedSupplierOrders=Latest %s modified supplier orders BoxTitleLastModifiedCustomerBills=Latest %s modified customer bills BoxTitleLastModifiedCustomerOrders=Latest %s modified customer orders -BoxTitleLastModifiedPropals=Latest %s modified propals +BoxTitleLastModifiedPropals=Latest %s modified proposals ForCustomersInvoices=Customers invoices ForCustomersOrders=Customers orders ForProposals=Proposals From 388b90a94c6db77bdf1f149a9c8d390b1389a7b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Nov 2017 19:00:52 +0100 Subject: [PATCH 65/76] Fix repair of utf8 --- htdocs/install/repair.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 058802978fd..8313f920394 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -897,7 +897,7 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha')) { print '
*** Force page code and collation with utf8 (for mysql/mariadb only)'; - if ($db->type == "mysql") + if ($db->type == "mysql" || $db->type == "mysqli") { $listoftables = $db->DDLListTables($db->database_name); From 77b6ef7396d8899addeb7727524ca0950175d224 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Nov 2017 19:41:57 +0100 Subject: [PATCH 66/76] Code comment --- htdocs/install/repair.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 8313f920394..d6a13f0813f 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -895,7 +895,7 @@ if ($ok && GETPOST('force_disable_of_modules_not_found','alpha')) // clean_linked_elements: Check and clean linked elements if ($ok && GETPOST('force_utf8_on_tables','alpha')) { - print '
*** Force page code and collation with utf8 (for mysql/mariadb only)'; + print '
*** Force page code and collation with utf8/utf8_unicode_ci (for mysql/mariadb only)'; if ($db->type == "mysql" || $db->type == "mysqli") { From 924cf871a7e4ada9dc31eaca1920454f8371de62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Nov 2017 10:40:24 +0100 Subject: [PATCH 67/76] FIX CSS for IE10 --- htdocs/theme/eldy/style.css.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 06d24db8948..e809f800bb5 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2868,6 +2868,12 @@ span.boxstatstext { opacity: 0.8; line-height: 18px; } +span.boxstatstext img, a.dashboardlineindicatorlate img { + border: 0; +} +a img { + border: 0; +} span.boxstatsindicator { font-size: 130%; font-weight: normal; From 4b90510b821cd84f9ee1d1c3f3c7804c56846f20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Nov 2017 22:35:55 +0100 Subject: [PATCH 68/76] Fix time assigned to wrong user --- htdocs/projet/activity/perday.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index b767c35e329..36b55ea79ff 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -237,7 +237,7 @@ if ($action == 'addtime' && $user->rights->projet->lire) $object->fetch($key); $object->progress = GETPOST($key.'progress', 'int'); $object->timespent_duration = $val; - $object->timespent_fk_user = $user->id; + $object->timespent_fk_user = $usertoprocess->id; $object->timespent_note = GETPOST($key.'note'); if (GETPOST($key."hour") != '' && GETPOST($key."hour") >= 0) // If hour was entered { From 57a6ada2a35bfee63d0e18178b913283bdf8148b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Nov 2017 13:56:41 +0100 Subject: [PATCH 69/76] FIX #7824 --- htdocs/product/stock/replenishorders.php | 74 +++++++++++++++--------- 1 file changed, 48 insertions(+), 26 deletions(-) diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 694f9cae1ad..b707b3f19a6 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -29,7 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -require_once './lib/replenishment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/lib/replenishment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("products"); $langs->load("stocks"); @@ -44,9 +45,13 @@ $sref = GETPOST('search_ref', 'alpha'); $snom = GETPOST('search_nom', 'alpha'); $suser = GETPOST('search_user', 'alpha'); $sttc = GETPOST('search_ttc', 'alpha'); -$sdate = GETPOST('search_date', 'alpha'); $page = GETPOST('page', 'int'); $sproduct = GETPOST('sproduct', 'int'); +$search_dateyear = GETPOST('search_dateyear', 'int'); +$search_datemonth = GETPOST('search_datemonth', 'int'); +$search_dateday = GETPOST('search_dateday', 'int'); +$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear); +if (GETPOST('search_date', 'alpha')) $search_date = dol_stringtotime(GETPOST('search_date', 'alpha')); // For backward compatibility $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield"); @@ -70,7 +75,10 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $snom=""; $suser=""; $sttc=""; - $sdate=''; + $search_date=''; + $search_datemonth=''; + $search_dateday=''; + $search_dateyear=''; $sproduct=0; } @@ -125,17 +133,19 @@ if ($sref) $sql .= natural_search('cf.ref', $sref); if ($snom) $sql .= natural_search('s.nom', $snom); if ($suser) $sql .= natural_search('u.login', $suser); if ($sttc) $sql .= natural_search('cf.total_ttc', $sttc, 1); -if ($sdate) + +if ($search_datemonth > 0) { - if (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int')) - { - $date = dol_mktime(0, 0, 0, GETPOST('search_datemonth', 'int'), GETPOST('search_dateday', 'int'), GETPOST('search_dateyear', 'int')); - } - else - { - $date = dol_stringtotime($sdate); - } - $sql .= " AND cf.date_creation = '" . $db->idate($date) . "'"; + if ($search_dateyear > 0 && empty($search_dateday)) + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,$search_datemonth,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,$search_datemonth,false))."'"; + else if ($search_dateyear > 0 && ! empty($search_dateday)) + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_datemonth, $search_dateday, $search_dateyear))."'"; + else + $sql.= " AND date_format(cf.date_creation, '%m') = '".$search_datemonth."'"; +} +else if ($search_dateyear > 0) +{ + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,12,false))."'"; } if ($sall) $sql .= natural_search(array('cf.ref','cf.note'), $sall); if (!empty($socid)) $sql .= ' AND s.rowid = ' . $socid; @@ -146,7 +156,6 @@ $sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut'; $sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom'; $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($limit+1, $offset); -//print $sql; $resql = $db->query($sql); if ($resql) @@ -158,25 +167,38 @@ if ($resql) print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, ''); + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($sref) $param.='&search_ref='.urlencode($sref); + if ($snom) $param.='&search_nom='.urlencode($snom); + if ($suser) $param.='&search_user='.urlencode($suser); + if ($sttc) $param.='&search_ttc='.urlencode($sttc); + if ($search_dateyear) $param.='&search_dateyear='.urlencode($search_dateyear); + if ($search_datemonth) $param.='&search_datemonth='.urlencode($search_datemonth); + if ($search_dateday) $param.='&search_dateday='.urlencode($search_dateday); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + + print ''; print ''; - print ''. - ''; + print ''. ''. ''. ''. ''. '
'. - ''. + print '
'. + ''. ''. - ''. + ''. ''. - ''. + ''. ''. - ''. + ''. ''. - $form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). + $form->select_date($search_date, 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); @@ -190,7 +212,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.ref', '', - '', + $param, '', $sortfield, $sortorder @@ -200,7 +222,7 @@ if ($resql) $_SERVER['PHP_SELF'], 's.nom', '', - '', + $param, '', $sortfield, $sortorder @@ -220,7 +242,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.total_ttc', '', - '', + $param, '', $sortfield, $sortorder @@ -230,7 +252,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.date_creation', '', - '', + $param, '', $sortfield, $sortorder @@ -240,7 +262,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.fk_statut', '', - '', + $param, 'align="right"', $sortfield, $sortorder From 7f28c9fff6119b72e52fcd365ccd69aad7a1bd0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Nov 2017 13:56:41 +0100 Subject: [PATCH 70/76] FIX #7824 Conflicts: htdocs/product/stock/replenishorders.php --- htdocs/product/stock/replenishorders.php | 73 ++++++++++++++++-------- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 5b1fda0371f..37d7bfd19f6 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -29,7 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -require_once './lib/replenishment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/lib/replenishment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("products"); $langs->load("stocks"); @@ -44,9 +45,13 @@ $sref = GETPOST('search_ref', 'alpha'); $snom = GETPOST('search_nom', 'alpha'); $suser = GETPOST('search_user', 'alpha'); $sttc = GETPOST('search_ttc', 'alpha'); -$sdate = GETPOST('search_date', 'alpha'); $page = GETPOST('page', 'int'); $sproduct = GETPOST('sproduct', 'int'); +$search_dateyear = GETPOST('search_dateyear', 'int'); +$search_datemonth = GETPOST('search_datemonth', 'int'); +$search_dateday = GETPOST('search_dateday', 'int'); +$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear); +if (GETPOST('search_date', 'alpha')) $search_date = dol_stringtotime(GETPOST('search_date', 'alpha')); // For backward compatibility $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield"); @@ -70,7 +75,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $snom=""; $suser=""; $sttc=""; - $sdate=''; + $search_date=''; + $search_datemonth=''; + $search_dateday=''; + $search_dateyear=''; $sproduct=0; } @@ -125,17 +133,19 @@ if ($sref) $sql .= natural_search('cf.ref', $sref); if ($snom) $sql .= natural_search('s.nom', $snom); if ($suser) $sql .= natural_search('u.login', $suser); if ($sttc) $sql .= natural_search('cf.total_ttc', $sttc, 1); -if ($sdate) + +if ($search_datemonth > 0) { - if (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int')) - { - $date = dol_mktime(0, 0, 0, GETPOST('search_datemonth', 'int'), GETPOST('search_dateday', 'int'), GETPOST('search_dateyear', 'int')); - } - else - { - $date = dol_stringtotime($sdate); - } - $sql .= " AND cf.date_creation = '" . $db->idate($date) . "'"; + if ($search_dateyear > 0 && empty($search_dateday)) + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,$search_datemonth,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,$search_datemonth,false))."'"; + else if ($search_dateyear > 0 && ! empty($search_dateday)) + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_datemonth, $search_dateday, $search_dateyear))."'"; + else + $sql.= " AND date_format(cf.date_creation, '%m') = '".$search_datemonth."'"; +} +else if ($search_dateyear > 0) +{ + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,12,false))."'"; } if ($sall) $sql .= natural_search(array('cf.ref','cf.note'), $sall); if (!empty($socid)) $sql .= ' AND s.rowid = ' . $socid; @@ -146,7 +156,6 @@ $sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut'; $sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom'; $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($limit+1, $offset); -//print $sql; $resql = $db->query($sql); if ($resql) @@ -158,6 +167,19 @@ if ($resql) print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, ''); + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($sref) $param.='&search_ref='.urlencode($sref); + if ($snom) $param.='&search_nom='.urlencode($snom); + if ($suser) $param.='&search_user='.urlencode($suser); + if ($sttc) $param.='&search_ttc='.urlencode($sttc); + if ($search_dateyear) $param.='&search_dateyear='.urlencode($search_dateyear); + if ($search_datemonth) $param.='&search_datemonth='.urlencode($search_datemonth); + if ($search_dateday) $param.='&search_dateday='.urlencode($search_dateday); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + + print ''; print ''. @@ -167,7 +189,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.ref', '', - '', + $param, '', $sortfield, $sortorder @@ -177,7 +199,7 @@ if ($resql) $_SERVER['PHP_SELF'], 's.nom', '', - '', + $param, '', $sortfield, $sortorder @@ -187,7 +209,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'u.login', '', - '', + $param, '', $sortfield, $sortorder @@ -197,7 +219,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.total_ttc', '', - '', + $param, '', $sortfield, $sortorder @@ -207,7 +229,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.date_creation', '', - '', + $param, '', $sortfield, $sortorder @@ -217,7 +239,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.fk_statut', '', - '', + $param, 'align="right"', $sortfield, $sortorder @@ -226,19 +248,19 @@ if ($resql) ''. ''. ''. ''. ''. ''. ''; $var = true; + $userstatic = new User($db); while ($i < min($num,$conf->liste_limit)) From fde33594a2c0b87e756cbcc34ce1d02ea2265f53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Nov 2017 14:06:08 +0100 Subject: [PATCH 71/76] FIX #7824 --- htdocs/product/stock/replenishorders.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 37d7bfd19f6..59a1a28ccf5 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -51,7 +51,6 @@ $search_dateyear = GETPOST('search_dateyear', 'int'); $search_datemonth = GETPOST('search_datemonth', 'int'); $search_dateday = GETPOST('search_dateday', 'int'); $search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear); -if (GETPOST('search_date', 'alpha')) $search_date = dol_stringtotime(GETPOST('search_date', 'alpha')); // For backward compatibility $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield"); @@ -63,7 +62,6 @@ if ($page < 0) $page = 0; $offset = $limit * $page; - /* * Actions */ @@ -244,6 +242,7 @@ if ($resql) $sortfield, $sortorder ); + print ''. ''. From 42b7d805675ad3ea3e34664c55b93d4b11be057f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Nov 2017 14:06:08 +0100 Subject: [PATCH 72/76] FIX #7824 Conflicts: htdocs/product/stock/replenishorders.php --- htdocs/product/stock/replenishorders.php | 91 +++++++++++++++++++----- 1 file changed, 73 insertions(+), 18 deletions(-) diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 785760ef511..c4a57d0475c 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -29,7 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -require_once './lib/replenishment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/lib/replenishment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("products"); $langs->load("stocks"); @@ -39,6 +40,46 @@ $langs->load("orders"); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service'); +$sall = GETPOST('search_all', 'alphanohtml'); +$sref = GETPOST('search_ref', 'alpha'); +$snom = GETPOST('search_nom', 'alpha'); +$suser = GETPOST('search_user', 'alpha'); +$sttc = GETPOST('search_ttc', 'alpha'); +$page = GETPOST('page', 'int'); +$sproduct = GETPOST('sproduct', 'int'); +$search_dateyear = GETPOST('search_dateyear', 'int'); +$search_datemonth = GETPOST('search_datemonth', 'int'); +$search_dateday = GETPOST('search_dateday', 'int'); +$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear); + +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; +$sortfield = GETPOST("sortfield"); +$sortorder = GETPOST("sortorder"); +if (!$sortorder) $sortorder = 'DESC'; +if (!$sortfield) $sortfield = 'cf.date_creation'; +$page = GETPOST("page"); +if ($page < 0) $page = 0; +$offset = $limit * $page; + + +/* + * Actions + */ + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $sall=""; + $sref=""; + $snom=""; + $suser=""; + $sttc=""; + $search_date=''; + $search_datemonth=''; + $search_dateday=''; + $search_dateyear=''; + $sproduct=0; +} + /* @@ -120,17 +161,18 @@ if ($suser) { if ($sttc) { $sql .= ' AND cf.total_ttc = ' . price2num($sttc); } -if ($sdate) +if ($search_datemonth > 0) { - if (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int')) - { - $date = dol_mktime(0, 0, 0, GETPOST('search_datemonth', 'int'), GETPOST('search_dateday', 'int'), GETPOST('search_dateyear', 'int')); - } - else - { - $date = dol_stringtotime($sdate); - } - $sql .= " AND cf.date_creation = '" . $db->idate($date) . "'"; + if ($search_dateyear > 0 && empty($search_dateday)) + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,$search_datemonth,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,$search_datemonth,false))."'"; + else if ($search_dateyear > 0 && ! empty($search_dateday)) + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_datemonth, $search_dateday, $search_dateyear))."'"; + else + $sql.= " AND date_format(cf.date_creation, '%m') = '".$search_datemonth."'"; +} +else if ($search_dateyear > 0) +{ + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,12,false))."'"; } if ($sall) { $sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" '; @@ -159,6 +201,18 @@ if ($resql) print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, ''); + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($sref) $param.='&search_ref='.urlencode($sref); + if ($snom) $param.='&search_nom='.urlencode($snom); + if ($suser) $param.='&search_user='.urlencode($suser); + if ($sttc) $param.='&search_ttc='.urlencode($sttc); + if ($search_dateyear) $param.='&search_dateyear='.urlencode($search_dateyear); + if ($search_datemonth) $param.='&search_datemonth='.urlencode($search_datemonth); + if ($search_dateday) $param.='&search_dateday='.urlencode($search_dateday); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + print ''; print '
'. - ''. + ''. ''. - ''. + ''. ''. - ''. + ''. ''. - ''. + ''. ''. - $form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). + $form->select_date($search_date, 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); @@ -247,6 +269,7 @@ if ($resql) '
'. @@ -168,7 +222,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.ref', '', - '', + $param, '', $sortfield, $sortorder @@ -178,7 +232,7 @@ if ($resql) $_SERVER['PHP_SELF'], 's.nom', '', - '', + $param, '', $sortfield, $sortorder @@ -188,7 +242,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'u.login', '', - '', + $param, '', $sortfield, $sortorder @@ -198,7 +252,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.total_ttc', '', - '', + $param, '', $sortfield, $sortorder @@ -208,7 +262,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.date_creation', '', - '', + $param, '', $sortfield, $sortorder @@ -218,11 +272,12 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.fk_statut', '', - '', + $param, 'align="right"', $sortfield, $sortorder ); + print ''. ''. @@ -239,7 +294,7 @@ if ($resql) ''. ''. ''. '';
'. - $form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). + $form->select_date($search_date, 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). ''; $src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png'; From 35182066a8dcfd1686a24c1d75615d8575e89156 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 19 Nov 2017 16:25:35 +0100 Subject: [PATCH 73/76] update createfromorder lack of 2 fields date_start and date_end not imported from order --- htdocs/compta/facture/class/facture.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e704a5a229a..840bb93a49f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -939,7 +939,8 @@ class Facture extends CommonInvoice { $this->db->commit(); return $this->id; - } + + } else { $this->db->rollback(); @@ -989,6 +990,8 @@ class Facture extends CommonInvoice $line->special_code = $object->lines[$i]->special_code; $line->fk_parent_line = $object->lines[$i]->fk_parent_line; $line->fk_unit = $object->lines[$i]->fk_unit; + $line->date_start = $object->lines[$i]->date_start; + $line->date_end = $object->lines[$i]->date_end; $line->fk_fournprice = $object->lines[$i]->fk_fournprice; $marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht); From 3f360601affe69cd4b963cc41faa921c11d01e20 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 19 Nov 2017 21:52:18 +0100 Subject: [PATCH 74/76] Fix entity Fix entity in list.php --- htdocs/don/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 9602b69a615..c93dcad0224 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -89,7 +89,7 @@ $sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,"; $sql.= " d.amount, d.fk_statut as statut, "; $sql.= " p.rowid as pid, p.ref, p.title, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p"; -$sql.= " ON p.rowid = d.fk_projet WHERE 1 = 1"; +$sql.= " ON p.rowid = d.fk_projet WHERE d.entity = ".$conf->entity.""; if ($statut != '' && $statut != '-1') { $sql .= " AND d.fk_statut IN (".$db->escape($statut).")"; From 5d6555b9dd7a9bc19c1e2b098b81c599b105a578 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 19 Nov 2017 21:54:14 +0100 Subject: [PATCH 75/76] Update list.php --- htdocs/don/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/list.php b/htdocs/don/list.php index c93dcad0224..cb5ab766ae9 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -89,7 +89,7 @@ $sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,"; $sql.= " d.amount, d.fk_statut as statut, "; $sql.= " p.rowid as pid, p.ref, p.title, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p"; -$sql.= " ON p.rowid = d.fk_projet WHERE d.entity = ".$conf->entity.""; +$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")"; if ($statut != '' && $statut != '-1') { $sql .= " AND d.fk_statut IN (".$db->escape($statut).")"; From e1344eb97cd12b745b29a2216b784633b022dd70 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Nov 2017 17:25:31 +0100 Subject: [PATCH 76/76] Fix edit of time spent --- htdocs/projet/tasks/time.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 9a513a4bce6..33642d4d3b6 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -975,19 +975,19 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print ''; } - else if ($user->rights->projet->lire) // Read project and enter time consumed on assigned tasks + else if ($user->rights->projet->lire || $user->rights->projet->all->creer) // Read project and enter time consumed on assigned tasks { - if ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) - { - print ' '; - print 'rowid.($withproject?'&withproject=1':'').'">'; - print img_edit(); - print ''; + if ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids) || $user->rights->projet->all->creer) + { + print ' '; + print 'rowid.($withproject?'&withproject=1':'').'">'; + print img_edit(); + print ''; - print ' '; - print 'rowid.($withproject?'&withproject=1':'').'">'; - print img_delete(); - print ''; + print ' '; + print 'rowid.($withproject?'&withproject=1':'').'">'; + print img_delete(); + print ''; } } print '