diff --git a/COPYRIGHT b/COPYRIGHT index 78b9bee6d18..ed8a667acc8 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -21,7 +21,7 @@ NuSoap 0.9.5 LGPL 2.1+ Yes odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files PHPExcel 1.7.6 LGPL-2.1+ Yes Read/Write XLS files, read ODS files PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests -TCPDF 6.0.021 LGPL-3+ Yes PDF generation +TCPDF 6.0.093 LGPL-3+ Yes PDF generation JS libraries: jQuery 1.8.2 MIT License Yes JS library diff --git a/ChangeLog b/ChangeLog index 5f92b91dcb0..0f7bee20186 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,14 +5,16 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: - Fix: Can upload files on services. -- Fix: sql errors on updat fichinter -- Fix: debian script syntax error +- Fix: sql errors on updat fichinter. +- Fix: debian script syntax error. - Fix: error "menu param is not inside list" into pos module. -- Fix: Salary payments are not reflected on the reporting sheets -- Fix: Unsubscribe emailing not working -- Fix: Trigger on create category call failed because user is not passed on card -- Fix: list event view lost type event filter -- Fix: Save also code event +- Fix: Salary payments are not reflected on the reporting sheets. +- Fix: Unsubscribe emailing not working. +- Fix: Trigger on create category call failed because user is not passed on card. +- Fix: list event view lost type event filter. +- Fix: Save also code event. +- Fix: VAT payment - Add control on field date value. +- Fix: Salaries payment - Field date value is now required and add control on it. - Fix: Iban was used instead of Bic into SEPA file. - Fix: Must unaccent strings into SEPA file. - Fix: Extrafield feature select from table should try to translate multiple column when not needed @@ -145,6 +147,8 @@ Fix: Missing include files.lib.php in some pages that use dol_delete_recursive Fix: [ bug #1558 ] Product/service edit page title shows new Ref instead of old ref. Fix: [ bug #1553 ] Saving User displays setup removes menu. Fix: [ bug #1544 ] Can remove date from invoice +Fix: list event view lost type event filter +Fix: Add code save on create event ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index c4de7377ebd..2044c511c35 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -74,7 +74,7 @@ class Categorie extends CommonObject function fetch($id,$label='') { global $conf; - + // Check parameters if (empty($id) && empty($label)) return -1; @@ -1137,11 +1137,11 @@ class Categorie extends CommonObject $cats = array(); $typeid=-1; $table='';; - if ($type == '0' || $type == 'product') { $typeid=0; $table='product'; $type='product'; } + if ($type == '0' || $type == 'product') { $typeid=0; $table='product'; $type='product'; } else if ($type == '1' || $type == 'supplier') { $typeid=1; $table='societe'; $type='fournisseur'; } else if ($type == '2' || $type == 'customer') { $typeid=2; $table='societe'; $type='societe'; } else if ($type == '3' || $type == 'member') { $typeid=3; $table='member'; $type='member'; } - else if ($type == '4' || $type == 'contact') { $typeid=4; $table='socpeople'; $type='contact'; } + else if ($type == '4' || $type == 'contact') { $typeid=4; $table='socpeople'; $type='contact'; } $sql = "SELECT ct.fk_categorie, c.label"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c"; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 8f6df313506..25c8d068ae1 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -269,10 +269,12 @@ else if ($action == 'add' && $user->rights->commande->creer) { if ($ret < 0) $error ++; - if (! $error) { + if (! $error) + { $object_id = $object->create($user); - if ($object_id > 0) { + if ($object_id > 0) + { dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); $classname = ucfirst($subelement); @@ -280,15 +282,20 @@ else if ($action == 'add' && $user->rights->commande->creer) { dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines"); $result = $srcobject->fetch($object->origin_id); - if ($result > 0) { + if ($result > 0) + { $lines = $srcobject->lines; if (empty($lines) && method_exists($srcobject, 'fetch_lines')) - $lines = $srcobject->fetch_lines(); + { + $srcobject->fetch_lines(); + $lines = $srcobject->lines; + } $fk_parent_line = 0; $num = count($lines); - for($i = 0; $i < $num; $i ++) { + for($i = 0; $i < $num; $i ++) + { $label = (! empty($lines [$i]->label) ? $lines [$i]->label : ''); $desc = (! empty($lines [$i]->desc) ? $lines [$i]->desc : $lines [$i]->libelle); $product_type = (! empty($lines [$i]->product_type) ? $lines [$i]->product_type : 0); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index bdb96718dfa..5332690e40b 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -97,7 +97,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - + $langs->load('bills'); $langs->load('products'); $langs->load('main'); @@ -213,13 +213,17 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) $result=$objectsrc->fetch($orders_id[$ii]); if ($result > 0) { - if ($closeOrders) + if ($closeOrders) { $objectsrc->classifyBilled(); $objectsrc->setStatut(3); } $lines = $objectsrc->lines; - if (empty($lines) && method_exists($objectsrc,'fetch_lines')) $lines = $objectsrc->fetch_lines(); + if (empty($lines) && method_exists($objectsrc, 'fetch_lines')) + { + $objectsrc->fetch_lines(); + $lines = $objectsrc->lines; + } $fk_parent_line=0; $num=count($lines); for ($i=0;$i<$num;$i++) diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 195bf9023b4..89df2428ca9 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -56,6 +56,7 @@ $search_ref=GETPOST('search_ref','alpha'); */ $tripandexpense_static=new Deplacement($db); +$userstatic = new User($db); llxHeader(); @@ -132,12 +133,23 @@ if ($resql) $var=!$var; print ''; + // Id print ''.img_object($langs->trans("ShowTrip"),"trip").' '.$obj->rowid.''; + // Type print ''.$langs->trans($obj->type).''; + // Date print ''.dol_print_date($db->jdate($obj->dd),'day').''; - print ''.img_object($langs->trans("ShowUser"),"user").' '.$obj->firstname.' '.$obj->name.''; + // User + print ''; + $userstatic->id = $obj->rowid; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + print $userstatic->getNomUrl(1); + print ''; + if ($obj->socid) print ''.$soc->getNomUrl(1).''; else print ' '; + print ''.$obj->km.''; $tripandexpense_static->statut=$obj->fk_statut; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 8138c56450e..7de3e878545 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -924,7 +924,11 @@ else if ($action == 'add' && $user->rights->facture->creer) if ($result > 0) { $lines = $srcobject->lines; - if (empty($lines) && method_exists($srcobject, 'fetch_lines')) $lines = $srcobject->fetch_lines(); + if (empty($lines) && method_exists($srcobject, 'fetch_lines')) + { + $srcobject->fetch_lines(); + $lines = $srcobject->lines; + } $fk_parent_line=0; $num=count($lines); @@ -2211,7 +2215,7 @@ if ($action == 'create') // Payment mode print '' . $langs->trans('PaymentMode') . ''; - $form->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id'); + $form->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id', 'CRDT'); print ''; // Project @@ -3151,10 +3155,13 @@ if ($action == 'create') print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . ''; print ''; print ''; - if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); - } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'none'); + if ($action == 'editmode') + { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT'); + } + else + { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none', 'CRDT'); } print ''; diff --git a/htdocs/compta/salaries/fiche.php b/htdocs/compta/salaries/fiche.php index ae74344ccf8..c46f83dd6fb 100644 --- a/htdocs/compta/salaries/fiche.php +++ b/htdocs/compta/salaries/fiche.php @@ -80,7 +80,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $sal->num_payment=GETPOST("num_payment"); $sal->fk_user_creat=$user->id; - if (empty($datep) || empty($datesp) || empty($dateep)) + if (empty($datep) || empty($datev) || empty($datesp) || empty($dateep)) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors'); $error++; @@ -219,7 +219,7 @@ if ($action == 'create') print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1); print ''; - print ''.$langs->trans("DateValue").''; + print ''.$langs->trans("DateValue").''; print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1); print ''; diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php index 65c4285d7d1..a4a5a8831c4 100644 --- a/htdocs/compta/tva/fiche.php +++ b/htdocs/compta/tva/fiche.php @@ -72,6 +72,16 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $tva->label=GETPOST("label"); $tva->note=GETPOST("note"); + if (empty($tva->datev)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateValue")),'errors'); + $error++; + } + if (empty($tva->datep)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DatePayment")),'errors'); + $error++; + } if (empty($tva->type_payment) || $tva->type_payment < 0) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors'); diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 7bcd7fcbc8d..38a2b3f1095 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -250,7 +250,11 @@ if ($action == 'add' && $user->rights->contrat->creer) { $srcobject->fetch_thirdparty(); $lines = $srcobject->lines; - if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); + if (empty($lines) && method_exists($srcobject,'fetch_lines')) + { + $srcobject->fetch_lines(); + $lines = $srcobject->lines; + } $fk_parent_line=0; $num=count($lines); @@ -337,10 +341,10 @@ if ($action == 'add' && $user->rights->contrat->creer) } else { - + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - + $result = $object->create($user); if ($result > 0) { @@ -715,7 +719,7 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra $error ++; if (! $error) { - + $result = $object->insertExtraFields(); if ($result < 0) { $error ++; @@ -948,7 +952,7 @@ if ($action == 'create') // Other attributes $parameters=array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - + // Other attributes if (empty($reshook) && ! empty($extrafields->attribute_label)) { print $object->showOptionals($extrafields, 'edit'); @@ -1112,7 +1116,7 @@ else // Other attributes $parameters=array('colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - + $res = $object->fetch_optionals($object->id, $extralabels); if (empty($reshook) && ! empty($extrafields->attribute_label)) { foreach ($extrafields->attribute_label as $key => $label) { @@ -1132,16 +1136,16 @@ else if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) { $value = isset($_POST ["options_" . $key]) ? dol_mktime($_POST ["options_" . $key . "hour"], $_POST ["options_" . $key . "min"], 0, $_POST ["options_" . $key . "month"], $_POST ["options_" . $key . "day"], $_POST ["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]); } - + if ($action == 'edit_extras' && $user->rights->commande->creer && GETPOST('attribute') == $key) { print '
'; print ''; print ''; print ''; print ''; - + print $extrafields->showInputField($key, $value); - + print ''; print '
'; } else { @@ -1153,9 +1157,9 @@ else } } } - - - + + + print ""; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8eb7eee4220..fdd951293a6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2329,8 +2329,8 @@ class Form dol_syslog(get_class($this)."::select_type_paiements ".$selected.", ".$htmlname.", ".$filtertype.", ".$format,LOG_DEBUG); $filterarray=array(); - if ($filtertype == 'CRDT') $filterarray=array(0,2); - elseif ($filtertype == 'DBIT') $filterarray=array(1,2); + if ($filtertype == 'CRDT') $filterarray=array(0,2,3); + elseif ($filtertype == 'DBIT') $filterarray=array(1,2,3); elseif ($filtertype != '' && $filtertype != '-1') $filterarray=explode(',',$filtertype); $this->load_cache_types_paiements(); @@ -3055,12 +3055,13 @@ class Form /** * Affiche formulaire de selection des modes de reglement * - * @param string $page Page - * @param int $selected Id mode pre-selectionne - * @param string $htmlname Name of select html field + * @param string $page Page + * @param int $selected Id mode pre-selectionne + * @param string $htmlname Name of select html field + * @param string $filtertype To filter on field type in llx_c_paiement (array('code'=>xx,'label'=>zz)) * @return void */ - function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id') + function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id', $filtertype='') { global $langs; if ($htmlname != "none") @@ -3070,7 +3071,7 @@ class Form print ''; print ''; print ''; print ''; print '
'; - $this->select_types_paiements($selected,$htmlname); + $this->select_types_paiements($selected,$htmlname,$filtertype); print '
'; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 4201cde9e9d..1d447430dfe 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -505,7 +505,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) $tmpday = date($tmparray[0])-$seconds; $tmpday = date("d",$tmpday); - //Check first day of week is form this month or not + //Check first day of week is in same month than current day or not if ($tmpday>$day) { $prev_month = $month-1; @@ -522,15 +522,17 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) $prev_month = $month; $prev_year = $year; } - + $tmpmonth = $prev_month; + $tmpyear = $prev_year; + //Get first day of next week $tmptime=dol_mktime(12,0,0,$month,$tmpday,$year,1,0); $tmptime-=24*60*60*7; $tmparray=dol_getdate($tmptime,true); $prev_day = $tmparray['mday']; - //Check first day of week is form this month or not - if ($prev_day>$tmpday) + //Check prev day of week is in same month than first day or not + if ($prev_day>$tmpday) { $prev_month = $month-1; $prev_year = $year; @@ -544,7 +546,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) $week = date("W",dol_mktime(0,0,0,$month,$tmpday,$year,$gm)); - return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day); + return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day); } /** diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 68c61886efd..1450e2f100f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -373,38 +373,43 @@ function dol_string_unaccent($str) { if (utf8_check($str)) { + // See http://www.utf8-chartable.de/ $string = rawurlencode($str); $replacements = array( - '%C3%80' => 'A','%C3%81' => 'A', - '%C3%88' => 'E','%C3%89' => 'E', - '%C3%8C' => 'I','%C3%8D' => 'I', - '%C3%92' => 'O','%C3%93' => 'O', - '%C3%99' => 'U','%C3%9A' => 'U', - '%C3%A0' => 'a','%C3%A1' => 'a','%C3%A2' => 'a', + '%C3%80' => 'A','%C3%81' => 'A','%C3%82' => 'A','%C3%83' => 'A','%C3%84' => 'A','%C3%85' => 'A', + '%C3%88' => 'E','%C3%89' => 'E','%C3%8A' => 'E','%C3%8B' => 'E', + '%C3%8C' => 'I','%C3%8D' => 'I','%C3%8E' => 'I','%C3%8F' => 'I', + '%C3%92' => 'O','%C3%93' => 'O','%C3%94' => 'O','%C3%95' => 'O','%C3%96' => 'O', + '%C3%99' => 'U','%C3%9A' => 'U','%C3%9B' => 'U','%C3%9C' => 'U', + '%C3%A0' => 'a','%C3%A1' => 'a','%C3%A2' => 'a','%C3%A3' => 'a','%C3%A4' => 'a','%C3%A5' => 'a', + '%C3%A7' => 'c', '%C3%A8' => 'e','%C3%A9' => 'e','%C3%AA' => 'e','%C3%AB' => 'e', - '%C3%AC' => 'i','%C3%AD' => 'i','%C3%AE' => 'i', - '%C3%B2' => 'o','%C3%B3' => 'o', - '%C3%B9' => 'u','%C3%BA' => 'u' + '%C3%AC' => 'i','%C3%AD' => 'i','%C3%AE' => 'i','%C3%AF' => 'i', + '%C3%B1' => 'n', + '%C3%B2' => 'o','%C3%B3' => 'o','%C3%B4' => 'o','%C3%B5' => 'o','%C3%B6' => 'o', + '%C3%B9' => 'u','%C3%BA' => 'u','%C3%BB' => 'u','%C3%BC' => 'u', + '%C3%BF' => 'y' ); $string=strtr($string, $replacements); return rawurldecode($string); } else { + // See http://www.ascii-code.com/ $string = strtr( $str, - "\xC0\xC1\xC2\xC3\xC5\xC7 + "\xC0\xC1\xC2\xC3\xC4\xC5\xC7 \xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1 \xD2\xD3\xD4\xD5\xD8\xD9\xDA\xDB\xDD - \xE0\xE1\xE2\xE3\xE5\xE7\xE8\xE9\xEA\xEB + \xE0\xE1\xE2\xE3\xE4\xE5\xE7\xE8\xE9\xEA\xEB \xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF8 - \xF9\xFA\xFB\xFD\xFF", - "AAAAAC + \xF9\xFA\xFB\xFC\xFD\xFF", + "AAAAAAC EEEEIIIIDN OOOOOUUUY - aaaaaceeee + aaaaaaceeee iiiidnooooo - uuuyy" + uuuuyy" ); $string = strtr($string, array("\xC4"=>"Ae", "\xC6"=>"AE", "\xD6"=>"Oe", "\xDC"=>"Ue", "\xDE"=>"TH", "\xDF"=>"ss", "\xE4"=>"ae", "\xE6"=>"ae", "\xF6"=>"oe", "\xFC"=>"ue", "\xFE"=>"th")); return $string; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 9a52ce47788..c11c1d549a9 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -112,7 +112,6 @@ if ($action == 'add') $classname = ucfirst($object->origin); $objectsrc = new $classname($db); $objectsrc->fetch($object->origin_id); - //$object->fetch_lines(); $object->socid = $objectsrc->socid; $object->ref_customer = $objectsrc->ref_client; @@ -698,7 +697,7 @@ if ($action == 'create') print ''; $expe->fetch_delivery_methods(); print $form->selectarray("shipping_method_id",$expe->meths,GETPOST('shipping_method_id','int'),1,0,0,"",1); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print "\n"; // Tracking number @@ -717,7 +716,6 @@ if ($action == 'create') * Lignes de commandes */ - //$lines = $object->fetch_lines(1); $numAsked = count($object->lines); print '