diff --git a/ChangeLog b/ChangeLog index 30887bd8379..567c3eaf542 100644 --- a/ChangeLog +++ b/ChangeLog @@ -229,6 +229,7 @@ Dolibarr better: 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 +FIX [ bug #3055 ] Product image thumbnails were not deleted after deleting the image ***** ChangeLog for 3.7.1 compared to 3.7.* ***** FIX Bug in the new photo system @@ -485,6 +486,7 @@ Dolibarr better: - Fix: [ bug #2542 ] Contracts store localtax preferences - Fix: Bad permission assignments for stock movements actions - Fix: [ bug #2891 ] Category hooks do not work +- Fix: [ bug #2696 ] Adding complementary attribute fails if code is numerics ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. @@ -664,6 +666,10 @@ 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 +Fix: [ bug #2715 ] Statistics page has broken layout with long thirdparty names +Fix: [ bug #2570 ] [Contacts] Page should not process if ID is invalid +Fix: [ bug #3268 ] SQL error when accessing thirdparty log page without a socid parameter +Fix: [ bug #3180 ] formObjectOptions hook when editing thirdparty card does not print result ***** ChangeLog for 3.5.6 compared to 3.5.5 ***** Fix: Avoid missing class error for fetch_thirdparty method #1973 diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index f336cefda98..b1cd1442f08 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1263,7 +1263,7 @@ class AccountLine extends CommonObject if ($this->rappro) { // Protection to avoid any delete of consolidated lines - $this->error="DeleteNotPossibleLineIsConsolidated"; + $this->error="ErrorDeleteNotPossibleLineIsConsolidated"; return -1; } diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 3dc2461de28..4eeea76abc0 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -218,6 +218,13 @@ complete_head_from_modules($conf,$langs,null,$head,$h,$type); dol_fiche_head($head,'byyear',$langs->trans("Statistics")); +$tmp_companies = $form->select_thirdparty_list($socid,'socid',$filter,1, 0, 0, array(), '', 1); +//Array passed as an argument to Form::selectarray to build a proper select input +$companies = array(); + +foreach ($tmp_companies as $value) { + $companies[$value['value']] = $value['label']; +} print '
'; @@ -233,7 +240,7 @@ print '
'; print ''.$langs->trans("ThirdParty").''; if ($mode == 'customer') $filter='s.client in (1,2,3)'; if ($mode == 'supplier') $filter='s.fournisseur = 1'; - print $form->select_company($socid,'socid',$filter,1); + print $form->selectarray('socid', $companies, $socid, 1, 0, 0, 'style="width: 100%"'); print ''; // User print ''.$langs->trans("CreatedBy").''; diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 2ef37c29e18..820d3a34fcc 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -87,7 +87,7 @@ class RejetPrelevement dol_syslog("RejetPrelevement::Create id $id"); $bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT; - $facs = $this->getListInvoices(); + $facs = $this->getListInvoices(1); $this->db->begin(); @@ -132,7 +132,7 @@ class RejetPrelevement for ($i = 0; $i < $num; $i++) { $fac = new Facture($this->db); - $fac->fetch($facs[$i]); + $fac->fetch($facs[$i][0]); // Make a negative payment $pai = new Paiement($this->db); @@ -144,7 +144,7 @@ class RejetPrelevement * PHP installs sends only the part integer negative */ - $pai->amounts[$facs[$i]] = price2num($fac->total_ttc * -1); + $pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * -1); $pai->datepaye = $date_rejet; $pai->paiementid = 3; // type of payment: withdrawal $pai->num_paiement = $fac->ref; @@ -152,7 +152,7 @@ class RejetPrelevement if ($pai->create($this->user) < 0) // we call with no_commit { $error++; - dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i]); + dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]); } else { @@ -270,22 +270,24 @@ class RejetPrelevement } /** - * Retrieve the list of invoices + * Retrieve the list of invoices * - * @return array + * @param int $amounts If you want to get the amount of the order for each invoice + * @return array Array List of invoices related to the withdrawal line + * @TODO A withdrawal line is today linked to one and only one invoice. So the function should return only one object ? */ - private function getListInvoices() + private function getListInvoices($amounts=0) { global $conf; $arr = array(); //Returns all invoices of a withdrawal - $sql = "SELECT f.rowid as facid"; + $sql = "SELECT f.rowid as facid, pl.amount"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf"; - $sql.= ", ".MAIN_DB_PREFIX."facture as f"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_lignes as pl ON (pf.fk_prelevement_lignes = pl.rowid)"; $sql.= " WHERE pf.fk_prelevement_lignes = ".$this->id; - $sql.= " AND pf.fk_facture = f.rowid"; $sql.= " AND f.entity = ".$conf->entity; $resql=$this->db->query($sql); @@ -299,7 +301,14 @@ class RejetPrelevement while ($i < $num) { $row = $this->db->fetch_row($resql); - $arr[$i] = $row[0]; + if (!$amounts) $arr[$i] = $row[0]; + else + { + $arr[$i] = array( + $row[0], + $row[1] + ); + } $i++; } } @@ -307,7 +316,7 @@ class RejetPrelevement } else { - dol_syslog("RejetPrelevement Erreur"); + dol_syslog("getListInvoices", LOG_ERR); } return $arr; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 45b2c51acfa..ade44bff415 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -317,16 +317,19 @@ class PaymentSocialContribution extends CommonObject global $conf, $langs; $error=0; + dol_syslog(get_class($this)."::delete"); + $this->db->begin(); - if (! $error) + if ($this->bank_line > 0) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url"; - $sql.= " WHERE type='payment_sc' AND url_id=".$this->id; - - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + $accline = new AccountLine($this->db); + $accline->fetch($this->bank_line); + $result = $accline->delete(); + if($result < 0) { + $this->errors[] = $accline->error; + $error++; + } } if (! $error) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 0278a864c2f..29d266eff51 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -809,7 +809,7 @@ else print ''; // Jabberid - print ''; + print ''; print 'jabberid).'">'; if (! empty($conf->mailing->enabled)) { diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index e1a5468cfb9..7731ee85e7f 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -568,7 +568,7 @@ class Contact extends CommonObject $this->country_id = $obj->country_id; $this->country_code = $obj->country_id?$obj->country_code:''; - $this->country = ($obj->country_id > 0)?$langs->transnoentitiesnoconv("Country".$obj->country_code):''; + $this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):''; $this->socid = $obj->fk_soc; $this->socname = $obj->socname; diff --git a/htdocs/contact/info.php b/htdocs/contact/info.php index 96e24a0b67c..3ad4f0779af 100644 --- a/htdocs/contact/info.php +++ b/htdocs/contact/info.php @@ -36,6 +36,8 @@ $contactid = GETPOST("id",'int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe'); +$contact = new Contact($db); + /* @@ -45,23 +47,23 @@ $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(" llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'); +if ($contactid > 0) +{ + $result = $contact->fetch($contactid, $user); -$contact = new Contact($db); -$contact->fetch($contactid, $user); -$contact->info($contactid); + $contact->info($contactid); -$head = contact_prepare_head($contact); + $head = contact_prepare_head($contact); -dol_fiche_head($head, 'info', $title, 0, 'contact'); + dol_fiche_head($head, 'info', $title, 0, 'contact'); + // TODO Put here ref of card -print '
'; -print '
'; + dol_print_object_info($contact); -dol_print_object_info($contact); - -print "
"; + dol_fiche_end(); +} llxFooter(); diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 170ed039904..187dea70def 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -40,7 +40,10 @@ if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $contact = new Contact($db); -$contact->fetch($id, $user); +if ($id > 0) +{ + $contact->fetch($id, $user); +} /* @@ -132,7 +135,8 @@ print 'LDAP '.$langs->trans("LDAPServerPort").''; -print '
'; +dol_fiche_end(); + /* * Barre d'actions @@ -204,6 +208,6 @@ print ''; -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index 77abf31ac89..5d71ba88f26 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -28,14 +28,20 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php'; +$contact = new Contact($db); + $id = GETPOST('id', 'int'); // Security check $result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); -$contact = new Contact($db); $result=$contact->fetch($id); +if (! $result) +{ + dol_print_error($contact->error); + exit; +} $physicalperson=1; @@ -43,7 +49,6 @@ $company = new Societe($db); if ($contact->socid) { $result=$company->fetch($contact->socid); - //print "ee"; } // We create VCard @@ -100,4 +105,3 @@ header("Connection: close"); header("Content-Type: text/x-vcard; name=\"".$filename."\""); print $output; - diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 4c5f0b512d2..8ac95358bb8 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -125,7 +125,7 @@ if ($action == 'add') if (! $error) { // attrname must be alphabetical and lower case only - if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname'])) + if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname']) && !is_numeric($_POST["attrname"])) { // Construct array for parameter (value of select list) $default_value = GETPOST('default_value'); diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index bbcd19b5234..331a5e87513 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2015 Regis Houssin * * 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 @@ -26,6 +26,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 5cc60cb8bd4..41ae45ef638 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -33,6 +33,18 @@ abstract class CommonDocGenerator { var $error=''; + protected $db; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) { + $this->db = $db; + return 1; + } /** diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d9f8daa9882..bb031b0a8de 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -352,7 +352,7 @@ abstract class CommonObject $sql = "SELECT rowid, ref, ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX.$element; - $sql.= " WHERE entity IN (".getEntity($element,1).")" ; + $sql.= " WHERE entity IN (".getEntity($element, true).")" ; 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 765503b7a4d..de85fd445f6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -984,7 +984,7 @@ class Form $out.= ''; } - array_push($outarray, array('key'=>$obj->rowid, 'value'=>$obj->name, 'label'=>$obj->name)); + array_push($outarray, array('key'=>$obj->rowid, 'value'=>$obj->rowid, 'label'=>$label)); $i++; if (($i % 10) == 0) $out.="\n"; @@ -2384,6 +2384,8 @@ class Form dol_syslog(__METHOD__, LOG_DEBUG); + $langs->load('propal'); + $sql = "SELECT rowid, code, label"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_availability'; $sql.= " WHERE active > 0"; diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index bc9f9081a49..ec3d381354b 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -150,7 +150,7 @@ class vCard { $this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); $this->filename = "$first%20$family.vcf"; - if ($this->properties["FN"]=="") $this->setFormattedName(trim("$prefix $first $additional $family $suffix")); + if (empty($this->properties["FN"])) $this->setFormattedName(trim("$prefix $first $additional $family $suffix")); } /** diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index b60d21ec814..2f197d8b645 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -388,7 +388,6 @@ function dol_is_url($url) return false; } - /** * Test if a folder is empty * diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index e759bf9454a..b7607e3920e 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -203,7 +203,7 @@ abstract class DolibarrModules // We should but can't set this as abstract because this will make dolibarr hang // after migration due to old module not implementing. We must wait PHP is able to make // a try catch on Fatal error to manage this correctly. - + /** * Enables a module. * Inserts all informations into database @@ -1392,7 +1392,7 @@ print $sql; $menu->user=$this->menu[$key]['user']; $menu->enabled=isset($this->menu[$key]['enabled'])?$this->menu[$key]['enabled']:0; $menu->position=$this->menu[$key]['position']; - + if (! $err) { $result=$menu->create($user); // Save menu entry into table llx_menu @@ -1587,7 +1587,6 @@ print $sql; global $conf; $error=0; - $entity=$conf->entity; if (is_array($this->module_parts) && ! empty($this->module_parts)) { @@ -1595,22 +1594,28 @@ print $sql; { if (is_array($value) && count($value) == 0) continue; // Discard empty arrays - $newvalue = $value; + $entity=$conf->entity; // Reset the current entity + $newvalue = $value; - // Serialize array parameters - if (is_array($value)) - { - // Can defined other parameters - if (is_array($value['data']) && ! empty($value['data'])) - { - $newvalue = json_encode($value['data']); - if (isset($value['entity'])) $entity = $value['entity']; - } - else - { - $newvalue = json_encode($value); - } - } + // Serialize array parameters + if (is_array($value)) + { + // Can defined other parameters + if (is_array($value['data']) && ! empty($value['data'])) + { + $newvalue = json_encode($value['data']); + if (isset($value['entity'])) $entity = $value['entity']; + } + else if (isset($value['data']) && !is_array($value['data'])) + { + $newvalue = $value['data']; + if (isset($value['entity'])) $entity = $value['entity']; + } + else + { + $newvalue = json_encode($value); + } + } $sql = "INSERT INTO ".MAIN_DB_PREFIX."const ("; $sql.= "name"; diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 85bf6151055..3da80b1cc96 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -252,6 +252,13 @@ class ExportCsv extends ModeleExports $newvalue=$this->csv_clean($newvalue,$outputlangs->charset_output); + if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) + { + $array = unserialize($typefield); + $array = $array['options']; + $newvalue = $array[$newvalue]; + } + fwrite($this->handle,$newvalue.$this->separator); $this->col++; } diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index 05a2c68f5d9..a59eb881e83 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -326,7 +326,14 @@ class ExportExcel extends ModeleExports $newvalue=$this->excel_clean($newvalue); $typefield=isset($array_types[$code])?$array_types[$code]:''; - + + if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) + { + $array = unserialize($typefield); + $array = $array['options']; + $newvalue = $array[$newvalue]; + } + // Traduction newvalue if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) { diff --git a/htdocs/core/modules/export/export_tsv.modules.php b/htdocs/core/modules/export/export_tsv.modules.php index a1b553bbe57..dad3a4b67f9 100644 --- a/htdocs/core/modules/export/export_tsv.modules.php +++ b/htdocs/core/modules/export/export_tsv.modules.php @@ -226,7 +226,14 @@ class ExportTsv extends ModeleExports if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) $newvalue=$outputlangs->transnoentities($reg[1]); $newvalue=$this->tsv_clean($newvalue,$outputlangs->charset_output); - + + if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) + { + $array = unserialize($typefield); + $array = $array['options']; + $newvalue = $array[$newvalue]; + } + fwrite($this->handle,$newvalue.$this->separator); $this->col++; } diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 1d7848f5f46..29eb7d62447 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -360,6 +360,8 @@ class modSociete extends DolibarrModules $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options'])); if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; + case 'select': + $typeFilter="Select:".$obj->param; break; } $this->export_fields_array[$r][$fieldname]=$fieldlabel; diff --git a/htdocs/core/tpl/document_actions_pre_headers.tpl.php b/htdocs/core/tpl/document_actions_pre_headers.tpl.php index 40bd0a5368e..1e4dbc7c5bb 100644 --- a/htdocs/core/tpl/document_actions_pre_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_pre_headers.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2015 Marcos García * * 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 @@ -58,7 +59,27 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') if ($urlfile) { + $dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine + $dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette + $ret = dol_delete_file($file, 0, 0, 0, $object); + + // Si elle existe, on efface la vignette + if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i',$file,$regs)) + { + $photo_vignette=basename(preg_replace('/'.$regs[0].'/i','',$file).'_small'.$regs[0]); + if (file_exists(dol_osencode($dirthumb.$photo_vignette))) + { + dol_delete_file($dirthumb.$photo_vignette); + } + + $photo_vignette=basename(preg_replace('/'.$regs[0].'/i','',$file).'_mini'.$regs[0]); + if (file_exists(dol_osencode($dirthumb.$photo_vignette))) + { + dol_delete_file($dirthumb.$photo_vignette); + } + } + if ($ret) setEventMessage($langs->trans("FileWasRemoved", $urlfile)); else setEventMessage($langs->trans("ErrorFailToDeleteFile", $urlfile), 'errors'); } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 4daf1bc590f..46f63fc5f32 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -65,7 +65,7 @@ ErrorNoValueForCheckBoxType=Please fill value for checkbox list ErrorNoValueForRadioType=Please fill value for radio list ErrorBadFormatValueList=The list value cannot have more than one come : %s, but need at least one: llave,valores ErrorFieldCanNotContainSpecialCharacters=Field %s must not contains special characters. -ErrorFieldCanNotContainSpecialNorUpperCharacters=Field %s must not contains special characters, nor upper case characters. +ErrorFieldCanNotContainSpecialNorUpperCharacters=Field %s must not contain special characters, nor upper case characters and cannot contain only numbers. ErrorNoAccountancyModuleLoaded=No accountancy module activated ErrorExportDuplicateProfil=This profile name already exists for this export set. ErrorLDAPSetupNotComplete=Dolibarr-LDAP matching is not complete. diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index c0fe6ce83b3..b359c5f368d 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -109,3 +109,4 @@ CategorieRecursivHelp=Si activé : quand un élément est ajouté dans une cat AddProductServiceIntoCategory=Ajouter le produit/service suivant ShowCategory=Afficher tag/catégorie ByDefaultInList=Par défaut dans la liste +Translation=Traduction \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2e919469cf4..830a8b0eb11 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -612,7 +612,7 @@ if (! defined('NOLOGIN')) exit; } else - { + { // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('main')); diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index a7b39cd5f34..563cd45edeb 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -311,7 +311,7 @@ function getPaypalPaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f } // For multicompany - //$out.="&entity=".$conf->entity; // This should not be into link. Link contains already a ref of an object that allow to retreive entity + $out.="&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities return $out; } diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index a839f25a99a..8bd2096af69 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -192,11 +192,11 @@ if ($resql) if ($sref || $snom || $sall || GETPOST('search')) { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy.(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num); } else { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"").(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num); } if (! empty($catid)) @@ -246,7 +246,7 @@ if ($resql) print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); // TODO Add info of running suppliers/customers orders //print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); - print ' '; + print_liste_field_titre(''); print_liste_field_titre($langs->trans("Sell"),$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Buy"),$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; @@ -342,11 +342,11 @@ if ($resql) { if ($sref || $snom || $sall || GETPOST('search')) { - print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, ''); + print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy.(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, 0, ''); } else { - print_barre_liste('', $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, ''); + print_barre_liste('', $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell."&tobuy=".$tobuy.(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, 0, ''); } } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 3ae7bfcb71c..cb159f0d82b 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -205,8 +205,10 @@ if ($resql) $i = 0; $param=''; + if ($mine) $param.='&mode=mine'; if ($month) $param.='&month='.$month; if ($year) $param.='&year=' .$year; + if ($socid) $param.='&socid='.$socid; if ($search_all != '') $param.='&search_all='.$search_all; if ($search_ref != '') $param.='&search_ref='.$search_ref; if ($search_label != '') $param.='&search_label='.$search_label; @@ -266,7 +268,6 @@ if ($resql) print '
'; } - print ''; print ''; @@ -277,7 +278,7 @@ if ($resql) if (empty($conf->global->PROJECT_LIST_HIDE_STARTDATE)) print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"p.dateo","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"p.datee","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder); - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { print_liste_field_titre($langs->trans("OpportunityAmountShort"),$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("OpportunityStatusShort"),$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'',$sortfield,$sortorder); @@ -423,13 +424,13 @@ if ($resql) print ''; // Date start - if (empty($conf->global->PROJECT_LIST_HIDE_STARTDATE)) + if (empty($conf->global->PROJECT_LIST_HIDE_STARTDATE)) { print ''; } - + // Date end print ''; - + print ''; diff --git a/htdocs/societe/info.php b/htdocs/societe/info.php index b3586c4f327..198d31666c3 100644 --- a/htdocs/societe/info.php +++ b/htdocs/societe/info.php @@ -40,6 +40,7 @@ $result = restrictedArea($user, 'societe', $socid, '&societe'); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('infothirdparty')); +$object = new Societe($db); /* @@ -56,28 +57,38 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e * View */ -$object = new Societe($db); -$object->fetch($socid); -$object->info($socid); - $title=$langs->trans("ThirdParty"); if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Info"); $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$title,$help_url); +if ($socid > 0) +{ + $result = $object->fetch($socid); + if (! $result) + { + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); -$head = societe_prepare_head($object); + llxFooter(); + $db->close(); -dol_fiche_head($head, 'info', $langs->trans("ThirdParty"),0,'company'); + exit; + } + + $object->info($socid); + + $head = societe_prepare_head($object); + + dol_fiche_head($head, 'info', $langs->trans("ThirdParty"), 0, 'company'); + print '
'; print dol_print_date($db->jdate($objp->date_start),'day'); print ''; print dol_print_date($db->jdate($objp->date_end),'day'); @@ -450,7 +451,7 @@ if ($resql) print ''; if ($objp->opp_status_code) print $langs->trans("OppAmount".$objp->opp_amount); print ''; if ($objp->opp_status_code) print $langs->trans("OppStatusShort".$objp->opp_status_code); print '
'; + dol_print_object_info($object); + print '
'; -print '
'; -dol_print_object_info($object); -print '
'; - - -dol_fiche_end(); + dol_fiche_end(); +} llxFooter(); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index c4e95abcb8e..5bd270c1ef5 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1256,6 +1256,7 @@ else // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; if (empty($reshook) && ! empty($extrafields->attribute_label)) { print $object->showOptionals($extrafields,'edit'); @@ -1777,6 +1778,7 @@ else // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; if (empty($reshook) && ! empty($extrafields->attribute_label)) { print $object->showOptionals($extrafields,'edit'); diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 86891e87595..9d26ce52fb2 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -1095,11 +1095,11 @@ function getProductsForCategory($authentication,$id,$lang='') $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('product',true); //Get extrafield values - $product->fetch_optionals($obj->id,$extralabels); + $obj->fetch_optionals($obj->id,$extralabels); foreach($extrafields->attribute_label as $key=>$label) { - $products[$iProduct]=array_merge($products[$iProduct],array('options_'.$key => $product->array_options['options_'.$key])); + $products[$iProduct]=array_merge($products[$iProduct],array('options_'.$key => $obj->array_options['options_'.$key])); } $iProduct++;