diff --git a/ChangeLog b/ChangeLog index 255810a05ff..6664dbe8941 100644 --- a/ChangeLog +++ b/ChangeLog @@ -407,6 +407,38 @@ Following changes may create regressions for some external modules, but were nec where {TYPE} is contact type code (BILLING, SHIPPING, CUSTOMER, ... see contact type dictionnary). +***** ChangeLog for 7.0.5 compared to 7.0.4 ***** +FIX: #3234 +FIX: #6580 +FIX: #8741 +FIX: #9934 +FIX: avoid Class 'AdherentType' not found +FIX: Can't create a thirdparty from member if customer code is mandatory. +FIX: Can't generate invoice pdf +FIX: contact/adress tab: when changing company ajax combo, the first contact change is not taken into account +FIX: Error generating ODT when option to use contact on doc on +FIX: Error reported when creation of thirdparty from member fails +FIX: filter on product category doesn't work +FIX: form actions: select_type_actions could be too small + bad init +FIX: fourn payment modes musn't be available on customer docs +FIX: Function updatePrice with wrong parameters +FIX: If we change customer/supplier rule we can't edit old thirdparty. +FIX: Interface regression for bind people. Fix option MAIN_OPTIMIZEFORTEXTBROWSER +FIX: Lines are not inserted correctly if VAT have code +FIX: OppStatusShort doesn't exists +FIX: pdf typhon: order reference duplicate +FIX: propal pdf: missing parenthesis for customs code +FIX: Same on customer card +FIX: same on lines +FIX: Select first mail model by default +FIX: sql query performance on list_qualified_avoir_supplier_invoices. +FIX: task time screen: last fix was overkill +FIX: task time screen: prevent users with access to all project from assigning to tasks they're not allowed to do +FIX: use discount with multicurrency +FIX: Variable name +FIX: We want to be able to send PDF of paid invoices +FIX: When delete a product, llx_product_association rows are not deleted +FIX: wrong occurence number of contract on contact card, we must only count externals ***** ChangeLog for 7.0.4 compared to 7.0.3 ***** FIX: #8984 button create expense report diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 7da96a65951..6bf387c9b0e 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -8,6 +8,7 @@ * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017 Frédéric France + * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -369,6 +370,18 @@ if ($result) { $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentloanstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id; //$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount; + $sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest'; + $sqlmid.= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l'; + $sqlmid.= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.$obj->rowid; + + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $tabtp[$obj->rowid][$objmid->accountancy_account_capital] -= $objmid->amount_capital; + $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] -= $objmid->amount_insurance; + $tabtp[$obj->rowid][$objmid->accountancy_account_interest] -= $objmid->amount_interest; + } } else if ($links[$key]['type'] == 'banktransfert') { $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer"); $tabtp[$obj->rowid][$account_transfer] += $obj->amount; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 0d7869d12db..62b3a3e59a4 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -428,7 +428,7 @@ if (empty($reshook)) } $typeid=GETPOST("typeid",'int'); - $civility_id=GETPOST("civility_id",'int'); + $civility_id=GETPOST("civility_id",'alpha'); $lastname=GETPOST("lastname",'alpha'); $firstname=GETPOST("firstname",'alpha'); $societe=GETPOST("societe",'alpha'); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 9d61ea07afa..c7807bc6b00 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -219,7 +219,9 @@ class Adherent extends CommonObject // Substitutions $substitutionarray=array( - '__CIVILITY__'=>$this->getCivilityLabel(), + '__ID__'=>$this->id, + '__MEMBER_ID__'=>$this->id, + '__CIVILITY__'=>$this->getCivilityLabel(), '__FIRSTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname, '__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname, '__FULLNAME__'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs), diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 53d1ff60836..a41438c4097 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -347,7 +347,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! if (! $error) { // Send confirmation Email - if ($object->email && $sendalsoemail) + if ($object->email && $sendalsoemail) // $object is 'Adherent' { $subject = ''; $msg= ''; @@ -859,8 +859,16 @@ if ($rowid > 0) { $tmpcompany = new Societe($db); $tmpcompany->name=$companyname; - $customercode = $tmpcompany->get_codeclient($tmpcompany,0); - $formquestion[]=array('label' => $langs->trans("CustomerCode"), 'type' => 'text', 'name' => 'customercode', 'value' => $customercode, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"'); + $tmpcompany->get_codeclient($tmpcompany, 0); + $customercode = $tmpcompany->code_client; + $formquestion[]=array( + 'label' => $langs->trans("CustomerCode"), + 'type' => 'text', + 'name' => 'customercode', + 'value' => $customercode, + 'morecss' => 'minwidth300', + 'moreattr' => 'maxlength="128"', + ); } // @TODO Add other extrafields mandatory for thirdparty creation diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 84271cff38f..6d56ba415c1 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -376,6 +376,11 @@ if ($result) print ''; } + if (! empty($conf->multicompany->enabled) && !$user->entity) + { + print ''; + } + // Actions print ''; if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index a60e0be68c8..e1e0c0d419e 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -794,7 +794,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; $i++; } - $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; + $sql.= " WHERE ".$rowidcol." = '".$db->escape($rowid)."'"; if (in_array('entity', $listfieldmodify)) $sql.= " AND entity = '".getEntity($tabname[$id])."'"; dol_syslog("actionmodify", LOG_DEBUG); @@ -818,7 +818,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } else { $rowidcol="rowid"; } - $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : ''); + $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = " . (int) $entity : ''); dol_syslog("delete", LOG_DEBUG); $result = $db->query($sql); @@ -842,7 +842,7 @@ if ($action == $acts[0]) else { $rowidcol="rowid"; } if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : ''); + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = " . (int) $entity : ''); } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : ''); @@ -862,7 +862,7 @@ if ($action == $acts[1]) else { $rowidcol="rowid"; } if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : ''); + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = " . (int) $entity : ''); } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : ''); @@ -882,7 +882,7 @@ if ($action == 'activate_favorite') else { $rowidcol="rowid"; } if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : ''); + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = " . (int) $entity : ''); } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : ''); @@ -902,7 +902,7 @@ if ($action == 'disable_favorite') else { $rowidcol="rowid"; } if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : ''); + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = " . (int) $entity : ''); } elseif ($code) { $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : ''); @@ -967,7 +967,7 @@ if (GETPOST('from')) $paramwithsearch.= '&from='.urlencode(GETPOST('from','alpha // Confirmation de la suppression de la ligne if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'rowid='.$rowid.'&code='.urlencode($code).$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'rowid='.urlencode($rowid).'&code='.urlencode($code).$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); } //var_dump($elementList); @@ -1367,8 +1367,8 @@ if ($id) print ''; print '
'; - print ''; - print ''; + print ''; + print ''; if (! is_null($withentity)) print ''; print ''; @@ -1622,14 +1622,14 @@ if ($id) if ($id == 4) { print ''; - if ($iserasable) print ''.$actl[$obj->favorite].''; + if ($iserasable) print ''.$actl[$obj->favorite].''; else print $langs->trans("AlwaysActive"); print ''; } // Active print ''; - if ($canbedisabled) print ''.$actl[$obj->active].''; + if ($canbedisabled) print ''.$actl[$obj->active].''; else { if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive"); diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 309d20e0abe..14b25aedac2 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -338,7 +338,6 @@ if (! $error && $xml) $out.=''; $out.=''.$i.'' . "\n"; $out.=''.$file['filename']; - $out.=PHP_OS; if (! preg_match('/^win/i',PHP_OS)) { $htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.'/'.$file['filename']); $out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'); diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index a0e992e9da9..e76f6c3a142 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -211,8 +211,7 @@ class Facturation $total_localtax1 = 0; $total_localtax2 = 0; - $tab=array(); - $tab = $_SESSION['poscart']; + $tab = (! empty($_SESSION['poscart'])?$_SESSION['poscart']:array()); $tab_size=count($tab); for($i=0;$i < $tab_size;$i++) diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 24b94562915..c09521585e6 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -41,6 +41,8 @@ if ( $_SESSION['uid'] > 0 ) $usertxt=GETPOST('user','',1); $err=GETPOST("err"); +// Instantiate hooks of thirdparty module only if not already define +$hookmanager->initHooks(array('cashdeskloginpage')); /* * View @@ -51,6 +53,15 @@ $formproduct=new FormProduct($db); $arrayofcss=array('/cashdesk/css/style.css'); top_htmlhead('','',0,0,'',$arrayofcss); + +// Execute hook getLoginPageOptions (for table) +$parameters=array('entity' => GETPOST('entity','int')); +$reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks. +if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) { + $morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility +} else { + $morelogincontent = $hookmanager->resPrint; +} ?> @@ -92,6 +103,24 @@ else + $option) + { + if ($format == 'table') { + echo ''; + echo $option; + } + } + } + else { + echo ''; + echo $morelogincontent; + } +} +?> +   diff --git a/htdocs/cashdesk/tpl/liste_articles.tpl.php b/htdocs/cashdesk/tpl/liste_articles.tpl.php index 65f48b0603c..082a1f901cd 100644 --- a/htdocs/cashdesk/tpl/liste_articles.tpl.php +++ b/htdocs/cashdesk/tpl/liste_articles.tpl.php @@ -46,8 +46,7 @@ $societe = new Societe($db); $societe->fetch($thirdpartyid); /** end add Ditto */ -$tab=array(); -$tab = $_SESSION['poscart']; +$tab = (! empty($_SESSION['poscart'])?$_SESSION['poscart']:array()); $tab_size=count($tab); if ($tab_size <= 0) print '
'.$langs->trans("NoArticle").'

'; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 2947319f812..ae411addb25 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -239,8 +239,15 @@ $sql.= " a.fk_contact, a.note, a.percent as percent,"; $sql.= " a.fk_element, a.elementtype,"; $sql.= " c.code as type_code, c.libelle as type_label,"; $sql.= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as phone_pro, sp.phone_mobile, sp.phone_perso, sp.fk_pays as country_id"; + // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); + +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_extrafields as ef ON (a.id = ef.fk_object) "; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; @@ -312,9 +319,15 @@ if ($filtert > 0 || $usergroup > 0) if ($dateselect > 0) $sql.= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect-3600)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'))"; if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'"; if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'"; + // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql.= $db->order($sortfield,$sortorder); $nbtotalofrecords = ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9ad79393499..8541581fb49 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1695,7 +1695,7 @@ if (empty($reshook)) setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); $error++; } - if ($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not '' + if (($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) // Unit price can be 0 but not '' { if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) { @@ -2155,7 +2155,7 @@ if (empty($reshook)) setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); $error++; } - if (empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && $pu_ht_devise == '') // Unit price can be 0 but not '' + if ((empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && $pu_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) // Unit price can be 0 but not '' { if ($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) { diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 3697a61672b..90a564fa006 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -164,7 +164,7 @@ class PaymentTerm // extends CommonObject global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; - $sql.= " t.entity"; + $sql.= " t.entity,"; $sql.= " t.code,"; $sql.= " t.sortorder,"; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 3bf42f0a538..33eeda9f4b2 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -2,6 +2,7 @@ /* Copyright (C) 2015-2017 Laurent Destailleur * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -516,7 +517,9 @@ if ($massaction == 'confirm_createbills') $objecttmp = new Facture($db); if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. else { - + // Load extrafields of order + $cmd->fetch_optionals(); + $objecttmp->socid = $cmd->socid; $objecttmp->type = Facture::TYPE_STANDARD; $objecttmp->cond_reglement_id = $cmd->cond_reglement_id; @@ -533,6 +536,8 @@ if ($massaction == 'confirm_createbills') $objecttmp->origin = 'commande'; $objecttmp->origin_id = $id_order; + $objecttmp->array_options = $cmd->array_options; // Copy extrafields + $res = $objecttmp->create($user); if($res > 0) $nb_bills_created++; @@ -682,6 +687,7 @@ if ($massaction == 'confirm_createbills') if (! $error && $validate_invoices) { $massaction = $action = 'builddoc'; + foreach($TAllFact as &$objecttmp) { $result = $objecttmp->validate($user); @@ -693,12 +699,18 @@ if ($massaction == 'confirm_createbills') } $id = $objecttmp->id; // For builddoc action + $object = $objecttmp; // Builddoc $donotredirect = 1; $upload_dir = $conf->facture->dir_output; $permissioncreate=$user->rights->facture->creer; + + // Call action to build doc + $savobject = $object; + $object = $objecttmp; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + $object = $savobject; } $massaction = $action = 'confirm_createbills'; diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 6afd6b1e354..da31b9dee96 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -1,6 +1,7 @@ - * +* Copyright (C) 2013 Juanjo Menent +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b6aa7826736..58df0ad4e22 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5812,22 +5812,31 @@ class Form * @param int $width Force width of select box. May be used only when using jquery couch. Example: 250, 95% * @param string $moreattrib Add more options on select component. Example: 'disabled' * @param string $elemtype Type of element we show ('category', ...) + * @param string $placeholder String to use as placeholder + * @param int $addjscombo Add js combo * @return string HTML multiselect string * @see selectarray */ - static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='',$elemtype='') + static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='',$elemtype='', $placeholder='', $addjscombo=-1) { global $conf, $langs; $out = ''; + if ($addjscombo < 0) { + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $addjscombo = 1; + else $addjscombo = 0; + } + // Add code for jquery to use multiselect if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) { $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; $out.="\n".' - '; + });'; + } + $out.=' '; } // Try also magic suggest @@ -6247,7 +6257,7 @@ class Form if (! empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || ! in_array($key, $excludelinksto))) { - print '
global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>'; + print '
use_javascript_ajax)?'':' style="display:none"').'>'; $sql = $possiblelink['sql']; $resqllist = $this->db->query($sql); @@ -6307,8 +6317,9 @@ class Form { $linktoelem='