diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index e369081f7e1..905fd8b97ef 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -97,7 +97,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $search_account = ""; $search_label = ""; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 311aab692ff..c72ce8cc134 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -98,7 +98,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $search_ref = ''; $search_label = ''; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index e742f4651cf..fb503c17ca0 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -98,7 +98,7 @@ if (! empty($search_accountancy_code_end)) { * Action */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_accountancy_code_start = ''; $search_accountancy_code_end = ''; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index c6d84ec9b57..d05dc11ed26 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -72,15 +72,24 @@ if ($action == "confirm_update") { $error = 0; if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { - setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); - $error ++; + $error++; + setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); + $action='update'; } + if (empty($account_number) || $account_number == '-1') + { + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); + $action='update'; + } - if (empty($error)) { + if (! $error) + { $book = new BookKeeping($db); $result = $book->fetch($id, null, $mode); if ($result < 0) { + $error++; setEventMessages($book->error, $book->errors, 'errors'); } else { $book->numero_compte = $account_number; @@ -120,12 +129,20 @@ if ($action == "confirm_update") { else if ($action == "add") { $error = 0; - if (empty($debit) && empty($credit)) { - setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); - $error ++; + if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) + { + $error++; + setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); + $action=''; + } + if (empty($account_number) || $account_number == '-1') + { + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); + $action=''; } - if (empty($error)) { + if (! $error) { $book = new BookKeeping($db); $book->numero_compte = $account_number; @@ -567,7 +584,7 @@ if ($action == 'create') { if ($action == 'update' && $line->id == $id) { print ''; - print $formaccounting->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, ''); + print $formaccounting->select_account($line->numero_compte, 'account_number', 1, array (), 1, 1, ''); print ''; print ''; // TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not @@ -583,8 +600,8 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print '' . "\n"; print ''; @@ -622,7 +639,7 @@ if ($action == 'create') { if ($action == "" || $action == 'add') { print ''; print ''; - print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); + print $formaccounting->select_account($account_number, 'account_number', 1, array (), 1, 1, ''); print ''; print ''; // TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not @@ -638,24 +655,30 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; } print ''; + if ($mode=='_tmp' && $action=='') { - print '
'; + print '
'; + print '
'; if ($total_debit == $total_credit) { - print ''.$langs->trans("ValidTransaction").''; + print ''.$langs->trans("ValidTransaction").''; } else { - print ''.$langs->trans("ValidTransaction").''; + print ''; } + + print '   '; + print ''.$langs->trans("Cancel").''; + print "
"; } print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 114b765e658..0d9832cb802 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -112,7 +112,7 @@ if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin if (GETPOST('cancel')) { $action='list'; $massaction=''; } if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_mvt_num = ''; $search_doc_type = ''; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index a1398df6fb2..4e9e7bd56e7 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -92,7 +92,7 @@ if (! empty($search_doc_date)) { } -if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (!GETPOST('button_removefilter_x','alpha') && !GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { if (! empty($search_accountancy_code_start)) { $filter['t.numero_compte'] = $search_accountancy_code_start; @@ -121,7 +121,7 @@ if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Bot * Action */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_doc_date = ''; $search_accountancy_code = ''; diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index becb700761a..d10f621d9e3 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -86,7 +86,7 @@ $offset = $limit * $page; * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_doc_type = ""; $search_doc_date = ""; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index d6d006c6556..d48f81259df 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -85,7 +85,7 @@ $formaccounting = new FormAccounting($db); */ // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_lineid = ''; $search_ref = ''; @@ -153,7 +153,7 @@ print ''; - $return .= ''; - - if ($showempty) - $return .= ''; - - // Find if keys is in selected array value - if (is_array($selected_array) && count($selected_array)>0) { - $intersect_array = array_intersect_key($options_array, array_flip($selected_array)); - } else { - $intersect_array=array(); - } - - if (count($options_array) > 0) { - foreach ($options_array as $keyoption => $valoption) { - // If key is in intersect table then it have to e selected - $selected = ''; - if (count ( $intersect_array ) > 0) { - if (array_key_exists ( $keyoption, $intersect_array )) { - $selected = ' selected="selected"'; - } - } - $return .= '' . $valoption . ''; - } - } - - $return .= ''; - + $form=new Form($this->db); + $return = $form->multiselectarray($htmlname, $options_array, $selected_array,0,0,'',0,295); return $return; } @@ -448,7 +407,7 @@ class FormAdvTargetEmailing extends Form dol_print_error($this->db); } - return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array ); + return $this->advMultiselectarray( $htmlname, $options_array, $selected_array ); } /** diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 4668c6a56a4..b1d8aa03022 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1250,6 +1250,8 @@ $now = dol_now(); // Add new proposal if ($action == 'create') { + $currency_code = $conf->currency; + print load_fiche_titre($langs->trans("NewProp")); $soc = new Societe($db); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index ec8f7d62b0f..f007cbdbf81 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2362,7 +2362,7 @@ class Propal extends CommonObject $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED; - $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT.' ;'; + $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); @@ -3502,7 +3502,7 @@ class Propal extends CommonObject /** * Class to manage commercial proposal lines */ -class PropaleLigne extends CommonObjectLine +class PropaleLigne extends CommonObjectLine { public $element='propaldet'; public $table_element='propaldet'; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index e9626a638b8..70953e58fbf 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -178,7 +178,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_categ=''; $search_user=''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index b93e399871c..f9ebf8a4cde 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -65,9 +65,8 @@ class Commande extends CommonOrder public $contactid; /** - * Status of the order. Check the following constants: + * Status of the order * @var int - * @see Commande::STATUS_CANCELED, Commande::STATUS_DRAFT, Commande::STATUS_ACCEPTED, Commande::STATUS_CLOSED */ public $statut; /** diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 8ce3ba7cd04..9e0b04ab6e9 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -162,7 +162,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_categ=''; $search_user=''; @@ -191,6 +191,11 @@ if (empty($reshook)) $toselect=''; $search_array_options=array(); } + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha') + || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha')) + { + $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } // Mass actions $objectclass='Commande'; @@ -371,7 +376,7 @@ if (empty($reshook)) } - $cmd->classifyBilled($user); + //$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module. if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object; else $TFact[$object->id] = $object; @@ -754,7 +759,7 @@ if ($resql) //var_dump($_REQUEST); print ''; - print ''; + print '
'; print ''; print ''; print ''; print ''; print '
'; print $langs->trans('DateInvoice'); @@ -776,7 +781,15 @@ if ($resql) print $langs->trans('ValidateInvoices'); print ''; - print $form->selectyesno('valdate_invoices', 1, 1); + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) + { + print $form->selectyesno('valdate_invoices', 0, 1, 1); + print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; + } + else + { + print $form->selectyesno('valdate_invoices', 0, 1); + } print '
'; @@ -838,7 +851,7 @@ if ($resql) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); print '
'; print ''."\n"; @@ -976,6 +989,7 @@ if ($resql) Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"), Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), + -3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"), Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort") ); print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4); @@ -1033,7 +1047,7 @@ if ($resql) if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'],$_SERVER["PHP_SELF"],"c.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'],$_SERVER["PHP_SELF"],"c.fk_statut","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'],$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,''); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'',$param,'align="center"',$sortfield,$sortorder,'maxwidthsearch '); print ''."\n"; $total=0; diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 2bc2242abc4..5a43548aed1 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -178,7 +178,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_dt_start=''; $search_dt_end=''; diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 9d8cf29ee39..9bc8608692d 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -121,7 +121,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $statut = 'all'; $search_ref=''; diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 6594bacea7f..3fce9c30fd6 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -69,7 +69,7 @@ else $typeid=$_REQUEST['typeid']; } -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $search_ref=""; $search_label=""; diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index de5e00045e7..e42e9f2325a 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -57,7 +57,7 @@ if (! $sortfield) $sortfield="d.dated"; $year=GETPOST("year"); $month=GETPOST("month"); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $search_ref=""; $search_name=""; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index dd89ae944ef..63b978a9e04 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4185,7 +4185,7 @@ else if ($id > 0 || ! empty($ref)) { if (! $objectidnext && count($object->lines) > 0) { - print ''; + print ''; } } diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 22306e498f2..d38ea012c3c 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -46,13 +46,18 @@ $langs->load('compta'); $langs->load('admin'); $langs->load('other'); +$action = GETPOST('action','alpha'); +$massaction = GETPOST('massaction','alpha'); +$show_files = GETPOST('show_files','int'); +$confirm = GETPOST('confirm','alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$toselect = GETPOST('toselect', 'array'); +$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'invoicetemplatelist'; // To manage different context of search + // Security check $id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int')); -$confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); $lineid=GETPOST('lineid','int'); $ref=GETPOST('ref','alpha'); -$action=GETPOST('action', 'alpha'); if ($user->societe_id) $socid=$user->societe_id; $objecttype = 'facture_rec'; if ($action == "create" || $action == "add") $objecttype = ''; @@ -112,7 +117,7 @@ $arrayfields=array( 'f.tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1), 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1), 'f.frequency'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1), - 'f.nb_gen_done'=>array('label'=>$langs->trans("NbGeneration"), 'checked'=>1), + 'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDone"), 'checked'=>1), 'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1), 'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1), 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), @@ -132,6 +137,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab * Actions */ +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + $parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -140,6 +148,9 @@ if (empty($reshook)) { if (GETPOST('cancel')) $action=''; + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + // Set note include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once @@ -148,7 +159,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once // Do we click on purge search criteria ? - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $search_ref=''; $search_societe=''; @@ -165,6 +176,14 @@ if (empty($reshook)) $search_array_options=array(); } + // Mass actions + /*$objectclass='MyObject'; + $objectlabel='MyObject'; + $permtoread = $user->rights->mymodule->read; + $permtodelete = $user->rights->mymodule->delete; + $uploaddir = $conf->mymodule->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';*/ + // Create predefined invoice if ($action == 'add') { @@ -517,7 +536,7 @@ if (empty($reshook)) $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); - + // if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ? if (! empty($price_ht)) { @@ -905,7 +924,7 @@ if ($action == 'create') print ''; print ''; - dol_fiche_head(); + dol_fiche_head(null, '', '', 0); $rowspan=4; if (! empty($conf->projet->enabled)) $rowspan++; @@ -942,7 +961,7 @@ if ($action == 'create') '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')' ); $substitutionarray['__(TransKey)__']=$langs->trans("TransKey"); - + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; foreach($substitutionarray as $key => $val) { @@ -952,10 +971,10 @@ if ($action == 'create') // Public note print '
'; - print ''; - print ''; - print ''; print '
'; + print ''; print $form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'); print ''; + print ''; $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -963,7 +982,7 @@ if ($action == 'create') if (empty($user->societe_id)) { print '
'; + print ''; print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'); print ''; @@ -1007,12 +1026,14 @@ if ($action == 'create') print "
"; - print '

'; + dol_fiche_end(); // Autogeneration $title = $langs->trans("Recurrence"); - print load_fiche_titre($title, '', 'calendar'); + print load_fiche_titre(' '.$title, '', ''); + + dol_fiche_head(null, '', '', 0); print ''; @@ -1040,7 +1061,8 @@ if ($action == 'create') print "
"; - print '

'; + dol_fiche_end(); + $title = $langs->trans("ProductsAndServices"); if (empty($conf->service->enabled)) @@ -1078,8 +1100,6 @@ if ($action == 'create') } print "\n"; - dol_fiche_end(); - print '
'; print '     '; print ''; @@ -1260,7 +1280,7 @@ else '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')' ); $substitutionarray['__(TransKey)__']=$langs->trans("TransKey"); - + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; foreach($substitutionarray as $key => $val) { @@ -1323,7 +1343,7 @@ else print ''; print ''; - + // if "frequency" is empty or = 0, the reccurence is disabled print ''; - + print ''; @@ -468,7 +468,7 @@ if ($num > 0) print ''; print ''; - + $i++; } } diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 24ee68eb0f7..2eab3557797 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -52,7 +52,7 @@ $optioncss = GETPOST('optioncss','alpha'); if (!$user->rights->don->lire) accessforbidden(); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $search_all=""; $search_ref=""; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 22e11e6fd1e..e936e0f73bd 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -127,7 +127,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_ref_exp=''; $search_ref_liv=''; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 34f1cfebf38..e0a9df80b3f 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -140,7 +140,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test must be present to be compatible with all browsers { $search_ref=""; $search_user=""; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 78fd59ecb22..3acef343aa9 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -141,7 +141,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_ref=""; $search_company=""; diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index bbc688264b8..25dc8932049 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -68,7 +68,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $actioncode=''; $search_agenda_label=''; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 3e3fe658155..41c9988e903 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -185,7 +185,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $ordermonth=''; $orderyear=''; diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 7cfe9697891..cb562edf9ec 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -64,7 +64,7 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield="f.date_lim_reglement"; if (! $sortorder) $sortorder="ASC"; -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $search_ref=""; $search_ref_supplier=""; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 056a1961b4c..3b3f7d98ab2 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -194,7 +194,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOST("button_removefilter.x")) // All test must be present to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha') || GETPOST('button_removefilter.x','alpha')) // All test must be present to be compatible with all browsers { $search_all=""; $search_user=''; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index fcf7dc92ebf..26db12ac047 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -95,7 +95,7 @@ $arrayfields=array(); * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_ref=""; $search_account=""; diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 00e2dbf939d..33659b87639 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -82,7 +82,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $sref = ''; $sRefSupplier = ''; diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 88f3438dcaf..92f1d4cafc6 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -84,7 +84,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_name=''; $toselect=''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index ec881f04c57..9048ed9a8b8 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -81,7 +81,7 @@ $fieldstosearchall = array( * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_ref=""; $month_create=""; diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 0137353f714..89b4f9cd00c 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -28,6 +28,7 @@ ALTER TABLE llx_supplier_proposaldet CHANGE COLUMN fk_askpricesupplier fk_supplier_proposal integer NOT NULL; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- -- VMYSQL4.1 ALTER TABLE llx_adherent MODIFY COLUMN datefin datetime DEFAULT '2001-01-01 00:00:00'; -- VMYSQL4.1 update llx_adherent set datefin = NULL where DATE(STR_TO_DATE(datefin, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; -- VMYSQL4.1 update llx_adherent set datefin = NULL where DATE(STR_TO_DATE(datefin, '%Y-%m-%d')) IS NULL; @@ -74,7 +75,7 @@ ALTER TABLE llx_holiday ADD COLUMN ref varchar(30) NULL; ALTER TABLE llx_holiday ADD COLUMN ref_ext varchar(255); -create table llx_notify_def_object +CREATE TABLE llx_notify_def_object ( id integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id @@ -129,14 +130,15 @@ ALTER TABLE llx_bank_account ADD COLUMN extraparams varchar(255); -- VMYSQL4.1 ALTER TABLE llx_adherent MODIFY COLUMN country integer DEFAULT NULL; -- VPGSQL8.2 ALTER TABLE llx_adherent MODIFY COLUMN country integer USING country::integer; -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',30); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',30); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',30); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',30); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',30); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',30); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expense_report',201); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expense_report',202); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expense_report',203); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_PAYED','Expense report billed','Executed when an expense report is set as billed','expense_report',204); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expense_report',201); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expense_report',201); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expense_report',202); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expense_report',203); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('EXPENSE_REPORT_PAYED','Expense report billed','Executed when an expense report is set as billed','expense_report',204); ALTER TABLE llx_c_email_templates ADD COLUMN content_lines text; @@ -156,6 +158,8 @@ ALTER TABLE llx_product_price_by_qty ADD COLUMN import_key varchar(14); ALTER TABLE llx_user ADD COLUMN import_key varchar(14); +ALTER TABLE llx_facture_rec ADD COLUMN tms timestamp; +UPDATE llx_facture_rec SET tms = datec where tms < '2000-01-01'; CREATE TABLE llx_product_attribute ( @@ -196,7 +200,7 @@ CREATE TABLE llx_product_attribute_combination ); -ALTER TABLE llx_bank_account drop foreign key bank_fk_accountancy_journal; +ALTER TABLE llx_bank_account DROP FOREIGN KEY bank_fk_accountancy_journal; -- Fix missing entity column after init demo ALTER TABLE llx_accounting_journal ADD COLUMN entity integer DEFAULT 1; @@ -209,18 +213,18 @@ INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES ( INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (5,'AN', 'Has new journal', 9, 1); INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (6,'ER', 'Expense report journal', 5, 1); -- Fix old entries -UPDATE llx_accounting_journal SET nature = 1 where code = 'OD' and nature = 0; -UPDATE llx_accounting_journal SET nature = 2 where code = 'VT' and nature = 1; -UPDATE llx_accounting_journal SET nature = 3 where code = 'AC' and nature = 2; -UPDATE llx_accounting_journal SET nature = 4 where (code = 'BK' or code = 'BQ') and nature = 3; +UPDATE llx_accounting_journal SET nature = 1 WHERE code = 'OD' AND nature = 0; +UPDATE llx_accounting_journal SET nature = 2 WHERE code = 'VT' AND nature = 1; +UPDATE llx_accounting_journal SET nature = 3 WHERE code = 'AC' AND nature = 2; +UPDATE llx_accounting_journal SET nature = 4 WHERE (code = 'BK' OR code = 'BQ') AND nature = 3; -UPDATE llx_bank_account as ba set accountancy_journal = 'BQ' where accountancy_journal = 'BK'; -UPDATE llx_bank_account as ba set accountancy_journal = 'OD' where accountancy_journal IS NULL; +UPDATE llx_bank_account SET accountancy_journal = 'BQ' WHERE accountancy_journal = 'BK'; +UPDATE llx_bank_account SET accountancy_journal = 'OD' WHERE accountancy_journal IS NULL; ALTER TABLE llx_bank_account ADD COLUMN fk_accountancy_journal integer; ALTER TABLE llx_bank_account ADD INDEX idx_fk_accountancy_journal (fk_accountancy_journal); -UPDATE llx_bank_account as ba set fk_accountancy_journal = (SELECT rowid FROM llx_accounting_journal as aj where ba.accountancy_journal = aj.code) where accountancy_journal not in ('1', '2', '3', '4', '5', '6', '5', '8', '9', '10', '11', '12', '13', '14', '15'); +UPDATE llx_bank_account AS ba SET fk_accountancy_journal = (SELECT rowid FROM llx_accounting_journal AS aj WHERE ba.accountancy_journal = aj.code) WHERE accountancy_journal NOT IN ('1', '2', '3', '4', '5', '6', '5', '8', '9', '10', '11', '12', '13', '14', '15'); ALTER TABLE llx_bank_account ADD CONSTRAINT fk_bank_account_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid); --Update general ledger for FEC format & harmonization @@ -233,7 +237,7 @@ ALTER TABLE llx_accounting_bookkeeping ADD COLUMN subledger_account varchar(32); ALTER TABLE llx_accounting_bookkeeping CHANGE COLUMN thirdparty_label subledger_label varchar(255); -- If field was already created, rename it ALTER TABLE llx_accounting_bookkeeping ADD COLUMN subledger_label varchar(255) AFTER subledger_account; -- If field dod not exists yet -update llx_accounting_bookkeeping set subledger_account = numero_compte where subledger_account IS NULL; +UPDATE llx_accounting_bookkeeping SET subledger_account = numero_compte WHERE subledger_account IS NULL; ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN label_compte varchar(255); ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN code_journal varchar(32); @@ -358,9 +362,9 @@ ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_tx d ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_price double(24,8) DEFAULT NULL; ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_price_ttc double(24,8) DEFAULT NULL; -UPDATE llx_contrat set ref = rowid where ref is null or ref = ''; +UPDATE llx_contrat SET ref = rowid WHERE ref IS NULL OR ref = ''; -create table llx_payment_various +CREATE TABLE llx_payment_various ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp, @@ -381,7 +385,7 @@ create table llx_payment_various )ENGINE=innodb; -create table llx_default_values +CREATE TABLE llx_default_values ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id @@ -441,27 +445,27 @@ ALTER TABLE llx_inventorydet ADD INDEX idx_inventorydet_tms (tms); ALTER TABLE llx_inventorydet ADD INDEX idx_inventorydet_datec (datec); ALTER TABLE llx_inventorydet ADD INDEX idx_inventorydet_fk_inventory (fk_inventory); -insert into llx_c_tva(fk_pays,taux,code,recuperableonly,note,active) values (1, '8.5', '85', '0','VAT standard rate (DOM sauf Guyane et Saint-Martin)',0); -insert into llx_c_tva(fk_pays,taux,code,recuperableonly,note,active) values (1, '8.5', '85NPR', '1','VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0); -insert into llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,note,active) values (1, '8.5', '85NPROM', '1', 2, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer',0); -insert into llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (1, '8.5', '85NPROMOMR', '1', 2, 3, 2.5, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer et Octroi de Mer Regional',0); +INSERT INTO llx_c_tva(fk_pays,taux,code,recuperableonly,note,active) VALUES (1, '8.5', '85', '0','VAT standard rate (DOM sauf Guyane et Saint-Martin)',0); +INSERT INTO llx_c_tva(fk_pays,taux,code,recuperableonly,note,active) VALUES (1, '8.5', '85NPR', '1','VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0); +INSERT INTO llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,note,active) VALUES (1, '8.5', '85NPROM', '1', 2, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer',0); +INSERT INTO llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) VALUES (1, '8.5', '85NPROMOMR', '1', 2, 3, 2.5, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer et Octroi de Mer Regional',0); ALTER TABLE llx_events MODIFY COLUMN ip varchar(250); ALTER TABLE llx_facture ADD COLUMN fk_fac_rec_source integer; -DELETE from llx_c_actioncomm where code in ('AC_PROP','AC_COM','AC_FAC','AC_SHIP','AC_SUP_ORD','AC_SUP_INV') AND id NOT IN (SELECT DISTINCT fk_action FROM llx_actioncomm); +DELETE FROM llx_c_actioncomm WHERE code IN ('AC_PROP','AC_COM','AC_FAC','AC_SHIP','AC_SUP_ORD','AC_SUP_INV') AND id NOT IN (SELECT DISTINCT fk_action FROM llx_actioncomm); -- Fix: delete orphelin category. -delete from llx_categorie_product where fk_categorie not in (select rowid from llx_categorie where type = 0); -delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type in (1, 2)); -delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3); -delete from llx_categorie_contact where fk_categorie not in (select rowid from llx_categorie where type = 4); -delete from llx_categorie_project where fk_categorie not in (select rowid from llx_categorie where type = 5); +DELETE FROM llx_categorie_product WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 0); +DELETE FROM llx_categorie_societe WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type IN (1, 2)); +DELETE FROM llx_categorie_member WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 3); +DELETE FROM llx_categorie_contact WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 4); +DELETE FROM llx_categorie_project WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 5); ALTER TABLE llx_inventory ADD COLUMN ref varchar(48); -create table llx_loan_schedule +CREATE TABLE llx_loan_schedule ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_loan integer, @@ -518,6 +522,9 @@ ALTER TABLE llx_website_page ADD UNIQUE INDEX uk_website_page_url (fk_website,pa ALTER TABLE llx_website_page ADD CONSTRAINT fk_website_page_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid); +UPDATE llx_extrafields set elementtype='categorie' where elementtype='categories'; + + -- For new module blockedlog CREATE TABLE llx_blockedlog @@ -559,3 +566,6 @@ ALTER TABLE llx_blockedlog_authority ADD INDEX signature (signature); UPDATE llx_bank SET label= '(SupplierInvoicePayment)' WHERE label= 'Règlement fournisseur'; UPDATE llx_bank SET label= '(CustomerInvoicePayment)' WHERE label= 'Règlement client'; +UPDATE llx_bank SET label= '(payment_salary)' WHERE label LIKE 'Règlement salaire'; + +ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_url varchar(255); diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index 0e25100386b..e9764e1e575 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -25,7 +25,8 @@ create table llx_facture_rec titre varchar(50) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer NOT NULL, - datec datetime, -- date de creation + datec datetime, -- date de creation + tms timestamp, -- date creation/modification amount double(24,8) DEFAULT 0 NOT NULL, remise real DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_mailing_cibles.sql b/htdocs/install/mysql/tables/llx_mailing_cibles.sql index f3031069220..c533eb0ff8a 100644 --- a/htdocs/install/mysql/tables/llx_mailing_cibles.sql +++ b/htdocs/install/mysql/tables/llx_mailing_cibles.sql @@ -30,7 +30,7 @@ create table llx_mailing_cibles other varchar(255) NULL, tag varchar(128) NULL, statut smallint NOT NULL DEFAULT 0, -- -1 = error, 0 = not sent, ... - source_url varchar(160), + source_url varchar(255), source_id integer, source_type varchar(16), date_envoi datetime, diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 1b2d184de0f..2e4125e39e4 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -102,6 +102,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_expedition FOR EACH CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_expensereport FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture_rec FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture_fourn FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture_fourn_det_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index a4e7d72bc2c..34e352205b0 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -194,7 +194,7 @@ ValidateHistory=Bind Automatically AutomaticBindingDone=Automatic binding done ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used -MvtNotCorrectlyBalanced=Mouvement not correctly balanced. Credit = %s. Debit = %s +MvtNotCorrectlyBalanced=Movement not correctly balanced. Credit = %s. Debit = %s FicheVentilation=Binding card GeneralLedgerIsWritten=Transactions are written in the Ledger GeneralLedgerSomeRecordWasNotRecorded=Some of the transactions could not be dispatched. If there is no other error message, this is probably because they were already dispatched. diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1f384015839..cd3aa50c439 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -147,6 +147,7 @@ PurgeDeleteAllFilesInDocumentsDir=Delete all files in directory %s. Tempo PurgeRunNow=Purge now PurgeNothingToDelete=No directory or files to delete. PurgeNDirectoriesDeleted=%s files or directories deleted. +PurgeNDirectoriesFailed=Failed to delete %s files or directories. PurgeAuditEvents=Purge all security events ConfirmPurgeAuditEvents=Are you sure you want to purge all security events? All security logs will be deleted, no other data will be removed. GenerateBackup=Generate backup @@ -298,7 +299,7 @@ SetupIsReadyForUse=Module deployment is finished. You must however enable and se NotExistsDirect=The alternative root directory is not defined to an existing directory.
InfDirAlt=Since version 3, it is possible to define an alternative root directory. This allows you to store, into a dedicated directory, plug-ins and custom templates.
Just create a directory at the root of Dolibarr (eg: custom).
InfDirExample=
Then declare it in the file conf.php
$dolibarr_main_url_root_alt='http://myserver/custom'
$dolibarr_main_document_root_alt='/path/of/dolibarr/htdocs/custom'
If these lines are commented with "#", to enable them, just uncomment by removing the "#" character. -YouCanSubmitFile=For this step, you can send package using this tool: Select module file +YouCanSubmitFile=For this step, you can submit your package file here : CurrentVersion=Dolibarr current version CallUpdatePage=Go to the page that updates the database structure and data: %s. LastStableVersion=Latest stable version diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 3c7f8b338c0..3f995673f88 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -151,7 +151,7 @@ CheckRejectedAndInvoicesReopened=Check returned and invoices reopened BankAccountModelModule=Document templates for bank accounts DocumentModelSepaMandate=Template of SEPA mandate. Usefull for european countries in EEC only. DocumentModelBan=Template to print a page with BAN information. -NewVariousPayment=New various payment -VariousPayment=Various payment -VariousPayments=Various payments -ShowVariousPayment=Show various payment +NewVariousPayment=New miscellaneous payment +VariousPayment=Miscellaneous payment +VariousPayments=Miscellaneous payments +ShowVariousPayment=Show miscellaneous payment diff --git a/htdocs/langs/en_US/multicurrency.lang b/htdocs/langs/en_US/multicurrency.lang index 222583c5516..c53c3aef460 100644 --- a/htdocs/langs/en_US/multicurrency.lang +++ b/htdocs/langs/en_US/multicurrency.lang @@ -4,7 +4,8 @@ ErrorAddRateFail=Error in added rate ErrorAddCurrencyFail=Error in added currency ErrorDeleteCurrencyFail=Error delete fail multicurrency_syncronize_error=Synchronisation error: %s -multicurrency_useOriginTx=When an object is created from another, keep the original rate of source object (otherwise use the new known rate) +MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE=Use date of document to find currency rate, instead of using latest known rate +multicurrency_useOriginTx=When an object is created from another, keep the original rate of source object (otherwise use the latest known rate) CurrencyLayerAccount=CurrencyLayer API CurrencyLayerAccount_help_to_synchronize=You sould create an account on their website to use this functionnality
Get your API key
If you use a free account you can't change the currency source (USD by default)
But if your main currency isn't USD you can use the alternate currency source to force you main currency

You are limited at 1000 synchronizations per month multicurrency_appId=API key diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index 7e22b2a3522..a477790b01b 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -2,14 +2,16 @@ WorkflowSetup=Workflow module setup WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is open (you can do things in the order you want). You can activate the automatic actions you are interested in. ThereIsNoWorkflowToModify=There is no workflow modifications available with the activated modules. -descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Automatically create a customer order after a commercial proposal is signed -descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Automatically create a customer invoice after a commercial proposal is signed +# Autocreate +descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Automatically create a customer order after a commercial proposal is signed (new order will have same amount than proposal) +descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Automatically create a customer invoice after a commercial proposal is signed (new invoice will have same amount than proposal) descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Automatically create a customer invoice after a contract is validated -descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Automatically create a customer invoice after a customer order is closed -descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer order is set to paid -descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is set to paid -descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is validated -descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer invoice is validated -descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING=Classify linked source order to shipped when a shipment is validated and quantity shipped is the same as in order +descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Automatically create a customer invoice after a customer order is closed (new invoice will have same amount than order) +# Autoclassify +descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal(s) to billed when customer order is set to billed (and if amount of the order is same than total amount of signed linked proposals) +descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classify linked source proposal(s) to billed when customer invoice is validated (and if amount of the invoice is same than total amount of signed linked proposals) +descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is validated (and if amount of the invoice is same than total amount of linked orders) +descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is set to paid (and if amount of the invoice is same than total amount of linked orders) +descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING=Classify linked source order to shipped when a shipment is validated (and if quantity shipped by all shipments is the same as in the order to update) AutomaticCreation=Automatic creation AutomaticClassification=Automatic classification \ No newline at end of file diff --git a/htdocs/loan/index.php b/htdocs/loan/index.php index 3ce2c048057..0aa16b4225d 100644 --- a/htdocs/loan/index.php +++ b/htdocs/loan/index.php @@ -55,7 +55,7 @@ $filtre=GETPOST("filtre"); $optioncss = GETPOST('optioncss','alpha'); // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $search_ref=""; $search_label=""; diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index ab6394eb74c..58fee8c3ea6 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -103,7 +103,7 @@ if (empty($reshook)) } // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_ref=''; $search_array_options=array(); diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index 2db00687df5..3ea9ed8a090 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -97,439 +97,221 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers */ public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { - // Put here code you want to execute when a Dolibarr business events occurs. + if (!empty($conf->mymodule->enabled)) return 0; // Module not active, we do nothing + + // Put here code you want to execute when a Dolibarr business events occurs. // Data and type of action are stored into $object and $action - /** Users */ - if ($action == 'USER_LOGIN') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_UPDATE_SESSION') { - // Warning: To increase performances, this action is triggered only if - // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_CREATE_FROM_CONTACT') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_NEW_PASSWORD') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_ENABLEDISABLE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_LOGOUT') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_SETINGROUP') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_REMOVEFROMGROUP') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + switch ($action) { - /** Groups */ - } elseif ($action == 'GROUP_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'GROUP_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'GROUP_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + // Users + case 'USER_CREATE': + case 'USER_MODIFY': + case 'USER_NEW_PASSWORD': + case 'USER_ENABLEDISABLE': + case 'USER_DELETE': + case 'USER_SETINGROUP': + case 'USER_REMOVEFROMGROUP': - /** Companies */ - } elseif ($action == 'COMPANY_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'COMPANY_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'COMPANY_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + case 'USER_LOGIN': + case 'USER_LOGIN_FAILED': + case 'USER_LOGOUT': + case 'USER_UPDATE_SESSION': // Warning: To increase performances, this action is triggered only if constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. - /** Contacts */ - } elseif ($action == 'CONTACT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTACT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTACT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - // Products - } elseif ($action == 'PRODUCT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PRODUCT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PRODUCT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + // Actions + case 'ACTION_MODIFY': + case 'ACTION_CREATE': + case 'ACTION_DELETE': - /** Customer orders */ - } elseif ($action == 'ORDER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_CLONE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEORDER_INSERT') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEORDER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + // Groups + case 'GROUP_CREATE': + case 'GROUP_MODIFY': + case 'GROUP_DELETE': - /** Supplier orders */ - } elseif ($action == 'ORDER_SUPPLIER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + // Companies + case 'COMPANY_CREATE': + case 'COMPANY_MODIFY': + case 'COMPANY_DELETE': - /** Proposals */ - } elseif ($action == 'PROPAL_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_CLONE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_CLOSE_SIGNED') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_CLOSE_REFUSED') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEPROPAL_INSERT') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEPROPAL_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEPROPAL_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + // Contacts + case 'CONTACT_CREATE': + case 'CONTACT_MODIFY': + case 'CONTACT_DELETE': + case 'CONTACT_ENABLEDISABLE': - /** Contracts */ - } elseif ($action == 'CONTRACT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_ACTIVATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_CANCEL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_CLOSE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + // Products + case 'PRODUCT_CREATE': + case 'PRODUCT_MODIFY': + case 'PRODUCT_DELETE': + case 'PRODUCT_PRICE_MODIFY': + case 'PRODUCT_SET_MULTILANGS': + case 'PRODUCT_DEL_MULTILANGS': - /** Bills */ - } elseif ($action == 'BILL_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_CLONE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_CANCEL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEBILL_INSERT') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEBILL_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + //Stock mouvement + case 'STOCK_MOVEMENT': - /** Payments */ - } elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PAYMENT_ADD_TO_BANK') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PAYMENT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + //MYECMDIR + case 'MYECMDIR_DELETE': + case 'MYECMDIR_CREATE': + case 'MYECMDIR_MODIFY': - /** Interventions */ - } elseif ($action == 'FICHEINTER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'FICHEINTER_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'FICHEINTER_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'FICHEINTER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + // Customer orders + case 'ORDER_CREATE': + case 'ORDER_CLONE': + case 'ORDER_VALIDATE': + case 'ORDER_DELETE': + case 'ORDER_CANCEL': + case 'ORDER_SENTBYMAIL': + case 'ORDER_CLASSIFY_BILLED': + case 'ORDER_SETDRAFT': + case 'LINEORDER_INSERT': + case 'LINEORDER_UPDATE': + case 'LINEORDER_DELETE': - /** Members */ - } elseif ($action == 'MEMBER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_SUBSCRIPTION') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_NEW_PASSWORD') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_RESILIATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + // Supplier orders + case 'ORDER_SUPPLIER_CREATE': + case 'ORDER_SUPPLIER_CLONE': + case 'ORDER_SUPPLIER_VALIDATE': + case 'ORDER_SUPPLIER_DELETE': + case 'ORDER_SUPPLIER_APPROVE': + case 'ORDER_SUPPLIER_REFUSE': + case 'ORDER_SUPPLIER_CANCEL': + case 'ORDER_SUPPLIER_SENTBYMAIL': + case 'ORDER_SUPPLIER_DISPATCH': + case 'LINEORDER_SUPPLIER_DISPATCH': + case 'LINEORDER_SUPPLIER_CREATE': + case 'LINEORDER_SUPPLIER_UPDATE': - /** Categories */ - } elseif ($action == 'CATEGORY_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CATEGORY_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CATEGORY_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + // Proposals + case 'PROPAL_CREATE': + case 'PROPAL_CLONE': + case 'PROPAL_MODIFY': + case 'PROPAL_VALIDATE': + case 'PROPAL_SENTBYMAIL': + case 'PROPAL_CLOSE_SIGNED': + case 'PROPAL_CLOSE_REFUSED': + case 'PROPAL_DELETE': + case 'LINEPROPAL_INSERT': + case 'LINEPROPAL_UPDATE': + case 'LINEPROPAL_DELETE': - /** Projects */ - } elseif ($action == 'PROJECT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROJECT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROJECT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - /** Project tasks */ - } elseif ($action == 'TASK_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'TASK_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'TASK_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + // SupplierProposal + case 'SUPPLIER_PROPOSAL_CREATE': + case 'SUPPLIER_PROPOSAL_CLONE': + case 'SUPPLIER_PROPOSAL_MODIFY': + case 'SUPPLIER_PROPOSAL_VALIDATE': + case 'SUPPLIER_PROPOSAL_SENTBYMAIL': + case 'SUPPLIER_PROPOSAL_CLOSE_SIGNED': + case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED': + case 'SUPPLIER_PROPOSAL_DELETE': + case 'LINESUPPLIER_PROPOSAL_INSERT': + case 'LINESUPPLIER_PROPOSAL_UPDATE': + case 'LINESUPPLIER_PROPOSAL_DELETE': - /** Task time spent */ - } elseif ($action == 'TASK_TIMESPENT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'TASK_TIMESPENT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'TASK_TIMESPENT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + // Contracts + case 'CONTRACT_CREATE': + case 'CONTRACT_ACTIVATE': + case 'CONTRACT_CANCEL': + case 'CONTRACT_CLOSE': + case 'CONTRACT_DELETE': + case 'LINECONTRACT_INSERT': + case 'LINECONTRACT_UPDATE': + case 'LINECONTRACT_DELETE': - /** Shipping */ - } elseif ($action == 'SHIPPING_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); + // Bills + case 'BILL_CREATE': + case 'BILL_CLONE': + case 'BILL_MODIFY': + case 'BILL_VALIDATE': + case 'BILL_UNVALIDATE': + case 'BILL_SENTBYMAIL': + case 'BILL_CANCEL': + case 'BILL_DELETE': + case 'BILL_PAYED': + case 'LINEBILL_INSERT': + case 'LINEBILL_UPDATE': + case 'LINEBILL_DELETE': - /** File */ - } elseif ($action == 'FILE_UPLOAD') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'FILE_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } + //Supplier Bill + case 'BILL_SUPPLIER_CREATE': + case 'BILL_SUPPLIER_UPDATE': + case 'BILL_SUPPLIER_DELETE': + case 'BILL_SUPPLIER_PAYED': + case 'BILL_SUPPLIER_UNPAYED': + case 'BILL_SUPPLIER_VALIDATE': + case 'BILL_SUPPLIER_UNVALIDATE': + case 'LINEBILL_SUPPLIER_CREATE': + case 'LINEBILL_SUPPLIER_UPDATE': + case 'LINEBILL_SUPPLIER_DELETE': + + // Payments + case 'PAYMENT_CUSTOMER_CREATE': + case 'PAYMENT_SUPPLIER_CREATE': + case 'PAYMENT_ADD_TO_BANK': + case 'PAYMENT_DELETE': + + // Online + case 'PAYMENT_PAYBOX_OK': + case 'PAYMENT_PAYPAL_OK': + case 'PAYMENT_STRIPE_OK': + + // Donation + case 'DON_CREATE': + case 'DON_UPDATE': + case 'DON_DELETE': + + // Interventions + case 'FICHINTER_CREATE': + case 'FICHINTER_MODIFY': + case 'FICHINTER_VALIDATE': + case 'FICHINTER_DELETE': + case 'LINEFICHINTER_CREATE': + case 'LINEFICHINTER_UPDATE': + case 'LINEFICHINTER_DELETE': + + // Members + case 'MEMBER_CREATE': + case 'MEMBER_VALIDATE': + case 'MEMBER_SUBSCRIPTION': + case 'MEMBER_MODIFY': + case 'MEMBER_NEW_PASSWORD': + case 'MEMBER_RESILIATE': + case 'MEMBER_DELETE': + + // Categories + case 'CATEGORY_CREATE': + case 'CATEGORY_MODIFY': + case 'CATEGORY_DELETE': + case 'CATEGORY_SET_MULTILANGS': + + // Projects + case 'PROJECT_CREATE': + case 'PROJECT_MODIFY': + case 'PROJECT_DELETE': + + // Project tasks + case 'TASK_CREATE': + case 'TASK_MODIFY': + case 'TASK_DELETE': + + // Task time spent + case 'TASK_TIMESPENT_CREATE': + case 'TASK_TIMESPENT_MODIFY': + case 'TASK_TIMESPENT_DELETE': + + // Shipping + case 'SHIPPING_CREATE': + case 'SHIPPING_MODIFY': + case 'SHIPPING_VALIDATE': + case 'SHIPPING_SENTBYMAIL': + case 'SHIPPING_BILLED': + case 'SHIPPING_CLOSED': + case 'SHIPPING_REOPEN': + case 'SHIPPING_DELETE': + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + break; + + } return 0; } diff --git a/htdocs/modulebuilder/template/css/mymodule.css.php b/htdocs/modulebuilder/template/css/mymodule.css.php index e010bbfe920..b8b39dd6e8b 100644 --- a/htdocs/modulebuilder/template/css/mymodule.css.php +++ b/htdocs/modulebuilder/template/css/mymodule.css.php @@ -22,7 +22,7 @@ */ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url. +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled. Language code is found on url. if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); @@ -50,7 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; session_cache_limiter(FALSE); -// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) and load permission if we need to use them in CSS +// Load user to have $user->conf loaded (not done by default here because of NOLOGIN constant defined) and load permission if we need to use them in CSS /*if (empty($user->id) && ! empty($_SESSION['dol_login'])) { $user->fetch('',$_SESSION['dol_login']); diff --git a/htdocs/modulebuilder/template/js/mymodule.js.php b/htdocs/modulebuilder/template/js/mymodule.js.php index 122b3978631..b9ca46e652e 100644 --- a/htdocs/modulebuilder/template/js/mymodule.js.php +++ b/htdocs/modulebuilder/template/js/mymodule.js.php @@ -13,8 +13,22 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . + * + * Library javascript to enable Browser notifications */ +if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); +if (!defined('NOREQUIREDB')) define('NOREQUIREDB','1'); +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); +if (!defined('NOLOGIN')) define('NOLOGIN', 1); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + + /** * \file htdocs/modulebuilder/template/js/mymodule.js.php * \ingroup mymodule @@ -41,4 +55,8 @@ header('Content-Type: application/javascript'); // You can use CTRL+F5 to refresh your browser cache. if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); else header('Cache-Control: no-cache'); +?> + +/* Javascript library of module MyModule */ + diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 14b88767128..fefd1f78d9d 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -47,6 +47,7 @@ while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2 if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php"); if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"); // Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php"); if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php"); if (! $res) die("Include of main fails"); diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index d024a5d9277..9d1019affee 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -48,6 +48,7 @@ while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2 if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php"); if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"); // Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php"); if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php"); if (! $res) die("Include of main fails"); @@ -64,6 +65,7 @@ $action = GETPOST('action','alpha'); $massaction = GETPOST('massaction','alpha'); $show_files = GETPOST('show_files','int'); $confirm = GETPOST('confirm','alpha'); +$cancel = GETPOST('cancel', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectlist'; // To manage different context of search @@ -154,7 +156,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { foreach($object->fields as $key => $val) { @@ -163,6 +165,11 @@ if (empty($reshook)) $toselect=''; $search_array_options=array(); } + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha') + || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha')) + { + $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } // Mass actions $objectclass='MyObject'; @@ -344,7 +351,7 @@ if (! empty($moreforfilter)) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); +$selectedfields.=$form->showCheckAddButtons('checkforselect', 1); print '
'; print '
'.$title.'
'; print ''; print "\n"; + print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER['PHP_SELF'],"f.total","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountVAT"),$_SERVER['PHP_SELF'],"f.tva","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER['PHP_SELF'],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RecurringInvoiceTemplate"),$_SERVER['PHP_SELF'],"f.frequency","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['f.nb_gen_done']['checked'])) - { - print_liste_field_titre($langs->trans("NbOfGenerationDone"),$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder); - } - print_liste_field_titre($langs->trans("DateLastGeneration"),$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("NextDateToExecution"),$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre(''); // Field may contains ling text + if (! empty($arrayfields['f.titre']['checked'])) print_liste_field_titre($arrayfields['f.titre']['label'],$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['f.total']['checked'])) print_liste_field_titre($arrayfields['f.total']['label'],$_SERVER['PHP_SELF'],"f.total","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.tva']['checked'])) print_liste_field_titre($arrayfields['f.tva']['label'],$_SERVER['PHP_SELF'],"f.tva","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.frequency']['checked'])) print_liste_field_titre($arrayfields['f.frequency']['label'],$_SERVER['PHP_SELF'],"f.frequency","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['f.nb_gen_done']['checked'])) print_liste_field_titre($arrayfields['f.nb_gen_done']['label'],$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['f.date_last_gen']['checked'])) print_liste_field_titre($arrayfields['f.date_last_gen']['label'],$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['f.date_when']['checked'])) print_liste_field_titre($arrayfields['f.date_when']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n"; print "\n"; - - + + if ($num > 0) { $var=true; @@ -1800,26 +1828,67 @@ else { $objp = $db->fetch_object($resql); - print ''; - - print '\n"; - $companystatic->id=$objp->socid; $companystatic->name=$objp->name; - print ''; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''; + print ''; + + if (! empty($arrayfields['f.titre']['checked'])) + { + print '\n"; + } + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + } + if (! empty($arrayfields['f.total']['checked'])) + { + print ''."\n"; + } + if (! empty($arrayfields['f.tva']['checked'])) + { + print ''."\n"; + } + if (! empty($arrayfields['f.total_ttc']['checked'])) + { + print ''."\n"; + } + if (! empty($arrayfields['f.frequency']['checked'])) + { + print ''; + } if (! empty($arrayfields['f.nb_gen_done']['checked'])) { - print ''; + print ''; } - print ''; - print ''; - + if (! empty($arrayfields['f.date_last_gen']['checked'])) + { + print ''; + } + if (! empty($arrayfields['f.date_when']['checked'])) + { + print ''; + } + if (! empty($arrayfields['f.datec']['checked'])) + { + print ''; + } + if (! empty($arrayfields['f.tms']['checked'])) + { + print ''; + } + // Action column print ''; + else + { + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''; + } print "
'; @@ -1558,7 +1578,8 @@ else * List mode */ $sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency,"; - $sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when"; + $sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when,"; + $sql.= " f.datec, f.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f"; if (! $user->rights->societe->client->voir && ! $socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -1570,10 +1591,10 @@ else } if ($search_ref) $sql .= natural_search('f.titre', $search_ref); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); - if ($search_frequency) $sql .= natural_search('f.frequency', $search_frequency); if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); + if ($search_frequency > 0) $sql.= natural_search('f.frequency', $search_frequency); if ($search_frequency == '1') $sql.= ' AND f.frequency > 0'; if ($search_frequency == '0') $sql.= ' AND (f.frequency IS NULL or f.frequency = 0)'; @@ -1605,23 +1626,24 @@ else } $nbtotalofrecords = ''; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) - { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); - } + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + } - $sql.= $db->order($sortfield, $sortorder); - $sql.= $db->plimit($limit+1,$offset); + $sql.= $db->order($sortfield, $sortorder); + $sql.= $db->plimit($limit+1,$offset); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - $param='&socid='.$socid; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($socid) $param.='&socid='.$socid; if ($day) $param.='&day='.$day; if ($month) $param.='&month='.$month; if ($year) $param.='&year=' .$year; @@ -1631,9 +1653,9 @@ else if ($search_ref) $param.='&search_ref=' .$search_ref; if ($search_societe) $param.='&search_societe=' .$search_societe; if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht; - if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat; + if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat; if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc; - if ($search_frequency) $param.='&search_frequency=' .$search_frequency; + if ($search_frequency > 0) $param.='&search_frequency=' .$search_frequency; if ($option) $param.="&option=".$option; if ($optioncss != '') $param.='&optioncss='.$optioncss; // Add $param from extra fields @@ -1646,14 +1668,20 @@ else $massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); - print '
'."\n"; + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + //$selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + + print ''."\n"; if ($optioncss != '') print ''; print ''; + print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; + print ''; print_barre_liste($langs->trans("RepeatableInvoices"),$page,$_SERVER['PHP_SELF'],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit); @@ -1776,23 +1804,23 @@ else print '
'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->titre; - print "'.$companystatic->getNomUrl(1,'customer').''.price($objp->total).''.price($objp->total_vat).''.price($objp->total_ttc).''.yn($objp->frequency?1:0).'
'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->titre; + print "'.$companystatic->getNomUrl(1,'customer').''.price($objp->total).''.price($objp->total_vat).''.price($objp->total_ttc).''.yn($objp->frequency?1:0).''.($objp->frequency ? $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') : '').''; + print ($objp->frequency ? $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') : ''.$langs->trans('NA').''); + print ''.($objp->frequency ? dol_print_date($objp->date_last_gen,'day') : '').''.($objp->frequency ? dol_print_date($objp->date_when,'day') : '').''; + print ($objp->frequency ? dol_print_date($db->jdate($objp->date_last_gen),'day') : ''.$langs->trans('NA').''); + print ''; + print ($objp->frequency ? dol_print_date($db->jdate($objp->date_when),'day') : ''.$langs->trans('NA').''); + print ''; + print dol_print_date($db->jdate($objp->datec),'dayhour'); + print ''; + print dol_print_date($db->jdate($objp->tms),'dayhour'); + print ''; if ($user->rights->facture->creer) { @@ -1842,7 +1911,12 @@ else $i++; } } - else print '
'.$langs->trans("NoneF").'
'.$langs->trans("NoRecordFound").'
"; print ""; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 5ab62bf5337..72ea7e1a647 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -191,7 +191,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOST("button_removefilter.x")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha') || GETPOST('button_removefilter.x','alpha')) // All tests are required to be compatible with all browsers { $search_user=''; $search_sale=''; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index aeed72d93d1..3e2b43b7f34 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -68,7 +68,7 @@ $accountstatic=new Account($db); */ // If click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_ref=''; $search_amount=''; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index ec2bbc78fc6..4a7a2e3c81a 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -77,7 +77,7 @@ $extrafields = new ExtraFields($db); * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $search_ref=""; $search_account=""; diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 9a5585c2513..6fcbb62b5d9 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -57,7 +57,7 @@ $search_ref = GETPOST('search_ref','alpha'); * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_ref=""; } diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 208be88aeae..6251a6f6521 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -65,7 +65,7 @@ $ligne=new LignePrelevement($db,$user); * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_line=""; $search_bon=""; diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index baf99182993..b25df5a71ac 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -79,7 +79,7 @@ else * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $search_ref=""; $search_label=""; diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 2ab2cb1c172..50dd4d430ed 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -71,7 +71,7 @@ else $typeid=$_REQUEST['typeid']; } -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $search_ref=""; $search_label=""; diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index 44c45a65dc7..c75730d2f8e 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -74,7 +74,7 @@ else $typeid=$_REQUEST['typeid']; } -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $search_ref=""; $search_label=""; diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 74ec89bf5d1..7f35c71cd11 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -122,7 +122,7 @@ if (empty($reshook)) } // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $actioncode=''; $search_agenda_label=''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index b80a300431a..3b7ce848731 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -108,7 +108,7 @@ class Contact extends CommonObject $this->db = $db; $this->statut = 1; // By default, status is enabled } - + /** * Load indicators into this->nb for board * @@ -117,10 +117,10 @@ class Contact extends CommonObject function load_state_board() { global $user; - + $this->nb=array(); $clause = "WHERE"; - + $sql = "SELECT count(sp.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; if (!$user->rights->societe->client->voir && !$user->societe_id) @@ -133,7 +133,7 @@ class Contact extends CommonObject $sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element, 1).')'; $sql.= " AND (sp.priv='0' OR (sp.priv='1' AND sp.fk_user_creat=".$user->id."))"; if ($user->societe_id > 0) $sql.=" AND sp.fk_soc = ".$user->societe_id; - + $resql=$this->db->query($sql); if ($resql) { @@ -410,7 +410,9 @@ class Contact extends CommonObject { global $conf,$langs; - // Object classes + $info = array(); + + // Object classes $info["objectclass"]=explode(',',$conf->global->LDAP_CONTACT_OBJECT_CLASS); $this->fullname=$this->getFullName($langs); @@ -486,7 +488,7 @@ class Contact extends CommonObject $result=false; $this->db->begin(); - + // Mis a jour contact $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET"; $sql.= " birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null"); @@ -544,7 +546,7 @@ class Contact extends CommonObject if ($result < 0) { $error++; } // End call triggers } - + if (! $error) { $this->db->commit(); @@ -659,7 +661,7 @@ class Contact extends CommonObject $this->canvas = $obj->canvas; $this->import_key = $obj->import_key; - + // Define gender according to civility $this->setGenderFromCivility(); @@ -735,7 +737,7 @@ class Contact extends CommonObject /** * Set property ->gender from property ->civility_id - * + * * @return void */ function setGenderFromCivility() @@ -746,8 +748,8 @@ class Contact extends CommonObject } else if(in_array($this->civility_id, array('MME','MLE'))) { $this->gender = 'woman'; } - } - + } + /** * Load number of elements the contact is used as a link for * ref_facturation @@ -1007,13 +1009,13 @@ class Contact extends CommonObject if ($this->phone_perso) $phonelist[]=$this->phone_perso; $label.= '
' . $langs->trans("Phone") . ': '.join(', ',$phonelist); $label.= '
' . $langs->trans("Address") . ': '.dol_format_address($this, 1, ' ', $langs); - + $link = 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label=$langs->trans("ShowContact"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.= ' class="classfortooltip">'; @@ -1029,15 +1031,15 @@ class Contact extends CommonObject if ($reshook > 0) $linkclose = $hookmanager->resPrint; $link.=$linkclose; - + $linkend=''; - + if ($option == 'xxx') { $link = ''; $linkend=''; } - + if ($withpicto) $result.=($link.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' '); $result.=$link.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend; return $result; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index a526a9bd78c..4b638dcfef6 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -146,7 +146,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $day=''; $month=''; diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index aea03a73df5..2fdec21f735 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -152,7 +152,7 @@ if (empty($reshook)) // Selection of new fields include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $search_name=""; $search_contract=""; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7917234158e..ddfb2780f3f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4169,6 +4169,9 @@ abstract class CommonObject $optionsArray = $extrafields->attributes[$this->table_element]['label']; } + $table_element = $this->table_element; + if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility + // Request to get complementary values if (count($optionsArray) > 0) { @@ -4180,7 +4183,7 @@ abstract class CommonObject $sql.= ", ".$name; } } - $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields"; + $sql.= " FROM ".MAIN_DB_PREFIX.$table_element."_extrafields"; $sql.= " WHERE fk_object = ".$rowid; dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG); @@ -4226,7 +4229,10 @@ abstract class CommonObject { $this->db->begin(); - $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; + $table_element = $this->table_element; + if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility + + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$table_element."_extrafields WHERE fk_object = ".$this->id; dol_syslog(get_class($this)."::deleteExtraFields delete", LOG_DEBUG); $resql=$this->db->query($sql_del); if (! $resql) @@ -4332,11 +4338,14 @@ abstract class CommonObject } $this->db->begin(); - $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; + $table_element = $this->table_element; + if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility + + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$table_element."_extrafields WHERE fk_object = ".$this->id; dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG); $this->db->query($sql_del); - $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$table_element."_extrafields (fk_object"; foreach($new_array_options as $key => $value) { $attributeKey = substr($key,8); // Remove 'options_' prefix @@ -4646,18 +4655,17 @@ abstract class CommonObject /** * Get buy price to use for margin calculation. This function is called when buy price is unknown. - * set buy price = sell price if ForceBuyingPriceIfNull configured, + * Set buy price = sell price if ForceBuyingPriceIfNull configured, * else if calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice * else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice * else set min buy price as buy price * - * @param float $unitPrice product unit price - * @param float $discountPercent line discount percent - * @param int $fk_product product id - * - * @return float <0 if ko, buyprice if ok + * @param float $unitPrice Product unit price + * @param float $discountPercent Line discount percent + * @param int $fk_product Product id + * @return float <0 if KO, buyprice if OK */ - public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0) + public function defineBuyPrice($unitPrice = 0.0, $discountPercent = 0.0, $fk_product = 0) { global $conf; @@ -4964,6 +4972,8 @@ abstract class CommonObject $fields = array_merge(array('datec'=>$this->db->idate(dol_now())), $this->set_save_query()); + $keys=array(); + $values = array(); foreach ($fields as $k => $v) { $keys[] = $k; $values[] = $this->quote($v); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4b5f151ec72..e44fa8a5aec 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -197,6 +197,7 @@ class ExtraFields if ($elementtype == 'contact') $elementtype='socpeople'; $table=$elementtype.'_extrafields'; + if ($elementtype == 'categorie') $table='categories_extrafields'; if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/",$attrname) && ! is_numeric($attrname)) { @@ -350,6 +351,7 @@ class ExtraFields if ($elementtype == 'contact') $elementtype='socpeople'; $table=$elementtype.'_extrafields'; + if ($elementtype == 'categorie') $table='categories_extrafields'; $error=0; @@ -460,6 +462,7 @@ class ExtraFields if ($elementtype == 'contact') $elementtype='socpeople'; $table=$elementtype.'_extrafields'; + if ($elementtype == 'categorie') $table='categories_extrafields'; if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ab64fad57dc..0f16a25c43f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2014 Regis Houssin + * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2006 Marc Barilley/Ocebo * Copyright (C) 2007 Franky Van Liedekerke @@ -5845,11 +5845,11 @@ class Form * @param string $morehtmlright More html code to show after ref. * @return string Portion HTML with ref + navigation buttons */ - function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='') - { - global $langs,$conf,$hookmanager; + function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='') + { + global $langs,$conf,$hookmanager; - $ret=''; + $ret=''; if (empty($fieldid)) $fieldid='rowid'; if (empty($fieldref)) $fieldref='ref'; @@ -5880,10 +5880,10 @@ class Form // Right part of banner if ($morehtmlright) $ret.='
'.$morehtmlright.'
'; - if ($previous_ref || $next_ref || $morehtml) - { - $ret.='
'; if (!empty($obj->maxrun)) {print $obj->maxrun;} print ''; if (!empty($obj->nbrun)) {print $obj->nbrun;} else {print '0';} print '
'."\n"; diff --git a/htdocs/product/inventory/listview.class.php b/htdocs/product/inventory/listview.class.php index ac5ec68f51a..3dddac44516 100644 --- a/htdocs/product/inventory/listview.class.php +++ b/htdocs/product/inventory/listview.class.php @@ -221,7 +221,7 @@ class Listview */ private function search($sql, &$TParam) { - if (empty($TParam['no-auto-sql-search']) && !GETPOST("button_removefilter_x") && !GETPOST("button_removefilter.x") && !GETPOST("button_removefilter")) + if (empty($TParam['no-auto-sql-search']) && !GETPOST('button_removefilter_x','alpha') && !GETPOST('button_removefilter.x','alpha') && !GETPOST('button_removefilter','alpha')) { foreach ($TParam['search'] as $field => $info) { @@ -331,7 +331,7 @@ class Listview if(empty($TSearch[$key]))$TSearch[$key]=''; } - $removeFilter = (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")); + $removeFilter = (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')); foreach($TParam['search'] as $key => $param_search) { if ($removeFilter) $value = ''; diff --git a/htdocs/product/list-with-listview.php b/htdocs/product/list-with-listview.php index 8e4218db227..2b967e62ba5 100644 --- a/htdocs/product/list-with-listview.php +++ b/htdocs/product/list-with-listview.php @@ -203,7 +203,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $sall=""; $sref=""; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index dae7ea7d8c8..af5e500fbf5 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -206,7 +206,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $sall=""; $sref=""; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index e296d44bd33..1000388cb56 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -89,7 +89,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_soc = ''; } diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index ffa0544976b..9d58c244b2e 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -86,7 +86,7 @@ if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $sref=""; $snom=""; diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index d3694e039eb..3c335ed1ad8 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -83,7 +83,7 @@ if (! empty($canvas)) * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $sref=""; $snom=""; diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 5d419cc880c..1b4036af8af 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -61,7 +61,7 @@ if (! $sortfield) $sortfield="c.date_commande"; $search_month = GETPOST('search_month', 'aplha'); $search_year = GETPOST('search_year', 'int'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) { $search_month=''; $search_year=''; } diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index d63300a3a96..ad802ed36f6 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -67,7 +67,7 @@ if (! $sortfield) $search_month = GETPOST('search_month', 'aplha'); $search_year = GETPOST('search_year', 'int'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) { $search_month = ''; $search_year = ''; } diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 7117f0c03c0..831e7ec729c 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -62,7 +62,7 @@ if (! $sortfield) $sortfield="f.datef"; $search_month = GETPOST('search_month', 'aplha'); $search_year = GETPOST('search_year', 'int'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) { $search_month=''; $search_year=''; } diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index e9124cd003b..514fc622cc5 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -63,7 +63,7 @@ if (! $sortfield) $sortfield = "f.datef"; $search_month = GETPOST('search_month', 'aplha'); $search_year = GETPOST('search_year', 'int'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) { $search_month = ''; $search_year = ''; } diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index c5caf6c7c2c..3b7131245a6 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -61,7 +61,7 @@ if (! $sortfield) $sortfield = "p.datep"; $search_month = GETPOST('search_month', 'aplha'); $search_year = GETPOST('search_year', 'int'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) { $search_month = ''; $search_year = ''; } diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index d3de2b6b6e5..683bb4de566 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -65,7 +65,7 @@ $fieldstosearchall = array( include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $search_ref=""; $sall=""; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 23df5282435..e12ecee2b9b 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -122,7 +122,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $year=''; $month=''; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index ef4a9bf70c9..fc60f500ba6 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -142,7 +142,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_entity=''; $search_product=''; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 59856e35d55..a3f4cb8ecaf 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -92,7 +92,7 @@ if ($mode == 'virtual') $usevirtualstock=1; * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter") || isset($_POST['valid'])) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha') || isset($_POST['valid'])) // Both test are required to be compatible with all browsers { $sref = ''; $snom = ''; diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index d190c4d704d..6ed7fc379b5 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -63,7 +63,7 @@ $offset = $limit * $page; * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $sall=""; $sref=""; diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 908767afe32..a7b243dd338 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -97,7 +97,7 @@ $object=new Task($db); */ // Purge criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $action = ''; $search_usertoprocessid = ''; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 4a2156430af..5f3e9b1aa20 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -110,7 +110,7 @@ $object=new Task($db); */ // Purge criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $action = ''; $search_usertoprocessid = ''; diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index 05c31287745..8e506b5d454 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -78,7 +78,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $actioncode=''; $search_agenda_label=''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 9c78387f95b..1bf65decd71 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -161,7 +161,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_all=''; $search_categ=''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 41ae6d28364..112c2697706 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -81,7 +81,7 @@ $userAccess=0; */ // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_user_id=""; $toselect=''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 7bff02fa864..58ef76b7a91 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -151,7 +151,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_all=""; $search_categ=""; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index f85b5071de1..a04a4573aea 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -459,7 +459,9 @@ if ($id > 0 || ! empty($ref)) // Third party $morehtmlref.=$langs->trans("ThirdParty").': '; - $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); + if (!empty($projectstatic->thirdparty)) { + $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); + } $morehtmlref.=''; } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 37331b000ab..f643b9b5ca3 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -96,7 +96,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_date=''; $search_datehour=''; diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 53658c588c6..0564392071a 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -130,7 +130,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $search_ref=""; $search_label=""; diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index c67fb1c4dc4..497b9593142 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -83,7 +83,7 @@ if (empty($reshook)) } // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $actioncode=''; $search_agenda_label=''; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 1605e7281b8..2bd764c92ed 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2003 Brian Fraval * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2005-2016 Regis Houssin + * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2008 Patrick Raguin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Florian Henry @@ -3346,31 +3346,36 @@ class Societe extends CommonObject */ function getOutstandingProposals($mode='customer') { - $table='propal'; - if ($mode == 'supplier') $table = 'supplier_proposal'; + $table='propal'; + if ($mode == 'supplier') $table = 'supplier_proposal'; - $sql = "SELECT rowid, total_ht, total as total_ttc, fk_statut FROM ".MAIN_DB_PREFIX.$table." as f"; - $sql .= " WHERE fk_soc = ". $this->id; + $sql = "SELECT rowid, total_ht, total as total_ttc, fk_statut FROM ".MAIN_DB_PREFIX.$table." as f"; + $sql .= " WHERE fk_soc = ". $this->id; + if ($mode == 'supplier') { + $sql .= " AND entity IN (".getEntity('supplier_proposal').")"; + } else { + $sql .= " AND entity IN (".getEntity('propal').")"; + } - dol_syslog("getOutstandingProposals", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - $outstandingOpened = 0; - $outstandingTotal = 0; - $outstandingTotalIncTax = 0; - while($obj=$this->db->fetch_object($resql)) { - $outstandingTotal+= $obj->total_ht; - $outstandingTotalIncTax+= $obj->total_ttc; - if ($obj->fk_statut != 0) // Not a draft - { - $outstandingOpened+=$obj->total_ttc; - } - } - return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); - } - else - return array(); + dol_syslog("getOutstandingProposals", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $outstandingOpened = 0; + $outstandingTotal = 0; + $outstandingTotalIncTax = 0; + while($obj=$this->db->fetch_object($resql)) { + $outstandingTotal+= $obj->total_ht; + $outstandingTotalIncTax+= $obj->total_ttc; + if ($obj->fk_statut != 0) // Not a draft + { + $outstandingOpened+=$obj->total_ttc; + } + } + return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); + } + else + return array(); } /** @@ -3381,31 +3386,36 @@ class Societe extends CommonObject */ function getOutstandingOrders($mode='customer') { - $table='commande'; - if ($mode == 'supplier') $table = 'commande_fournisseur'; + $table='commande'; + if ($mode == 'supplier') $table = 'commande_fournisseur'; - $sql = "SELECT rowid, total_ht, total_ttc, fk_statut FROM ".MAIN_DB_PREFIX.$table." as f"; - $sql .= " WHERE fk_soc = ". $this->id; + $sql = "SELECT rowid, total_ht, total_ttc, fk_statut FROM ".MAIN_DB_PREFIX.$table." as f"; + $sql .= " WHERE fk_soc = ". $this->id; + if ($mode == 'supplier') { + $sql .= " AND entity IN (".getEntity('supplier_order').")"; + } else { + $sql .= " AND entity IN (".getEntity('commande').")"; + } - dol_syslog("getOutstandingOrders", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - $outstandingOpened = 0; - $outstandingTotal = 0; - $outstandingTotalIncTax = 0; - while($obj=$this->db->fetch_object($resql)) { - $outstandingTotal+= $obj->total_ht; - $outstandingTotalIncTax+= $obj->total_ttc; - if ($obj->fk_statut != 0) // Not a draft - { - $outstandingOpened+=$obj->total_ttc; - } - } - return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); - } - else - return array(); + dol_syslog("getOutstandingOrders", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $outstandingOpened = 0; + $outstandingTotal = 0; + $outstandingTotalIncTax = 0; + while($obj=$this->db->fetch_object($resql)) { + $outstandingTotal+= $obj->total_ht; + $outstandingTotalIncTax+= $obj->total_ttc; + if ($obj->fk_statut != 0) // Not a draft + { + $outstandingOpened+=$obj->total_ttc; + } + } + return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); + } + else + return array(); } /** @@ -3416,64 +3426,69 @@ class Societe extends CommonObject */ function getOutstandingBills($mode='customer') { - $table='facture'; - if ($mode == 'supplier') $table = 'facture_fourn'; + $table='facture'; + if ($mode == 'supplier') $table = 'facture_fourn'; - /* Accurate value of remain to pay is to sum remaintopay for each invoice - $paiement = $invoice->getSommePaiement(); - $creditnotes=$invoice->getSumCreditNotesUsed(); - $deposits=$invoice->getSumDepositsUsed(); - $alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT'); - $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); - */ - if ($mode == 'supplier') $sql = "SELECT rowid, total_ht as total_ht, total_ttc, paye, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; - else $sql = "SELECT rowid, total as total_ht, total_ttc, paye, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; - $sql .= " WHERE fk_soc = ". $this->id; + /* Accurate value of remain to pay is to sum remaintopay for each invoice + $paiement = $invoice->getSommePaiement(); + $creditnotes=$invoice->getSumCreditNotesUsed(); + $deposits=$invoice->getSumDepositsUsed(); + $alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT'); + $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); + */ + if ($mode == 'supplier') $sql = "SELECT rowid, total_ht as total_ht, total_ttc, paye, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; + else $sql = "SELECT rowid, total as total_ht, total_ttc, paye, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; + $sql .= " WHERE fk_soc = ". $this->id; + if ($mode == 'supplier') { + $sql .= " AND entity IN (".getEntity('facture_fourn').")"; + } else { + $sql .= " AND entity IN (".getEntity('facture').")"; + } - dol_syslog("getOutstandingBills", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - $outstandingOpened = 0; - $outstandingTotal = 0; - $outstandingTotalIncTax = 0; - if ($mode == 'supplier') - { - require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; - $tmpobject=new FactureFournisseur($this->db); - } - else - { - require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - $tmpobject=new Facture($this->db); - } - while($obj=$this->db->fetch_object($resql)) { - $tmpobject->id=$obj->rowid; - if ($obj->fk_statut != 0 // Not a draft - && ! ($obj->fk_statut == 3 && $obj->close_code == 'replaced') // Not a replaced invoice - ) - { - $outstandingTotal+= $obj->total_ht; - $outstandingTotalIncTax+= $obj->total_ttc; - } - if ($obj->paye == 0 - && $obj->fk_statut != 0 // Not a draft - && $obj->fk_statut != 3 // Not abandonned - && $obj->fk_statut != 2) // Not classified as paid - //$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason - { - $paiement = $tmpobject->getSommePaiement(); - $creditnotes = $tmpobject->getSumCreditNotesUsed(); - $deposits = $tmpobject->getSumDepositsUsed(); - $outstandingOpened+=$obj->total_ttc - $paiement - $creditnotes - $deposits; - } - } - return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); - } - else - { - return array(); - } + dol_syslog("getOutstandingBills", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $outstandingOpened = 0; + $outstandingTotal = 0; + $outstandingTotalIncTax = 0; + if ($mode == 'supplier') + { + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; + $tmpobject=new FactureFournisseur($this->db); + } + else + { + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $tmpobject=new Facture($this->db); + } + while($obj=$this->db->fetch_object($resql)) { + $tmpobject->id=$obj->rowid; + if ($obj->fk_statut != 0 // Not a draft + && ! ($obj->fk_statut == 3 && $obj->close_code == 'replaced') // Not a replaced invoice + ) + { + $outstandingTotal+= $obj->total_ht; + $outstandingTotalIncTax+= $obj->total_ttc; + } + if ($obj->paye == 0 + && $obj->fk_statut != 0 // Not a draft + && $obj->fk_statut != 3 // Not abandonned + && $obj->fk_statut != 2) // Not classified as paid + //$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason + { + $paiement = $tmpobject->getSommePaiement(); + $creditnotes = $tmpobject->getSumCreditNotesUsed(); + $deposits = $tmpobject->getSumDepositsUsed(); + $outstandingOpened+=$obj->total_ttc - $paiement - $creditnotes - $deposits; + } + } + return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); + } + else + { + return array(); + } } /** diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index d9cae2a4170..5c134aee36d 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -57,7 +57,7 @@ $month = GETPOST('month','int'); $year = GETPOST('year','int'); // Clean up on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $sref=''; $sprod_fulldescr=''; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 252bfc9383c..f7a479b8ddf 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -209,7 +209,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Did we click on purge search criteria ? - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_nom=''; $search_alias=''; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index d7b683f92e7..515aef60a6a 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -69,7 +69,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $search_prod = ''; } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index e5040b3150d..e8fe0f5b2a2 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -983,7 +983,9 @@ $now = dol_now(); // Add new askprice if ($action == 'create') { - print load_fiche_titre($langs->trans("NewAskPrice")); + $currency_code = $conf->currency; + + print load_fiche_titre($langs->trans("NewAskPrice")); $soc = new Societe($db); if ($socid > 0) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 1d27e7c4986..61ad1401dc2 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2563,10 +2563,9 @@ class SupplierProposal extends CommonObject /** - * \class SupplierProposalLine - * \brief Class to manage supplier_proposal lines + * Class to manage supplier_proposal lines */ -class SupplierProposalLine extends CommonObjectLine +class SupplierProposalLine extends CommonObjectLine { var $db; var $error; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index f6d9c9510a0..23a0fae1876 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -177,7 +177,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_categ=''; $search_user=''; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index be9bb0e1f4c..5240605c25c 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -806,6 +806,7 @@ class UserGroup extends CommonObject function _load_ldap_info() { global $conf,$langs; + $info=array(); // Object classes diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index e53080cea73..a32db37d3fb 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -1,9 +1,9 @@ - * Copyright (C) 2005-2015 Laurent Destailleur - * Copyright (C) 2005-2017 Regis Houssin - * Copyright (C) 2011 Herve Prot - * Copyright (C) 2012 Florian Henry +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2015 Laurent Destailleur + * Copyright (C) 2005-2017 Regis Houssin + * Copyright (C) 2011 Herve Prot + * Copyright (C) 2012 Florian Henry * * 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 @@ -82,7 +82,7 @@ if ($action == 'confirm_delete' && $confirm == "yes") } else { - $langs->load("errors"); + $langs->load("errors"); setEventMessages($langs->trans('ErrorForbidden'), null, 'errors'); } } @@ -132,7 +132,7 @@ if ($action == 'add') } else { - $langs->load("errors"); + $langs->load("errors"); setEventMessages($langs->trans('ErrorForbidden'), null, 'errors'); } } @@ -165,7 +165,7 @@ if ($action == 'adduser' || $action =='removeuser') } else { - $langs->load("errors"); + $langs->load("errors"); setEventMessages($langs->trans('ErrorForbidden'), null, 'errors'); } } @@ -207,7 +207,7 @@ if ($action == 'update') } else { - $langs->load("errors"); + $langs->load("errors"); setEventMessages($langs->trans('ErrorForbidden'), null, 'mesgs'); } } @@ -275,7 +275,7 @@ if ($action == 'create') print $hookmanager->resPrint; if (empty($reshook) && ! empty($extrafields->attribute_label)) { - print $object->showOptionals($extrafields,'edit'); + print $object->showOptionals($extrafields,'edit'); } print "
\n"; @@ -316,23 +316,26 @@ else if ($action != 'edit') { - dol_fiche_head($head, 'group', $title, -1, 'group'); + dol_fiche_head($head, 'group', $title, -1, 'group'); dol_banner_tab($object,'id','',$user->rights->user->user->lire || $user->admin); print '
'; print '
'; - print ''; + print '
'; - // Name - print ''; - print '\n"; + // Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner) + if (! empty($conf->mutlicompany->enabled)) + { + print ''; + print '\n"; + } // Multicompany if (! empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) @@ -350,7 +353,7 @@ else // Other attributes $parameters=array('colspan' => ' colspan="2"'); - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print "
'.$langs->trans("Name").''.$object->name; - if (empty($object->entity)) - { - print img_picto($langs->trans("GlobalGroup"),'redstar'); - } - print "
'.$langs->trans("Name").''.$object->name; + if (empty($object->entity)) + { + print img_picto($langs->trans("GlobalGroup"),'redstar'); + } + print "
\n"; print '
'; @@ -435,59 +438,57 @@ else print ''.$langs->trans("Lastname").''; print ''.$langs->trans("Firstname").''; if (! empty($conf->multicompany->enabled) && $conf->entity == 1) - { - print ''.$langs->trans("Entity").''; + { + print ''.$langs->trans("Entity").''; } print ''.$langs->trans("Status").''; print ' '; print "\n"; - if (! empty($object->members)) - { - foreach($object->members as $useringroup) - { - - - print ''; - print ''; - print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login'); - if ($useringroup->admin && ! $useringroup->entity) print img_picto($langs->trans("SuperAdministrator"),'redstar'); - else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star'); - print ''; - print ''.$useringroup->lastname.''; - print ''.$useringroup->firstname.''; - if (! empty($conf->multicompany->enabled) && is_object($mc) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print ''; - if (! empty($useringroup->usergroup_entity)) - { - $nb=0; - foreach($useringroup->usergroup_entity as $group_entity) - { - $mc->getInfo($group_entity); - print ($nb > 0 ? ', ' : '').$mc->label; - print ''; - print img_delete($langs->trans("RemoveFromGroup")); - print ''; - $nb++; - } - } - print ''; - } - print ''.$useringroup->getLibStatut(3).''; - print ''; - if (! empty($user->admin) && empty($conf->multicompany->enabled)) - { - print ''; - print img_delete($langs->trans("RemoveFromGroup")); - print ''; - } - else - { - print "-"; - } - print "\n"; - } + if (! empty($object->members)) + { + foreach($object->members as $useringroup) + { + print ''; + print ''; + print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login'); + if ($useringroup->admin && ! $useringroup->entity) print img_picto($langs->trans("SuperAdministrator"),'redstar'); + else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star'); + print ''; + print ''.$useringroup->lastname.''; + print ''.$useringroup->firstname.''; + if (! empty($conf->multicompany->enabled) && is_object($mc) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print ''; + if (! empty($useringroup->usergroup_entity)) + { + $nb=0; + foreach($useringroup->usergroup_entity as $group_entity) + { + $mc->getInfo($group_entity); + print ($nb > 0 ? ', ' : '').$mc->label; + print ''; + print img_delete($langs->trans("RemoveFromGroup")); + print ''; + $nb++; + } + } + print ''; + } + print ''.$useringroup->getLibStatut(3).''; + print ''; + if (! empty($user->admin) && empty($conf->multicompany->enabled)) + { + print ''; + print img_delete($langs->trans("RemoveFromGroup")); + print ''; + } + else + { + print "-"; + } + print "\n"; + } } else { @@ -547,10 +548,10 @@ else print "".$mc->select_entities($object->entity); print "\n"; } - else - { - print ''; - } + else + { + print ''; + } } print ''.$langs->trans("Description").''; @@ -560,13 +561,13 @@ else $doleditor->Create(); print ''; print "\n"; - // Other attributes + // Other attributes $parameters=array(); $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'); + print $object->showOptionals($extrafields,'edit'); } print "\n"; diff --git a/htdocs/user/group/index.php b/htdocs/user/group/index.php index e8d37801998..41eb7d0fa77 100644 --- a/htdocs/user/group/index.php +++ b/htdocs/user/group/index.php @@ -81,7 +81,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers { $search_label=""; $search_date_creation=""; diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index 6d987be85cb..c195136863e 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php'; $langs->load("companies"); $langs->load("ldap"); $langs->load("users"); +$langs->load("admin"); // Users/Groups management only in master entity if transverse mode if (! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) @@ -110,22 +111,23 @@ print '
'; print ''; -// Name -print ''; -print ''; + print '\n"; } -print "\n"; // Note -print ''; -print ''; +print ''; +print ''; print "\n"; -$langs->load("admin"); - // LDAP DN print '\n"; diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 94a9c9c1883..46477879b14 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -205,14 +205,17 @@ if ($object->id) print '
'.$langs->trans("Name").''.$object->name; -if (!$object->entity) +// Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner) +if (! empty($conf->mutlicompany->enabled)) { - print img_picto($langs->trans("GlobalGroup"),'redstar'); + print '
'.$langs->trans("Name").''.$object->name; + if (!$object->entity) + { + print img_picto($langs->trans("GlobalGroup"),'redstar'); + } + print "
'.$langs->trans("Note").''.nl2br($object->note).' 
'.$langs->trans("Description").''.dol_htmlentitiesbr($object->note).'
LDAP '.$langs->trans("LDAPGroupDn").''.$conf->global->LDAP_GROUP_DN."
'; - // Nom - print ''; - print ''; + print '\n"; } - print "\n"; // Note print ''; diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index 3e82e2b6357..59798d65e1a 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -47,7 +47,7 @@ $search_statut=GETPOST('search_statut','int'); if ($search_statut == '') $search_statut='1'; -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { $search_statut=""; } diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 54fffcd3fb7..631a75d47c4 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -148,7 +148,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria - if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_user=""; $search_login=""; diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index c0a4ce845a9..feac8b212ed 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -286,11 +286,27 @@ class FilesLibTest extends PHPUnit_Framework_TestCase $db=$this->savdb; $dirout=$conf->admin->dir_temp.'/test'; + $dirout2=$conf->admin->dir_temp.'/test2'; $count=0; - $result=dol_delete_dir_recursive($dirout,$count,1); // If it has no permission to delete, it will fails as if dir does not exists, so we can't test it + $result=dol_delete_dir_recursive($dirout,$count); // If it has no permission to delete, it will fails as if dir does not exists, so we can't test it print __METHOD__." result=".$result."\n"; $this->assertGreaterThanOrEqual(0,$result); + + $count=0; + $countdeleted=0; + $result=dol_delete_dir_recursive($dirout,$count,1,0,$countdeleted); // If it has no permission to delete, it will fails as if dir does not exists, so we can't test it + print __METHOD__." result=".$result."\n"; + $this->assertGreaterThanOrEqual(0,$result); + $this->assertGreaterThanOrEqual(0,$countdeleted); + + dol_mkdir($dirout2); + $count=0; + $countdeleted=0; + $result=dol_delete_dir_recursive($dirout2,$count,1,0,$countdeleted); // If it has no permission to delete, it will fails as if dir does not exists, so we can't test it + print __METHOD__." result=".$result."\n"; + $this->assertGreaterThanOrEqual(1,$result); + $this->assertGreaterThanOrEqual(1,$countdeleted); } @@ -399,7 +415,7 @@ class FilesLibTest extends PHPUnit_Framework_TestCase print __METHOD__." result=".join(',',$result)."\n"; $this->assertEquals(0,count($result)); } - + /** * testDolDirList * @@ -411,7 +427,7 @@ class FilesLibTest extends PHPUnit_Framework_TestCase public function testDolDirList() { global $conf,$user,$langs,$db; - + // Scan dir to guaruante we on't have library jquery twice (we accept exception of duplicte into ckeditor because all dir is removed for debian package, so there is no duplicate). $founddirs=dol_dir_list(DOL_DOCUMENT_ROOT.'/includes/', 'files', 1, '^jquery\.js', array('ckeditor')); print __METHOD__." count(founddirs)=".count($founddirs)."\n"; @@ -431,60 +447,60 @@ class FilesLibTest extends PHPUnit_Framework_TestCase $user=$this->savuser; $langs=$this->savlangs; $db=$this->savdb; - - + + //$dummyuser=new User($db); //$result=restrictedArea($dummyuser,'societe'); // We save user properties $savpermlire = $user->rights->facture->lire; $savpermcreer = $user->rights->facture->creer; - - + + // Check access to SPECIMEN $user->rights->facture->lire = 0; $user->rights->facture->creer = 0; $filename='SPECIMEN.pdf'; // Filename relative to module part $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'read'); $this->assertEquals(1,$result['accessallowed']); - - + + // Check read permission $user->rights->facture->lire = 1; $user->rights->facture->creer = 1; $filename='FA010101/FA010101.pdf'; // Filename relative to module part $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'read'); $this->assertEquals(1,$result['accessallowed']); - + $user->rights->facture->lire = 0; $user->rights->facture->creer = 0; $filename='FA010101/FA010101.pdf'; // Filename relative to module part $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'read'); $this->assertEquals(0,$result['accessallowed']); - + // Check write permission $user->rights->facture->lire = 0; $user->rights->facture->creer = 0; $filename='FA010101/FA010101.pdf'; // Filename relative to module part $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'write'); $this->assertEquals(0,$result['accessallowed']); - + $user->rights->facture->lire = 1; $user->rights->facture->creer = 1; $filename='FA010101/FA010101.pdf'; // Filename relative to module part $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'write'); $this->assertEquals(1,$result['accessallowed']); - + $user->rights->facture->lire = 1; $user->rights->facture->creer = 0; $filename='FA010101/FA010101.pdf'; // Filename relative to module part $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'write'); $this->assertEquals(0,$result['accessallowed']); - - + + // We restore user properties $user->rights->facture->lire = $savpermlire; $user->rights->facture->creer = $savpermcreer; - } + } }
'.$langs->trans("Name").''.$object->name.''; - if (! $object->entity) + // Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner) + if (! empty($conf->mutlicompany->enabled)) { - print img_picto($langs->trans("GlobalGroup"),'redstar'); + print '
'.$langs->trans("Name").''.$object->name.''; + if (! $object->entity) + { + print img_picto($langs->trans("GlobalGroup"),'redstar'); + } + print "
'.$langs->trans("Description").'