diff --git a/ChangeLog b/ChangeLog index 0bb51e86c75..28b663e99b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ make a Dolibarr upgrade. ***** ChangeLog for 3.7.2 compared to 3.7.1 ***** FIX [ bug #2855 ] Wrong translation key in localtax report page FIX [ bug #1852 ] JS error when editing a customer order line +FIX [ bug #2900 ] Courtesy title is not stored in create thirdparty form ***** ChangeLog for 3.7.1 compared to 3.7.* ***** FIX Bug in the new photo system @@ -265,6 +266,7 @@ Dolibarr better: - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme - Fix: [ bug #2542 ] Contracts store localtax preferences - Fix: Bad permission assignments for stock movements actions +- Fix: [ bug #2891 ] Category hooks do not work ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. @@ -439,6 +441,11 @@ Fix: [ bug #2577 ] Incorrect invoice status in "Linked objects" page of a projec Fix: [ bug #2576 ] Unable to edit a dictionary entry that has # in its ref Fix: [ bug #2758 ] Product::update sets product note to "null" when $prod->note is null Fix: [ bug #2757 ] Deleting product category photo gives "Forbidden access" error +Fix: [ bug #2976 ] "Report" tab is the current tab but it is not marked as selected by the UI +Fix: [ bug #2861 ] Undefined variable $res when migrating +Fix: [ bug #2837 ] Product list table column header does not match column body +Fix: [ bug #2835 ] Customer prices of a product shows incorrect history order +Fix: [ bug #2814 ] JPEG photos are not displayed in Product photos page ***** ChangeLog for 3.5.6 compared to 3.5.5 ***** Fix: Avoid missing class error for fetch_thirdparty method #1973 diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index f5d556eb2c5..8feecdd774e 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -456,10 +456,10 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`; # Removed known external modules to avoir any error when packaging on test env + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom/*`; # For custom we want to keep dir $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/calling*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`; diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index 2d7d170f22e..76055fb635e 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -44,8 +44,8 @@ $langs->load("cashdesk"); diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index 8a587d7de32..4b18eed7a22 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -64,6 +64,10 @@ $object = new Categorie($db); $extrafields = new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('categorycard')); + + /* * Actions */ diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index a105d104036..6b6ed88350d 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -56,6 +56,9 @@ $object = new Categorie($db); $extrafields = new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('categorycard')); + /* * Actions */ diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index c55f324ab06..0460ecde5ed 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -63,6 +63,9 @@ $type=$object->type; $extrafields = new ExtraFields($db); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('categorycard')); + /* * Actions */ diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index 97256c840b1..bc9a13832c2 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -66,7 +66,7 @@ class PropaleStats extends Stats $this->field='total_ht'; $this->field_line='total_ht'; - + $this->where.= " p.fk_statut > 0"; //$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity; $this->where.= " AND p.entity = ".$conf->entity; @@ -183,7 +183,7 @@ class PropaleStats extends Stats return $this->_getAllByYear($sql); } - + /** * Return nb, amount of predefined product for year @@ -193,9 +193,11 @@ class PropaleStats extends Stats */ function getAllByProduct($year) { + global $user; + $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE ".$this->where; $sql.= " AND p.rowid = tl.fk_propal AND tl.fk_product = product.rowid"; $sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'"; @@ -204,5 +206,5 @@ class PropaleStats extends Stats //$sql.= $this->db->plimit(20); return $this->_getAllByProduct($sql); - } + } } diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index 1ec98ad9bd0..d98851e619d 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -176,7 +176,7 @@ $form->select_comptes($account_to,'account_to',0,'',1); print "\n"; print ""; -$form->select_date((isset($dateo) ? $dateo : ''),'','','','','add'); +$form->select_date((! empty($dateo)?$dateo:''),'','','','','add'); print "\n"; print ''; print ''; diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index c15bc9831ce..fec676d8265 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -1,5 +1,6 @@ + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -18,7 +19,6 @@ * \file htdocs/core/boxes/box_task.php * \ingroup Projet * \brief Module to Task activity of the current year - * \version $Id: box_task.php,v 1.1 2012/09/11 Charles-François BENKE */ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); @@ -39,11 +39,11 @@ class box_task extends ModeleBoxes var $info_box_head = array(); var $info_box_contents = array(); - /** - * \brief Constructeur de la classe - * - * @return void - */ + /** + * Constructor + * + * @return void + */ function box_task() { global $langs; @@ -120,8 +120,7 @@ class box_task extends ModeleBoxes // Add the sum à the bottom of the boxes - $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead); - $this->info_box_contents[$i][1] = array('td' => '', 'text' => ""); + $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left" colspan="2" ', 'text' => $langs->trans("Total")." ".$textHead); $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); $this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5)); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0f7ad41de14..06648b42ea2 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -81,7 +81,7 @@ abstract class CommonObject $sql = "SELECT rowid, ref, ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX.$element; - $sql.= " WHERE entity IN (".getEntity($element).")" ; + $sql.= " WHERE entity IN (".getEntity($element,1).")" ; if ($id > 0) $sql.= " AND rowid = ".$db->escape($id); else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index eeac381cff8..c65a164a303 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -394,9 +394,9 @@ class Form $htmltext=str_replace("\n","",$htmltext); $htmltext=str_replace('"',""",$htmltext); - if ($tooltipon == 2 || $tooltipon == 3) $paramfortooltipimg=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td img tag to store tooltip + if ($tooltipon == 2 || $tooltipon == 3) $paramfortooltipimg=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'" '; // Attribut to put on td img tag to store tooltip else $paramfortooltipimg =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag - if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip + if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'" '; // Attribut to put on td tag to store tooltip else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag $s=""; if (empty($notabs)) $s.=''; diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 4cdd31d3b4c..bc5cfa2872c 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -124,7 +124,7 @@ class FormProjets } else if ($obj->fk_statut == 2) { - if ($discard_close == 2) $disabled=1; + if ($discard_closed == 2) $disabled=1; $labeltoshow.=' - '.$langs->trans("Closed"); } else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 349b32d5104..56e338b7eb8 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -400,7 +400,7 @@ class RssParser { if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { - $itemLink = (string) $item['link']['href']; + $itemLink = (isset($item['link']['href']) ? (string) $item['link']['href'] : ''); $itemTitle = (string) $item['title']; $itemDescription = (string) $item['summary']; $itemPubDate = (string) $item['created']; @@ -409,7 +409,7 @@ class RssParser } else { - $itemLink = (string) $item['link']['href']; + $itemLink = (isset($item['link']['href']) ? (string) $item['link']['href'] : ''); $itemTitle = (string) $item['title']; $itemDescription = (string) $item['summary']; $itemPubDate = (string) $item['created']; diff --git a/htdocs/core/js/lib_batch.js b/htdocs/core/js/lib_batch.js index 65c138b73aa..b434083edd0 100644 --- a/htdocs/core/js/lib_batch.js +++ b/htdocs/core/js/lib_batch.js @@ -19,7 +19,7 @@ // \brief File that include javascript functions used when dispatching batch-enabled product // -function AddLineBatch(index) { +function addLineBatch(index) { var nme = 'dluo_0_'+index; $row=$("tr[name='"+nme+"']").clone(true); $row.find("input[name^='qty']").val(''); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ae4a65ada7e..f3f4fa838ee 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -181,7 +181,7 @@ function dol_shutdown() global $conf,$user,$langs,$db; $disconnectdone=false; $depth=0; if (is_object($db) && ! empty($db->connected)) { $depth=$db->transaction_opened; $disconnectdone=$db->close(); } - dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth)?' (Warn: db disconnection forced, transaction depth was '.$depth.')':''), (($disconnectdone && $depth)?LOG_WARNING:LOG_DEBUG)); + dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth)?' (Warn: db disconnection forced, transaction depth was '.$depth.')':''), (($disconnectdone && $depth)?LOG_WARNING:LOG_INFO)); } diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index e6fbd7e59bc..dc509384335 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -39,7 +39,7 @@ */ function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='') { - global $langs, $hselected; + global $langs; print "\n\n\n"; @@ -48,7 +48,7 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat $head[$h][1] = $langs->trans("Report"); $head[$h][2] = 'report'; - dol_fiche_head($head, $hselected); + dol_fiche_head($head, 'report'); print ''; foreach($moreparam as $key => $value) diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index a59031b4a44..a339d65d54d 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -210,7 +210,7 @@ class modUser extends DolibarrModules $this->export_label[$r]='Liste des utilisateurs Dolibarr et attributs'; $this->export_permission[$r]=array(array("user","user","export")); $this->export_fields_array[$r]=array('u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.office_phone'=>'Phone','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",'u.admin'=>"Administrator",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion','u.fk_socpeople'=>"IdContact",'u.fk_societe'=>"IdCompany",'u.fk_member'=>"MemberId"); - $this->export_TypeFields_array[$r]=array('u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.office_phone'=>'Text','u.office_fax'=>'Text','u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date','u.datepreviouslogin'=>'Date','u.fk_societe'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:nom"); + $this->export_TypeFields_array[$r]=array('u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.office_phone'=>'Text','u.office_fax'=>'Text','u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date','u.datepreviouslogin'=>'Date','u.fk_societe'=>"Text",'u.fk_member'=>"Text"); $this->export_entities_array[$r]=array('u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.office_phone'=>'user','u.office_fax'=>'user','u.email'=>'user','u.datec'=>"user",'u.tms'=>"user",'u.admin'=>"user",'u.statut'=>'user','u.note'=>"user",'u.datelastlogin'=>'user','u.datepreviouslogin'=>'user','u.fk_socpeople'=>"contact",'u.fk_societe'=>"company",'u.fk_member'=>"member"); if (empty($conf->adherent->enabled)) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 7cb2cc7cdf3..108fb8e1339 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -194,7 +194,7 @@ else { diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index d49e2f561c9..415fd35f05e 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -46,7 +46,6 @@ class Export // To store export modules var $hexa; - var $hexafilter; var $hexafiltervalue; var $datatoexport; var $model_name; @@ -627,9 +626,6 @@ class Export $this->db->begin(); $filter=''; - if (! empty($this->hexafilter) && ! empty($this->hexafiltervalue)) { - $filter = json_encode(array('field' => $this->hexafilter, 'value' => $this->hexafiltervalue)); - } $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'export_model ('; $sql.= 'label,'; @@ -638,12 +634,12 @@ class Export $sql.= 'filter'; $sql.= ') VALUES ('; $sql.= "'".$this->db->escape($this->model_name)."',"; - $sql.= "'".$this->datatoexport."',"; - $sql.= "'".$this->hexa."',"; - $sql.= (! empty($filter)?"'".$filter."'":"null"); + $sql.= "'".$this->db->escape($this->datatoexport)."',"; + $sql.= "'".$this->db->escape($this->hexa)."',"; + $sql.= "'".$this->db->escape($this->hexafiltervalue)."'"; $sql.= ")"; - dol_syslog("Export::create", LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -667,7 +663,7 @@ class Export */ function fetch($id) { - $sql = 'SELECT em.rowid, em.field, em.label, em.type, em.filter'; + $sql = 'SELECT em.rowid, em.label, em.type, em.field, em.filter'; $sql.= ' FROM '.MAIN_DB_PREFIX.'export_model as em'; $sql.= ' WHERE em.rowid = '.$id; @@ -679,13 +675,11 @@ class Export if ($obj) { $this->id = $obj->rowid; - $this->hexa = $obj->field; $this->model_name = $obj->label; $this->datatoexport = $obj->type; - - $filter = json_decode($obj->filter, true); - $this->hexafilter = (isset($filter['field'])?$filter['field']:''); - $this->hexafiltervalue = (isset($filter['value'])?$filter['value']:''); + + $this->hexa = $obj->field; + $this->hexafiltervalue = $obj->filter; return 1; } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index d76350e878f..4eac9e03342 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -99,7 +99,7 @@ $entitytolang = array( ); $array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array(); -$array_filtervalue=isset($_SESSION["export_FilterValue_fields"])?$_SESSION["export_FilterValue_fields"]:array(); +$array_filtervalue=isset($_SESSION["export_filtered_fields"])?$_SESSION["export_filtered_fields"]:array(); $datatoexport=GETPOST("datatoexport"); $action=GETPOST('action', 'alpha'); $confirm=GETPOST('confirm', 'alpha'); @@ -222,7 +222,6 @@ if ($action=='downfield' || $action=='upfield') if ($step == 1 || $action == 'cleanselect') { $_SESSION["export_selected_fields"]=array(); - //$_SESSION["export_FilterValue_fields"]=array(); $_SESSION["export_filtered_fields"]=array(); $array_selected=array(); $array_filtervalue=array(); @@ -280,12 +279,15 @@ if ($action == 'add_export_model') } $hexafiltervalue=''; - foreach($array_filtervalue as $key=>$val) + if (! empty($array_filtervalue) && is_array($array_filtervalue)) { - if ($hexafilter) $hexafiltervalue.=','; - $hexafiltervalue.=$key.'='.$val; + foreach($array_filtervalue as $key=>$val) + { + if ($hexafiltervalue) $hexafiltervalue.=','; + $hexafiltervalue.=$key.'='.$val; + } } - + $objexport->model_name = $export_name; $objexport->datatoexport = $datatoexport; $objexport->hexa = $hexa; @@ -311,10 +313,11 @@ if ($action == 'add_export_model') } } +// Reload an predefined export model if ($step == 2 && $action == 'select_model') { $_SESSION["export_selected_fields"]=array(); - $_SESSION["export_FilterValue_fields"]=array(); + $_SESSION["export_filtered_fields"]=array(); $array_selected=array(); $array_filtervalue=array(); @@ -331,16 +334,15 @@ if ($step == 2 && $action == 'select_model') } $_SESSION["export_selected_fields"]=$array_selected; - $fieldsarray=explode(',',$objexport->hexafilter); $fieldsarrayvalue=explode(',',$objexport->hexafiltervalue); $i=1; - foreach($fieldsarray as $val) + foreach($fieldsarrayvalue as $val) { $tmp=explode('=',$val); $array_filtervalue[$tmp[0]]=$tmp[1]; $i++; } - $_SESSION["export_FilterValue_fields"]=$array_filtervalue; + $_SESSION["export_filtered_fields"]=$array_filtervalue; } } @@ -350,7 +352,7 @@ if ($step == 4 && $action == 'submitFormField') // on boucle sur les champs selectionne pour recuperer la valeur if (is_array($objexport->array_export_TypeFields[0])) { - $_SESSION["export_FilterValue_fields"]=array(); + $_SESSION["export_filtered_fields"]=array(); //var_dump($_POST); foreach($objexport->array_export_TypeFields[0] as $code => $type) // $code: s.fieldname $value: Text|Boolean|List:ccc { @@ -366,7 +368,7 @@ if ($step == 4 && $action == 'submitFormField') } } $array_filtervalue=(! empty($objexport->array_export_FilterValue[0])?$objexport->array_export_FilterValue[0]:''); - $_SESSION["export_FilterValue_fields"]=$array_filtervalue; + $_SESSION["export_filtered_fields"]=$array_filtervalue; } } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 6fb4d374a7a..69ec8984cf6 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Ferran Marcet @@ -324,24 +324,34 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) } else { - // Extrafields - $extrafields = new ExtraFields($db); - $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $array_option = $extrafields->getOptionalsFromPost($extralabels); + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) { + $error ++; + $action = 'create'; + } - $object->array_options = $array_option; + if (! $error) + { + // Extrafields + $extrafields = new ExtraFields($db); + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $array_option = $extrafields->getOptionalsFromPost($extralabels); - $result = $object->create($user); - if ($result > 0) - { - $id=$result; // Force raffraichissement sur fiche venant d'etre cree - } - else - { - $langs->load("errors"); - setEventMessages($object->error, $object->errors, 'errors'); - $action = 'create'; - } + $object->array_options = $array_option; + + $result = $object->create($user); + if ($result > 0) + { + $id=$result; // Force raffraichissement sur fiche venant d'etre cree + } + else + { + $langs->load("errors"); + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'create'; + } + } } } else diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index cf5c8f78744..53c2987ace7 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -535,7 +535,7 @@ if (! defined('NOLOGIN')) { // We are already into an authenticated session $login=$_SESSION["dol_login"]; - dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login); + dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login, LOG_DEBUG); $resultFetchUser=$user->fetch('',$login); if ($resultFetchUser <= 0) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a0ade451c53..f30874690fa 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2169,7 +2169,7 @@ class Product extends CommonObject $sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')"; if ($mode == 'bynumber') $sql.= ", count(DISTINCT c.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as d, ".MAIN_DB_PREFIX."commande_fournisseur as c, ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->fournisseur->lire && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.rowid = d.fk_commande"; $sql.= " AND d.fk_product =".$this->id; $sql.= " AND c.fk_soc = s.rowid"; @@ -3447,6 +3447,12 @@ class Product extends CommonObject { dol_delete_file($dirthumb.$photo_vignette); } + + $photo_vignette=preg_replace('/'.$regs[0].'/i','',$filename).'_mini'.$regs[0]; + if (file_exists(dol_osencode($dirthumb.$photo_vignette))) + { + dol_delete_file($dirthumb.$photo_vignette); + } } } diff --git a/htdocs/product/price.php b/htdocs/product/price.php index e4a46c76674..6992b1b5a99 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -748,9 +748,8 @@ $sql .= " " . MAIN_DB_PREFIX . "user as u"; $sql .= " WHERE fk_product = " . $object->id; $sql .= " AND p.entity IN (" . getEntity('productprice', 1) . ")"; $sql .= " AND p.fk_user_author = u.rowid"; -if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) - $sql .= " AND p.price_level = " . $soc->price_level; -$sql .= " ORDER BY p.date_price DESC, p.price_level ASC"; +if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) $sql .= " AND p.price_level = " . $soc->price_level; +$sql .= " ORDER BY p.date_price DESC, p.price_level ASC, p.rowid DESC"; // $sql .= $db->plimit(); $result = $db->query($sql); diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index f8b5829b03e..53d5daedb6e 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -2,6 +2,7 @@ /* Copyright (C) 2012-2013 Philippe Berthet * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Ferran Marcet * * Version V1.1 Initial version of Philippe Berthet * Version V2 Change to be compatible with 3.4 and enhanced to be more generic @@ -197,7 +198,7 @@ if ($type_element == 'invoice') { // Customer : show products from invoices require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $documentstatic=new Facture($db); - $sql_select = 'SELECT f.rowid as doc_id, f.facnumber as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, '; + $sql_select = 'SELECT f.rowid as doc_id, f.facnumber as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, '; $tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d"; $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_facture = f.rowid"; @@ -228,7 +229,7 @@ if ($type_element == 'order') $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_commande = c.rowid"; $where.= " AND c.entity = ".$conf->entity; - $dateprint = 'c.datef'; + $dateprint = 'c.date_commande'; $doc_number='c.ref'; $thirdTypeSelect='customer'; } @@ -335,11 +336,12 @@ if ($sql_select) { $documentstatic->id=$objp->doc_id; $documentstatic->ref=$objp->doc_number; - $documentstatic->type=$objp->type; + $documentstatic->type=$objp->doc_type; $documentstatic->fk_statut=$objp->status; $documentstatic->fk_status=$objp->status; $documentstatic->statut=$objp->status; $documentstatic->status=$objp->status; + $documentstatic->paye=$objp->paid; $var=!$var; print ""; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 2a9e159558c..bddbd174f6e 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -137,7 +137,7 @@ if (empty($reshook)) $object->particulier = GETPOST("private"); $object->name = dolGetFirstLastname(GETPOST('firstname','alpha'),GETPOST('nom','alpha')?GETPOST('nom','alpha'):GETPOST('name','alpha')); - $object->civility_id = GETPOST('civility_id', 'int'); + $object->civility_id = GETPOST('civility_id'); // Add non official properties $object->name_bis = GETPOST('name','alpha')?GETPOST('name','alpha'):GETPOST('nom','alpha'); $object->firstname = GETPOST('firstname','alpha');
tva_assuj == "0") echo '0'; + if ($seller->tva_assuj == "0") echo ''.vatrate(0, true); else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer); ?>