From 39f35bbaab2ae4771320b2c4d3aba5a37aa20ad9 Mon Sep 17 00:00:00 2001 From: arnaud Date: Tue, 17 Jan 2017 11:17:40 +0100 Subject: [PATCH 01/68] FIX all dolibarr versions about project list and ajax completion bug --- htdocs/core/class/html.formprojet.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 4c094061ee4..ba4d2bac3ff 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -127,13 +127,15 @@ class FormProjets // Search all projects $sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public'; $sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p'; - $sql.= " WHERE p.entity = ".$conf->entity; + $sql.= " WHERE p.entity IN (".getEntity('project',1).")"; if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; if (!empty($filterkey)) { - $sql .= ' AND p.title LIKE "%'.$this->db->escape($filterkey).'%"'; + $sql .= ' AND ('; + $sql .= ' p.title LIKE "%'.$this->db->escape($filterkey).'%"'; $sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"'; + $sql .= ')'; } $sql.= " ORDER BY p.ref ASC"; From e2e440386983415ac8ed39a5e49277b525b5c2fb Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jan 2017 12:20:44 +0100 Subject: [PATCH 02/68] Fix: avoid numeric errors --- htdocs/contact/list.php | 30 +++++++++++++++--------------- htdocs/societe/list.php | 22 +++++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 04010fd3ad2..3fbd4fa462d 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -77,7 +77,7 @@ $userid=GETPOST('userid','int'); $begin=GETPOST('begin'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="p.lastname"; -if ($page < 0) { $page = 0; } +if (empty($page) || $page < 0) { $page = 0; } $offset = $limit * $page; $langs->load("companies"); @@ -147,7 +147,7 @@ $arrayfields=array( // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); } @@ -176,7 +176,7 @@ if (empty($reshook)) { // Selection of new fields include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - + // Purge search criteria if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers { @@ -200,7 +200,7 @@ if (empty($reshook)) $search_categ_supplier=''; $search_array_options=array(); } - + // Mass actions $objectclass='Contact'; $objectlabel='Contact'; @@ -345,7 +345,7 @@ foreach ($search_array_options as $key => $val) $typ=$extrafields->attribute_type[$tmpkey]; $mode=0; if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric - if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); } @@ -424,7 +424,7 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); -} +} print '
'; if ($optioncss != '') print ''; @@ -504,9 +504,9 @@ if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_tit // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); @@ -555,13 +555,13 @@ if (! empty($arrayfields['p.town']['checked'])) print ''; print ''; } -if (! empty($arrayfields['p.phone']['checked'])) +if (! empty($arrayfields['p.phone']['checked'])) { print ''; print ''; print ''; } -if (! empty($arrayfields['p.phone_perso']['checked'])) +if (! empty($arrayfields['p.phone_perso']['checked'])) { print ''; print ''; @@ -607,9 +607,9 @@ if (! empty($arrayfields['p.priv']['checked'])) // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { print ''; print ''; @@ -664,7 +664,7 @@ while ($i < min($num,$limit)) $contactstatic->phone_mobile=$obj->phone_mobile; $contactstatic->zip=$obj->zip; $contactstatic->town=$obj->town; - + // Name if (! empty($arrayfields['p.lastname']['checked'])) { @@ -746,9 +746,9 @@ while ($i < min($num,$limit)) // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { print 'getAlignFlag($key); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 301ca845286..4a0be451c45 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -88,7 +88,7 @@ $sortorder=GETPOST("sortorder",'alpha'); $page=GETPOST("page",'int'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="s.nom"; -if ($page == -1) { $page = 0 ; } +if (empty($page) || $page == -1) { $page = 0 ; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -240,7 +240,7 @@ if (empty($reshook)) $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm'); $result=$object->update($object->id, $user); if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); - + $action=''; } } @@ -505,7 +505,7 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); -} +} // Show delete result message if (GETPOST('delsoc')) @@ -619,9 +619,9 @@ if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_f // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); @@ -838,9 +838,9 @@ if (! empty($arrayfields['s.fk_stcomm']['checked'])) // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); $typeofextrafield=$extrafields->attribute_type[$key]; @@ -895,7 +895,7 @@ while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); $var=!$var; - + $companystatic->id=$obj->rowid; $companystatic->name=$obj->name; $companystatic->canvas=$obj->canvas; @@ -906,7 +906,7 @@ while ($i < min($num, $limit)) $companystatic->code_fournisseur=$obj->code_fournisseur; $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; $companystatic->name_alias=$obj->name_alias; - + print ""; if (! empty($arrayfields['s.nom']['checked'])) { @@ -948,12 +948,12 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['s.zip']['checked'])) { print "".$obj->zip."\n"; - } + } // State if (! empty($arrayfields['state.nom']['checked'])) { print "".$obj->state_name."\n"; - } + } // Country if (! empty($arrayfields['country.code_iso']['checked'])) { From 0479fdb0a29c5bbefab196ec8b9e8a83e7531456 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jan 2017 12:25:39 +0100 Subject: [PATCH 03/68] Fix: avoid non-numeric error --- htdocs/user/document.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/user/document.php b/htdocs/user/document.php index a9162767bea..081bf2bc408 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -76,7 +76,7 @@ if ($user->id <> $id && ! $canreaduser) accessforbidden(); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if ($page == -1) { $page = 0; } +if (empty($page) || $page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -132,11 +132,11 @@ if ($object->id) dol_fiche_head($head, 'document', $langs->trans("User"),0,'user'); $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); - + print '
'; - + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; @@ -160,7 +160,7 @@ if ($object->id) print ''; dol_fiche_end(); - + $modulepart = 'user'; $permission = $user->rights->user->user->creer; From 7980f1c999f77f5551cae541bf3414053fc58a4b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jan 2017 12:29:05 +0100 Subject: [PATCH 04/68] Fix: avoid php non-numeric errors --- htdocs/user/group/index.php | 40 ++++++++++++++++++------------------- htdocs/user/index.php | 34 +++++++++++++++---------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/htdocs/user/group/index.php b/htdocs/user/group/index.php index c2dd4936ea8..94c12147f1a 100644 --- a/htdocs/user/group/index.php +++ b/htdocs/user/group/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2015 Regis Houssin + * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2011 Herve Prot * * This program is free software; you can redistribute it and/or modify @@ -43,7 +43,7 @@ $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); -if ($page == -1) { $page = 0; } +if (empty($page) || $page == -1) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -115,16 +115,16 @@ $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - + $nbtotalofrecords = $num; - + $i = 0; $param="&search_group=".urlencode($search_group)."&sall=".urlencode($sall); if ($optioncss != '') $param.='&optioncss='.$optioncss; - + $text = $langs->trans("ListOfGroups"); - + print ''."\n"; if ($optioncss != '') print ''; print ''; @@ -133,26 +133,26 @@ if ($resql) print ''; print ''; print ''; - + print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); - - if ($sall) - { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); - } - + if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - + + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + } + $moreforfilter=''; - + //$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; //$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - + print '
'; print ''."\n"; @@ -166,7 +166,7 @@ if ($resql) print_liste_field_titre($langs->trans("NbOfUsers"),$_SERVER["PHP_SELF"],"nb",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"g.datec",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; - + $var=True; while ($i < $num) { @@ -192,10 +192,10 @@ if ($resql) $i++; } print "
"; - + print '
'; print "\n"; - + $db->free(); } else diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 54c99ca411a..623e2df3434 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Marcos García * @@ -50,7 +50,7 @@ $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); -if ($page == -1) { $page = 0; } +if (empty($page) || $page == -1) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -103,7 +103,7 @@ $arrayfields=array( // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); } @@ -146,7 +146,7 @@ if (empty($reshook)) { // Selection of new fields include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - + // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { @@ -224,7 +224,7 @@ foreach ($search_array_options as $key => $val) $typ=$extrafields->attribute_type[$tmpkey]; $mode=0; if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric - if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); } @@ -285,7 +285,7 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); -} +} $text = $langs->trans("ListOfUsers"); @@ -331,9 +331,9 @@ if (! empty($arrayfields['u.datepreviouslogin']['checked'])) print_liste_field_t // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); @@ -368,7 +368,7 @@ if (! empty($arrayfields['u.gender']['checked'])) { print ''; $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); - print $form->selectarray('search_gender', $arraygender, $search_gender, 1); + print $form->selectarray('search_gender', $arraygender, $search_gender, 1); print ''; } if (! empty($arrayfields['u.employee']['checked'])) @@ -408,9 +408,9 @@ if (! empty($arrayfields['u.datepreviouslogin']['checked'])) // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); $typeofextrafield=$extrafields->attribute_type[$key]; @@ -479,7 +479,7 @@ while ($i < min($num,$limit)) $userstatic->lastname=$obj->lastname; $userstatic->employee=$obj->employee; $userstatic->photo=$obj->photo; - + $li=$userstatic->getNomUrl(-1,'',0,0,24,1,'login'); print ""; @@ -592,8 +592,8 @@ while ($i < min($num,$limit)) } } print ''; - } - + } + // Date last login if (! empty($arrayfields['u.datelastlogin']['checked'])) { @@ -604,13 +604,13 @@ while ($i < min($num,$limit)) { print ''.dol_print_date($db->jdate($obj->datepreviouslogin),"dayhour").''; } - + // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { print 'getAlignFlag($key); From e4eb2d2aaf2af7fc0f392b119ee05d103054c14e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jan 2017 13:36:14 +0100 Subject: [PATCH 05/68] Fix: explode array result is 0,1,2 and not 1,2,3 --- htdocs/theme/eldy/style.css.php | 56 ++++++++++---------- htdocs/theme/md/style.css.php | 92 ++++++++++++++++----------------- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 3fabbf347c0..b09cde24630 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1,7 +1,7 @@ * Copyright (C) 2006 Rodolphe Quiedeville - * Copyright (C) 2007-2012 Regis Houssin + * Copyright (C) 2007-2017 Regis Houssin * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Juanjo Menent * @@ -158,25 +158,25 @@ if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) // Set text color to black or white $tmppart=explode(',',$colorbackhmenu1); -$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); +$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); if ($tmpval <= 360) $colortextbackhmenu='FFFFFF'; else $colortextbackhmenu='000000'; $tmppart=explode(',',$colorbackvmenu1); -$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); +$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); if ($tmpval <= 360) { $colortextbackvmenu='FFFFFF'; } else { $colortextbackvmenu='000000'; } $tmppart=explode(',',$colorbacktitle1); if ($colortexttitle == '') { - $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); + $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); if ($tmpval <= 360) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } else { $colortexttitle='000000'; $colorshadowtitle='FFFFFF'; } } $tmppart=explode(',',$colorbacktabcard1); -$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); +$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); if ($tmpval <= 340) { $colortextbacktab='FFFFFF'; } else { $colortextbacktab='111111'; } @@ -254,7 +254,7 @@ a.tab { font-weight: bold !important; } a:link, a:visited, a:hover, a:active { font-family: ; font-weight: normal; color: rgb(); text-decoration: none; } a:hover { text-decoration: underline; color: rgb(); } -a.commonlink { color: rgb() !important; text-decoration: none; } +a.commonlink { color: rgb() !important; text-decoration: none; } input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: #FFF; @@ -284,7 +284,7 @@ textarea.cke_source:focus input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { font-size: px; font-family: ; - + border: 1px solid #C0C0C0; /* v6 border: none; border-bottom: 1px solid #C0C0C0; @@ -309,7 +309,7 @@ textarea { border: solid 1px rgba(0,0,0,.3); border-top:solid 1px rgba(0,0,0,.3); border-bottom:solid 1px rgba(0,0,0,.2); - + padding:4px; margin-left:0px; margin-bottom:1px; @@ -621,12 +621,12 @@ div.myavailability { overflow-y: hidden; -ms-overflow-style: -ms-autohiding-scrollbar; }*/ -/* Style used for most tables */ +/* Style used for most tables */ .div-table-responsive, .div-table-responsive-no-min { overflow-x: auto; min-height: 0.01%; } -/* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */ +/* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */ div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive-no-min { overflow-x: auto; } @@ -715,20 +715,20 @@ div.fiche>form>div.div-table-responsive { .border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { height: 40px !important; } - + .quatrevingtpercent, .inputsearch { width: 95%; } - - input, input[type=text], input[type=password], select, textarea { - min-width: 20px; + + input, input[type=text], input[type=password], select, textarea { + min-width: 20px; min-height: 1.4em; line-height: 1.4em; padding: .4em .1em; border: 1px solid #BBB; /* max-width: inherit; why this ? */ } - + .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; } @@ -747,20 +747,20 @@ div.fiche>form>div.div-table-responsive { .minwidth500imp { min-width: 50px !important; } .titlefield { width: auto; } .titlefieldcreate { width: auto; } - + #tooltip { position: absolute; width: px; } - + /* intput, input[type=text], */ select { width: 98%; min-width: 40px; } - + div.divphotoref { - padding-right: 5px; + padding-right: 5px; } img.photoref, div.photoref { border: none; @@ -772,7 +772,7 @@ div.fiche>form>div.div-table-responsive { width: 20px; object-fit: contain; } - + } .linkobject { cursor: pointer; } @@ -1239,7 +1239,7 @@ div.menu_titre { padding-top: 4px; padding-bottom: 4px; overflow: hidden; - text-overflow: ellipsis; + text-overflow: ellipsis; } .mainmenuaspan { @@ -1442,7 +1442,7 @@ form#login { -moz-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15); -webkit-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15); box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15); - + /*-moz-box-shadow: 3px 2px 20px #CCC; -webkit-box-shadow: 3px 2px 20px #CCC; box-shadow: 3px 2px 20px #CCC;*/ @@ -1646,7 +1646,7 @@ a.vsmenu.addbookmarkpicto { { /* border-bottom: 1px solid #BBB; */ } -div.blockvmenusearchphone +div.blockvmenusearchphone { border-bottom: none !important; } @@ -2511,8 +2511,8 @@ div.liste_titre_bydiv .divsearchfield { padding: 2px 1px 2px 0px; /* t r b l */ } -tr.box_titre .nobordernopadding td { - padding: 0px ! important; +tr.box_titre .nobordernopadding td { + padding: 0px ! important; } table.nobordernopadding { border-collapse: collapse !important; @@ -2807,7 +2807,7 @@ div.liste_titre_bydiv { border-top-width: px; border-top-color: rgb(); border-top-style: solid; - + border-collapse: collapse; display: table; padding: 2px 0px 2px 0; @@ -3419,7 +3419,7 @@ td.hidden { border-bottom: 1px solid #888; background: #eee; } -.websitebar .button, .websitebar .buttonDelete +.websitebar .button, .websitebar .buttonDelete { padding: 2px 5px 3px 5px !important; margin: 2px 4px 2px 4px !important; @@ -3428,7 +3428,7 @@ td.hidden { .websiteselection { display: inline-block; padding-left: 10px; - vertical-align: middle; + vertical-align: middle; line-height: 29px; } .websitetools { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 236e87abc84..8f0242db8ca 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1,7 +1,7 @@ * Copyright (C) 2006 Rodolphe Quiedeville - * Copyright (C) 2007-2012 Regis Houssin + * Copyright (C) 2007-2017 Regis Houssin * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2015 Alexandre Spangaro @@ -159,25 +159,25 @@ if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1; // Set text color to black or white $tmppart=explode(',',$colorbackhmenu1); -$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); +$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); if ($tmpval <= 360) $colortextbackhmenu='FFFFFF'; else $colortextbackhmenu='000000'; $tmppart=explode(',',$colorbackvmenu1); -$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); +$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); if ($tmpval <= 360) { $colortextbackvmenu='FFFFFF'; } else { $colortextbackvmenu='000000'; } $tmppart=explode(',',$colorbacktitle1); if ($colortexttitle == '') { - $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); + $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); if ($tmpval <= 260) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } else { $colortexttitle='101010'; $colorshadowtitle='FFFFFF'; } } $tmppart=explode(',',$colorbacktabcard1); -$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); +$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); if ($tmpval <= 340) { $colortextbacktab='FFFFFF'; } else { $colortextbacktab='111111'; } @@ -254,7 +254,7 @@ a.tab { font-weight: bold !important; } a:link, a:visited, a:hover, a:active { font-family: ; font-weight: normal; color: rgb(); text-decoration: none; } a:hover { text-decoration: underline; color: rgb(); } -a.commonlink { color: rgb() !important; text-decoration: none; } +a.commonlink { color: rgb() !important; text-decoration: none; } input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: #FDFDFD; @@ -525,7 +525,7 @@ div.divsearchfield { margin-: 2px; margin-top: 4px; margin-bottom: 4px; - padding-left: 2px; + padding-left: 2px; } div.confirmmessage { padding-top: 6px; @@ -539,8 +539,8 @@ div.myavailability { } .checkallactions { vertical-align: top; - margin-top: 6px; - margin-left: 4px; + margin-top: 6px; + margin-left: 4px; } .selectlimit, .marginrightonly { margin-right: 10px !important; @@ -598,12 +598,12 @@ div.myavailability { overflow-y: hidden; -ms-overflow-style: -ms-autohiding-scrollbar; }*/ -/* Style used for most tables */ +/* Style used for most tables */ .div-table-responsive, .div-table-responsive-no-min { overflow-x: auto; min-height: 0.01%; } -/* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */ +/* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */ div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive-no-min { overflow-x: auto; } @@ -650,7 +650,7 @@ div.fiche>form>div.div-table-responsive { .titlefield { width: 25%; } .titlefieldmiddle { width: 50%; } .imgmaxwidth180 { max-width: 180px; } - + /* Force values for small screen 1400 */ @media only screen and (max-width: 1400px) @@ -693,20 +693,20 @@ div.fiche>form>div.div-table-responsive { .border tbody tr, .border tbody tr td, div.tabBar table.border tr { height: 40px !important; } - + .quatrevingtpercent, .inputsearch { width: 95%; } - - input, input[type=text], input[type=password], select, textarea { - min-width: 20px; + + input, input[type=text], input[type=password], select, textarea { + min-width: 20px; min-height: 1.4em; line-height: 1.4em; padding: .4em .1em; border: 1px solid #BBB; /* max-width: inherit; why this */ } - + .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; } @@ -725,20 +725,20 @@ div.fiche>form>div.div-table-responsive { .minwidth500imp { min-width: 50px !important; } .titlefield { width: auto; } .titlefieldcreate { width: auto; } - + #tooltip { position: absolute; width: px; } - + /* intput, input[type=text], */ select { width: 98%; min-width: 40px; } - + div.divphotoref { - padding-right: 5px; + padding-right: 5px; } img.photoref, div.photoref { border: none; @@ -749,7 +749,7 @@ div.fiche>form>div.div-table-responsive { height: 20px; width: 20px; object-fit: contain; - } + } } .linkobject { cursor: pointer; } @@ -802,7 +802,7 @@ td.showDragHandle { padding-left: 229px; padding-top: 12px; - + } .side-nav { @@ -1017,7 +1017,7 @@ table.noborder tr.liste_titre td { padding-right: 1px; padding-top: 1px; padding-bottom: 1px; - width: 44px; + width: 44px; } div.attacharea { padding-top: 10px; @@ -1033,7 +1033,7 @@ div.arearefnobottom { padding-bottom: 4px; } div.heightref { - min-height: 80px; + min-height: 80px; } div.divphotoref { padding-right: 20px; @@ -1249,7 +1249,7 @@ div.tmenucenter div.menu_titre { padding-bottom: 2px; overflow: hidden; - text-overflow: ellipsis; + text-overflow: ellipsis; } .mainmenuaspan { @@ -1625,8 +1625,8 @@ div.vmenu, td.vmenu { width: 202px; } -.menu_contenu { - padding-top: 4px; +.menu_contenu { + padding-top: 4px; padding-bottom: 3px; overflow: hidden; text-overflow: ellipsis; @@ -2204,16 +2204,16 @@ span.butAction, span.butActionDelete { text-shadow: none; border-color: #555; cursor: not-allowed; - + background-color: #f5f5f5; background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); - background-repeat: repeat-x + background-repeat: repeat-x } - + .butActionDelete, .buttonDelete { color: #ffffff !important; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); @@ -2358,9 +2358,9 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-bottom-width: 1px; border-bottom-color: #BBB; border-bottom-style: solid; - + margin: 0px 0px 8px 0px; - + -moz-border-radius: 0.1em; -webkit-border-radius: 0.1em; border-radius: 0.1em; @@ -2618,7 +2618,7 @@ div.pagination li.paginationafterarrows { margin-bottom: 1px; color: #202020; min-height: 18px; /* seems to not be used */ - + background: #; } #GanttChartDIV { @@ -2685,7 +2685,7 @@ div.liste_titre_bydiv { border-top-width: px; border-top-color: rgb(); border-top-style: solid; - + box-shadow: none; border-collapse: collapse; display: table; @@ -2708,7 +2708,7 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list background: rgb(); font-weight: ; - + color: rgb(); font-family: ; border-bottom: 1px solid #FDFFFF; @@ -2876,7 +2876,7 @@ span.dashboardlineko { tr.box_titre { height: 26px !important; - + /* TO MATCH BOOTSTRAP */ /*background: #ddd; color: #000 !important; */ @@ -2891,7 +2891,7 @@ tr.box_titre { background: rgb(); - + background-repeat: repeat-x; color: rgb(); font-family: , sans-serif; @@ -3324,7 +3324,7 @@ td.hidden { border-bottom: 1px solid #888; background: #eee; } -.websitebar .button, .websitebar .buttonDelete +.websitebar .button, .websitebar .buttonDelete { padding: 2px 4px 2px 4px !important; margin: 2px 4px 2px 4px !important; @@ -3333,7 +3333,7 @@ td.hidden { .websiteselection { display: inline-block; padding-left: 10px; - vertical-align: middle; + vertical-align: middle; line-height: 29px; } .websitetools { @@ -4494,12 +4494,12 @@ img.demothumb { @media only screen and (max-width: 767px) { .imgopensurveywizard, .imgautosize { width:95%; height: auto; } - + #tooltip { position: absolute; width: px; } - + img.demothumb { box-shadow: 1px 1px 4px #BBB; margin-right: 6px; @@ -4516,7 +4516,7 @@ img.demothumb { border-right: none; border-left: none; } - + } @@ -4590,7 +4590,7 @@ img.demothumb { div.mainmenu { min-width: 20px; } - + #tooltip { position: absolute; width: px; @@ -4600,7 +4600,7 @@ img.demothumb { min-width: 0 !important; } div.divphotoref { - padding-right: 5px; + padding-right: 5px; } img.photoref, div.photoref { border: none; @@ -4612,7 +4612,7 @@ img.demothumb { width: 20px; object-fit: contain; } - + } From 9dca9e4f8bfe487c09217f8bab7970996b8d9890 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jan 2017 13:46:25 +0100 Subject: [PATCH 06/68] Fix: travis error - Space found before comma in function call --- htdocs/bookmarks/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index b89dbf291b7..e75f2596806 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -194,7 +194,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) * Fact bookmark mode or visually edition */ $object->fetch($id); - + $hselected = 'card'; $head = array( array( @@ -216,10 +216,10 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); - + $linkback = ''.$langs->trans("BackToList").''; - - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '' , '', 0, '', '', 0); + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', '', 0); print '
'; print ''; @@ -307,7 +307,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) // Buttons - + print "
\n"; // Edit From 2be601106918c58a75216c8df441cdcffdb88a9f Mon Sep 17 00:00:00 2001 From: fappels Date: Mon, 23 Jan 2017 20:59:32 +0100 Subject: [PATCH 07/68] Fix product elephant verify for service --- htdocs/core/modules/product/mod_codeproduct_elephant.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 517cd0a7ce9..bb7eb09abf4 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -252,7 +252,7 @@ class mod_codeproduct_elephant extends ModeleProductCode // Get Mask value $mask = ''; if ($type==0) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT)?'':$conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT; - if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SSERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE; + if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE; if (! $mask) { $this->error='NotConfigured'; From fd55ded9966754d77a7de18ebe319b01d5a685f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jan 2017 18:45:57 +0100 Subject: [PATCH 08/68] Prepare 4.0.4 version --- ChangeLog | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index 553e5327366..cc6f1364f17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,25 @@ Upgrading to any other version or any other database system is abolutely require make a Dolibarr upgrade. +***** ChangeLog for 4.0.4 to 4.0.3 ***** +FIX: #6227 Document models table header "Unit" is shown in 2 lines in Spanish +FIX: #6230 +FIX: #6237 +FIX: #6245 Thirdparty link in supplier invoices list, links to "comm/card" instead of "fourn/card" page +FIX: #6253 Supplier invoice list filter does not respect "thirdparty" filter +FIX: #6277 +FIX: project list and ajax completion return wrong list. +FIX: bug margin calculation by user with multicompany +FIX: Can make a stock transfert on product not on sale/purchase. +FIX: extrafield input for varchar was not working with special char within (ie double quotes) +FIX: javascript error +FIX: link for not found photo when using gravatar. Must use external url. +FIX: Protection so even if link is output for external user, links is disabled. +FIX: repair tool was ko to restore extrafields with type select. +FIX: Security access problem with external users on projects/tasks +FIX: We must not drop extrafield column if there is still record on other entities. +FIX: regression with sedning email when introducing security options to restrict nb of email sending. +t ***** ChangeLog for 4.0.3 to 4.0.2 ***** FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1 FIX: #5958 no discount on supplier command made by replenishment From d65cb29536b8b6271df64c110e1b3fd90bbc2985 Mon Sep 17 00:00:00 2001 From: altatof Date: Wed, 25 Jan 2017 09:25:06 +0100 Subject: [PATCH 09/68] FIX: use param for http links --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5a55b3a8a9c..d94354df68b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -604,7 +604,7 @@ class FormFile // Show file name with link to download $out.= '
"; if ($object->methode_commande) { - print ''; + print ''; } } From cb5117ad06c7590d2a1fd1e5ac793c8ed467d347 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 25 Jan 2017 16:08:46 +0100 Subject: [PATCH 12/68] Fix: Invalid variable. Shoud be $object --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 5967706d479..dc34686361f 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -6,7 +6,7 @@ * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2014 Cedric Gross * Copyright (C) 2016 Florian Henry - * Copyright (C) 2010 Ferran Marcet + * Copyright (C) 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 From c56074d48fad80ff807f135807cceba80924d416 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 25 Jan 2017 16:11:06 +0100 Subject: [PATCH 13/68] Fix: Travis error --- htdocs/bookmarks/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index b89dbf291b7..0583c45bdab 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -219,7 +219,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '' , '', 0, '', '', 0); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', '', 0); print '
'; print '
'; - $out.= ' Date: Wed, 25 Jan 2017 09:26:26 +0100 Subject: [PATCH 10/68] FIX: add entity param to document link --- htdocs/societe/soc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 181f95e43c6..f3f87ba6f79 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -2524,7 +2524,7 @@ else $var=true; - print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang); + print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang); print '
'; From 7f87f6688b3266be563eab0114ad35c614cf17c0 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 25 Jan 2017 12:58:21 +0100 Subject: [PATCH 11/68] Fix: Invalid variable. Shoud be $object --- htdocs/fourn/commande/dispatch.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 44dfb07f255..5967706d479 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -6,6 +6,7 @@ * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2014 Cedric Gross * Copyright (C) 2016 Florian Henry + * Copyright (C) 2010 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 @@ -368,7 +369,7 @@ if ($id > 0 || ! empty($ref)) { print "
' . $langs->trans("Method") . '' . $commande->getInputMethod() . '
' . $langs->trans("Method") . '' . $object->getInputMethod() . '
'; From daa4536f834f7385ad64d8ea7b59fe71605c1da4 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 25 Jan 2017 18:58:47 +0100 Subject: [PATCH 14/68] Fix: Contract clone don't work --- htdocs/contrat/class/contrat.class.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 958f14f8911..2cffecfaf96 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -8,7 +8,7 @@ * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García - * Copyright (C) 2015-2016 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 @@ -2253,11 +2253,11 @@ class Contrat extends CommonObject $this->context['createfromclone'] = 'createfromclone'; $error = 0; - $now = dol_now(); $this->fetch($this->id); // Load dest object $clonedObj = clone $this; + $clonedObj->socid = $socid; $this->db->begin(); @@ -2292,16 +2292,13 @@ class Contrat extends CommonObject $this->error = $clonedObj->error; $this->errors[] = $clonedObj->error; } else { - // copy internal contacts - if ($clonedObj->copy_linked_contact($this, 'internal') < 0) - $error ++; - - // copy external contacts if same company - elseif ($this->socid == $clonedObj->socid) { - if ($clonedObj->copy_linked_contact($this, 'external') < 0) - $error ++; - } - } + // copy external contacts if same company + if ($this->socid == $clonedObj->socid) { + if ($clonedObj->copy_linked_contact($this, 'external') < 0) { + $error++; + } + } + } if (! $error) { foreach ( $this->lines as $line ) { From debfb97903e465ea588724911f1ce074e6f69e6f Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 25 Jan 2017 19:12:02 +0100 Subject: [PATCH 15/68] Fix: Write All Right don't work --- htdocs/expensereport/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 2d93c88159c..e7773be7eda 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2016 Alexandre Spangaro + * Copyright (C) 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 @@ -1229,7 +1230,7 @@ if ($action == 'create') $defaultselectuser=$user->id; if (GETPOST('fk_user_author') > 0) $defaultselectuser=GETPOST('fk_user_author'); $include_users = array($user->id); - if (! empty($user->rights->expensereport->writeall)) $include_users=array(); + if (! empty($user->rights->expensereport->writeall_advance)) $include_users=array(); $s=$form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users); print $s; print ''; From 0df39149c49485c0c41f92de222d80ffd37f6134 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 25 Jan 2017 19:28:20 +0100 Subject: [PATCH 16/68] Fix: Hidden option not showing correctly --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 7 +++++-- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 5 ++++- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 5 ++++- .../modules/supplier_order/pdf/pdf_muscadet.modules.php | 5 ++++- .../modules/supplier_proposal/doc/pdf_aurore.modules.php | 5 ++++- 5 files changed, 21 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 3f3b072de34..d31ed238965 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -6,6 +6,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Marcos García + * Copyright (C) 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 @@ -1261,10 +1262,12 @@ class pdf_einstein extends ModelePDFCommandes $arrayidcontact=$object->getIdContact('internal','SALESREPFOLL'); if (count($arrayidcontact) > 0) { - $usertmp=new User($this->db); + $usertmp=new User($this->db); $usertmp->fetch($arrayidcontact[0]); + $posy+=4; + $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(190, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); + $pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); } } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 3c3324d741a..fc9bae07c9c 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -7,6 +7,7 @@ * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2015 Marcos García + * Copyright (C) 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 @@ -1620,8 +1621,10 @@ class pdf_crabe extends ModelePDFFactures { $usertmp=new User($this->db); $usertmp->fetch($arrayidcontact[0]); + $posy+=4; + $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(190, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); + $pdf->MultiCell($w, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); } } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 566127c803d..41cd29f8b35 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -6,6 +6,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Marcos García + * Copyright (C) 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 @@ -1473,8 +1474,10 @@ class pdf_azur extends ModelePDFPropales { $usertmp=new User($this->db); $usertmp->fetch($arrayidcontact[0]); + $posy+=4; + $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(190, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); + $pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); } } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 96cec5e5ba3..111fe12d9ec 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -4,6 +4,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2015 Marcos García + * Copyright (C) 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 @@ -1111,8 +1112,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $usertmp=new User($this->db); $usertmp->fetch($arrayidcontact[0]); + $posy+=4; + $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(190, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); + $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); } } diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index b3f99886f25..32c8eb23cbb 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -4,6 +4,7 @@ * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 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 @@ -1288,8 +1289,10 @@ class pdf_aurore extends ModelePDFSupplierProposal { $usertmp=new User($this->db); $usertmp->fetch($arrayidcontact[0]); + $posy+=4; + $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(190, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); + $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); } } From 28115689e8c293f0296d4b4b2dede9fc179b2667 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 26 Jan 2017 08:46:39 +0100 Subject: [PATCH 17/68] fix : wrong $formproject->select_projects call on model invoice --- htdocs/compta/facture/fiche-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 584d3915430..41fe096d974 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -983,7 +983,7 @@ if ($action == 'create') $projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project; $langs->load('projects'); print ''; } From f0ba5cdba8d3c000341f55b31fc3cd87c6676f01 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 26 Jan 2017 09:02:47 +0100 Subject: [PATCH 18/68] fix travais --- htdocs/bookmarks/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index b89dbf291b7..0583c45bdab 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -219,7 +219,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '' , '', 0, '', '', 0); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', '', 0); print '
'; print '
' . $langs->trans('Project') . ''; - $numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, $forceaddid=0, $morecss=''); + $numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, ''); print '   thirdparty->id.(!empty($id)?'&id='.$id:'')).'">' . $langs->trans("AddProject") . ''; print '
'; From eac6ac024770b668f4e8f60b006c96d1d63d5aa9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Jan 2017 10:41:02 +0100 Subject: [PATCH 19/68] Fix fields into projet export --- htdocs/core/modules/modProjet.class.php | 19 ++++++++++++------- htdocs/filefunc.inc.php | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index c21390c3ece..67ee51a56a9 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -213,18 +213,23 @@ class modProjet extends DolibarrModules $this->export_dependencies_array[$r]=array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid'); $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label', - 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', - 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", + 's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', + 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text", 'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text", 'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text"); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', - 's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company'); + 's.phone'=>'company','s.email'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company'); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', - 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', - 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description"); - + 's.phone'=>'Phone','s.email'=>'Email','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', + 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.opp_amount'=>'OpportunityAmount','p.description'=>"Description"); + if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + unset($this->export_fields_array[$r]['p.opp_percent']); + unset($this->export_fields_array[$r]['p.opp_amount']); + unset($this->export_fields_array[$r]['cls.code']); + } + // Add fields for project $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array()); $keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra'; diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index eddcf1ebbdf..c0f95fe76f7 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.4'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.5'); if (! defined('EURO')) define('EURO',chr(128)); From 4839d06fc3249c077a788c51c518301eaa1e1e62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Jan 2017 12:48:32 +0100 Subject: [PATCH 20/68] Fix log --- dev/initdemo/initdemo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/initdemo/initdemo.sh b/dev/initdemo/initdemo.sh index c34d9e2ffda..940f0b59467 100755 --- a/dev/initdemo/initdemo.sh +++ b/dev/initdemo/initdemo.sh @@ -174,7 +174,7 @@ then echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images" cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images" else - echo Detection of documents directory $documentdir failed so demo files were not copied. + echo Detection of documents directory from $mydir failed so demo files were not copied. fi From 32ebe8f4d72dba3893f595f17b2c9328b4fa2177 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 26 Jan 2017 14:38:49 +0100 Subject: [PATCH 21/68] fix : ressource extrafield in list --- htdocs/resource/class/dolresource.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 2cf93493739..6e418e2e649 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -460,7 +460,7 @@ class Dolresource extends CommonObject $extrafields=new ExtraFields($this->db); $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); if (is_array($extralabels) && count($extralabels)>0) { - foreach($extralabels as $label=>$code) { + foreach($extralabels as $code=>$label) { $sql.= " ef.".$code." as extra_".$code.","; } } From deceeea8ffed662c8c76acdbbeaeabc7515999d6 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 26 Jan 2017 15:44:09 +0100 Subject: [PATCH 22/68] fix extrafield list of fileds --- htdocs/resource/list.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index b2ef82cf8c1..2c97b68f7ed 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -119,12 +119,15 @@ $arrayfields = array( // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { foreach ( $extrafields->attribute_label as $key => $val ) { - $arrayfields["ef." . $key] = array( - 'label' => $extrafields->attribute_label[$key], - 'checked' => $extrafields->attribute_list[$key], - 'position' => $extrafields->attribute_pos[$key], - 'enabled' => $extrafields->attribute_perms[$key] - ); + $typeofextrafield=$extrafields->attribute_type[$key]; + if ($typeofextrafield!='separate') { + $arrayfields["ef." . $key] = array( + 'label' => $extrafields->attribute_label[$key], + 'checked' => $extrafields->attribute_list[$key], + 'position' => $extrafields->attribute_pos[$key], + 'enabled' => $extrafields->attribute_perms[$key] + ); + } } } From a333a328d834d4ac6de6d9b98c61ff7ff217d96c Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 26 Jan 2017 16:32:36 +0100 Subject: [PATCH 23/68] FIX #6338 --- htdocs/contrat/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 849a466e18d..6c6b55ee949 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -272,7 +272,7 @@ $sql.= " state.code_departement, state.nom"; // Add where from extra fields foreach ($extrafields->attribute_label as $key => $val) { - $sql .= ', ef.'.$val; + $sql .= ', ef.'.$key; } // Add where from hooks $parameters=array(); From c1b59b195013668329aaf1c923865bb822416495 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Jan 2017 18:08:00 +0100 Subject: [PATCH 24/68] Fix several security bugs on expense report --- htdocs/core/class/html.form.class.php | 28 ++--- .../core/modules/modExpenseReport.class.php | 104 ++++++++++-------- htdocs/expensereport/card.php | 14 +-- .../class/expensereport.class.php | 3 + htdocs/expensereport/list.php | 2 +- htdocs/index.php | 32 +++--- htdocs/user/card.php | 5 +- htdocs/user/class/user.class.php | 45 +++++--- 8 files changed, 128 insertions(+), 105 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bc761b2d2b1..6cf24b2e38f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1372,7 +1372,7 @@ class Form * @param int $show_empty 0=list with no empty value, 1=add also an empty value into list * @param array $exclude Array list of users id to exclude * @param int $disabled If select list must be disabled - * @param array $include Array list of users id to include or 'hierarchy' to have only supervised users + * @param array|string $include Array list of users id to include or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me * @param array $enableonly Array list of users id to be enabled. All other must be disabled * @param int $force_entity 0 or Id of environment to force * @param int $maxlength Maximum length of string into list (0=no limit) @@ -1396,24 +1396,20 @@ class Form $includeUsers=null; // Permettre l'exclusion d'utilisateurs - if (is_array($exclude)) $excludeUsers = implode("','",$exclude); + if (is_array($exclude)) $excludeUsers = implode(",",$exclude); // Permettre l'inclusion d'utilisateurs - if (is_array($include)) $includeUsers = implode("','",$include); + if (is_array($include)) $includeUsers = implode(",",$include); else if ($include == 'hierarchy') { // Build list includeUsers to have only hierarchy - $userid=$user->id; - $include=array(); - if (empty($user->users) || ! is_array($user->users)) $user->get_full_tree(); - foreach($user->users as $key => $val) - { - if (preg_match('/_'.$userid.'/',$val['fullpath'])) $include[]=$val['id']; - } - $includeUsers = implode("','",$include); - //var_dump($includeUsers);exit; - //var_dump($user->users);exit; + $includeUsers = implode(",",$user->getAllChildIds(0)); } - + else if ($include == 'hierarchyme') + { + // Build list includeUsers to have only hierarchy and current user + $includeUsers = implode(",",$user->getAllChildIds(1)); + } + $out=''; // On recherche les utilisateurs @@ -1443,8 +1439,8 @@ class Form } } if (! empty($user->societe_id)) $sql.= " AND u.fk_soc = ".$user->societe_id; - if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN ('".$excludeUsers."')"; - if (is_array($include) && $includeUsers) $sql.= " AND u.rowid IN ('".$includeUsers."')"; + if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN (".$excludeUsers.")"; + if ($includeUsers) $sql.= " AND u.rowid IN (".$includeUsers.")"; if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) $sql.= " AND u.statut <> 0"; if (! empty($morefilter)) $sql.=" ".$morefilter; $sql.= " ORDER BY u.lastname ASC"; diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index 1507d236698..96b30d92467 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -111,54 +111,62 @@ class modExpenseReport extends DolibarrModules $this->rights = array(); // Permission array used by this module $this->rights_class = 'expensereport'; - $this->rights[1][0] = 771; - $this->rights[1][1] = 'Read expense reports (yours and your subordinates)'; - $this->rights[1][2] = 'r'; - $this->rights[1][3] = 0; - $this->rights[1][4] = 'lire'; - - $this->rights[3][0] = 772; - $this->rights[3][1] = 'Create/modify expense reports'; - $this->rights[3][2] = 'w'; - $this->rights[3][3] = 0; - $this->rights[3][4] = 'creer'; - - $this->rights[4][0] = 773; - $this->rights[4][1] = 'Delete expense reports'; - $this->rights[4][2] = 'd'; - $this->rights[4][3] = 0; - $this->rights[4][4] = 'supprimer'; - - $this->rights[6][0] = 775; - $this->rights[6][1] = 'Approve expense reports'; - $this->rights[6][2] = 'w'; - $this->rights[6][3] = 0; - $this->rights[6][4] = 'approve'; - - $this->rights[7][0] = 776; - $this->rights[7][1] = 'Pay expense reports'; - $this->rights[7][2] = 'w'; - $this->rights[7][3] = 0; - $this->rights[7][4] = 'to_paid'; - - $this->rights[2][0] = 777; - $this->rights[2][1] = 'Read expense reports of everybody'; - $this->rights[2][2] = 'r'; - $this->rights[2][3] = 1; - $this->rights[2][4] = 'readall'; - - $this->rights[2][0] = 778; - $this->rights[2][1] = 'Create expense reports for everybody'; - $this->rights[2][2] = 'w'; - $this->rights[2][3] = 0; - $this->rights[2][4] = 'writeall_advance'; - - $this->rights[5][0] = 779; - $this->rights[5][1] = 'Export expense reports'; - $this->rights[5][2] = 'r'; - $this->rights[5][3] = 0; - $this->rights[5][4] = 'export'; - + $this->rights[$r][0] = 771; + $this->rights[$r][1] = 'Read expense reports (yours and your subordinates)'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'lire'; + $r++; + + $this->rights[$r][0] = 772; + $this->rights[$r][1] = 'Create/modify expense reports'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'creer'; + $r++; + + $this->rights[$r][0] = 773; + $this->rights[$r][1] = 'Delete expense reports'; + $this->rights[$r][2] = 'd'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'supprimer'; + $r++; + + $this->rights[$r][0] = 775; + $this->rights[$r][1] = 'Approve expense reports'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'approve'; + $r++; + + $this->rights[$r][0] = 776; + $this->rights[$r][1] = 'Pay expense reports'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'to_paid'; + $r++; + + $this->rights[$r][0] = 777; + $this->rights[$r][1] = 'Read expense reports of everybody'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 1; + $this->rights[$r][4] = 'readall'; + $r++; + + $this->rights[$r][0] = 778; + $this->rights[$r][1] = 'Create expense reports for everybody'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'writeall_advance'; + $r++; + + $this->rights[$r][0] = 779; + $this->rights[$r][1] = 'Export expense reports'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'export'; + $r++; + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 2d93c88159c..a0c5138200e 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2016 Alexandre Spangaro * @@ -1228,8 +1228,8 @@ if ($action == 'create') print ''; @@ -1313,10 +1313,10 @@ else if ($result > 0) { - if ($object->fk_user_author != $user->id) + if (! in_array($object->fk_user_author, $user->getAllChildIds(1))) { if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) - && empty($user->rights->expensereport->writeall_advance)) + && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance))) { print load_fiche_titre($langs->trans('TripCard')); @@ -2090,7 +2090,7 @@ if ($action != 'create' && $action != 'edit') */ if ($user->rights->expensereport->creer && $object->fk_statut==0) { - if ($object->fk_user_author == $user->id) + if (in_array($object->fk_user_author, $user->getAllChildIds(1))) { // Modify print ''; @@ -2138,7 +2138,7 @@ if ($action != 'create' && $action != 'edit') */ if ($object->fk_statut == 2) { - if ($object->fk_user_author == $user->id) + if (in_array($object->fk_user_author, $user->getAllChildIds(1))) { // Brouillonner print ''; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 574fde69c2a..209d7edb12c 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1674,11 +1674,14 @@ class ExpenseReport extends CommonObject $now=dol_now(); + $userchildids = $user->getAllChildIds(1); + $sql = "SELECT ex.rowid, ex.date_valid"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex"; if ($option == 'toapprove') $sql.= " WHERE ex.fk_statut = 2"; else $sql.= " WHERE ex.fk_statut = 5"; $sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")"; + $sql.= " AND ex.fk_user_author IN (".join(',',$userchildids).")"; $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 7928e0f8e3d..cb54414fe35 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -240,7 +240,7 @@ if ($search_status != '' && $search_status >= 0) } // RESTRICT RIGHTS if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) - && empty($user->rights->expensereport->writeall_advance)) + && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance))) { $childids = $user->getAllChildIds(); $childids[]=$user->id; diff --git a/htdocs/index.php b/htdocs/index.php index f4be0dc9c63..16126975b9f 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -178,8 +178,8 @@ if (empty($user->societe_id)) ! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), ! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), ! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), - ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, - ! empty($conf->projet->enabled) && $user->rights->projet->lire + ! empty($conf->projet->enabled) && $user->rights->projet->lire, + ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire ); // Class file containing the method load_state_board for each line $includes=array( @@ -199,8 +199,8 @@ if (empty($user->societe_id)) DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", - DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", - DOL_DOCUMENT_ROOT."/projet/class/project.class.php" + DOL_DOCUMENT_ROOT."/projet/class/project.class.php", + DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php" ); // Name class containing the method load_state_board for each line $classes=array('User', @@ -219,8 +219,8 @@ if (empty($user->societe_id)) 'CommandeFournisseur', 'FactureFournisseur', 'SupplierProposal', - 'ExpenseReport', - 'Project' + 'Project', + 'ExpenseReport' ); // Cle array returned by the method load_state_board for each line $keys=array('users', @@ -239,8 +239,8 @@ if (empty($user->societe_id)) 'supplier_orders', 'supplier_invoices', 'askprice', - 'expensereports', - 'projects' + 'projects', + 'expensereports' ); // Dashboard Icon lines $icons=array('user', @@ -259,8 +259,8 @@ if (empty($user->societe_id)) 'order', 'bill', 'propal', - 'trip', - 'project' + 'project', + 'trip' ); // Translation keyword $titres=array("Users", @@ -279,8 +279,8 @@ if (empty($user->societe_id)) "SuppliersOrders", "SuppliersInvoices", "SupplierProposalShort", - "ExpenseReports", - "Projects" + "Projects", + "ExpenseReports" ); // Dashboard Link lines $links=array( @@ -300,8 +300,8 @@ if (empty($user->societe_id)) DOL_URL_ROOT.'/fourn/commande/list.php', DOL_URL_ROOT.'/fourn/facture/list.php', DOL_URL_ROOT.'/supplier_proposal/list.php', - DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm', - DOL_URL_ROOT.'/projet/list.php?mainmenu=project' + DOL_URL_ROOT.'/projet/list.php?mainmenu=project', + DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm' ); // Translation lang files $langfile=array("users", @@ -318,8 +318,8 @@ if (empty($user->societe_id)) "supplier_proposal", "contracts", "interventions", - "trips", - "projects" + "projects", + "trips" ); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index e7614f06f9d..f6ec03abf91 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -752,9 +752,10 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; // Employee + $defaultemployee=1; print ''; - print ''; // Position/Job diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index c215f5f29cc..68bfad3a988 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -127,6 +127,9 @@ class User extends CommonObject public $dateemployment; // Define date of employment by company + private $cache_childids; + + /** * Constructor de la classe * @@ -2600,26 +2603,38 @@ class User extends CommonObject } /** - * Return list of all child users id in herarchy (all sublevels). + * Return list of all child users id in herarchy of current user (all sublevels). * + * @return int $addcurrentuser 1=Add also current user id to the list. * @return array Array of user id lower than user. This overwrite this->users. * @see get_children */ - function getAllChildIds() + function getAllChildIds($addcurrentuser=0) { - // Init this->users - $this->get_full_tree(); - - $idtoscan=$this->id; - $childids=array(); - - dol_syslog("Build childid for id = ".$idtoscan); - foreach($this->users as $id => $val) - { - //var_dump($val['fullpath']); - if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id']; - } - + $childids=array(); + + if (isset($this->cache_childids[$this->id])) + { + $childids = $this->cache_childids[$this->id]; + } + else + { + // Init this->users + $this->get_full_tree(); + + $idtoscan=$this->id; + + dol_syslog("Build childid for id = ".$idtoscan); + foreach($this->users as $id => $val) + { + //var_dump($val['fullpath']); + if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id']; + } + } + $this->cache_childids[$this->id] = $childids; + + if ($addcurrentuser) $childids[$this->id]=$this->id; + return $childids; } From 60ac751d84aa5f74deb6d4da1b035325bcbe0044 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Jan 2017 18:21:39 +0100 Subject: [PATCH 25/68] Fix translation --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 5fd1ae065ec..e8c60db1fc9 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -689,7 +689,7 @@ PermissionAdvanced253=Create/modify internal/external users and permissions Permission254=Create/modify external users only Permission255=Modify other users password Permission256=Delete or disable other users -Permission262=Extend access to all third parties (not only third parties that user is a sale representative). Not effective for external users (always limited to themselves for proposals, orders, invoices, contracts, etc). Not effective for projects (only rules on project permissions, visibility and assignement matters). +Permission262=Extend access to all third parties (not only third parties that user is a sale representative).
Not effective for external users (always limited to themselves for proposals, orders, invoices, contracts, etc).
Not effective for projects (only rules on project permissions, visibility and assignement matters). Permission271=Read CA Permission272=Read invoices Permission273=Issue invoices From 72fd21b1833266f39fed5ed0922ac9e57160be8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Jan 2017 20:41:16 +0100 Subject: [PATCH 26/68] Fix phpcs --- htdocs/bookmarks/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index b89dbf291b7..0583c45bdab 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -219,7 +219,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '' , '', 0, '', '', 0); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', '', 0); print '
'; print '
'; $defaultselectuser=$user->id; if (GETPOST('fk_user_author') > 0) $defaultselectuser=GETPOST('fk_user_author'); - $include_users = array($user->id); - if (! empty($user->rights->expensereport->writeall)) $include_users=array(); + $include_users = 'hierarchyme'; + if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expensereport->writeall_advance)) $include_users=array(); $s=$form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users); print $s; print '
'.fieldLabel('Employee','employee',0).''; - print $form->selectyesno("employee",(GETPOST('employee')?GETPOST('employee'):0),1); + print ''.$langs->trans('Employee').''; + print $form->selectyesno("employee",(GETPOST('employee')!=''?GETPOST('employee'):$defaultemployee),1); print '
'; From ca79d0c274201563d25539580623113f97ed8f80 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Jan 2017 23:36:58 +0100 Subject: [PATCH 27/68] Fix PHPCS --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 68bfad3a988..188195b04bf 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2605,7 +2605,7 @@ class User extends CommonObject /** * Return list of all child users id in herarchy of current user (all sublevels). * - * @return int $addcurrentuser 1=Add also current user id to the list. + * @param int $addcurrentuser 1=Add also current user id to the list. * @return array Array of user id lower than user. This overwrite this->users. * @see get_children */ From ade8fd14151f3aa5ba541a19298be2b531bac7a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Jan 2017 01:20:56 +0100 Subject: [PATCH 28/68] Fix table format --- htdocs/compta/prelevement/demandes.php | 54 ++++++++++++++++---------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 22679af2110..173505329dc 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -45,6 +45,18 @@ $page = GETPOST('page','int'); $sortorder = GETPOST('sortorder','alpha'); $sortfield = GETPOST('sortfield','alpha'); +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortorder) $sortorder="DESC"; +if (! $sortfield) $sortfield="f.facnumber"; + + /* * View */ @@ -54,17 +66,7 @@ llxHeader(); $thirdpartystatic=new Societe($db); $invoicestatic=new Facture($db); -if ($page == -1) $page = 0 ; -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; -if (! $sortorder) $sortorder="DESC"; -if (! $sortfield) $sortfield="f.facnumber"; - - -/* - * Liste de demandes - */ +// List of requests $sql= "SELECT f.facnumber, f.rowid, f.total_ttc,"; $sql.= " s.nom as name, s.rowid as socid,"; @@ -83,10 +85,10 @@ if ($statut) $sql.= " AND pfd.traite = ".$statut; $sql.= " AND pfd.fk_facture = f.rowid"; if (dol_strlen(trim(GETPOST('search_societe','alpha')))) { - $sql.= " AND s.nom LIKE '%".GETPOST('search_societe','alpha')."%'"; + $sql.= natural_search("s.nom", 'search_societe'); } $sql.= " ORDER BY $sortfield $sortorder "; -$sql.= $db->plimit($conf->liste_limit+1, $offset); +$sql.= $db->plimit($limit+1, $offset); $resql=$db->query($sql); if ($resql) @@ -103,26 +105,35 @@ if ($resql) print_barre_liste($langs->trans("RequestStandingOrderTreated"), $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num); } + print '
'; + print '
'; print ''; - print ''; - print ''; - print ''; + print_liste_field_titre($langs->trans("Bill")); + print_liste_field_titre($langs->trans("Company")); + print_liste_field_titre($langs->trans("Amount")); + print_liste_field_titre($langs->trans("DateRequest")); + print_liste_field_titre(''); print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; + print ''; + // Action column + print ''; print ''; - print ''; $var = True; $users = array(); - while ($i < min($num,$conf->liste_limit)) + while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); $var=!$var; @@ -145,12 +156,15 @@ if ($resql) print ''; + print ''; + print ''; $i++; } print "
'.$langs->trans("Bill").''.$langs->trans("Company").''.$langs->trans("Amount").''.$langs->trans("DateRequest").'
'; + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + print $searchpitco; + print '
'.dol_print_date($db->jdate($obj->date_demande),'day').'

"; + print ''; } else { From 7b6488b1c79a9b1fdcd5d1a3cc9b5cadd27c2ace Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 27 Jan 2017 10:05:57 +0100 Subject: [PATCH 29/68] Fix numbering was disaplying technical error instead of error message --- htdocs/commande/class/commande.class.php | 3 ++- htdocs/compta/facture/class/facture.class.php | 3 ++- htdocs/fourn/class/fournisseur.facture.class.php | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index e554990892c..268459a3c12 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -239,7 +239,8 @@ class Commande extends CommonOrder } else { - dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); + $this->error=$obj->error; + //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); return ""; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f15526f34ba..623a355023e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3003,7 +3003,8 @@ class Facture extends CommonInvoice * set up mask. */ if ($mode != 'last' && !$numref) { - dol_print_error($this->db,"Facture::getNextNumRef ".$obj->error); + $this->error=$obj->error; + //dol_print_error($this->db,"Facture::getNextNumRef ".$obj->error); return ""; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index bc7f5bfdca6..27b7627f450 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1627,6 +1627,7 @@ class FactureFournisseur extends CommonInvoice } else { + $this->error=$obj->error; //dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); return false; } From c0b4667713d2cdadd58bfb6621cc82792b2fd097 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Fri, 27 Jan 2017 10:50:50 +0100 Subject: [PATCH 30/68] NEW: Use the expense repport author account instead of the default account, if exists --- htdocs/accountancy/journal/expensereportsjournal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index ce1c632e85b..8bc62c27ef6 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -86,14 +86,14 @@ $idpays = $p[0]; $sql = "SELECT er.rowid, er.ref, er.date_debut as de,"; $sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation,"; -$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_code,"; +$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,"; $sql .= " f.accountancy_code, ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON erd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation"; $sql .= " JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_valid"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_author"; $sql .= " WHERE er.fk_statut > 0 "; $sql .= " AND erd.fk_code_ventilation > 0 "; $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy From 63f614d1d50b6336b5ce1c4c847765e5dd1929d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Jan 2017 13:22:36 +0100 Subject: [PATCH 31/68] Fix color switching threshold --- htdocs/theme/eldy/style.css.php | 8 ++++---- htdocs/theme/md/style.css.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b09cde24630..ce5b7f3761e 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -159,25 +159,25 @@ if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) // Set text color to black or white $tmppart=explode(',',$colorbackhmenu1); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); -if ($tmpval <= 360) $colortextbackhmenu='FFFFFF'; +if ($tmpval <= 460) $colortextbackhmenu='FFFFFF'; else $colortextbackhmenu='000000'; $tmppart=explode(',',$colorbackvmenu1); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); -if ($tmpval <= 360) { $colortextbackvmenu='FFFFFF'; } +if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; } else { $colortextbackvmenu='000000'; } $tmppart=explode(',',$colorbacktitle1); if ($colortexttitle == '') { $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); - if ($tmpval <= 360) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } + if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } else { $colortexttitle='000000'; $colorshadowtitle='FFFFFF'; } } $tmppart=explode(',',$colorbacktabcard1); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); -if ($tmpval <= 340) { $colortextbacktab='FFFFFF'; } +if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; } else { $colortextbacktab='111111'; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8f0242db8ca..f1caa8e13a1 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -160,25 +160,25 @@ if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1; // Set text color to black or white $tmppart=explode(',',$colorbackhmenu1); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); -if ($tmpval <= 360) $colortextbackhmenu='FFFFFF'; +if ($tmpval <= 460) $colortextbackhmenu='FFFFFF'; else $colortextbackhmenu='000000'; $tmppart=explode(',',$colorbackvmenu1); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); -if ($tmpval <= 360) { $colortextbackvmenu='FFFFFF'; } +if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; } else { $colortextbackvmenu='000000'; } $tmppart=explode(',',$colorbacktitle1); if ($colortexttitle == '') { $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); - if ($tmpval <= 260) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } + if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } else { $colortexttitle='101010'; $colorshadowtitle='FFFFFF'; } } $tmppart=explode(',',$colorbacktabcard1); $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : '')+(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : ''); -if ($tmpval <= 340) { $colortextbacktab='FFFFFF'; } +if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; } else { $colortextbacktab='111111'; } // Format color value to match expected format (may be 'FFFFFF' or '255,255,255') From 3e14a89eb0f45a73775f89749548aae7ebd731fb Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 27 Jan 2017 23:05:29 +0100 Subject: [PATCH 32/68] Fix #6314 --- htdocs/compta/bank/bankentries.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 54c77ed6e73..ad3817f28cd 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -5,6 +5,7 @@ * Copyright (C) 2012 Vinícius Nogueira * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -773,7 +774,7 @@ if ($resql) if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'balance','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) From 27caa586c20066fad6a1bdaff5a47f835be6d398 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 12:36:53 +0100 Subject: [PATCH 33/68] Fix auto increment customer code must be done only if error is on duplicate code --- htdocs/societe/class/societe.class.php | 5 ++--- htdocs/societe/soc.php | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9248a07469c..b4a9a549ea7 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -503,10 +503,9 @@ class Societe extends CommonObject } else { - if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') + if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - - $this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->name); + $this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->name); // duplicate on a field (code or profid or ...) $result=-1; } else diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 36fe26447fa..540c3aed883 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -514,8 +514,8 @@ if (empty($reshook)) } else { - - if($result == -3) { + if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') // TODO Sometime errors on duplicate on profid and not on code, so + { $duplicate_code_error = true; $object->code_fournisseur = null; $object->code_client = null; From 4bce208035259953b39f580063bf2c9908d36a77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 12:42:02 +0100 Subject: [PATCH 34/68] FIX detail of deposit and credit not was not visible into final invoice --- htdocs/core/tpl/objectline_view.tpl.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 559cae91464..fabba837e21 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -69,19 +69,20 @@ if (empty($usemargins)) $usemargins=0; description) { - if ($line->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) + if ($line->description == '(CREDIT_NOTE)' && $line->fk_remise_except > 0) { $discount=new DiscountAbsolute($this->db); $discount->fetch($line->fk_remise_except); echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); } - elseif ($line->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) + elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) { $discount=new DiscountAbsolute($this->db); $discount->fetch($line->fk_remise_except); echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); // Add date of deposit - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) + echo ' ('.dol_print_date($discount->datec).')'; } else { From bc8ccd8ec5f7931e546f3422c6e207e50d82f1d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 12:59:32 +0100 Subject: [PATCH 35/68] Fix bad var set --- htdocs/core/class/discount.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 2295a301e03..5ea11cba680 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -41,10 +41,10 @@ class DiscountAbsolute public $fk_user; // Id utilisateur qui accorde la remise public $description; // Description libre public $datec; // Date creation - public $fk_facture_line; // Id invoice line when a discount linked to invoice line (for absolute discounts) - public $fk_facture; // Id invoice when a discoutn linked to invoice (for credit note) + public $fk_facture_line; // Id invoice line when a discount is used into an invoice line (for absolute discounts) + public $fk_facture; // Id invoice when a discount line is used into an invoice (for credit note) public $fk_facture_source; // Id facture avoir a l'origine de la remise - public $ref_facture_source; // Ref facture avoir a l'origine de la remise + public $ref_facture_source; // Ref facture avoir a l'origine de la remise /** * Constructor @@ -296,7 +296,7 @@ class DiscountAbsolute $resql = $this->db->query($sql); if ($resql) { - $this->fk_facture_source=$rowidline; + $this->fk_facture_line=$rowidline; $this->fk_facture=$rowidinvoice; return 1; } From 7c638feb3bfa0ae338f9058e7ca5bb4236a9875e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 13:13:57 +0100 Subject: [PATCH 36/68] Fix label of field --- htdocs/margin/agentMargins.php | 7 ++++++- htdocs/margin/checkMargins.php | 11 ++++++----- htdocs/margin/customerMargins.php | 7 ++++++- htdocs/margin/productMargins.php | 9 ++++++++- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 61cee328b41..26a5813c8be 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -171,6 +171,11 @@ if ($result) print '
'; print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,$num,''); + if ($conf->global->MARGIN_TYPE == "1") + $labelcostprice=$langs->trans('BuyingPrice'); + else // value is 'costprice' or 'pmp' + $labelcostprice=$langs->trans('CostPrice'); + $i = 0; print ""; @@ -181,7 +186,7 @@ if ($result) print_liste_field_titre($langs->trans("SalesRepresentative"),$_SERVER["PHP_SELF"],"u.lastname","","&agentid=".$agentid,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($labelcostprice,$_SERVER["PHP_SELF"],"buying_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index 93f6e6915f9..b3c663ad886 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -179,6 +179,11 @@ if ($result) { print '
'; print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); + if ($conf->global->MARGIN_TYPE == "1") + $labelcostprice=$langs->trans('BuyingPrice'); + else // value is 'costprice' or 'pmp' + $labelcostprice=$langs->trans('CostPrice'); + $moreforfilter=''; print '
'; @@ -189,11 +194,7 @@ if ($result) { print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "f.ref", "", $options, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "", "", $options, 'width=20%', $sortfield, $sortorder); print_liste_field_titre($langs->trans("UnitPriceHT"), $_SERVER["PHP_SELF"], "d.subprice", "", $options, 'align="right"', $sortfield, $sortorder); - if ($conf->global->MARGIN_TYPE == "1") { - print_liste_field_titre($langs->trans("BuyingPrice"), $_SERVER["PHP_SELF"], "d.buy_price_ht", "", $options, 'align="right"', $sortfield, $sortorder); - } else { - print_liste_field_titre($langs->trans("CostPrice"), $_SERVER["PHP_SELF"], "d.buy_price_ht", "", $options, 'align="right"', $sortfield, $sortorder); - } + print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "d.buy_price_ht", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Qty"), $_SERVER["PHP_SELF"], "d.qty", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("AmountTTC"), $_SERVER["PHP_SELF"], "d.total_ht", "", $options, 'align="right"', $sortfield, $sortorder); diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 8b960a150a4..8bdff263ebf 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -207,6 +207,11 @@ if ($result) print '
'; print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,$num,''); + if ($conf->global->MARGIN_TYPE == "1") + $labelcostprice=$langs->trans('BuyingPrice'); + else // value is 'costprice' or 'pmp' + $labelcostprice=$langs->trans('CostPrice'); + $i = 0; print "
"; @@ -218,7 +223,7 @@ if ($result) else print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&socid=".$socid,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($labelcostprice,$_SERVER["PHP_SELF"],"buying_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&socid=".$socid,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&socid=".$socid,'align="right"',$sortfield,$sortorder); diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index dcf80e9a49c..26d5accf710 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -203,6 +203,11 @@ if ($result) print '
'; print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=".$id,$sortfield,$sortorder,'',$num,$num,''); + if ($conf->global->MARGIN_TYPE == "1") + $labelcostprice=$langs->trans('BuyingPrice'); + else // value is 'costprice' or 'pmp' + $labelcostprice=$langs->trans('CostPrice'); + $moreforfilter=''; $i = 0; @@ -215,9 +220,11 @@ if ($result) print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$id,'align="center"',$sortfield,$sortorder); } else + { print_liste_field_titre($langs->trans("ProductService"),$_SERVER["PHP_SELF"],"p.ref","","&id=".$id,'',$sortfield,$sortorder); + } print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&id=".$id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($labelcostprice,$_SERVER["PHP_SELF"],"buying_price","","&id=".$id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$id,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&id=".$id,'align="right"',$sortfield,$sortorder); From 1e78c4c4182906599b464360aa40517d8324b776 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 14:54:06 +0100 Subject: [PATCH 37/68] FIX Change the customer code only if error on duplicate --- htdocs/societe/soc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index f3f87ba6f79..d3c8240417f 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -509,8 +509,8 @@ if (empty($reshook)) } else { - - if($result == -3) { + if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') // TODO Sometime errors on duplicate on profid and not on code, so + { $duplicate_code_error = true; $object->code_fournisseur = null; $object->code_client = null; From e2ce31e1a7ed7dd9023825dd7566c2642c92415f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 14:54:51 +0100 Subject: [PATCH 38/68] Add code comment --- htdocs/margin/lib/margins.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index 84d7945ec0d..d7dbd5d81eb 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -109,7 +109,7 @@ function marges_prepare_head() * @param float $localtax2_tx Vat rate special 2 (not used) * @param int $fk_pa Id of buying price (prefer set this to 0 and provide $paht instead. With id, buying price may have change) * @param float $paht Buying price without tax - * @return array Array of margin info + * @return array Array of margin info (buying price, marge rate, marque rate) */ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $paht) { @@ -134,7 +134,7 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta } else { - $paht_ret = $paht; + $paht_ret = $paht; } // Calculate selling unit price including line discount From c88e63ecc972eafaf70752144c4f5735529ca47e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 15:01:17 +0100 Subject: [PATCH 39/68] FIX #6259 --- htdocs/compta/facture/class/facture.class.php | 15 +++++- htdocs/core/class/html.formmargin.class.php | 49 ++++++++++--------- 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f15526f34ba..2d76242ccc4 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1164,7 +1164,7 @@ class Facture extends CommonInvoice { $this->lines=array(); - $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, '; + $sql = 'SELECT l.rowid, l.fk_facture, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, '; $sql.= ' l.situation_percent, l.fk_prev_id,'; $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,'; $sql.= ' l.rang, l.special_code,'; @@ -1191,6 +1191,7 @@ class Facture extends CommonInvoice $line->id = $objp->rowid; $line->rowid = $objp->rowid; // deprecated + $line->fk_facture = $objp->fk_facture; $line->label = $objp->custom_label; // deprecated $line->desc = $objp->description; // Description line $line->description = $objp->description; // Description line @@ -1443,6 +1444,18 @@ class Facture extends CommonInvoice $facligne->rang=-1; $facligne->info_bits=2; + // Get buy/cost price of invoice that is source of discount + if ($remise->fk_facture_source > 0) + { + $srcinvoice=new Facture($this->db); + $srcinvoice->fetch($remise->fk_facture_source); + $totalcostpriceofinvoice=0; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; // TODO Move this into commonobject + $formmargin=new FormMargin($this->db); + $arraytmp=$formmargin->getMarginInfosArray($srcinvoice, false); + $facligne->pa_ht = $arraytmp['pa_total']; + } + $facligne->total_ht = -$remise->amount_ht; $facligne->total_tva = -$remise->amount_tva; $facligne->total_ttc = -$remise->amount_ttc; diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 6678d87ca60..6d29125df6c 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -48,6 +48,7 @@ class FormMargin /** * get array with margin information from lines of object + * TODO Move this in common class. * * @param CommonObject $object Object we want to get margin information for * @param boolean $force_price True of not @@ -92,19 +93,23 @@ class FormMargin $line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100)); } + $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); + $pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign + $pa = $line->qty * $pa_ht; + // calcul des marges if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise - $pa = $line->qty * $line->pa_ht; - $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit $marginInfos['pa_products'] += $pa; $marginInfos['pv_products'] += $pv; $marginInfos['pa_total'] += $pa; $marginInfos['pv_total'] += $pv; // if credit note, margin = -1 * (abs(selling_price) - buying_price) - if ($pv < 0) - $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa); - else + //if ($pv < 0) + //{ + // $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa); + //} + //else $marginInfos['margin_on_products'] += $pv - $pa; } elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service @@ -113,9 +118,9 @@ class FormMargin $marginInfos['pa_total'] += $pa; $marginInfos['pv_total'] += $pv; // if credit note, margin = -1 * (abs(selling_price) - buying_price) - if ($pv < 0) - $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); - else + //if ($pv < 0) + // $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); + //else $marginInfos['margin_on_services'] += $pv - $pa; } elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total @@ -126,29 +131,29 @@ class FormMargin else { $type=$line->product_type?$line->product_type:$line->fk_product_type; if ($type == 0) { // product - $pa = $line->qty * $line->pa_ht; - $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pa_products'] += $pa; $marginInfos['pv_products'] += $pv; $marginInfos['pa_total'] += $pa; $marginInfos['pv_total'] += $pv; // if credit note, margin = -1 * (abs(selling_price) - buying_price) - if ($pv < 0) - $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa); - else - $marginInfos['margin_on_products'] += $pv - $pa; + //if ($pv < 0) + //{ + // $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa); + //} + //else + //{ + $marginInfos['margin_on_products'] += $pv - $pa; + //} } elseif ($type == 1) { // service - $pa = $line->qty * $line->pa_ht; - $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pa_services'] += $pa; $marginInfos['pv_services'] += $pv; $marginInfos['pa_total'] += $pa; $marginInfos['pv_total'] += $pv; // if credit note, margin = -1 * (abs(selling_price) - buying_price) - if ($pv < 0) - $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); - else + //if ($pv < 0) + // $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); + //else $marginInfos['margin_on_services'] += $pv - $pa; } } @@ -164,9 +169,9 @@ class FormMargin $marginInfos['mark_rate_services'] = 100 * $marginInfos['margin_on_services'] / $marginInfos['pv_services']; // if credit note, margin = -1 * (abs(selling_price) - buying_price) - if ($marginInfos['pv_total'] < 0) - $marginInfos['total_margin'] = -1 * (abs($marginInfos['pv_total']) - $marginInfos['pa_total']); - else + //if ($marginInfos['pv_total'] < 0) + // $marginInfos['total_margin'] = -1 * (abs($marginInfos['pv_total']) - $marginInfos['pa_total']); + //else $marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total']; if ($marginInfos['pa_total'] > 0) $marginInfos['total_margin_rate'] = 100 * $marginInfos['total_margin'] / $marginInfos['pa_total']; From 2c07d2df22d08cf7a866323cf667d5ce6278eaaf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 15:08:46 +0100 Subject: [PATCH 40/68] Add comments --- htdocs/margin/agentMargins.php | 1 + htdocs/margin/customerMargins.php | 1 + htdocs/margin/productMargins.php | 1 + 3 files changed, 3 insertions(+) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 66bdbb26f8e..d5f50d7529c 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -115,6 +115,7 @@ $sql = "SELECT"; if ($agentid > 0) $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; $sql.= " u.rowid as agent, u.login, u.lastname, u.firstname,"; $sql.= " sum(d.total_ht) as selling_price,"; +// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this) $sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; $sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge" ; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 7f6d5a951c2..3d95d2ae091 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -164,6 +164,7 @@ $sql = "SELECT"; $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; if ($client) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; $sql.= " sum(d.total_ht) as selling_price,"; +// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this) $sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; $sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index b4609633447..ac9d61fb814 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -166,6 +166,7 @@ $sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity," if ($id > 0) $sql.= " d.fk_product,"; if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; $sql.= " SUM(d.total_ht) as selling_price,"; +// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this) $sql.= " SUM(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; $sql.= " SUM(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; From 4f76626f51adf5e4e07569c19d74e4d4a6030c6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 15:55:44 +0100 Subject: [PATCH 41/68] FIX Creation of credit note on invoice with deposit stole the discount. --- htdocs/compta/facture.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 22 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index abce93d9d90..f900e2889a3 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -812,14 +812,14 @@ if (empty($reshook)) $line->fk_parent_line = $fk_parent_line; $line->subprice =-$line->subprice; // invert price for object - $line->pa_ht = -$line->pa_ht; + $line->pa_ht = $line->pa_ht; // we choosed to have buy/cost price always positive, so no revert of sign here $line->total_ht=-$line->total_ht; $line->total_tva=-$line->total_tva; $line->total_ttc=-$line->total_ttc; $line->total_localtax1=-$line->total_localtax1; $line->total_localtax2=-$line->total_localtax2; - $result = $line->insert(); + $result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked $object->lines[] = $line; // insert new line in current object diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2d76242ccc4..36046fa8010 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4096,10 +4096,11 @@ class FactureLigne extends CommonInvoiceLine /** * Insert line into database * - * @param int $notrigger 1 no triggers - * @return int <0 if KO, >0 if OK + * @param int $notrigger 1 no triggers + * @param int $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another + * @return int <0 if KO, >0 if OK */ - function insert($notrigger=0) + function insert($notrigger=0, $noerrorifdiscountalreadylinked=0) { global $langs,$user,$conf; @@ -4243,13 +4244,16 @@ class FactureLigne extends CommonInvoiceLine // Check if discount was found if ($result > 0) { - // Check if discount not already affected to another invoice - if ($discount->fk_facture) + // Check if discount not already affected to another invoice + if ($discount->fk_facture_line > 0) { - $this->error=$langs->trans("ErrorDiscountAlreadyUsed",$discount->id); - dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); - $this->db->rollback(); - return -3; + if (empty($noerrorifdiscountalreadylinked)) + { + $this->error=$langs->trans("ErrorDiscountAlreadyUsed",$discount->id); + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); + $this->db->rollback(); + return -3; + } } else { From b4b81d8dcb83f84f45292c73ff3820cc141d2d78 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2017 14:53:05 +0100 Subject: [PATCH 42/68] Fix css and missing translation key --- htdocs/comm/mailing/cibles.php | 2 +- htdocs/core/modules/mailings/advthirdparties.modules.php | 1 + htdocs/core/modules/mailings/contacts1.modules.php | 6 +++--- htdocs/core/modules/mailings/contacts2.modules.php | 2 +- htdocs/core/modules/mailings/contacts3.modules.php | 4 ++-- htdocs/core/modules/mailings/contacts4.modules.php | 4 ++-- htdocs/core/modules/mailings/example.modules.php | 4 +++- htdocs/core/modules/mailings/fraise.modules.php | 6 ++---- htdocs/core/modules/mailings/framboise.modules.php | 6 ++---- htdocs/core/modules/mailings/modules_mailings.php | 6 ++++-- htdocs/core/modules/mailings/pomme.modules.php | 1 + htdocs/core/modules/mailings/thirdparties.modules.php | 1 + .../mailings/thirdparties_services_expired.modules.php | 1 + htdocs/core/modules/mailings/xinputfile.modules.php | 1 + htdocs/core/modules/mailings/xinputuser.modules.php | 1 + htdocs/langs/en_US/mails.lang | 5 ++++- htdocs/theme/eldy/style.css.php | 3 +++ htdocs/theme/md/style.css.php | 3 +++ 18 files changed, 36 insertions(+), 21 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index e104db4dcda..0d096f1ecef 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -231,7 +231,7 @@ if ($object->fetch($id) >= 0) $var=!$var; - $allowaddtarget=($object->statut == 0); + $allowaddtarget=($object->statut == 0 || $object->statut == 1); // Show email selectors if ($allowaddtarget && $user->rights->mailing->creer) diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index cd0f229983d..737b239498f 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -26,6 +26,7 @@ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; class mailing_advthirdparties extends MailingTargets { var $name='ThirdPartyAdvancedTargeting'; + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found var $desc="Third parties"; var $require_admin=0; diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 99de75c6d26..02bcc17ec30 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -34,12 +34,12 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; class mailing_contacts1 extends MailingTargets { var $name='ContactCompanies'; // Identifiant du module mailing - // This label is used if no translation is found for key MailingModuleDescXXX where XXX=name is found - var $desc='Contacts des tiers (prospects, clients, fournisseurs...)'; + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found + var $desc='Contacts of thirdparties (prospects, customers, suppliers...)'; var $require_module=array("societe"); // Module mailing actif si modules require_module actifs var $require_admin=0; // Module mailing actif pour user admin ou non var $picto='contact'; - + var $db; diff --git a/htdocs/core/modules/mailings/contacts2.modules.php b/htdocs/core/modules/mailings/contacts2.modules.php index 08e92af45e8..778b2182e1a 100644 --- a/htdocs/core/modules/mailings/contacts2.modules.php +++ b/htdocs/core/modules/mailings/contacts2.modules.php @@ -33,7 +33,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; class mailing_contacts2 extends MailingTargets { var $name='ContactsByFunction'; - // This label is used if no translation is found for key MailingModuleDescXXX where XXX=name is found + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found var $desc='Add contacts by function'; var $require_admin=0; diff --git a/htdocs/core/modules/mailings/contacts3.modules.php b/htdocs/core/modules/mailings/contacts3.modules.php index b9878fd1c83..2c142541023 100644 --- a/htdocs/core/modules/mailings/contacts3.modules.php +++ b/htdocs/core/modules/mailings/contacts3.modules.php @@ -32,8 +32,8 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; class mailing_contacts3 extends MailingTargets { var $name='ContactsByCompanyCategory'; - // This label is used if no translation is found for key MailingModuleDescXXX where XXX=name is found - var $desc='Add contacts by company category'; + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found + var $desc='Add contacts by company category'; var $require_admin=0; var $require_module=array(); diff --git a/htdocs/core/modules/mailings/contacts4.modules.php b/htdocs/core/modules/mailings/contacts4.modules.php index 421fd2676c8..a79d48a03e4 100644 --- a/htdocs/core/modules/mailings/contacts4.modules.php +++ b/htdocs/core/modules/mailings/contacts4.modules.php @@ -32,8 +32,8 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; class mailing_contacts4 extends MailingTargets { var $name='ContactsByCategory'; - // This label is used if no translation is found for key MailingModuleDescXXX where XXX=name is found - var $desc='Add contacts by category'; + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found + var $desc='Add contacts by category'; var $require_admin=0; var $require_module=array(); diff --git a/htdocs/core/modules/mailings/example.modules.php b/htdocs/core/modules/mailings/example.modules.php index f0f8b99e3c5..548510f81a0 100644 --- a/htdocs/core/modules/mailings/example.modules.php +++ b/htdocs/core/modules/mailings/example.modules.php @@ -32,7 +32,9 @@ class mailing_example extends MailingTargets var $desc='Put here a description'; // CHANGE THIS: Set to 1 if selector is available for admin users only var $require_admin=0; - + // CHANGE THIS: Add a tooltip language key to add a tooltip help icon after the email target selector + var $tooltip='MyTooltipLangKey'; + var $require_module=array(); var $picto=''; var $db; diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 089c42d4950..05d9e525652 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -32,12 +32,10 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; */ class mailing_fraise extends MailingTargets { - // CHANGE THIS: Put here a name not already used var $name='FundationMembers'; // Identifiant du module mailing - // CHANGE THIS: Put here a description of your selector module. - // This label is used if no translation found for key MailingModuleDescXXX where XXX=name is found + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found var $desc='Foundation members with emails (by status)'; - // CHANGE THIS: Set to 1 if selector is available for admin users only + // Set to 1 if selector is available for admin users only var $require_admin=0; var $require_module=array('adherent'); diff --git a/htdocs/core/modules/mailings/framboise.modules.php b/htdocs/core/modules/mailings/framboise.modules.php index a30a9ba3c17..82f7e51e0ef 100644 --- a/htdocs/core/modules/mailings/framboise.modules.php +++ b/htdocs/core/modules/mailings/framboise.modules.php @@ -23,12 +23,10 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; */ class mailing_framboise extends MailingTargets { - // CHANGE THIS: Put here a name not already used var $name='MembersCategories'; - // CHANGE THIS: Put here a description of your selector module. - // This label is used if no translation found for key MailingModuleDescXXX where XXX=name is found + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found var $desc="Foundation members with emails (by categories)"; - // CHANGE THIS: Set to 1 if selector is available for admin users only + // Set to 1 if selector is available for admin users only var $require_admin=0; var $require_module=array("adherent","categorie"); diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 16b930e8907..1a97f3502b7 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -49,7 +49,7 @@ class MailingTargets // This can't be abstract as it is used for some method /** * Return description of email selector * - * @return string Retourne la traduction de la cle MailingModuleDescXXX ou XXX nom du module, ou $this->desc si non trouve + * @return string Return translation of module label. Try translation of $this->name then translation of 'MailingModuleDesc'.$this->name, or $this->desc if not found */ function getDesc() { @@ -58,7 +58,9 @@ class MailingTargets // This can't be abstract as it is used for some method $langs->load("mails"); $transstring="MailingModuleDesc".$this->name; $s=''; - if ($langs->trans($transstring) != $transstring) $s=$langs->trans($transstring); + + if ($langs->trans($this->name) != $this->name) $s=$langs->trans($this->name); + elseif ($langs->trans($transstring) != $transstring) $s=$langs->trans($transstring); else $s=$this->desc; if ($this->tooltip && is_object($form)) $s .= ' '.$form->textwithpicto('', $langs->trans($this->tooltip), 1, 1); diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 3db13ac824c..5824f456365 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -31,6 +31,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; class mailing_pomme extends MailingTargets { var $name='DolibarrUsers'; // Identifiant du module mailing + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found var $desc='Dolibarr users with emails'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e var $require_module=array(); // Module mailing actif si modules require_module actifs var $require_admin=1; // Module mailing actif pour user admin ou non diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index cfccc1ff673..55cce13fbcf 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -24,6 +24,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; class mailing_thirdparties extends MailingTargets { var $name='ContactsCategories'; + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found var $desc="Third parties (by categories)"; var $require_admin=0; diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 39790959b97..de92354a964 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -23,6 +23,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; class mailing_thirdparties_services_expired extends MailingTargets { var $name='DolibarrContractsLinesExpired'; + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found var $desc='Third parties with expired contract\'s lines'; var $require_admin=0; diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 04c4be3ce2e..152322c2899 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; class mailing_xinputfile extends MailingTargets { var $name='EmailsFromFile'; // Identifiant du module mailing + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found var $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e var $require_module=array(); // Module mailing actif si modules require_module actifs var $require_admin=0; // Module mailing actif pour user admin ou non diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 4c5567f574d..794de3d9294 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; class mailing_xinputuser extends MailingTargets { var $name='EmailsFromUser'; // Identifiant du module mailing + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found var $desc='EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e var $require_module=array(); // Module mailing actif si modules require_module actifs var $require_admin=0; // Module mailing actif pour user admin ou non diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 0c894cc7b19..879f4469478 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -74,7 +74,10 @@ ResultOfMailSending=Result of mass EMail sending NbSelected=Nb selected NbIgnored=Nb ignored NbSent=Nb sent -ContactsWithThirdpartyFilter=Contact with customer filters +MailingModuleDescContactsWithThirdpartyFilter=Contact with customer filters +MailingModuleDescContactsByCompanyCategory=Contacts by third party category +MailingModuleDescContactsByCategory=Contacts by categories +MailingModuleDescContactsByFunction=Contacts by position # Libelle des modules de liste de destinataires mailing LineInFile=Line %s in file diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ce5b7f3761e..6731b541423 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2778,6 +2778,9 @@ tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair padding: 5px 2px 5px 3px; border-bottom: 1px solid #ddd; } +form.pair, form.impair { + font-weight: normal; +} form.tagtr:last-of-type div.tagtd, tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td { border-bottom: 0px !important; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index f1caa8e13a1..5fe8597b04c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2651,6 +2651,9 @@ tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair padding: 5px 2px 5px 3px; border-bottom: 1px solid #eee; } +form.pair, form.impair { + font-weight: normal; +} tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td { border-bottom: 0px !important; } From 756919de2a0a62ee86fa328a93415fbe3764c366 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2017 15:31:22 +0100 Subject: [PATCH 43/68] Fix deadlock feature: could not solve a situation where an emailing was validated by error. --- htdocs/comm/mailing/card.php | 39 ++++++++++++++++++++++-- htdocs/comm/mailing/cibles.php | 2 +- htdocs/core/class/commonobject.class.php | 1 + htdocs/langs/en_US/mails.lang | 1 + 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index aeaf19f8471..21e26814119 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -602,6 +602,29 @@ if (empty($reshook)) } } + // Action confirmation validation + if ($action == 'confirm_settodraft' && $confirm == 'yes') + { + if ($object->id > 0) + { + $result = $object->setStatut(0); + if ($result > 0) + { + //setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs'); + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + else + { + dol_print_error($db); + } + } + // Resend if ($action == 'confirm_reset' && $confirm == 'yes') { @@ -727,7 +750,12 @@ else dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email'); - // Confirmation de la validation du mailing + // Confirmation back to draft + if ($action == 'settodraft') + { + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("SetToDraft"),$langs->trans("ConfirmUnvalidateEmailing"),"confirm_settodraft",'','',1); + } + // Confirmation validation of mailing if ($action == 'valid') { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valid",'','',1); @@ -900,10 +928,15 @@ else * Boutons d'action */ - if (GETPOST("cancel") || $confirm=='no' || $action == '' || in_array($action,array('valid','delete','sendall','clone'))) + if (GETPOST("cancel") || $confirm=='no' || $action == '' || in_array($action,array('settodraft', 'valid','delete','sendall','clone'))) { print "\n\n
\n"; + if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id)) + { + print ''.$langs->trans("SetToDraft").''; + } + if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer) { print ''.$langs->trans("EditMailing").''; @@ -1212,7 +1245,7 @@ else print '
'; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%'); + $doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%'); $doleditor->Create(); print '
'; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 0d096f1ecef..e104db4dcda 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -231,7 +231,7 @@ if ($object->fetch($id) >= 0) $var=!$var; - $allowaddtarget=($object->statut == 0 || $object->statut == 1); + $allowaddtarget=($object->statut == 0); // Show email selectors if ($allowaddtarget && $user->rights->mailing->creer) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7b48240a72b..6340facf31a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2771,6 +2771,7 @@ abstract class CommonObject $this->db->begin(); $fieldstatus="fk_statut"; + if ($elementTable == 'mailing') $fieldstatus="statut"; if ($elementTable == 'user') $fieldstatus="statut"; if ($elementTable == 'expensereport') $fieldstatus="fk_statut"; if ($elementTable == 'commande_fournisseur_dispatch') $fieldstatus="status"; diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 879f4469478..c337b6e1119 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -74,6 +74,7 @@ ResultOfMailSending=Result of mass EMail sending NbSelected=Nb selected NbIgnored=Nb ignored NbSent=Nb sent +ConfirmUnvalidateEmailing=Are you sure you want to change email %s to draft status? MailingModuleDescContactsWithThirdpartyFilter=Contact with customer filters MailingModuleDescContactsByCompanyCategory=Contacts by third party category MailingModuleDescContactsByCategory=Contacts by categories From d7c2bdba384fbe2627664a99198a26ec742afbab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2017 16:42:59 +0100 Subject: [PATCH 44/68] Fix: link was useless with a nofollow tag. --- htdocs/core/lib/security.lib.php | 5 +++-- htdocs/core/tpl/login.tpl.php | 15 +++++++++++++-- htdocs/main.inc.php | 5 +++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 4cfc077f0be..ced20a79ea6 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -339,7 +339,8 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu } /** - * Check access by user to object + * Check access by user to object. + * This function is also called by restrictedArea * * @param User $user User to check * @param array $featuresarray Features/modules to check @@ -348,8 +349,8 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu * @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) - * * @return bool True if user has access, False otherwise + * @see restrictedArea */ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='', $dbt_select='rowid') { diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index a9d7c73ae1a..b3a2ced1023 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +// Need global variable $title to be defined + header('Cache-Control: Public, must-revalidate'); header("Content-type: text/html; charset=".$conf->file->character_set_client); @@ -35,7 +37,10 @@ $arrayofjs=array( ); $titleofloginpage=$langs->trans('Login').' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version. -print top_htmlhead('',$titleofloginpage,0,0,$arrayofjs); +$disablenofollow=1; +if (! preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) $disablenofollow=0; + +print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disablenofollow); ?> @@ -71,7 +76,13 @@ $(document).ready(function () {
- +
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8aba2e428f2..a18840f131c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -993,9 +993,10 @@ function top_httphead() * @param array $arrayofjs Array of complementary js files * @param array $arrayofcss Array of complementary css files * @param int $disablejmobile Disable jmobile + * @param int $disablenofollow Disable no follow tag * @return void */ -function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0) +function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0, $disablenofollow=0) { global $user, $conf, $langs, $db; @@ -1017,7 +1018,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print "\n"; if (GETPOST('dol_basehref')) print ''."\n"; // Displays meta - print ''."\n"; // Do not index + print ''."\n"; // Do not index print ''; // Scale for mobile device print ''."\n"; $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1); From 45c99d9d24efae791f8c75ab0c3790346c77e8c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2017 16:46:59 +0100 Subject: [PATCH 45/68] Fix HTML5 error --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a18840f131c..7c22308f201 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1024,7 +1024,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1); if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; print ''."\n"; - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print ''."\n"; + //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print ''."\n"; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print ''."\n"; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print ''."\n"; From 92e61e67070d8030cdd172feb7ebbadaa6204d81 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2017 18:29:37 +0100 Subject: [PATCH 46/68] Fix hide url if not defined --- htdocs/comm/mailing/cibles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index e104db4dcda..470ee2a4ec1 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -533,7 +533,7 @@ if ($object->fetch($id) >= 0) print ''; if (empty($obj->source_id) || empty($obj->source_type)) { - print $obj->source_url; // For backward compatibility + print empty($obj->source_url)?'':$obj->source_url; // For backward compatibility } else { From ff8b7e6e4d3259ac4121a89c7d5dc05fd61e8616 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2017 18:35:56 +0100 Subject: [PATCH 47/68] Fix size of email --- htdocs/comm/mailing/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 21e26814119..b7f2a002105 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -730,7 +730,7 @@ if ($action == 'create') print '
'; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('body',$_POST['body'],'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%'); + $doleditor=new DolEditor('body',$_POST['body'],'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%'); $doleditor->Create(); print '
'; @@ -1098,7 +1098,7 @@ else $readonly=1; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly); + $doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly); $doleditor->Create(); } else print dol_htmlentitiesbr($object->body); From 45263c85ecc3b3a0cf521ee04d8443fcc5c9bfed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2017 20:33:08 +0100 Subject: [PATCH 48/68] Fix in emailing --- htdocs/comm/mailing/class/mailing.class.php | 37 +++++++++++---------- htdocs/comm/mailing/list.php | 5 +-- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index dc39c2e9399..b0dff81332c 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -601,35 +601,38 @@ class Mailing extends CommonObject if ($mode == 2) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); - if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); - if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); + if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); + if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); + if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } if ($mode == 3) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); - if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); - if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); + if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); + if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); + if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } if ($mode == 4) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); - if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); - if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); + if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); + if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); + if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } if ($mode == 5) { - if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); - if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); - if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); + if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); + if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); + if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); + if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); + } + if ($mode == 6) + { + if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); + if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); + if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); + if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - - - - } } diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index b0801c817aa..2d6fae37b98 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -174,7 +174,7 @@ if ($result) { print ''; $nbemail = $obj->nbemail; - if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) + /*if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) { $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); print $form->textwithpicto($nbemail,$text,1,'warning'); @@ -182,7 +182,8 @@ if ($result) else { print $nbemail; - } + }*/ + print $nbemail; print ''; } // Last send From 5e4509953d79c8714bdb0a5df2ad97801456aecd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2017 21:25:29 +0100 Subject: [PATCH 49/68] Associated product must be on another export profile --- htdocs/core/modules/modProduct.class.php | 34 +++++++++++++++++++++--- htdocs/exports/export.php | 4 +++ htdocs/langs/en_US/products.lang | 2 +- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 330349b0842..6927c7c7fef 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -165,11 +165,11 @@ class modProduct extends DolibarrModules if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text')); if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text')); - $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product"); + $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_buy'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product"); if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array("group_concat(cat.label)"=>'category')); if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product')); if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product')); - if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product','pf.ref_fourn'=>'product','pf.unitprice'=>'product')); + if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'company','pf.ref_fourn'=>'product','pf.unitprice'=>'product')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation')); $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; @@ -211,7 +211,35 @@ class modProduct extends DolibarrModules $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')'; } - + if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) + { + $r++; + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]="AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_permission[$r]=array(array("produit","export")); + $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); + if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); + if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode')); + $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock')); + $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); + if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); + if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); + $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('pa.qty'=>'Numeric')); + $this->export_entities_array[$r]=array('p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct','p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"); + if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct')); + if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'virtualproduct')); + $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct')); + $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description")); + $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct")); + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,'; + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2'; + $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')'; + $this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils'; + } // Imports //-------- diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 604af215581..01e963585ec 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -61,6 +61,8 @@ $entitytoicon = array( 'other' => 'generic', 'account' => 'account', 'product' => 'product', + 'virtualproduct'=>'product', + 'subproduct' => 'product', 'warehouse' => 'stock', 'batch' => 'stock', 'category' => 'category', @@ -93,6 +95,8 @@ $entitytolang = array( 'account' => 'BankTransactions', 'payment' => 'Payment', 'product' => 'Product', + 'virtualproduct' => 'AssociatedProducts', + 'subproduct' => 'SubProduct', 'service' => 'Service', 'stock' => 'Stock', 'batch' => 'Batch', diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 89aa8ff296e..1bf032de891 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -256,4 +256,4 @@ VolumeUnits=Volume unit SizeUnits=Size unit DeleteProductBuyPrice=Delete buying price ConfirmDeleteProductBuyPrice=Are you sure you want to delete this buying price? - +SubProduct=Sub product From f16e65c6b11bbfe38ef0921689389a670c9c9810 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jan 2017 12:22:58 +0100 Subject: [PATCH 50/68] Fix css --- htdocs/projet/activity/perday.php | 2 +- htdocs/projet/activity/perweek.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index e694d6630a9..195ad3dbd89 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -427,7 +427,7 @@ print ''; print ''; print ''; print ''; -if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) print ''; +if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) print ''; print ''; print ''; print ''; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 584923636f0..9a34913b2f5 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -427,7 +427,7 @@ print ''; print ''; print ''; print ''; -if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) print ''; +if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) print ''; print ''; print ''; print ''; From c79137d14cae26a33711b0fc689c2172d547db00 Mon Sep 17 00:00:00 2001 From: arnaud Date: Mon, 30 Jan 2017 17:29:01 +0100 Subject: [PATCH 51/68] FIX Supplier Order list filter by project --- htdocs/fourn/commande/list.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index c8d333f578d..33b9c81fd0c 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -77,6 +77,7 @@ $search_total_vat=GETPOST('search_total_vat','alpha'); $search_total_ttc=GETPOST('search_total_ttc','alpha'); $optioncss = GETPOST('optioncss','alpha'); $billed = GETPOST('billed','int'); +$search_project_ref=GETPOST('search_project_ref','alpha'); $page = GETPOST('page','int'); $sortorder = GETPOST('sortorder','alpha'); @@ -204,6 +205,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $deliverymonth=''; $deliveryyear=''; $billed=''; + $search_project_ref=''; $search_array_options=array(); } @@ -350,6 +352,7 @@ if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.elemen if ($search_total_ht != '') $sql.= natural_search('cf.total_ht', $search_total_ht, 1); if ($search_total_vat != '') $sql.= natural_search('cf.tva', $search_total_vat, 1); if ($search_total_ttc != '') $sql.= natural_search('cf.total_ttc', $search_total_ttc, 1); +if ($search_project_ref != '') $sql.= natural_search("p.ref",$search_project_ref); // Add where from extra fields foreach ($search_array_options as $key => $val) From 90e8f062e93c6ef1cdc294272fa158183d82cd6f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 31 Jan 2017 10:23:03 +0100 Subject: [PATCH 52/68] Fix : link to user in bank was wrong regarding expensereport payment --- .../expensereport/class/paymentexpensereport.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 4c9c5843a49..9b05313a581 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -527,13 +527,14 @@ class PaymentExpenseReport extends CommonObject { if ($mode == 'payment_expensereport') { - $euser = new User($this->db); - $euser->fetch($key); + $er = new ExpenseReport($this->db); + $er->fetch($key); + $er->fetch_user($er->fk_user_author); $result=$acc->add_url_line( $bank_line_id, - $euser->id, + $er->user->id, DOL_URL_ROOT.'/user/card.php?id=', - $euser->getFullName($langs), + $er->user->getFullName($langs), 'user' ); if ($result <= 0) From 8e675fa039dc7da40da05d80fafb804d6aa793b7 Mon Sep 17 00:00:00 2001 From: fappels Date: Tue, 31 Jan 2017 12:54:00 +0100 Subject: [PATCH 53/68] Improve lot qty separation Add spaces to lot info separation. Use implode params according PHP doc. --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 082089b429f..3ef4cad4bef 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1308,7 +1308,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if ($detail->sellby) $dte[]=$outputlangs->transnoentitiesnoconv('printSellby',dol_print_date($detail->sellby, $format, false, $outputlangs)); if ($detail->batch) $dte[]=$outputlangs->transnoentitiesnoconv('printBatch',$detail->batch); $dte[]=$outputlangs->transnoentitiesnoconv('printQty',$detail->dluo_qty); - $libelleproduitservice.= "__N__ ".implode($dte,"-"); + $libelleproduitservice.= "__N__ ".implode(" - ", $dte); } } From aaa2e393c3c47719b3c0d6aad5945adb08b61185 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Jan 2017 16:17:10 +0100 Subject: [PATCH 54/68] Fix css --- htdocs/core/tpl/login.tpl.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index b3a2ced1023..3772b44c9fc 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -16,7 +16,8 @@ * along with this program. If not, see . */ -// Need global variable $title to be defined +// Need global variable $title to be defined by caller (like dol_loginfunction) + header('Cache-Control: Public, must-revalidate'); header("Content-type: text/html; charset=".$conf->file->character_set_client); @@ -78,7 +79,7 @@ $(document).ready(function () { '; print ''; print ''; @@ -843,12 +865,12 @@ elseif ($object->id > 0) // Opportunity percent print ''; // Opportunity Amount print ''; } @@ -865,7 +887,7 @@ elseif ($object->id > 0) // Budget print ''; // Other attributes @@ -915,27 +937,49 @@ elseif ($object->id > 0) print ''; // Change probability from status - if (! empty($conf->use_javascript_ajax)) + if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + $defaultcheckedwhenoppclose=1; + if (empty($conf->global->PROJECT_HIDE_TASKS)) $defaultcheckedwhenoppclose=0; + + print ''; print ''; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 460e698e432..b242f7d6b06 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -773,7 +773,7 @@ class Project extends CommonObject * Close a project * * @param User $user User that close project - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, 0 if already closed, >0 if OK */ function setClose($user) { @@ -828,6 +828,8 @@ class Project extends CommonObject return -1; } } + + return 0; } /** diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 374a87c72ef..3da099390ac 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1308,11 +1308,16 @@ else print '
'; print ''; - if ($backtopage) + if (! empty($backtopage)) { - print '   '; + print '     '; print ''; } + else + { + print '     '; + print ''; + } print '
'."\n"; print ''."\n"; @@ -1898,7 +1903,7 @@ else print '
'; print ''; - print '     '; + print '     '; print ''; print '
'; From fbbf8cd8a4227f94e8831aed0eabd02f73c96d0f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Feb 2017 15:47:08 +0100 Subject: [PATCH 58/68] Fix bad side effect of uniformizing a constant name. --- htdocs/contact/agenda.php | 2 +- htdocs/fourn/commande/info.php | 2 +- htdocs/projet/info.php | 2 +- htdocs/societe/agenda.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 3882d2ebca3..e97263ebf00 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -81,7 +81,7 @@ if (GETPOST('actioncode','array')) } else { - $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); + $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label=GETPOST('search_agenda_label'); diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index d858dc7172c..50b310a55e5 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -45,7 +45,7 @@ if (GETPOST('actioncode','array')) } else { - $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); + $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECTS)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECTS)); } $search_agenda_label=GETPOST('search_agenda_label'); diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index de27a363533..65a95e232ff 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -54,7 +54,7 @@ if (GETPOST('actioncode','array')) } else { - $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); + $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label=GETPOST('search_agenda_label'); diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 25eb78cfe24..644cda92bc4 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -41,7 +41,7 @@ if (GETPOST('actioncode','array')) } else { - $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); + $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label=GETPOST('search_agenda_label'); From 924a08a0785dd86502014b1864f28fc5bd1307c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Feb 2017 16:24:40 +0100 Subject: [PATCH 59/68] Fix code should use 5.0 framework --- htdocs/product/stock/massstockmove.php | 2 +- htdocs/product/stock/replenishorders.php | 90 ++++++++++++------------ 2 files changed, 45 insertions(+), 47 deletions(-) diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 944cc27dffb..03c0ebd78ba 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -342,7 +342,7 @@ print ''; print ''; -print '
'; +print '
'; print '
'; //print '
'; diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 785760ef511..4986d7c524d 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -39,6 +39,41 @@ $langs->load("orders"); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service'); +$sref = GETPOST('search_ref', 'alpha'); +$snom = GETPOST('search_nom', 'alpha'); +$suser = GETPOST('search_user', 'alpha'); +$sttc = GETPOST('search_ttc', 'alpha'); +$sall = GETPOST('search_all', 'alpha'); +$sdate = GETPOST('search_date', 'alpha'); +$page = GETPOST('page', 'int'); +$sproduct = GETPOST('sproduct', 'int'); + +$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=""; + $sdate=''; + $sproduct=0; +} + /* @@ -65,21 +100,6 @@ $head[1][2] = 'replenishorders'; dol_fiche_head($head, 'replenishorders', '', 0, ''); $commandestatic = new CommandeFournisseur($db); -$sref = GETPOST('search_ref', 'alpha'); -$snom = GETPOST('search_nom', 'alpha'); -$suser = GETPOST('search_user', 'alpha'); -$sttc = GETPOST('search_ttc', 'int'); -$sall = GETPOST('search_all', 'alpha'); -$sdate = GETPOST('search_date', 'alpha'); -$page = GETPOST('page', 'int'); -$sproduct = GETPOST('sproduct', 'int'); -$sortorder = GETPOST('sortorder', 'alpha'); -$sortfield = GETPOST('sortfield', 'alpha'); - -if (!$sortorder) $sortorder = 'DESC'; -if (!$sortfield) $sortfield = 'cf.date_creation'; - -$offset = $conf->liste_limit * $page ; $sql = 'SELECT s.rowid as socid, s.nom as name, cf.date_creation as dc,'; $sql.= ' cf.rowid, cf.ref, cf.fk_statut, cf.total_ttc, cf.fk_user_author,'; @@ -101,25 +121,10 @@ if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) { if (!$user->rights->societe->client->voir && !$socid) { $sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = ' . $user->id; } -if ($sref) { - //natural search - $scrit = explode(' ', $sref); - foreach ($scrit as $crit) { - $sql .= ' AND cf.ref LIKE "%' . $db->escape($crit) . '%"'; - } -} -if ($snom) { - $scrit = explode(' ', $snom); - foreach ($scrit as $crit) { - $sql .= ' AND s.nom LIKE "%' . $db->escape($crit) . '%"'; - } -} -if ($suser) { - $sql .= ' AND u.login LIKE "%' . $db->escape($suser) . '%"'; -} -if ($sttc) { - $sql .= ' AND cf.total_ttc = ' . price2num($sttc); -} +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 (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int')) @@ -132,21 +137,15 @@ if ($sdate) } $sql .= " AND cf.date_creation = '" . $db->idate($date) . "'"; } -if ($sall) { - $sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" '; - $sql .= 'OR cf.note LIKE "%' . $db->escape($sall) . '%")'; -} -if (!empty($socid)) { - $sql .= ' AND s.rowid = ' . $socid; -} - +if ($sall) $sql .= natural_search(array('cf.ref','cf.note'), $sall); +if (!empty($socid)) $sql .= ' AND s.rowid = ' . $socid; if (GETPOST('statut', 'int')) { $sql .= ' AND fk_statut = ' . GETPOST('statut', 'int'); } $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($conf->liste_limit+1, $offset); +$sql .= $db->plimit($limit+1, $offset); //print $sql; $resql = $db->query($sql); @@ -242,9 +241,8 @@ if ($resql) $form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). ''. '
'. ''; From 8b2d0064a37bfca8872bb74d62a5ad6a3fdfe942 Mon Sep 17 00:00:00 2001 From: fappels Date: Wed, 1 Feb 2017 16:51:42 +0100 Subject: [PATCH 60/68] Update changelog for developer --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 9b561820629..4abc3d9b932 100644 --- a/ChangeLog +++ b/ChangeLog @@ -150,6 +150,7 @@ Dolibarr better: - A new paramater sqlfilters was introduced to allow filter on any fields int the REST API. Few old parameters, no more required, were also removed. Use this new one if you were using one of them. - The trigger that activate or close a contract line is run on a contract line, not on contract. +- Method commande->set_availability(user, availability_id) removed from commande class. Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful on PHP 7.1 but we don't have enough feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0. From 52b92995ccf9f29f3b503317f8b8d96df7dd3cfd Mon Sep 17 00:00:00 2001 From: fappels Date: Wed, 1 Feb 2017 19:49:52 +0100 Subject: [PATCH 61/68] use method commande->availability --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4abc3d9b932..d8387c6a0e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -150,7 +150,7 @@ Dolibarr better: - A new paramater sqlfilters was introduced to allow filter on any fields int the REST API. Few old parameters, no more required, were also removed. Use this new one if you were using one of them. - The trigger that activate or close a contract line is run on a contract line, not on contract. -- Method commande->set_availability(user, availability_id) removed from commande class. +- Method commande->set_availability(user, availability_id) removed from commande class, use method commande->availability(availability_id, notrigger). Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful on PHP 7.1 but we don't have enough feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0. From 9b37b52f45c3e4c4ef776c282d0e4685d60155bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Feb 2017 20:55:30 +0100 Subject: [PATCH 62/68] Fix css --- htdocs/public/demo/index.php | 16 ++++++---------- htdocs/theme/eldy/style.css.php | 8 ++++++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index e50193d8d51..4c7c8cbebc8 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -228,8 +228,8 @@ if (GETPOST("action") == 'gotodemo') */ $head=''; -$head.=''."\n"; -$head.=''."\n"; +$head.=''."\n"; +$head.=''."\n"; $head.='
'; - $src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png'; - $value = dol_escape_htmltag($langs->trans('Search')); - print ''. + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; '