From ae7f49b5d81d0cd44528738e9ef129bcc600ea59 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 21 Dec 2016 18:40:05 +0100 Subject: [PATCH 01/24] FIX: Deposits and credit notes weren't added in the received and pending columns --- htdocs/compta/facture/list.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index d9e5ae8ce23..8d0cc61d5d6 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1216,6 +1216,12 @@ if ($resql) $facturestatic->type=$obj->type; $facturestatic->statut=$obj->fk_statut; $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); + + $paiement = $facturestatic->getSommePaiement(); + $totalcreditnotes = $facturestatic->getSumCreditNotesUsed(); + $totaldeposits = $facturestatic->getSumDepositsUsed(); + $totalpay = $paiement + $totalcreditnotes + $totaldeposits; + $remaintopay = $obj->total_ttc - $totalpay; print ''; if (! empty($arrayfields['f.facnumber']['checked'])) @@ -1223,9 +1229,7 @@ if ($resql) print ''; $notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1); - $paiement = $facturestatic->getSommePaiement(); - $remaintopay = $obj->total_ttc - $paiement; - + print ''; print ''; // TODO Use a denormalized field + print ''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalamfield']=$totalarray['nbfield']; - $totalarray['totalam'] += $paiement; + $totalarray['totalam'] += $totalpay; } if (! empty($arrayfields['rtp']['checked'])) From d53a238b49fd0425a8fae52f310f0602a567b61e Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 22 Dec 2016 06:12:42 +0100 Subject: [PATCH 02/24] Fix: Accountancy - Problem on quadratus export --- htdocs/accountancy/class/accountancyexport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 268b5fa69c2..524326e320c 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -357,7 +357,7 @@ class AccountancyExport $Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 20), 20); $Tab['sens'] = $data->sens; // C or D $Tab['signe_montant'] = '+'; - $Tab['montant'] = str_pad(abs($data->montant) * 100, 12, '0', STR_PAD_LEFT); // TODO manage negative amount + $Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount $Tab['contrepartie'] = str_repeat(' ', 8); if (! empty($data->date_echeance)) $Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE); From b777ec79f29d9b854862c0ff045d19e29b98ef8e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 10:38:27 +0100 Subject: [PATCH 03/24] Fix contextpage implementation into skeleton --- dev/skeletons/skeleton_list.php | 6 +++++- htdocs/comm/action/class/api_agendaevents.class.php | 2 +- htdocs/commande/list.php | 3 ++- htdocs/core/menus/standard/eldy.lib.php | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index d937b34536f..0ca4d6f8589 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -89,8 +89,11 @@ if ($user->societe_id > 0) //accessforbidden(); } +// Initialize technical object to manage context to save list fields +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'mymodulelist'; + // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager->initHooks(array('skeletonlist')); +$hookmanager->initHooks(array('mymodulelist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels @@ -305,6 +308,7 @@ print ''; print ''; print ''; +print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index b14d48c174e..5eeca63a4aa 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -94,7 +94,7 @@ class AgendaEvents extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $user_ids User ids filter field (owners of event). Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'%dol%') and (t.date_creation:<:'20160101')" * @return array Array of Agenda Events objects */ function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 0, $page = 0, $user_ids = 0, $sqlfilters = '') { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 0262187b342..9ca79421f20 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -99,7 +99,7 @@ if (! $sortfield) $sortfield='c.ref'; if (! $sortorder) $sortorder='DESC'; // Initialize technical object to manage context to save list fields -$contextpage='orderlist'; +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'orderlist'; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array($contextpage)); @@ -653,6 +653,7 @@ if ($resql) print ''; print ''; print ''; + print ''; print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b95e0c5bd25..a88e180b16a 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -844,7 +844,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->commande->enabled)) { $langs->load("orders"); - if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=-3&billed=0", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); + if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); // if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); } From 43942e6ea26216b0b1accc380e622c4b2a42c903 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 13:04:46 +0100 Subject: [PATCH 04/24] Fix css and fix navigation on resource tab. --- htdocs/core/class/html.form.class.php | 24 +++++----- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/lib/functions2.lib.php | 11 +++-- htdocs/core/tpl/extrafields_view.tpl.php | 9 +++- htdocs/core/tpl/resource_view.tpl.php | 22 ++++----- htdocs/fichinter/card.php | 10 ++-- htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/fichinter/contact.php | 8 +++- htdocs/fichinter/list.php | 2 +- htdocs/resource/element_resource.php | 41 ++++++----------- htdocs/theme/eldy/style.css.php | 53 +++++++++------------- htdocs/theme/md/style.css.php | 14 ++++-- 12 files changed, 100 insertions(+), 98 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8abe3f271f7..ad968de506a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5633,18 +5633,18 @@ class Form * Return a HTML area with the reference of object and a navigation bar for a business object * To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria. * - * @param object $object Object to show - * @param string $paramid Name of parameter to use to name the id into the URL next/previous link - * @param string $morehtml More html content to output just before the nav bar - * @param int $shownav Show Condition (navigation is shown if value is 1) - * @param string $fieldid Name of field id into database to use for select next and previous (we make the select max and min on this field) + * @param object $object Object to show. + * @param string $paramid Name of parameter to use to name the id into the URL next/previous link. + * @param string $morehtml More html content to output just before the nav bar. + * @param int $shownav Show Condition (navigation is shown if value is 1). + * @param string $fieldid Name of field id into database to use for select next and previous (we make the select max and min on this field). * @param string $fieldref Name of field ref of object (object->ref) to show or 'none' to not show ref. - * @param string $morehtmlref More html to show after ref - * @param string $moreparam More param to add in nav link url. - * @param int $nodbprefix Do not include DB prefix to forge table name - * @param string $morehtmlleft More html code to show before ref - * @param string $morehtmlstatus More html code to show under navigation arrows (status place) - * @param string $morehtmlright More html code to show after ref + * @param string $morehtmlref More html to show after ref. + * @param string $moreparam More param to add in nav link url. Must start with '&...'. + * @param int $nodbprefix Do not include DB prefix to forge table name. + * @param string $morehtmlleft More html code to show before ref. + * @param string $morehtmlstatus More html code to show under navigation arrows (status place). + * @param string $morehtmlright More html code to show after ref. * @return string Portion HTML with ref + navigation buttons */ function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='') @@ -5657,7 +5657,7 @@ class Form //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix); - + //$previous_ref = $object->ref_previous?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):' ').'':''; //$next_ref = $object->ref_next?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):' ').'':''; $previous_ref = $object->ref_previous?''.(($conf->dol_use_jmobile != 4)?'<':' ').'':''.(($conf->dol_use_jmobile != 4)?'<':' ').''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 98dc7f14fd4..bb268ffa2d0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1103,7 +1103,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $morehtmlref.=''; } - print '
'; + print '
'; print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright); print '
'; print '
'; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index a07c506d758..a09b962ee26 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2007,13 +2007,14 @@ function getElementProperties($element_type) /** * Fetch an object from its id and element_type - * Inclusion classes is automatic + * Inclusion of classes is automatic * * @param int $element_id Element id * @param string $element_type Element type + * @param ref $element_ref Element ref (Use this if element_id but not both) * @return int|object object || 0 || -1 if error */ -function fetchObjectByElement($element_id, $element_type) +function fetchObjectByElement($element_id, $element_type, $element_ref='') { global $conf; global $db,$conf; @@ -2023,11 +2024,11 @@ function fetchObjectByElement($element_id, $element_type) { dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php'); - $objectstat = new $element_prop['classname']($db); - $ret = $objectstat->fetch($element_id); + $objecttmp = new $element_prop['classname']($db); + $ret = $objecttmp->fetch($element_id, $element_ref); if ($ret >= 0) { - return $objectstat; + return $objecttmp; } } return 0; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 4cfc4a20afb..fcb92f1b525 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -22,6 +22,9 @@ * * $cols */ +?> + +fetch_optionals($object->id, $extralabels); $parameters = array('colspan' => ' colspan="'.$cols.'"', 'cols' => $cols, 'socid' => $object->fk_soc); @@ -47,7 +50,9 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) { if (!empty($extrafields->attribute_hidden[$key])) print '
'; @@ -1372,10 +1376,10 @@ if ($resql) if (! empty($arrayfields['dynamount_payed']['checked'])) { - print ''.(! empty($paiement)?price($paiement,0,$langs):' ').''.(! empty($totalpay)?price($totalpay,0,$langs):' ').'
'; else print '
'; - print ''; + print ''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; print '>' . $langs->trans($label) . ''; @@ -100,3 +105,5 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) } } } +?> + \ No newline at end of file diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index 6f88d8bb5f8..ecc9f32d837 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -10,21 +10,21 @@ print '
'; if($mode == 'edit' ) { print '
'; - print '
'.$langs->trans('Resource').'
'; - print '
'.$langs->trans('Type').'
'; - print '
'.$langs->trans('Busy').'
'; - print '
'.$langs->trans('Mandatory').'
'; - print '
'; + print '
'.$langs->trans('Resource').'
'; + print '
'.$langs->trans('Type').'
'; + print '
'.$langs->trans('Busy').'
'; + print '
'.$langs->trans('Mandatory').'
'; + print '
'; print ''; } else { print '
'; - print '
'.$langs->trans('Resource').'
'; - print '
'.$langs->trans('Type').'
'; - print '
'.$langs->trans('Busy').'
'; - print '
'.$langs->trans('Mandatory').'
'; - print '
'; + print '
'.$langs->trans('Resource').'
'; + print '
'.$langs->trans('Type').'
'; + print '
'.$langs->trans('Busy').'
'; + print '
'.$langs->trans('Mandatory').'
'; + print '
'; print ''; } @@ -66,7 +66,7 @@ if( (array) $linked_resources && count($linked_resources) > 0) print '
'; print $object_resource->getNomUrl(1); - print '
'; + print '
'; print '
'; print $object_resource->type_label; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index fb37a235b37..9b0bb737128 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1395,10 +1395,12 @@ else if ($id > 0 || ! empty($ref)) print '
'; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; } $var=true; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index a320c4ff7c7..2942a8903ab 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -383,7 +383,7 @@ class Fichinter extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } } diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index ca1813ce3e2..83825b08a90 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -45,7 +45,11 @@ $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $object = new Fichinter($db); $result = $object->fetch($id,$ref); - +if (! $result) +{ + print 'Record not found'; + exit; +} /* * Adding a new contact @@ -166,7 +170,7 @@ if ($id > 0 || ! empty($ref)) } $morehtmlref.=''; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, 0, 0, '', '', 1); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_fiche_end(); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index e350250a638..5126768c083 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -253,7 +253,7 @@ if ($result) print '
'.$langs->trans('Description').''.$langs->trans('Date').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?$langs->trans('Duration'):'').' '.$langs->trans('Description').''.$langs->trans('Date').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?$langs->trans('Duration'):'').'   
'; print ''; - if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'width="15%"',$sortfield,$sortorder); + if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre('',$_SERVER["PHP_SELF"],''); diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 87354c6fd9d..14475c58203 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -51,13 +51,13 @@ $hookmanager->initHooks(array('element_resource')); $object->available_resources = array('dolresource'); // Get parameters -$id = GETPOST('id','int'); -$ref = GETPOST('ref','alpha'); +$id = GETPOST('id','int'); // resource id +$element_id = GETPOST('element_id','int'); // element_id +$element_ref = GETPOST('ref','alpha'); // element ref +$element = GETPOST('element','alpha'); // element_type $action = GETPOST('action','alpha'); $mode = GETPOST('mode','alpha'); $lineid = GETPOST('lineid','int'); -$element = GETPOST('element','alpha'); // element_type -$element_id = GETPOST('element_id','int'); $resource_id = GETPOST('fk_resource','int'); $resource_type = GETPOST('resource_type','alpha'); $busy = GETPOST('busy','int'); @@ -66,7 +66,7 @@ $cancel = GETPOST('cancel','alpha'); $confirm = GETPOST('confirm','alpha'); $socid = GETPOST('socid','int'); -if ($socid > 0) +if ($socid > 0) // Special for thirdparty { $element_id = $socid; $element = 'societe'; @@ -183,11 +183,11 @@ else // Specific to agenda module - if ($element_id && $element == 'action') + if (($element_id || $element_ref) && $element == 'action') { require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; - $act = fetchObjectByElement($element_id,$element); + $act = fetchObjectByElement($element_id,$element, $element_ref); if (is_object($act)) { @@ -212,16 +212,10 @@ else $linkback.=$out; - dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '', "&element=".$element); + dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '', '&element='.$element, 0, '', ''); print '
'; - // Ref - /*print '';*/ - - // Affichage fiche action en mode visu print '
'.$langs->trans("Ref").''; - print $form->showrefnav($act, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); - print '
'; // Type @@ -248,11 +242,6 @@ else if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); print ''; - // Status - /*print '';*/ - // Location if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { @@ -301,9 +290,9 @@ else } // Specific to thirdparty module - if ($element_id && $element == 'societe') + if (($element_id || $element_ref) && $element == 'societe') { - $socstatic = fetchObjectByElement($element_id, $element); + $socstatic = fetchObjectByElement($element_id, $element, $element_ref); if (is_object($socstatic)) { $savobject = $object; @@ -314,7 +303,7 @@ else dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"), 0, 'company'); - dol_banner_tab($socstatic, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); + dol_banner_tab($socstatic, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '&element='.$element); print '
'; @@ -337,12 +326,12 @@ else } // Specific to fichinter module - if ($element_id && $element == 'fichinter') + if (($element_id || $element_ref) && $element == 'fichinter') { require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; $fichinter = new Fichinter($db); - $fichinter->fetch($element_id); + $fichinter->fetch($element_id, $element_ref); $fichinter->fetch_thirdparty(); if (is_object($fichinter)) @@ -395,7 +384,7 @@ else } $morehtmlref.='
'; - dol_banner_tab($fichinter, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($fichinter, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '&element='.$element, 0, '', '', 1); dol_fiche_end(); } @@ -403,7 +392,7 @@ else // hook for other elements linked - $parameters=array('element'=>$element, 'element_id'=>$element_id ); + $parameters=array('element'=>$element, 'element_id'=>$element_id, 'element_ref'=>$element_ref); $reshook=$hookmanager->executeHooks('printElementTab',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c5d9dd13189..ec4ccdd2b38 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -967,12 +967,13 @@ div.attacharea { } div.arearef { - /*border-bottom: 1px solid #bbb;*/ padding-top: 2px; - padding-bottom: 5px; - /*padding-right: 3px; - padding-left: 2px;*/ margin-bottom: 10px; + padding-bottom: 7px; +} +div.arearefnobottom { + padding-top: 2px; + padding-bottom: 4px; } div.heightref { min-height: 80px; @@ -1961,15 +1962,8 @@ div.tabBar { color: #; padding-top: 16px; padding-left: 0px; padding-right: 0px; - /*padding-left: 18px; - padding-right: 18px;*/ padding-bottom: 14px; margin: 0px 0px 14px 0px; - /*-moz-border-radius:4px; - -webkit-border-radius: 4px; - border-radius: 4px; - border-right: 1px solid #AAA; - border-left: 1px solid #AAA; */ border-top: 1px solid #BBB; border-bottom: 1px solid #AAA; width: auto; @@ -2456,11 +2450,16 @@ table.liste tr, table.noborder tr, div.noborder form { table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.noborder tr.box_titre td { padding: 8px 2px 8px 3px; /* t r b l */ } -tr.box_titre .nobordernopadding td { padding: 0px ! important; } -table.liste td, table.noborder td, div.noborder form, div.noborder form div { - padding: 5px 2px 5px 3px; /* t r b l */ +table.liste td, table.noborder td, div.noborder form div { + padding: 8px 2px 8px 3px; /* t r b l */ +} +div.liste_titre_bydiv .divsearchfield { + padding: 2px 1px 2px 0px; /* t r b l */ } +tr.box_titre .nobordernopadding td { + padding: 0px ! important; +} table.nobordernopadding { border-collapse: collapse !important; border: 0px; @@ -2725,7 +2724,7 @@ 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; } -tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td { +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; } tr.even td .nobordernopadding tr td, tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td, tr.odd td .nobordernopadding tr td { @@ -2737,26 +2736,18 @@ td.nobottom, td.nobottom { div.liste_titre .tagtd { vertical-align: middle; } -div.liste_titre { +/*div.liste_titre { box-shadow: 2px 2px 4px #CCC; -} +}*/ div.liste_titre { min-height: 26px !important; /* We cant use height because it's a div and it should be higher if content is more. but min-height does not work either for div */ padding-top: 2px; padding-bottom: 2px; - /*border-right-width: 1px; - border-right-color: #BBB; - border-right-style: solid; - - border-left-width: 1px; - border-left-color: #BBB; - border-left-style: solid;*/ - - border-top-width: 1px; +/* border-top-width: 1px; border-top-color: #BBB; - border-top-style: solid; + border-top-style: solid;*/ } div.liste_titre_bydiv { border-top-width: px; @@ -2773,7 +2764,7 @@ tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, tabl { height: 26px !important; } -div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr +div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr { background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); @@ -2791,11 +2782,11 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list border-bottom: 1px solid #FDFFFF; text-align: ; } -tr.liste_titre th, tr.liste_titre td, th.liste_titre, form.liste_titre div, div.liste_titre +tr.liste_titre th, tr.liste_titre td, th.liste_titre { border-bottom: 1px solid #; } -tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div, div.liste_titre +tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div { font-family: ; font-weight: ; @@ -2819,7 +2810,7 @@ tr.liste_titre_topborder td { .liste_titre td a.notasortlink:hover { background: transparent; } -tr.liste_titre td.liste_titre { /* For last line of table headers only */ +tr.liste_titre td.liste_titre, form.liste_titre div.tagtd { /* For last line of table headers only */ border-bottom: 1px solid rgb(); } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index fd22ef5520d..17eec130377 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1016,13 +1016,14 @@ div.attacharea { padding-bottom: 10px; } div.arearef { - /*border-bottom: 1px solid #bbb;*/ padding-top: 2px; padding-bottom: 5px; - /*padding-right: 3px; - padding-left: 2px;*/ margin-bottom: 10px; } +div.arearefnobottom { + padding-top: 2px; + padding-bottom: 4px; +} div.heightref { min-height: 80px; } @@ -2379,6 +2380,13 @@ table.noborder td, div.noborder form, div.noborder form div { padding: 4px 2px 4px 3px; /* t r b l */ } +table.liste td, table.noborder td, div.noborder form div { + padding: 8px 2px 8px 3px; /* t r b l */ +} +div.liste_titre_bydiv .divsearchfield { + padding: 2px 1px 2px 0px; /* t r b l */ +} + table.nobordernopadding { border-collapse: collapse !important; border: 0px; From a2133f391fe6da43a1cec40586cf0d9e9045dcc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 14:52:25 +0100 Subject: [PATCH 05/24] Complete work on dol_banner --- htdocs/comm/propal/note.php | 2 +- htdocs/core/class/conf.class.php | 1 + htdocs/core/lib/agenda.lib.php | 4 +- htdocs/fichinter/list.php | 3 +- htdocs/supplier_proposal/card.php | 11 --- htdocs/supplier_proposal/document.php | 72 ++++++++++++++++---- htdocs/supplier_proposal/info.php | 58 +++++++++++++++- htdocs/supplier_proposal/note.php | 97 +++++++++++++++++---------- htdocs/theme/eldy/style.css.php | 1 + htdocs/theme/md/style.css.php | 1 + 10 files changed, 183 insertions(+), 67 deletions(-) diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index d161fe03870..57181b83f6b 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -132,9 +132,9 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - print '
'; print ''; dol_fiche_end(); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index c451b2e32fd..81de34e012f 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -282,6 +282,7 @@ class Conf // Define default dir_output and dir_temp for directories of modules foreach($this->modules as $module) { + //var_dump($module); // For multicompany sharings $this->$module->multidir_output = array($this->entity => $rootfordata."/".$module); $this->$module->multidir_temp = array($this->entity => $rootfordata."/".$module."/temp"); diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index ad592359936..09f89ba0c3f 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -239,7 +239,7 @@ function show_array_actions_to_do($max=5) print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; - print $act->getLibStatut(4); - print '
'; print ''; - print ''; $var = true; @@ -336,7 +336,7 @@ function show_array_last_actions_done($max=5) print '
'.$langs->trans("LastActionsToDo",$max).''.$langs->trans("FullList").''; + print ''.$langs->trans("FullList").''; print '
'; print ''; - print ''; $var = true; $i = 0; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 5126768c083..9d01643825a 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -407,10 +407,11 @@ if ($result) print $warnornote; print ''; } + // Other picto tool print '
'.$langs->trans("LastDoneTasks",$max).''.$langs->trans("FullList").''; + print ''.$langs->trans("FullList").''; print '
'; $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->fichinter->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $filedir=$conf->ficheinter->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print '
'; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 443e402674f..d91823dfcf4 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1408,17 +1408,6 @@ if ($action == 'create') print ''; - // Ref - /* - print ''; - - // Company - print ''; - print ''; - */ - // Payment term print ''; - print ''; + print ''; print ''; } else // Credit note From 6e00d7fee32d13b96a866d07d571000748588e23 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Dec 2016 01:41:04 +0100 Subject: [PATCH 24/24] Fix date modification not visible --- htdocs/compta/sociales/class/chargesociales.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 1fdd567745f..61546b39061 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -510,7 +510,7 @@ class ChargeSociales extends CommonObject function info($id) { $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,"; - $sql.= " fk_user_author, fk_user_modif, fk_user_valid"; + $sql.= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid"; $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e"; $sql.= " WHERE e.rowid = ".$id; @@ -543,7 +543,7 @@ class ChargeSociales extends CommonObject } $this->date_creation = $this->db->jdate($obj->datec); - if (! empty($obj->fk_user_modif)) $this->date_modification = $this->db->jdate($obj->datem); + $this->date_modification = $this->db->jdate($obj->datem); $this->date_validation = $this->db->jdate($obj->datev); $this->import_key = $obj->import_key; }
' . $langs->trans('Ref') . ''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
' . $langs->trans('Supplier') . '' . $soc->getNomUrl(1) . '
'; print ''; + $filterfound=0; foreach ($fieldlist as $field => $value) { $showfield=1; // By defaut @@ -1284,21 +1285,25 @@ if ($id) { if ($value == 'country') { - print ''; + $filterfound++; } else { - print ''; + print ''; } } } if ($id == 4) print ''; - print ''; + print ''; print ''; print ''; @@ -1314,19 +1319,17 @@ if ($id) print ''; if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) { - print ''; - print ''; - print ''; - print ''; - $tmpaction='edit'; $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; + // Show fields if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); print ''; diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 9545332d93b..faf6f28c955 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -251,11 +251,16 @@ $dolibarr_main_restrict_os_commands='mysqldump, mysql, pg_dump, pgrestore'; $dolibarr_nocsrfcheck='0'; // dolibarr_mailing_limit_sendbyweb -// Can set a limit for mailing send by web. Can be used for a restricted mode. -// Default value: 0 (use database value if exist) -// Examples: -// $dolibarr_mailing_limit_sendbyweb='0'; +// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level. +// Default value: '25' +// Examples: '-1' (sending by web is forbidden) +// $dolibarr_mailing_limit_sendbyweb='25'; +// dolibarr_mailing_limit_sendbycli +// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level. +// Default value: '0' (no hard limit, use soft database value if exists) +// Examples: '-1' (sending by cli is forbidden) +// $dolibarr_mailing_limit_sendbycli='0'; //################## @@ -274,18 +279,6 @@ $dolibarr_nocsrfcheck='0'; // Examples: // $dolibarr_main_limit_users='0'; -// dolibarr_mailing_limit_sendbyweb -// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level. -// Default value: '0' (no overwrite, use database value if exists) -// Examples: '-1' (sending by web is forbidden) -// $dolibarr_mailing_limit_sendbyweb='0'; - -// dolibarr_mailing_limit_sendbycli -// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level. -// Default value: '0' (no overwrite, use database value if exists) -// Examples: '-1' (sending by cli is forbidden) -// $dolibarr_mailing_limit_sendbycli='0'; - // dolibarr_strict_mode // Set this to 1 to enable the PHP strict mode. For dev environment only. // Default value: 0 (use database value if exist) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index e74ba8fc03b..52cce35f0d2 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -483,28 +483,35 @@ class CMailFile // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10; - $tmparray = explode(',', $this->addr_to); - if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + $tmparray1 = explode(',', $this->addr_to); + if (count($tmparray1) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL) { $this->error = 'Too much recipients in to:'; dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); return false; } - $tmparray = explode(',', $this->addr_cc); - if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + $tmparray2 = explode(',', $this->addr_cc); + if (count($tmparray2) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL) { $this->error = 'Too much recipients in cc:'; dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); return false; } - $tmparray = explode(',', $this->addr_bcc); - if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + $tmparray3 = explode(',', $this->addr_bcc); + if (count($tmparray3) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL) { $this->error = 'Too much recipients in bcc:'; dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); return false; } - + if ((count($tmparray1)+count($tmparray2)+count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in to:, cc:, bcc:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + + // Action according to choosed sending method if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') { diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index ccbc8aa9b92..eddcf1ebbdf 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.3'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.4'); if (! defined('EURO')) define('EURO',chr(128)); From 635157be4c3075fd8cdf902a4ac2fca3178ed34d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Dec 2016 12:36:30 +0100 Subject: [PATCH 16/24] Fix bad translation --- htdocs/langs/eu_ES/mails.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/eu_ES/mails.lang b/htdocs/langs/eu_ES/mails.lang index d6224bf2346..c9116999a8f 100644 --- a/htdocs/langs/eu_ES/mails.lang +++ b/htdocs/langs/eu_ES/mails.lang @@ -27,7 +27,7 @@ DeleteAMailing=Delete an emailing PreviewMailing=Preview emailing CreateMailing=Create emailing TestMailing=Test email -ValidMailing=Valid emailing +ValidMailing=Validate emailing MailingStatusDraft=Draft MailingStatusValidated=Validated MailingStatusSent=Sent From b9e362833f7395e50173f5dd8f434f1a25bb8f93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Dec 2016 13:15:14 +0100 Subject: [PATCH 17/24] More complete label --- htdocs/install/mysql/data/llx_c_typent.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_typent.sql b/htdocs/install/mysql/data/llx_c_typent.sql index 11b512f26c2..4365a2e99a6 100644 --- a/htdocs/install/mysql/data/llx_c_typent.sql +++ b/htdocs/install/mysql/data/llx_c_typent.sql @@ -43,6 +43,6 @@ insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 7, 'TE_RE insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 8, 'TE_PRIVATE', 'Particulier', NULL, 1); insert into llx_c_typent (id,code,libelle,fk_country,active) values (100, 'TE_OTHER', 'Autres', NULL, 1); -- Argentina (country 23) -insert into llx_c_typent (id,code,libelle,fk_country,active) values (231, 'TE_A_RI', 'Responsable Inscripto', 23, 0); -insert into llx_c_typent (id,code,libelle,fk_country,active) values (232, 'TE_B_RNI', 'Responsable No Inscripto', 23, 0); -insert into llx_c_typent (id,code,libelle,fk_country,active) values (233, 'TE_C_FE', 'Consumidor Final/Exento', 23, 0); +insert into llx_c_typent (id,code,libelle,fk_country,active) values (231, 'TE_A_RI', 'Responsable Inscripto (typo A)', 23, 0); +insert into llx_c_typent (id,code,libelle,fk_country,active) values (232, 'TE_B_RNI', 'Responsable No Inscripto (typo B)', 23, 0); +insert into llx_c_typent (id,code,libelle,fk_country,active) values (233, 'TE_C_FE', 'Consumidor Final/Exento (typo C)', 23, 0); From 82052450a6c6a91583263760a646542bf228057f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Dec 2016 18:21:18 +0100 Subject: [PATCH 18/24] Complete work on dol_banner --- htdocs/comm/action/card.php | 7 +- htdocs/core/lib/company.lib.php | 20 ++- htdocs/core/lib/fourn.lib.php | 10 +- htdocs/fourn/commande/contact.php | 2 +- htdocs/fourn/commande/dispatch.php | 4 +- htdocs/fourn/commande/info.php | 250 +++++++++++++++++++---------- htdocs/projet/info.php | 15 +- 7 files changed, 206 insertions(+), 102 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 4b6380b1240..b4a9f8b5395 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -278,7 +278,7 @@ if ($action == 'add') if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby","int"); } - $object->note = trim($_POST["note"]); + $object->note = trim(GETPOST("note")); if (isset($_POST["contactid"])) $object->contact = $contact; @@ -290,11 +290,6 @@ if ($action == 'add') $object->societe = $object->thirdparty; // For backward compatibility } - // Special for module webcal and phenix - // TODO external modules - if (! empty($conf->webcalendar->enabled) && GETPOST('add_webcal') == 'on') $object->use_webcal=1; - if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1; - // Check parameters if (empty($object->userownerid) && empty($_SESSION['assignedtouser'])) { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index ff6459413a4..ccec6af47d0 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -993,16 +993,26 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $sql.= " u.login, u.rowid as user_id"; if (get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname"; if (get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname"; + if (get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id"; if (get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; if (get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m"; + if (get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o"; $sql.= " WHERE u.rowid = a.fk_user_author"; $sql.= " AND a.entity IN (".getEntity('agenda', 1).")"; if (get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; if (get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; - if (get_class($filterobj) == 'Adherent') $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; - if (get_class($filterobj) == 'Adherent' && $filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + if (get_class($filterobj) == 'Adherent') + { + $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } + if (get_class($filterobj) == 'CommandeFournisseur') + { + $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id; // Condition on actioncode if (! empty($actioncode)) @@ -1133,6 +1143,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; @@ -1142,9 +1153,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $userstatic=new User($db); $contactstatic = new Contact($db); - // TODO uniformize + // TODO mutualize/uniformize $propalstatic=new Propal($db); $orderstatic=new Commande($db); + $supplierorderstatic=new CommandeFournisseur($db); $facturestatic=new Facture($db); $out.=''; @@ -1286,7 +1298,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= //$out.=''; // Objet lie - // TODO uniformize + // TODO mutualize/uniformize $out.=''; print ''."\n"; $var = true; - $tmpfilelist = dol_sort_array($file_list['updated'], 'filename'); - if (is_array($tmpfilelist) && count($tmpfilelist)) + $tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename'); + if (is_array($tmpfilelist2) && count($tmpfilelist2)) { - foreach ($tmpfilelist as $file) + foreach ($tmpfilelist2 as $file) { $var = !$var; print ''; @@ -208,6 +208,15 @@ if ($xml) print ''; } print '
'; diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index d8c51a45152..2f49951c844 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -93,26 +93,70 @@ if ($object->id > 0) $totalsize+=$file['size']; } + + // Supplier proposal card + $linkback = '' . $langs->trans("BackToList") . ''; + + + $morehtmlref='
'; + // Ref supplier + //$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); + //$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print ''; - $linkback=''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Supplier - print ""; - print ''; - - print ''; - print ''; + print ''; + print ''; print '
'.$langs->trans('Ref').''; - print $form->showrefnav($object,'ref',$linkback,1,'ref','ref',''); - print '
".$langs->trans("Supplier")."'.$object->thirdparty->getNomUrl(1).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; print '
'; - + + dol_fiche_end(); + $modulepart = 'supplier_proposal'; $permission = $user->rights->supplier_proposal->creer; $permtoedit = $user->rights->supplier_proposal->creer; diff --git a/htdocs/supplier_proposal/info.php b/htdocs/supplier_proposal/info.php index 9c3f8967bd5..de98ed5be65 100644 --- a/htdocs/supplier_proposal/info.php +++ b/htdocs/supplier_proposal/info.php @@ -49,10 +49,65 @@ $object = new SupplierProposal($db); $object->fetch($id); $object->fetch_thirdparty(); +$object->info($object->id); + + $head = supplier_proposal_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans('CommRequest'), 0, 'supplier_proposal'); -$object->info($object->id); +// Supplier proposal card +$linkback = '' . $langs->trans("BackToList") . ''; + + +$morehtmlref='
'; +// Ref supplier +//$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); +//$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); +// Thirdparty +$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); +// Project +if (! empty($conf->projet->enabled)) +{ + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } +} +$morehtmlref.='
'; + + +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + +print '
'; +print '
'; + +print '
'; print '
'; dol_print_object_info($object); @@ -60,6 +115,7 @@ print '
'; print '
'; +dol_fiche_end(); llxFooter(); $db->close(); diff --git a/htdocs/supplier_proposal/note.php b/htdocs/supplier_proposal/note.php index 981b654599d..b764372848d 100644 --- a/htdocs/supplier_proposal/note.php +++ b/htdocs/supplier_proposal/note.php @@ -45,19 +45,18 @@ $object = new SupplierProposal($db); -/******************************************************************************/ -/* Actions */ -/******************************************************************************/ +/* + * Actions + */ $permissionnote=$user->rights->supplier_proposal->creer; // Used by the include of actions_setnotes.inc.php include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once - -/******************************************************************************/ -/* Affichage fiche */ -/******************************************************************************/ +/* + * View + */ llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur'); @@ -71,47 +70,71 @@ if ($id > 0 || ! empty($ref)) if ($object->fetch($id, $ref)) { + $object->fetch_thirdparty(); + $societe = new Societe($db); if ( $societe->fetch($object->socid) ) { $head = supplier_proposal_prepare_head($object); dol_fiche_head($head, 'note', $langs->trans('CommRequest'), 0, 'supplier_proposal'); - print ''; - $linkback = ''.$langs->trans('BackToList').''; - - // Ref - print ''; + // Supplier proposal card + $linkback = '' . $langs->trans("BackToList") . ''; - // Customer - if ( is_null($object->thirdparty) ) - $object->fetch_thirdparty(); - print ""; - print ''; - // Payment term - print ''; - print ''; - print ''; - print ''; + $morehtmlref='
'; + // Ref supplier + //$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); + //$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; - print "
'.$langs->trans('Ref').''; - print $form->showrefnav($object,'ref',$linkback,1,'ref','ref',''); - print '
".$langs->trans("Supplier")."'.$object->thirdparty->getNomUrl(1).'
'; - print ''; - print '
'; - print $langs->trans('PaymentConditionsShort'); - print '
'; - print '
'; - $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'none', 1); - print '
'.$langs->trans('SupplierProposalDate').''; - print dol_print_date($object->date_livraison,'daytext'); - print '
"; - - print '
'; - + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + print '
'; dol_fiche_end(); } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ec4ccdd2b38..0e278019df6 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -254,6 +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; } input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: #FFF; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 17eec130377..f45b0355880 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -254,6 +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; } input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: #FDFDFD; From 24cad7cfdf191f87a70f6121867897102f2b6c3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 14:57:00 +0100 Subject: [PATCH 06/24] Fix return code REST similar for all api with POST --- test/phpunit/RestAPIUserTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index a92bc80ed63..a79739fef43 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -207,9 +207,9 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'],''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertGreaterThan(0, $object['id'], $object['error']['code'].' '.$object['error']['message']); + $resid=json_decode($result['content'], true); + $this->assertNotNull($resid, "Parsing of json result must no be null"); + $this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']); // attempt to create duplicated user print __METHOD__." Request POST url=".$url."\n"; From cb4e0233b9ca51cc0b629d2f6be8c06b2c7e6f27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 15:21:38 +0100 Subject: [PATCH 07/24] Fix orphelins --- htdocs/install/mysql/migration/repair.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 9f192a0d9cc..1dda63f61e7 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -143,6 +143,10 @@ delete from llx_element_element where sourcetype='facture' and fk_source not in delete from llx_element_element where sourcetype='commande' and fk_source not in (select rowid from llx_commande); +-- Fix: delete orphelin actioncomm_resources +delete from llx_actioncomm_resources where fk_actioncomm not in (select id from llx_actioncomm); + + UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; UPDATE llx_product SET canvas = NULL where canvas = 'service@product'; From 46a804114345d252c033a712a4ea034273122092 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 15:22:25 +0100 Subject: [PATCH 08/24] Clean orphelins --- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 1 + htdocs/install/mysql/migration/repair.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index b94d289de31..974184b5f58 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -230,6 +230,7 @@ ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_valid (fk_user ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_approve (fk_user_approve); ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_approve); +DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm); -- Sequence to removed duplicated values of llx_links. Use serveral times if you still have duplicate. drop table tmp_links_double; diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 1dda63f61e7..8d6c12b407f 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -144,7 +144,7 @@ delete from llx_element_element where sourcetype='commande' and fk_source not in -- Fix: delete orphelin actioncomm_resources -delete from llx_actioncomm_resources where fk_actioncomm not in (select id from llx_actioncomm); +DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm); UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; From 8ce5ed01923dd105782a1a755a847d03c81d6775 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 15:57:31 +0100 Subject: [PATCH 09/24] Fix position of discount on PDF with US letter format --- .../commande/doc/pdf_einstein.modules.php | 1 + .../modules/facture/doc/pdf_crabe.modules.php | 18 ++++++++++-------- .../modules/propale/doc/pdf_azur.modules.php | 1 + .../pdf/pdf_canelle.modules.php | 1 + .../pdf/pdf_muscadet.modules.php | 1 + .../doc/pdf_aurore.modules.php | 1 + 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index e753c12e2ea..95c8f933be5 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -129,6 +129,7 @@ class pdf_einstein extends ModelePDFCommandes $this->posxtva-=20; $this->posxup-=20; $this->posxqty-=20; + $this->posxunit-=20; $this->posxdiscount-=20; $this->postotalht-=20; } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index cc0d6478bb6..f127ab09500 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -135,12 +135,14 @@ class pdf_crabe extends ModelePDFFactures $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { - $this->posxpicture-=20; - $this->posxtva-=20; - $this->posxup-=20; - $this->posxqty-=20; - $this->posxdiscount-=20; - $this->postotalht-=20; + $this->posxpicture-=20; + $this->posxtva-=20; + $this->posxup-=20; + $this->posxqty-=20; + $this->posxunit-=20; + $this->posxdiscount-=20; + $this->posxprogress-=20; + $this->postotalht-=20; } $this->tva=array(); @@ -297,7 +299,7 @@ class pdf_crabe extends ModelePDFFactures $this->atleastonediscount++; } } - if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS)) + if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS)) // retreive space not used by discount { $this->posxpicture+=($this->postotalht - $this->posxdiscount); $this->posxtva+=($this->postotalht - $this->posxdiscount); @@ -527,9 +529,9 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($this->posxprogress-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); } + // Situation progress if ($this->situationinvoice) { - // Situation progress $progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxprogress, $curY); $pdf->MultiCell($this->postotalht-$this->posxprogress, 3, $progress, 0, 'R'); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index ee977908814..d599cb2e58a 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -127,6 +127,7 @@ class pdf_azur extends ModelePDFPropales $this->posxtva-=20; $this->posxup-=20; $this->posxqty-=20; + $this->posxunit-=20; $this->posxdiscount-=20; $this->postotalht-=20; } diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index cd6f0b1fdc9..b476a2b9986 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -113,6 +113,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->posxtva-=20; $this->posxup-=20; $this->posxqty-=20; + $this->posxunit-=20; $this->posxdiscount-=20; $this->postotalht-=20; } 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 dc40d084d71..a23501497a5 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -127,6 +127,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->posxtva-=20; $this->posxup-=20; $this->posxqty-=20; + $this->posxunit-=20; $this->posxdiscount-=20; $this->postotalht-=20; } 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 e53f0343230..bc78730ba57 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -115,6 +115,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $this->posxtva-=20; $this->posxup-=20; $this->posxqty-=20; + $this->posxunit-=20; $this->posxdiscount-=20; $this->postotalht-=20; } From 7e2b41402ee3f192cd40a74eba84501c8f03165c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 16:24:07 +0100 Subject: [PATCH 10/24] Fix bad balance of form --- htdocs/admin/dict.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 0cd4886f8c9..2ca1337736e 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1274,6 +1274,7 @@ if ($id) // Title line with search boxes print '
'; + print ''; print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; + if ($filterfound) + { + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; + } print '
'; + print ''; + print ''; print ''; print '
'; print ''; From b2fbef4a919e60d759bf372fb99682cb3a0f2b29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Dec 2016 23:04:59 +0100 Subject: [PATCH 11/24] Prepare 4.0.3 --- ChangeLog | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/ChangeLog b/ChangeLog index c602d3a2a3c..00d654010c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,52 @@ Upgrading to any other version or any other database system is abolutely require make a Dolibarr upgrade. +***** 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 +FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them +FIX: #5972 #5734 +FIX: #6007 +FIX: #6010 +FIX: #6029 +FIX: #6043 - Payment mode not visible on supplier invoice list +FIX: #6051 +FIX: #6062 +FIX: #6088 +FIX: A draft can be deleted by a user with create permission. +FIX: bad permission to see contract on home page +FIX: bad permission to see contract statistics +FIX: Bcc must not appears to recipient when using SMTPs lib +FIX: Consistent description for add or edit product +FIX: delete contract extrafields on contract deletion +FIX: Deposits and credit notes weren't added in the received and pending columns +FIX: export extrafields must not include separe type +FIX: Export of opportunity status must be code, not id. +FIX: False positive on services not activated +FIX: Filter was wrong or lost during navigation +FIX: HT and TTC price should always be displayed together +FIX: if a supplier price reference is changed after creating an order, we can't clone order. +FIX: in export. Error when using a separate extrafields. +FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email. +FIX: javascript error when using on mobile/smartphone +FIX: javascript xss injection and a translation +FIX: Label of project is in field title not label. +FIX: List of people able to validate an expense report was not complete. +FIX: Missing field +FIX: Module gravatar was not triggered on thirdparty and contact card +FIX: Must use external link into a forged email content. +FIX: Pb in management of date end of projects +FIX: Regression when deleting product +FIX: rendering of output of estimated amount on project overview page. +FIX: Sanitize title of ajax_dialog +FIX: Security to restrict email sending was not efficient +FIX: Setting supplier as client when accept a supplier proposal +FIX: Some statistics not compatible with multicompany module. +FIX: the time spent on project was not visible in its overwiew +FIX: Update intervention lline crash with PgSQL +FIX: wrong test on dict.php +FIX: wrong var name + ***** ChangeLog for 4.0.2 compared to 4.0.1 ***** FIX: #5340 FIX: #5779 From c16489a3c04d6f0e06b360924c5acacebfd4f6c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 19:54:06 +0100 Subject: [PATCH 12/24] Fix add message to explain why some emails fails --- htdocs/admin/mails.php | 6 ++++++ htdocs/langs/en_US/admin.lang | 1 + 2 files changed, 7 insertions(+) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index d05518374c1..ed290060370 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -619,6 +619,12 @@ else print ''; + if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') + { + $text = $langs->trans("WarningPHPMail"); + print info_admin($text); + } + // Run the test to connect if ($action == 'testconnect') { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 82ff69fe88a..c57ea45858a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -411,6 +411,7 @@ ModuleCompanyCodePanicum=Return an empty accountancy code. ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code. Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1=validation, 2=first approval and 3=second approval if amount is enough).
Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval (3 steps) is always required. UseDoubleApproval=Use a 3 steps approval when amount (without tax) is higher than... +WarningPHPMail=WARNING: Some email providers (like Yahoo) does not allow you to send an email from another server than the Yahoo server if the email address used as a sender is your Yahoo email (like myemail@yahoo.com, myemail@yahoo.fr, ...). Your current setup use the server of the application to send email, so some recipients (the one compatible with the restrictive DMARC protocol), will ask Yahoo if they can accept your email and Yahoo will respond "no" because the server is not a server owned by Yahoo, so few of your sent Emails may not be accepted.
If your Email provider (like Yahoo) has this restriction, you must change Email setup to choose the other method "SMTP server" and enter the SMTP server and credentials provided by your Email provider (ask your EMail provider to get SMTP credentials for your account). # Modules Module0Name=Users & groups From 45028de51f1f693c0dcab01a7b5846f3c43409f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Dec 2016 23:47:25 +0100 Subject: [PATCH 13/24] Better fix for install on distant server --- htdocs/install/step1.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 7f9c1a2fc4b..b323c970a9d 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -541,16 +541,20 @@ if (! $error && $db->connected && $action == "set") { if ($db->connected) { + $resultbis = 1; + // Create user - $tmpdolibarr_main_db_host = $dolibarr_main_db_host; + $result=$db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); + // Create user bis if ($databasefortest == 'mysql') { - if (! in_array($conf->db->host, array('127.0.0.1', 'localhost', 'localhost.local'))) $tmpdolibarr_main_db_host='%'; + if (! in_array($dolibarr_main_db_host, array('127.0.0.1', '::1', 'localhost', 'localhost.local'))) + { + $resultbis=$db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); + } } - $result=$db->DDLCreateUser($tmpdolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); - - if ($result > 0) + if ($result > 0 && $resultbis > 0) { print '
'; From c9c8079c3d293ee139a0a2cadac6bac520133548 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Dec 2016 00:00:28 +0100 Subject: [PATCH 14/24] Can add additionnal paramon mail to solve rare sendmail problems --- htdocs/core/class/CMailFile.class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 027bedebb6e..4ba153ad5da 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -538,25 +538,28 @@ class CMailFile } else { - $bounce = ''; // By default + $additionnalparam = ''; // By default if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) { // le "Return-Path" (retour des messages bounced) dans les header ne fonctionne pas avec tous les MTA // Le forcage de la valeur grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie. - // La variable definie pose des pb avec certains sendmail securisee (option -f refusee car dangereuse) - $bounce .= ($bounce?' ':'').(! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO,2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from,2) : '') ); + // Having this variable defined may create problems with some sendmail (option -f refused) + // Having this variable not defined may create problems with some other sendmail (option -f required) + $additionnalparam .= ($additionnalparam?' ':'').(! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO,2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from,2) : '') ); } if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender { - $bounce .= ($bounce?' ':'').'-ba'; + $additionnalparam .= ($additionnalparam?' ':'').'-ba'; } - dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$bounce, LOG_DEBUG); + if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM)) $additionnalparam .= ($additionnalparam?' ':'').'-U '.$additionnalparam; // Use -U to add additionnal params + + dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$additionnalparam, LOG_DEBUG); $this->message=stripslashes($this->message); if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); - if (! empty($bounce)) $res = mail($dest,$this->encodetorfc2822($this->subject),$this->message,$this->headers, $bounce); + if (! empty($additionnalparam)) $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers, $additionnalparam); else $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers); if (! $res) From e297b647220b4d80cd8159cf1fa9e6e59b314ac2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Dec 2016 12:30:59 +0100 Subject: [PATCH 15/24] Several security fix in using mailings. --- htdocs/comm/mailing/card.php | 44 +++++++++++++++------------ htdocs/conf/conf.php.example | 25 ++++++--------- htdocs/core/class/CMailFile.class.php | 21 ++++++++----- htdocs/filefunc.inc.php | 2 +- 4 files changed, 49 insertions(+), 43 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 48044928ecc..3660b560f78 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -753,8 +753,9 @@ else $sendingmode=$conf->global->MAIN_MAIL_SENDMODE; if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function - // MAILING_NO_USING_PHPMAIL may be defined or not - // MAILING_LIMIT_SENDBYWEB is always defined to something != 0, MAILING_LIMIT_SENDBYCLI may be defined ot not. + // MAILING_NO_USING_PHPMAIL may be defined or not. + // MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden). + // MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0=no limit). if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. @@ -794,7 +795,7 @@ else } $text.=$langs->trans('ConfirmSendingEmailing').'
'; $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,270); + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,300); } } @@ -832,23 +833,28 @@ else print $langs->trans("TotalNbOfDistinctRecipients"); print '
'; $nbemail = ($object->nbemail?$object->nbemail:img_warning('').' '.$langs->trans("NoTargetYet").''); - if ($object->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) + if ($object->statut != 3 && is_numeric($nbemail)) { - if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) - { - $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); - print $form->textwithpicto($nbemail,$text,1,'warning'); - } - else - { - $text=$langs->trans('NotEnoughPermissions'); - print $form->textwithpicto($nbemail,$text,1,'warning'); - } - - } - else - { - print $nbemail; + $text=''; + if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) + { + if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) + { + $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); + } + else + { + $text.=$langs->trans('NotEnoughPermissions'); + } + } + if ($text) + { + print $form->textwithpicto($nbemail,$text,1,'warning'); + } + else + { + print $nbemail; + } } print '
'.dol_trunc($histo[$key]['note'], 40).''; //var_dump($histo[$key]['elementtype']); if (isset($histo[$key]['elementtype'])) diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 4c277a69968..3ac3cf49a9c 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -101,7 +101,8 @@ function facturefourn_prepare_head($object) */ function ordersupplier_prepare_head($object) { - global $db, $langs, $conf; + global $db, $langs, $conf, $user; + $h = 0; $head = array(); @@ -159,7 +160,12 @@ function ordersupplier_prepare_head($object) $h++; $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/info.php?id='.$object->id; - $head[$h][1] = $langs->trans("Info"); + $head[$h][1].= $langs->trans("Events"); + if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) + { + $head[$h][1].= '/'; + $head[$h][1].= $langs->trans("Agenda"); + } $head[$h][2] = 'info'; $h++; complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_order', 'remove'); diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 04bb5a24506..564057d991a 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -184,7 +184,7 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.=''; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_fiche_end(); diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 7de5d34d248..d8d60e96272 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -625,9 +625,9 @@ if ($id > 0 || ! empty($ref)) { // Message if nothing to dispatch if (! $nbproduct) { if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) - print $langs->trans("NoPredefinedProductToDispatch"); // No predefined line at all + print '
'.$langs->trans("NoPredefinedProductToDispatch").'
'; // No predefined line at all else - print $langs->trans("NoMorePredefinedProductToDispatch"); // No predefined line that remain to be dispatched. + print '
'.$langs->trans("NoMorePredefinedProductToDispatch").'
'; // No predefined line that remain to be dispatched. } print ''; diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 5cd8510d854..d858dc7172c 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -27,6 +27,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; $langs->load("orders"); $langs->load("suppliers"); @@ -35,11 +36,44 @@ $langs->load('stocks'); $id=GETPOST('id','int'); $ref=GETPOST('ref','alpha'); +$action = GETPOST('action','alpha'); + +if (GETPOST('actioncode','array')) +{ + $actioncode=GETPOST('actioncode','array',3); + if (! count($actioncode)) $actioncode='0'; +} +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)); +} +$search_agenda_label=GETPOST('search_agenda_label'); // Security check -$socid=''; -if (! empty($user->societe_id)) $socid=$user->societe_id; -$result = restrictedArea($user, 'fournisseur', $id, '', 'commande'); +$socid=0; +if ($user->societe_id) $socid=$user->societe_id; +$result=restrictedArea($user,'fournisseur',$id,'', 'commande'); + +if (!$user->rights->fournisseur->commande->lire) accessforbidden(); + + + + +/* + * Actions + */ + +$parameters=array('id'=>$id); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +// 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 +{ + $actioncode=''; + $search_agenda_label=''; +} + /* @@ -47,89 +81,143 @@ $result = restrictedArea($user, 'fournisseur', $id, '', 'commande'); */ $form = new Form($db); - -$now=dol_now(); +$object = new CommandeFournisseur($db); if ($id > 0 || ! empty($ref)) { - $soc = new Societe($db); - $object = new CommandeFournisseur($db); - - $result=$object->fetch($id,$ref); - if ($result >= 0) - { - $object->info($object->id); - - $soc->fetch($object->socid); - - $help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; - llxHeader('',$langs->trans("Order"),$help_url); - - $head = ordersupplier_prepare_head($object); - - $title=$langs->trans("SupplierOrder"); - dol_fiche_head($head, 'info', $title, 0, 'order'); - - - /* - * Commande - */ - - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - print ''; - - // Fournisseur - print '"; - print ''; - print ''; - - // Statut - print ''; - print ''; - print '"; - - // Date - if ($object->methode_commande_id > 0) - { - print '"; - - if ($object->methode_commande) - { - print ''; - } - } - - print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$langs->trans("Supplier")."'.$soc->getNomUrl(1,'supplier').'
'.$langs->trans("Status").''; - print $object->getLibStatut(4); - print "
'.$langs->trans("Date").''; - if ($object->date_commande) - { - print dol_print_date($object->date_commande,"dayhourtext")."\n"; - } - print "
'.$langs->trans("Method").''.$object->getInputMethod().'
\n"; - print "
"; - - print '
'; - dol_print_object_info($object, 1); - print '
'; - - print ''; - } - else - { - /* Order not found */ - print "OrderNotFound"; - } + $object->fetch($id, $ref); + $object->fetch_thirdparty(); + $object->info($object->id); } +$title=$langs->trans("SupplierOrder").' - '.$object->ref.' '.$object->name; +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info"); +$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; +llxHeader('',$title,$help_url); + +$now=dol_now(); + +$head = ordersupplier_prepare_head($object); + + +dol_fiche_head($head, 'info', $langs->trans("SupplierOrder"), 0, 'order'); + + +// Supplier order card + +$linkback = ''.$langs->trans("BackToList").''; + +$morehtmlref='
'; +// Ref supplier +$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); +$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); +// Thirdparty +$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); +// Project +if (! empty($conf->projet->enabled)) +{ + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->fournisseur->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } +} +$morehtmlref.='
'; + +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + +print '
'; +print '
'; + +dol_print_object_info($object, 1); + +print '
'; + +print '
'; + +dol_fiche_end(); + + + + +// Actions buttons + +$out=''; +$permok=$user->rights->agenda->myactions->create; +if ($permok) +{ + $out.='&originid='.$object->id.'&origin=order_supplier'; +} + + +print '
'; + +if (! empty($conf->agenda->enabled)) +{ + if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } +} + +print '
'; + + +if (!empty($object->id)) +{ + $param='&id='.$object->id; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + + print load_fiche_titre($langs->trans("ActionsOnOrder"),'',''); + + // List of actions on element + /*include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($object,'project',0);*/ + + // List of todo actions + //show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode); + + // List of done actions + //show_actions_done($conf,$langs,$db,$object,null,0,$actioncode); + + // List of all actions + $filters=array(); + $filters['search_agenda_label']=$search_agenda_label; + show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters); +} + + llxFooter(); $db->close(); diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index 8b6bf3c0288..0c37f999259 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -48,7 +48,6 @@ $search_agenda_label=GETPOST('search_agenda_label'); // Security check $socid=0; -$id = GETPOST("id",'int'); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'projet',$id,''); @@ -80,11 +79,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $form = new Form($db); $object = new Project($db); -$title=$langs->trans("Project").' - '.$object->ref.' '.$object->name; -if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info"); -$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; -llxHeader("",$title,$help_url); - if ($id > 0 || ! empty($ref)) { $object->fetch($id, $ref); @@ -92,6 +86,11 @@ if ($id > 0 || ! empty($ref)) $object->info($object->id); } +$title=$langs->trans("Project").' - '.$object->ref.' '.$object->name; +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info"); +$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; +llxHeader("",$title,$help_url); + $head = project_prepare_head($object); dol_fiche_head($head, 'agenda', $langs->trans("Project"), 0, ($object->public?'projectpub':'project')); @@ -162,6 +161,10 @@ print ''; if (!empty($object->id)) { + $param='&id='.$object->id; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + print load_fiche_titre($langs->trans("ActionsOnProject"),'',''); // List of actions on element From 374a6d7783af6840a695fac6ca1496e5dc2e4c59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Dec 2016 18:50:20 +0100 Subject: [PATCH 19/24] Fix filecheck tool. --- htdocs/admin/system/filecheck.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 5bea1b521ac..6f90d2c0348 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -75,9 +75,9 @@ $file_list = array('missing' => array(), 'updated' => array()); // File to analyze //$xmlfile = DOL_DOCUMENT_ROOT.'/install/filelist-'.DOL_VERSION.'.xml'; -$xmlshortfile = '/install/filelist-'.DOL_VERSION.'.xml'; +$xmlshortfile = GETPOST('xmlshortfile')?GETPOST('xmlshortfile'):'/install/filelist-'.DOL_VERSION.'.xml'; $xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile; -$xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml'; +$xmlremote = GETPOST('xmlremote')?GETPOST('xmlremote'):'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml'; // Test if remote test is ok @@ -87,21 +87,27 @@ if (preg_match('/beta|alpha/i', DOL_VERSION)) $enableremotecheck=False; print '
'; print $langs->trans("MakeIntegrityAnalysisFrom").':
'; +print ''."\n"; if (dol_is_file($xmlfile)) { print ' '.$langs->trans("LocalSignature").' = '.$xmlshortfile.'
'; } else { - print ' '.$langs->trans("LocalSignature").' = '.$xmlshortfile.' ('.$langs->trans("AvailableOnlyOnPackagedVersions").')
'; + print ' '.$langs->trans("LocalSignature").' = '.$xmlshortfile; + if (! GETPOST('xmlshortfile')) print ' ('.$langs->trans("AvailableOnlyOnPackagedVersions").')'; + print '
'; } +print ''."\n"; if ($enableremotecheck) { print ' '.$langs->trans("RemoteSignature").' = '.$xmlremote.'
'; } else { - print ' '.$langs->trans("RemoteSignature").' = '.$xmlremote.' ('.$langs->trans("FeatureAvailableOnlyOnStable").')
'; + print ' '.$langs->trans("RemoteSignature").' = '.$xmlremote; + if (! GETPOST('xmlremote')) print ' ('.$langs->trans("FeatureAvailableOnlyOnStable").')'; + print '
'; } print '
'; print '
'; @@ -128,7 +134,8 @@ if (GETPOST('target') == 'remote') if (! $xmlarray['curl_error_no'] && $xmlarray['http_code'] != '404') { $xmlfile = $xmlarray['content']; - $xml = simplexml_load_file($xmlfile); + //print "eee".$xmlfile."eee"; + $xml = simplexml_load_string($xmlfile); } else { From 83a8fcb7f9b9b3d76a82eef28a247666ddeae7db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Dec 2016 19:01:24 +0100 Subject: [PATCH 20/24] Fix filecheck tool. --- build/generate_filelist_xml.php | 0 htdocs/admin/system/filecheck.php | 15 ++++++++++++--- htdocs/langs/en_US/admin.lang | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) mode change 100644 => 100755 build/generate_filelist_xml.php diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php old mode 100644 new mode 100755 diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 6f90d2c0348..0d6c2e5cd1d 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -188,10 +188,10 @@ if ($xml) print '
' . $langs->trans("DateModification") . '
'.$langs->trans("None").'
'; + + if (empty($tmpfilelist) && empty($tmpfilelist2)) + { + setEventMessage($langs->trans("FileIntegrityIsStrictlyConformedWithReference")); + } + else + { + setEventMessage($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), 'warnings'); + } } else { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c57ea45858a..d8b0c586584 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -10,6 +10,8 @@ VersionUnknown=Unknown VersionRecommanded=Recommended FileCheck=Files integrity checker FileCheckDesc=This tool allows you to check the integrity of files of your application, comparing each files with the official ones. You can use this tool to detect if some files were modified by a hacker for example. +FileIntegrityIsStrictlyConformedWithReference=Files integrity is strictly conformed with the reference. +FileIntegritySomeFilesWereRemovedOrModified=Files integrity check has failed. Some files were modified of removed. MakeIntegrityAnalysisFrom=Make integrity analysis of application files from LocalSignature=Embedded local signature (less reliable) RemoteSignature=Remote distant signature (more reliable) From c5850d29e7b2e5c98f3c0dd0622219de08b78a42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Dec 2016 19:51:24 +0100 Subject: [PATCH 21/24] Fix checksum integrity. Also add a global checksum. --- build/generate_filelist_xml.php | 22 +++++++++++-- htdocs/admin/system/filecheck.php | 55 +++++++++++++++++++++++-------- htdocs/langs/en_US/admin.lang | 1 + 3 files changed, 63 insertions(+), 15 deletions(-) diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index 1bc0e2b6620..07e87dd86bb 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -65,6 +65,8 @@ fputs($fp, ''."\n"); fputs($fp, ''."\n"); +$checksumconcat=array(); + $dir_iterator1 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../htdocs/'); $iterator1 = new RecursiveIteratorIterator($dir_iterator1); // need to ignore document custom etc @@ -81,12 +83,22 @@ foreach ($files as $file) { $needtoclose=1; } if (filetype($file)=="file") { - fputs($fp, ''.md5_file($file).''."\n"); + $md5=md5_file($file); + $checksumconcat[]=$md5; + fputs($fp, ''.$md5.''."\n"); } } fputs($fp, ''."\n"); fputs($fp, ''."\n"); +asort($checksumconcat); // Sort list of checksum +//var_dump($checksumconcat); +fputs($fp, ''."\n"); +fputs($fp, md5(join(',',$checksumconcat))."\n"); +fputs($fp, ''."\n"); + + +$checksumconcat=array(); fputs($fp, ''."\n"); @@ -106,12 +118,18 @@ foreach ($files as $file) { $needtoclose=1; } if (filetype($file)=="file") { - fputs($fp, ''.md5_file($file).''."\n"); + $md5=md5_file($file); + $checksumconcat[]=$md5; + fputs($fp, ''.$md5.''."\n"); } } fputs($fp, ''."\n"); fputs($fp, ''."\n"); +asort($checksumconcat); // Sort list of checksum +fputs($fp, ''."\n"); +fputs($fp, md5(join(',',$checksumconcat))."\n"); +fputs($fp, ''."\n"); fputs($fp, ''."\n"); fclose($fp); diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 0d6c2e5cd1d..1340b5ae3c1 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -148,11 +148,14 @@ if (GETPOST('target') == 'remote') if ($xml) { + $checksumconcat = array(); + + // Scan htdocs if (is_object($xml->dolibarr_htdocs_dir[0])) { - $file_list = array(); - $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0]); // Fill array $file_list - + $file_list = array(); + $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list + print ''; print ''; print ''; @@ -223,6 +226,29 @@ if ($xml) print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile; $error++; } + + + // Scan scripts + /* + if (is_object($xml->dolibarr_script_dir[0])) + { + $file_list = array(); + $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', ???, $checksumconcat); // Fill array $file_list + }*/ + + + asort($checksumconcat); // Sort list of checksum + //var_dump($checksumconcat); + $checksumget = md5(join(',',$checksumconcat)); + $checksumtoget = $xml->dolibarr_htdocs_dir_checksum; + if ($checksumtoget) + { + print '
'; + print ''.$langs->trans("GlobalChecksum").'
'; + print $langs->trans("ExpectedChecksum").' = '.$checksumtoget.'
'; + print $langs->trans("CurrentChecksum").' = '.$checksumget; + } + } @@ -239,12 +265,14 @@ exit($error); * Function to get list of updated or modified files. * $file_list is used as global variable * - * @param array $file_list Array for response - * @param SimpleXMLElement $dir SimpleXMLElement of files to test - * @param string $path Path of file - * @return array Array of filenames + * @param array $file_list Array for response + * @param SimpleXMLElement $dir SimpleXMLElement of files to test + * @param string $path Path of files relative to $pathref. We start with ''. Used by recursive calls. + * @param string $pathref Path ref (DOL_DOCUMENT_ROOT) + * @param array $checksumconcat Array of checksum + * @return array Array of filenames */ -function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '') +function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathref = '', &$checksumconcat = array()) { $exclude = 'install'; @@ -252,20 +280,21 @@ function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '') { $filename = $path.$file['name']; - if (preg_match('#'.$exclude.'#', $filename)) continue; + //if (preg_match('#'.$exclude.'#', $filename)) continue; - if (!file_exists(DOL_DOCUMENT_ROOT.'/'.$filename)) + if (!file_exists($pathref.'/'.$filename)) { $file_list['missing'][] = array('filename'=>$filename, 'expectedmd5'=>(string) $file); } else { - $md5_local = md5_file(DOL_DOCUMENT_ROOT.'/'.$filename); + $md5_local = md5_file($pathref.'/'.$filename); if ($md5_local != (string) $file) $file_list['updated'][] = array('filename'=>$filename, 'expectedmd5'=>(string) $file, 'md5'=>(string) $md5_local); - } + $checksumconcat[] = $md5_local; + } } - foreach ($dir->dir as $subdir) getFilesUpdated($file_list, $subdir, $path.$subdir['name'].'/'); + foreach ($dir->dir as $subdir) getFilesUpdated($file_list, $subdir, $path.$subdir['name'].'/', $pathref, $checksumconcat); return $file_list; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d8b0c586584..4f029afd8d8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -12,6 +12,7 @@ FileCheck=Files integrity checker FileCheckDesc=This tool allows you to check the integrity of files of your application, comparing each files with the official ones. You can use this tool to detect if some files were modified by a hacker for example. FileIntegrityIsStrictlyConformedWithReference=Files integrity is strictly conformed with the reference. FileIntegritySomeFilesWereRemovedOrModified=Files integrity check has failed. Some files were modified of removed. +GlobalChecksum=Global checksum MakeIntegrityAnalysisFrom=Make integrity analysis of application files from LocalSignature=Embedded local signature (less reliable) RemoteSignature=Remote distant signature (more reliable) From 3e28f22bad4b2ec5007c8eecae7bd012c532d4a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Dec 2016 00:05:33 +0100 Subject: [PATCH 22/24] Fix style --- htdocs/compta/facture.php | 2 +- htdocs/compta/sociales/card.php | 44 +++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index cd44122b981..fd1f4d73a4c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3723,7 +3723,7 @@ else if ($id > 0 || ! empty($ref)) else print $langs->trans('ExcessReceived'); print ' :'; - print ''; + print ''; print ''; } else // Credit note diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index e917e1e1c71..77393b78f4e 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -556,34 +556,42 @@ if ($id > 0) print ''; print ''; print ''; - print ''; print ''; - $var=True; - while ($i < $num) + $var=true; + if ($num > 0) + { + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print "'; + print '\n"; + $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; + print "\n"; + print '\n"; + print ""; + $totalpaye += $objp->amount; + $i++; + } + } + else { - $objp = $db->fetch_object($resql); $var=!$var; - print "'; - print '\n"; - $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; - print "\n"; - print '\n"; - print ""; - $totalpaye += $objp->amount; - $i++; + print ''; } - + if ($object->paye == 0) { - print "\n"; - print "\n"; + print "\n"; + print "\n"; $resteapayer = $object->amount - $totalpaye; - + $cssforamountpaymentcomplete = 'amountpaymentcomplete'; + print ""; - print "\n"; + print '\n"; } print "
' . $langs->trans("FilesMissing") . '' . price($resteapayeraffiche) . '' . price($resteapayeraffiche) . ' 
'.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").' 
"; + print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$objp->num_paiement."'.price($objp->amount)."
"; - print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
'.$langs->trans("None").'
".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AlreadyPaid")." :".price($totalpaye)."
".$langs->trans("AmountExpected")." :".price($object->amount)."
".$langs->trans("RemainderToPay")." :".price($resteapayer)." ".$langs->trans("Currency".$conf->currency)."
'.price($resteapayer)."
"; $db->free($resql); From 003045525f55a31c6f3b9d8b3e772bfa64ccd67b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Dec 2016 01:32:29 +0100 Subject: [PATCH 23/24] Fix css --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index fd1f4d73a4c..c8959c86029 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3723,7 +3723,7 @@ else if ($id > 0 || ! empty($ref)) else print $langs->trans('ExcessReceived'); print ' :
' . price($resteapayeraffiche) . '' . price($resteapayeraffiche) . '