From 50bc65ce77e499fd11c50891d5453f6b2650ccec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Dec 2016 13:05:38 +0100 Subject: [PATCH 01/11] Add css to help debug --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a86a3b939a2..58f4ff9bbb4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5188,7 +5188,7 @@ class Form -
+
    '.$lis.' From 99542de935bbb611a7679eca36e39ab1127421f3 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 10 Dec 2016 14:47:18 +0100 Subject: [PATCH 02/11] Fix: fails to load image to redim into photo resize --- htdocs/core/lib/files.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index f67f1a0daf4..2744946e215 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2012-2015 Regis Houssin - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2016 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2016 Raphaël Doursenaud * @@ -1741,7 +1741,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les produits et services - else if ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service') + else if ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service' || $modulepart == 'produit|service') { if (($fuser->rights->produit->lire || $fuser->rights->service->lire) || preg_match('/^specimen/i',$original_file)) { From bc189c0f6ad09dd12296ab735457506500f66697 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 10 Dec 2016 15:13:24 +0100 Subject: [PATCH 03/11] Responsive --- htdocs/compta/sociales/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 79401b57798..3816fa6ee58 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -426,7 +426,7 @@ if ($id > 0) print ''; - /* + /* // Ref print '"; + print '"; print ""; // Period end date From 542499d94e123efd9dad5522002106b7a6e97ac0 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 10 Dec 2016 15:47:44 +0100 Subject: [PATCH 04/11] Fix Social contribution - Missing information in tab information --- .../sociales/class/chargesociales.class.php | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 1ba0773afff..1fdd567745f 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -153,6 +153,8 @@ class ChargeSociales extends CommonObject { global $conf; + $now=dol_now(); + // Nettoyage parametres $newamount=price2num($this->amount,'MT'); @@ -162,17 +164,18 @@ class ChargeSociales extends CommonObject return -2; } - $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, entity)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, entity, fk_user_author, date_creation)"; $sql.= " VALUES (".$this->type; $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); $sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"NULL"); - $sql.= ", '".$this->db->escape($this->lib)."',"; - $sql.= " '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."',"; - $sql.= " '".price2num($newamount)."',"; - $sql.= " ".$conf->entity; + $sql.= ", '".$this->db->escape($this->lib)."'"; + $sql.= ", '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."'"; + $sql.= ", '".price2num($newamount)."'"; + $sql.= ", ".$conf->entity; + $sql.= ", ".$user->id; + $sql.= ", '".$this->db->idate($now)."'"; $sql.= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -276,10 +279,11 @@ class ChargeSociales extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales"; - $sql.= " SET libelle='".$this->db->escape($this->lib)."',"; - $sql.= " date_ech='".$this->db->idate($this->date_ech)."',"; - $sql.= " periode='".$this->db->idate($this->periode)."',"; - $sql.= " amount='".price2num($this->amount,'MT')."'"; + $sql.= " SET libelle='".$this->db->escape($this->lib)."'"; + $sql.= ", date_ech='".$this->db->idate($this->date_ech)."'"; + $sql.= ", periode='".$this->db->idate($this->periode)."'"; + $sql.= ", amount='".price2num($this->amount,'MT')."'"; + $sql.= ", fk_user_modif=".$user->id; $sql.= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -505,8 +509,9 @@ class ChargeSociales extends CommonObject */ function info($id) { - $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key"; - $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e"; + $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,"; + $sql.= " fk_user_author, fk_user_modif, fk_user_valid"; + $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e"; $sql.= " WHERE e.rowid = ".$id; dol_syslog(get_class($this)."::info", LOG_DEBUG); @@ -522,7 +527,13 @@ class ChargeSociales extends CommonObject if ($obj->fk_user_author) { $cuser = new User($this->db); $cuser->fetch($obj->fk_user_author); - $this->user_creation = $cuser; + $this->user_creation = $cuser; + } + + if ($obj->fk_user_modif) { + $muser = new User($this->db); + $muser->fetch($obj->fk_user_modif); + $this->user_modification = $muser; } if ($obj->fk_user_valid) { @@ -532,7 +543,7 @@ class ChargeSociales extends CommonObject } $this->date_creation = $this->db->jdate($obj->datec); - $this->date_modification = $this->db->jdate($obj->datem); + if (! empty($obj->fk_user_modif)) $this->date_modification = $this->db->jdate($obj->datem); $this->date_validation = $this->db->jdate($obj->datev); $this->import_key = $obj->import_key; } From ce41c84c95d83f65d7a1d8e2b195f51c38b2b03f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Dec 2016 16:00:33 +0100 Subject: [PATCH 05/11] Fix td class --- htdocs/product/stock/product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 2cec79d7020..216d08df637 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -685,7 +685,7 @@ if ($id > 0 || $ref) { dol_print_error($db); } - print ''; - print ''; + print ''; print '\n"; print '\n"; print ''; @@ -198,7 +198,7 @@ if ($action == 'create') print ''; print ''; - print '
    '.$langs->trans("Ref").''; print $form->showrefnav($object,'id',$linkback); @@ -446,7 +446,7 @@ if ($id > 0) }*/ // Type - print "
    ".$langs->trans("Type")."".$object->type_libelle."
    '.$langs->trans("Type")."".$object->type_libelle."
    '.$langs->trans("LastMovement").''; + print '
    '.$langs->trans("LastMovement").''; if ($lastmovementdate) { print dol_print_date($lastmovementdate,'dayhour').' '; From a3b070d641bbc433e3aef4b845fa0763d0cde44a Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 10 Dec 2016 16:17:15 +0100 Subject: [PATCH 06/11] Responsive --- htdocs/loan/payment/payment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index ead01e9c6d7..fff2cf7a03d 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -170,7 +170,7 @@ if ($action == 'create') print '
    '.$langs->trans("Loan").'
    '.$langs->trans("Ref").''.$chid.'
    '.$langs->trans("Ref").''.$chid.'
    '.$langs->trans("DateStart").''.dol_print_date($loan->datestart,'day')."
    '.$langs->trans("Label").''.$loan->label."
    '.$langs->trans("Amount").''.price($loan->capital,0,$outputlangs,1,-1,-1,$conf->currency).'
    '.$langs->trans("Payment").'
    '.$langs->trans("Date").''; + print '
    '.$langs->trans("Date").''; $datepaid = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $datepayment = empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaye):0; $form->select_date($datepayment, '', '', '', '', "add_payment", 1, 1); From a75000715536fbf2e8b9e11d4d535770802e60d0 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 10 Dec 2016 16:17:52 +0100 Subject: [PATCH 07/11] Fix Loan - Register a payment with a comma --- htdocs/loan/class/paymentloan.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 5a0ad6b14fd..52c822e54c1 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -87,9 +87,9 @@ class PaymentLoan extends CommonObject // Clean parameters if (isset($this->fk_loan)) $this->fk_loan = trim($this->fk_loan); - if (isset($this->amount_capital)) $this->amount_capital = trim($this->amount_capital?$this->amount_capital:0); - if (isset($this->amount_insurance)) $this->amount_insurance = trim($this->amount_insurance?$this->amount_insurance:0); - if (isset($this->amount_interest)) $this->amount_interest = trim($this->amount_interest?$this->amount_interest:0); + if (isset($this->amount_capital)) $this->amount_capital = price2num($this->amount_capital?$this->amount_capital:0); + if (isset($this->amount_insurance)) $this->amount_insurance = price2num($this->amount_insurance?$this->amount_insurance:0); + if (isset($this->amount_interest)) $this->amount_interest = price2num($this->amount_interest?$this->amount_interest:0); if (isset($this->fk_typepayment)) $this->fk_typepayment = trim($this->fk_typepayment); if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); if (isset($this->note_private)) $this->note_private = trim($this->note_private); From cdba7cfa1ceb216acdf961ee05ab8cdffeea2358 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Dec 2016 19:04:56 +0100 Subject: [PATCH 08/11] Clean api rest --- htdocs/langs/fr_FR/accountancy.lang | 2 +- htdocs/product/class/api_products.class.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index dfc6f5c1c18..8fbef9f9290 100644 --- a/htdocs/langs/fr_FR/accountancy.lang +++ b/htdocs/langs/fr_FR/accountancy.lang @@ -4,7 +4,7 @@ ACCOUNTING_EXPORT_DATE=Format de date pour le fichier d'exportation ACCOUNTING_EXPORT_PIECE=Exporter la référence de la pièce ? ACCOUNTING_EXPORT_GLOBAL_ACCOUNT=Exporter avec les lignes regroupées ? ACCOUNTING_EXPORT_LABEL=Exporter le libellé -ACCOUNTING_EXPORT_AMOUNT=Exporter le montant +ACCOUNTING_EXP ORT_AMOUNT=Exporter le montant ACCOUNTING_EXPORT_DEVISE=Exporter la devise Selectformat=Sélectionnez le format du fichier ACCOUNTING_EXPORT_PREFIX_SPEC=Spécifiez le préfixe pour le nom du fichier diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 19fae0b6342..81b4458706c 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -268,6 +268,21 @@ class Products extends DolibarrApi return $categories->getListForItem('product', $sortfield, $sortorder, $limit, $page, $id); } + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + */ + function _cleanObjectDatas($object) { + + $object = parent::_cleanObjectDatas($object); + + unset($object->regeximgext); + + return $object; + } + /** * Validate fields before create or update object * From 518049bed419fe20c72377953e88d3a9fbfd6140 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Dec 2016 19:26:58 +0100 Subject: [PATCH 09/11] Fix pagination --- htdocs/product/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 24df0f65715..fd3970ac0ea 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -835,8 +835,8 @@ else $i++; } - print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', '', '', 'paginationatbottom'); - + print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', 'paginationatbottom', $limit); + $db->free($resql); print "
    "; From b74071dc732f3621ef0daf9b5f76485938c579e4 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 10 Dec 2016 19:35:58 +0100 Subject: [PATCH 10/11] Better display on internal/external module info --- htdocs/admin/modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index a7b3065658d..c9f2c57b8f2 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -500,8 +500,10 @@ if ($mode != 'marketplace') else $text.='
    '.$objMod->getDesc().'

    '; $textexternal=''; + $imginfo="info"; if ($objMod->isCoreOrExternalModule() == 'external') { + $imginfo="info_black"; $textexternal.='
    '.$langs->trans("Origin").': '.$langs->trans("ExternalModule",$dirofmodule); if ($objMod->editor_name != 'dolibarr') $textexternal.='
    '.$langs->trans("Publisher").': '.(empty($objMod->editor_name)?$langs->trans("Unknown"):$objMod->editor_name); if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='
    '.$langs->trans("Url").': '.$objMod->editor_url; @@ -645,7 +647,7 @@ if ($mode != 'marketplace') $text.='
    '.$langs->trans("AddOtherPagesOrServices").': '; $text.=$langs->trans("DetectionNotPossible"); - print $form->textwithpicto('', $text, 1, 'help', 'minheight20'); + print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20'); print ''; @@ -659,8 +661,6 @@ if ($mode != 'marketplace') if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: left"'); if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: left"'); - // Picto external - if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: left"'); print $versiontrans; From 653eb4d907d43e81070cfe2f9a8601129a9617ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Dec 2016 20:00:07 +0100 Subject: [PATCH 11/11] Fix project into dol_banner --- htdocs/core/lib/fichinter.lib.php | 15 +++++++++------ htdocs/fichinter/card.php | 2 +- htdocs/fichinter/contact.php | 5 ++++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index de7fc01d0ff..964bbe14b2c 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -75,16 +75,19 @@ function fichinter_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php'; $nbResource = 0; $objectres=new Dolresource($db); - foreach ($objectres->available_resources as $modresources => $resources) + if (is_array($objectres->available_resources)) { - $resources=(array) $resources; // To be sure $resources is an array - foreach($resources as $resource_obj) + foreach ($objectres->available_resources as $modresources => $resources) { - $linked_resources = $object->getElementResources('fichinter',$object->id,$resource_obj); - + $resources=(array) $resources; // To be sure $resources is an array + foreach($resources as $resource_obj) + { + $linked_resources = $object->getElementResources('fichinter',$object->id,$resource_obj); + + } } } - + $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id; $head[$h][1] = $langs->trans("Resources"); if ($nbResource > 0) $head[$h][1].= ' '.$nbResource.''; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index d2eb83a720f..fb37a235b37 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1203,7 +1203,7 @@ else if ($id > 0 || ! empty($ref)) { $langs->load("projects"); $morehtmlref.='
    '.$langs->trans('Project') . ' '; - if ($user->rights->commande->creer) + if ($user->rights->ficheinter->creer) { if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index ab9b15da666..22116857d7f 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load("interventions"); $langs->load("sendings"); @@ -105,6 +107,7 @@ $form = new Form($db); $formcompany = new FormCompany($db); $contactstatic=new Contact($db); $userstatic=new User($db); +$formproject=new FormProjets($db); llxHeader('',$langs->trans("Intervention")); @@ -133,7 +136,7 @@ if ($id > 0 || ! empty($ref)) { $langs->load("projects"); $morehtmlref.='
    '.$langs->trans('Project') . ' '; - if ($user->rights->commande->creer) + if ($user->rights->ficheinter->creer) { if ($action != 'classify') //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';