diff --git a/build.xml b/build.xml deleted file mode 100644 index c6995ce95f3..00000000000 --- a/build.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 7eae1eb6536..ae36f0f7fa6 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -37,8 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other")); // Security access -if (empty($user->rights->accounting->chartofaccount)) -{ +if (empty($user->rights->accounting->chartofaccount)) { accessforbidden(); } @@ -48,9 +47,9 @@ $action = GETPOST('action', 'aZ09'); $list = array( 'ACCOUNTING_LENGTH_GACCOUNT', 'ACCOUNTING_LENGTH_AACCOUNT', -// 'ACCOUNTING_LIMIT_LIST_VENTILATION' // there is already a global parameter to define the nb of records in lists, we must use it in priority. Having one parameter for nb of record for each page is deprecated. -// 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc -// 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc +// 'ACCOUNTING_LIMIT_LIST_VENTILATION' // there is already a global parameter to define the nb of records in lists, we must use it in priority. Having one parameter for nb of record for each page is deprecated. +// 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc +// 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc ); $list_binding = array( @@ -65,10 +64,8 @@ $list_binding = array( if ($action == 'update') { $error = 0; - if (!$error) - { - foreach ($list as $constname) - { + if (!$error) { + foreach ($list as $constname) { $constvalue = GETPOST($constname, 'alpha'); if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { @@ -79,8 +76,7 @@ if ($action == 'update') { setEventMessages($langs->trans("Error"), null, 'errors'); } - foreach ($list_binding as $constname) - { + foreach ($list_binding as $constname) { $constvalue = GETPOST($constname, 'alpha'); if ($constname == 'ACCOUNTING_DATE_START_BINDING') { @@ -104,8 +100,9 @@ if ($action == 'update') { if ($action == 'setlistsorttodo') { $setlistsorttodo = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity); - if (!$res > 0) + if (!$res > 0) { $error++; + } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -117,8 +114,9 @@ if ($action == 'setlistsorttodo') { if ($action == 'setlistsortdone') { $setlistsortdone = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity); - if (!$res > 0) + if (!$res > 0) { $error++; + } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -129,8 +127,9 @@ if ($action == 'setlistsortdone') { if ($action == 'setmanagezero') { $setmanagezero = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity); - if (!$res > 0) + if (!$res > 0) { $error++; + } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -141,8 +140,9 @@ if ($action == 'setmanagezero') { if ($action == 'setdisabledirectinput') { $setdisabledirectinput = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); - if (!$res > 0) + if (!$res > 0) { $error++; + } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -153,8 +153,9 @@ if ($action == 'setdisabledirectinput') { if ($action == 'setenabledraftexport') { $setenabledraftexport = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity); - if (!$res > 0) + if (!$res > 0) { $error++; + } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -165,8 +166,9 @@ if ($action == 'setenabledraftexport') { if ($action == 'setenablesubsidiarylist') { $setenablesubsidiarylist = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity); - if (!$res > 0) + if (!$res > 0) { $error++; + } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -177,8 +179,9 @@ if ($action == 'setenablesubsidiarylist') { if ($action == 'setdisablebindingonsales') { $setdisablebindingonsales = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity); - if (!$res > 0) + if (!$res > 0) { $error++; + } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -189,8 +192,9 @@ if ($action == 'setdisablebindingonsales') { if ($action == 'setdisablebindingonpurchases') { $setdisablebindingonpurchases = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity); - if (!$res > 0) + if (!$res > 0) { $error++; + } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -201,8 +205,9 @@ if ($action == 'setdisablebindingonpurchases') { if ($action == 'setdisablebindingonexpensereports') { $setdisablebindingonexpensereports = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity); - if (!$res > 0) + if (!$res > 0) { $error++; + } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -289,11 +294,12 @@ if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { print ''; // Param a user $user->rights->accounting->chartofaccount can access -foreach ($list as $key) -{ +foreach ($list as $key) { print ''; - if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue; + if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) { + continue; + } // Param $label = $langs->trans($key); @@ -342,8 +348,7 @@ if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { print ''; // Param a user $user->rights->accounting->chartofaccount can access -foreach ($list_binding as $key) -{ +foreach ($list_binding as $key) { print ''; // Param diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 5ee0989c97c..34a6b2d5ffd 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Olivier Geffroy - * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2020 Florian Henry * Copyright (C) 2013-2020 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * @@ -22,7 +22,7 @@ /** * \file htdocs/accountancy/bookkeeping/listbyaccount.php * \ingroup Accountancy (Double entries) - * \brief List operation of book keeping ordered by account number + * \brief List operation of ledger ordered by account number */ require '../../main.inc.php'; @@ -62,7 +62,7 @@ $search_doc_ref = GETPOST('search_doc_ref', 'alpha'); $search_label_operation = GETPOST('search_label_operation', 'alpha'); $search_mvt_num = GETPOST('search_mvt_num', 'int'); $search_direction = GETPOST('search_direction', 'alpha'); -$search_ledger_code = GETPOST('search_ledger_code', 'alpha'); +$search_ledger_code = GETPOST('search_ledger_code', 'array'); $search_debit = GETPOST('search_debit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha'); $search_lettering_code = GETPOST('search_lettering_code', 'alpha'); @@ -172,7 +172,7 @@ if (empty($reshook)) $search_label_operation = ''; $search_mvt_num = ''; $search_direction = ''; - $search_ledger_code = ''; + $search_ledger_code = array(); $search_date_start = ''; $search_date_end = ''; $search_date_startyear = ''; @@ -233,7 +233,9 @@ if (empty($reshook)) } if (!empty($search_ledger_code)) { $filter['t.code_journal'] = $search_ledger_code; - $param .= '&search_ledger_code='.urlencode($search_ledger_code); + foreach ($search_ledger_code as $code) { + $param .= '&search_ledger_code[]='.urlencode($code); + } } if (!empty($search_debit)) { $filter['t.debit'] = $search_debit; @@ -448,7 +450,9 @@ print ''; // Code journal if (!empty($arrayfields['t.code_journal']['checked'])) { - print ''; + print ''; + print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); + print ''; } // Date document if (!empty($arrayfields['t.doc_date']['checked'])) { @@ -758,40 +762,42 @@ while ($i < min($num, $limit)) $i++; } -// Show sub-total of last shown account -if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { - $colnumber = 3; - $colnumberend = 7; -} else { - $colnumber = 4; - $colnumberend = 7; +if ($num > 0) { + // Show sub-total of last shown account + if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { + $colnumber = 3; + $colnumberend = 7; + } else { + $colnumber = 4; + $colnumberend = 7; + } + $colspan = $totalarray['nbfield'] - $colnumber; + $colspanend = $totalarray['nbfield'] - $colnumberend; + print ''; + print ''.$langs->trans("TotalForAccount").' '.$accountg.':'; + print ''.price($sous_total_debit).''; + print ''.price($sous_total_credit).''; + print ''; + print ''; + // Show balance of last shown account + $balance = $sous_total_debit - $sous_total_credit; + print ''; + print ''.$langs->trans("Balance").':'; + if ($balance > 0) + { + print ''; + print price($sous_total_debit - $sous_total_credit); + print ''; + print ''; + } else { + print ''; + print ''; + print price($sous_total_credit - $sous_total_debit); + print ''; + } + print ''; + print ''; } -$colspan = $totalarray['nbfield'] - $colnumber; -$colspanend = $totalarray['nbfield'] - $colnumberend; -print ''; -print ''.$langs->trans("TotalForAccount").' '.$accountg.':'; -print ''.price($sous_total_debit).''; -print ''.price($sous_total_credit).''; -print ''; -print ''; -// Show balance of last shown account -$balance = $sous_total_debit - $sous_total_credit; -print ''; -print ''.$langs->trans("Balance").':'; -if ($balance > 0) -{ - print ''; - print price($sous_total_debit - $sous_total_credit); - print ''; - print ''; -} else { - print ''; - print ''; - print price($sous_total_credit - $sous_total_debit); - print ''; -} -print ''; -print ''; // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index e54d20cd647..e30a9984949 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Olivier Geffroy - * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2020 Florian Henry * Copyright (C) 2013-2020 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * @@ -62,7 +62,7 @@ $search_doc_ref = GETPOST('search_doc_ref', 'alpha'); $search_label_operation = GETPOST('search_label_operation', 'alpha'); $search_mvt_num = GETPOST('search_mvt_num', 'int'); $search_direction = GETPOST('search_direction', 'alpha'); -$search_ledger_code = GETPOST('search_ledger_code', 'alpha'); +$search_ledger_code = GETPOST('search_ledger_code', 'array'); $search_debit = GETPOST('search_debit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha'); $search_lettering_code = GETPOST('search_lettering_code', 'alpha'); @@ -171,7 +171,7 @@ if (empty($reshook)) $search_label_operation = ''; $search_mvt_num = ''; $search_direction = ''; - $search_ledger_code = ''; + $search_ledger_code = array(); $search_date_start = ''; $search_date_end = ''; $search_date_startyear = ''; @@ -232,7 +232,9 @@ if (empty($reshook)) } if (!empty($search_ledger_code)) { $filter['t.code_journal'] = $search_ledger_code; - $param .= '&search_ledger_code='.urlencode($search_ledger_code); + foreach ($search_ledger_code as $code) { + $param .= '&search_ledger_code[]='.urlencode($code); + } } if (!empty($search_debit)) { $filter['t.debit'] = $search_debit; @@ -452,7 +454,9 @@ print ''; // Code journal if (!empty($arrayfields['t.code_journal']['checked'])) { - print ''; + print ''; + print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); + print ''; } // Date document if (!empty($arrayfields['t.doc_date']['checked'])) { @@ -770,40 +774,42 @@ while ($i < min($num, $limit)) $i++; } -// Show sub-total of last shown account -if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { - $colnumber = 3; - $colnumberend = 7; -} else { - $colnumber = 4; - $colnumberend = 7; +if ($num > 0) { + // Show sub-total of last shown account + if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { + $colnumber = 3; + $colnumberend = 7; + } else { + $colnumber = 4; + $colnumberend = 7; + } + $colspan = $totalarray['nbfield'] - $colnumber; + $colspanend = $totalarray['nbfield'] - $colnumberend; + print ''; + print ''.$langs->trans("TotalForAccount").' '.$accountg.':'; + print ''.price($sous_total_debit).''; + print ''.price($sous_total_credit).''; + print ''; + print ''; + // Show balance of last shown account + $balance = $sous_total_debit - $sous_total_credit; + print ''; + print ''.$langs->trans("Balance").':'; + if ($balance > 0) + { + print ''; + print price($sous_total_debit - $sous_total_credit); + print ''; + print ''; + } else { + print ''; + print ''; + print price($sous_total_credit - $sous_total_debit); + print ''; + } + print ''; + print ''; } -$colspan = $totalarray['nbfield'] - $colnumber; -$colspanend = $totalarray['nbfield'] - $colnumberend; -print ''; -print ''.$langs->trans("TotalForAccount").' '.$accountg.':'; -print ''.price($sous_total_debit).''; -print ''.price($sous_total_credit).''; -print ''; -print ''; -// Show balance of last shown account -$balance = $sous_total_debit - $sous_total_credit; -print ''; -print ''.$langs->trans("Balance").':'; -if ($balance > 0) -{ - print ''; - print price($sous_total_debit - $sous_total_credit); - print ''; - print ''; -} else { - print ''; - print ''; - print price($sous_total_credit - $sous_total_debit); - print ''; -} -print ''; -print ''; // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 72428762459..3b03e6ae8ca 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2015-2017 Alexandre Spangaro - * Copyright (C) 2015-2017 Florian Henry + * Copyright (C) 2015-2020 Florian Henry * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 2637612acc0..c87c1d90b0d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2597,38 +2597,8 @@ class Adherent extends CommonObject */ public function setCategories($categories) { - // Handle single category - if (!is_array($categories)) { - $categories = array($categories); - } - - // Get current categories require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - $c = new Categorie($this->db); - $existing = $c->containing($this->id, Categorie::TYPE_MEMBER, 'id'); - - // Diff - if (is_array($existing)) { - $to_del = array_diff($existing, $categories); - $to_add = array_diff($categories, $existing); - } else { - $to_del = array(); // Nothing to delete - $to_add = $categories; - } - - // Process - foreach ($to_del as $del) { - if ($c->fetch($del) > 0) { - $c->del_type($this, Categorie::TYPE_MEMBER); - } - } - foreach ($to_add as $add) { - if ($c->fetch($add) > 0) { - $c->add_type($this, Categorie::TYPE_MEMBER); - } - } - - return; + return parent::setCategoriesCommon($categories, Categorie::TYPE_MEMBER); } /** diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index 370de13c3a2..04b9f750a88 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -87,7 +87,7 @@ class Subscriptions extends DolibarrApi */ public function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { - global $db, $conf; + global $conf; $obj_ret = array(); @@ -183,7 +183,9 @@ class Subscriptions extends DolibarrApi } foreach ($request_data as $field => $value) { - if ($field == 'id') continue; + if ($field == 'id') { + continue; + } $subscription->$field = $value; } @@ -236,8 +238,9 @@ class Subscriptions extends DolibarrApi { $subscription = array(); foreach (Subscriptions::$FIELDS as $field) { - if (!isset($data[$field])) + if (!isset($data[$field])) { throw new RestException(400, "$field field missing"); + } $subscription[$field] = $data[$field]; } return $subscription; diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index b6349bf9dc2..dff127d6d2b 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -84,8 +84,15 @@ class Subscription extends CommonObject * @var int ID */ public $fk_type; + + /** + * @var int Member ID + */ public $fk_adherent; + /** + * @var double amount subscription + */ public $amount; /** @@ -140,7 +147,9 @@ class Subscription extends CommonObject $this->error = $langs->trans("ErrorBadValueForDate"); return -1; } - if (empty($this->datec)) $this->datec = $now; + if (empty($this->datec)) { + $this->datec = $now; + } $this->db->begin(); @@ -177,7 +186,9 @@ class Subscription extends CommonObject $this->context = array('member' => $member); // Call triggers $result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user); - if ($result < 0) { $error++; } + if ($result < 0) { + $error++; + } // End call triggers } @@ -278,7 +289,9 @@ class Subscription extends CommonObject $this->context = array('member'=>$member); // Call triggers $result = $this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user); - if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail + if ($result < 0) { + $error++; + } //Do also here what you must do to rollback action if trigger fail // End call triggers } } else { @@ -320,7 +333,9 @@ class Subscription extends CommonObject if (!$notrigger) { // Call triggers $result = $this->call_trigger('MEMBER_SUBSCRIPTION_DELETE', $user); - if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail + if ($result < 0) { + $error++; + } // Do also here what you must do to rollback action if trigger fail // End call triggers } } @@ -407,16 +422,24 @@ class Subscription extends CommonObject if ($option != 'nolink') { // Add param to save lastsearch_values or not $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { + $add_save_lastsearch_values = 1; + } + if ($add_save_lastsearch_values) { + $url .= '&save_lastsearch_values=1'; + } } $linkstart = ''; $linkend = ''; $result .= $linkstart; - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); - if ($withpicto != 2) $result .= $this->ref; + if ($withpicto) { + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + } + if ($withpicto != 2) { + $result .= $this->ref; + } $result .= $linkend; return $result; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 1da75fdefa5..87eec3676f8 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -230,6 +230,7 @@ if (empty($reshook)) { $objectlabel = 'Members'; $permissiontoread = $user->rights->adherent->lire; $permissiontodelete = $user->rights->adherent->supprimer; + $permissiontoadd = $user->rights->adherent->creer; $uploaddir = $conf->adherent->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -406,7 +407,8 @@ $arrayofmassactions = array( ); if ($user->rights->adherent->creer) $arrayofmassactions['close'] = $langs->trans("Resiliate"); if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); -if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); +if ($user->rights->societe->creer) $arrayofmassactions['preaffecttag'] = ''.$langs->trans("AffectTag"); +if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index a93f5c3c608..61688e18515 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -37,7 +37,9 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; // Load translation files required by the page $langs->loadLangs(array('admin', 'errors', 'trips', 'other')); -if (!$user->admin) accessforbidden(); +if (!$user->admin) { + accessforbidden(); +} $action = GETPOST('action', 'aZ09'); $value = GETPOST('value', 'alpha'); @@ -52,51 +54,47 @@ $type = 'expensereport'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; -if ($action == 'updateMask') -{ +if ($action == 'updateMask') { $maskconst = GETPOST('maskconst', 'alpha'); $maskvalue = GETPOST('maskvalue', 'alpha'); - if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); + if ($maskconst) { + $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); + } - if (!$res > 0) $error++; + if (!$res > 0) { + $error++; + } - if (!$error) - { + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') // For fiche inter -{ +} elseif ($action == 'specimen') { // For fiche expensereport $modele = GETPOST('module', 'alpha'); - $inter = new ExpenseReport($db); - $inter->initAsSpecimen(); - $inter->status = 0; // Force statut draft to show watermark - $inter->fk_statut = 0; // Force statut draft to show watermark + $expensespecimen = new ExpenseReport($db); + $expensespecimen->initAsSpecimen(); + $expensespecimen->status = 0; // Force statut draft to show watermark // Search template files $file = ''; $classname = ''; $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) - { + foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/expensereport/doc/pdf_".$modele.".modules.php", 0); - if (file_exists($file)) - { + if (file_exists($file)) { $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) - { + if ($filefound) { require_once $file; $module = new $classname($db); - if ($module->write_file($inter, $langs) > 0) - { + if ($module->write_file($expensespecimen, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expensereport&file=SPECIMEN.pdf"); return; } else { @@ -107,30 +105,22 @@ if ($action == 'updateMask') setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } -} - -// Activate a model -elseif ($action == 'set') -{ +} elseif ($action == 'set') { + // Activate a model $ret = addDocumentModel($value, $type, $label, $scandir); - if ($ret > 0 && empty($conf->global->EXPENSEREPORT_ADDON_PDF)) - { + if ($ret > 0 && empty($conf->global->EXPENSEREPORT_ADDON_PDF)) { dolibarr_set_const($db, 'EXPENSEREPORT_ADDON_PDF', $value, 'chaine', 0, '', $conf->entity); } -} elseif ($action == 'del') -{ +} elseif ($action == 'del') { $ret = delDocumentModel($value, $type); - if ($ret > 0) - { - if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$value") dolibarr_del_const($db, 'EXPENSEREPORT_ADDON_PDF', $conf->entity); + if ($ret > 0) { + if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$value") { + dolibarr_del_const($db, 'EXPENSEREPORT_ADDON_PDF', $conf->entity); + } } -} - -// Set default model -elseif ($action == 'setdoc') -{ - if (dolibarr_set_const($db, "EXPENSEREPORT_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) - { +} elseif ($action == 'setdoc') { + // Set default model + if (dolibarr_set_const($db, "EXPENSEREPORT_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) { // La constante qui a ete lue en avant du nouveau set // on passe donc par une variable pour avoir un affichage coherent $conf->global->EXPENSEREPORT_ADDON_PDF = $value; @@ -138,18 +128,15 @@ elseif ($action == 'setdoc') // On active le modele $ret = delDocumentModel($value, $type); - if ($ret > 0) - { + if ($ret > 0) { $ret = addDocumentModel($value, $type, $label, $scandir); } -} elseif ($action == 'setmod') -{ +} elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated dolibarr_set_const($db, "EXPENSEREPORT_ADDON", $value, 'chaine', 0, '', $conf->entity); -} elseif ($action == 'setoptions') -{ +} elseif ($action == 'setoptions') { $db->begin(); $freetext = GETPOST('EXPENSEREPORT_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string @@ -158,10 +145,11 @@ elseif ($action == 'setdoc') $draft = GETPOST('EXPENSEREPORT_DRAFT_WATERMARK', 'alpha'); $res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (!$res1 > 0 || !$res2 > 0) $error++; + if (!$res1 > 0 || !$res2 > 0) { + $error++; + } - if (!$error) - { + if (!$error) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -206,19 +194,14 @@ print ''."\n"; clearstatcache(); -foreach ($dirmodels as $reldir) -{ +foreach ($dirmodels as $reldir) { $dir = dol_buildpath($reldir."core/modules/expensereport/"); - if (is_dir($dir)) - { + if (is_dir($dir)) { $handle = opendir($dir); - if (is_resource($handle)) - { - while (($file = readdir($handle)) !== false) - { - if (substr($file, 0, 18) == 'mod_expensereport_' && substr($file, dol_strlen($file) - 3, 3) == 'php') - { + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { + if (substr($file, 0, 18) == 'mod_expensereport_' && substr($file, dol_strlen($file) - 3, 3) == 'php') { $file = substr($file, 0, dol_strlen($file) - 4); require_once $dir.$file.'.php'; @@ -226,11 +209,14 @@ foreach ($dirmodels as $reldir) $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + continue; + } + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + continue; + } - if ($module->isEnabled()) - { + if ($module->isEnabled()) { print ''.$module->nom."\n"; print $module->info(); print ''; @@ -241,13 +227,15 @@ foreach ($dirmodels as $reldir) if (preg_match('/^Error/', $tmp)) { $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; - } elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); - else print $tmp; + } elseif ($tmp == 'NotConfigured') { + print $langs->trans($tmp); + } else { + print $tmp; + } print ''."\n"; print ''; - if ($conf->global->EXPENSEREPORT_ADDON == $file) - { + if ($conf->global->EXPENSEREPORT_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; @@ -266,8 +254,9 @@ foreach ($dirmodels as $reldir) if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip .= ''.$langs->trans("NextValue").': '; if ($nextval) { - if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { $nextval = $langs->trans($nextval); + } $htmltooltip .= $nextval.'
'; } else { $htmltooltip .= $langs->trans($module->error).'
'; @@ -289,7 +278,7 @@ foreach ($dirmodels as $reldir) print "
\n"; /* - * Documents models for Interventions + * Documents models for ExpenseReport */ print load_fiche_titre($langs->trans("TemplatePDFExpenseReports"), '', ''); @@ -302,12 +291,10 @@ $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; $sql .= " WHERE type = '".$db->escape($type)."'"; $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); -if ($resql) -{ +if ($resql) { $i = 0; $num_rows = $db->num_rows($resql); - while ($i < $num_rows) - { + while ($i < $num_rows) { $array = $db->fetch_array($resql); array_push($def, $array[0]); $i++; @@ -328,28 +315,21 @@ print "\n"; clearstatcache(); -foreach ($dirmodels as $reldir) -{ +foreach ($dirmodels as $reldir) { $dir = dol_buildpath($reldir."core/modules/expensereport/doc"); - if (is_dir($dir)) - { + if (is_dir($dir)) { $handle = opendir($dir); - if (is_resource($handle)) - { - while (($file = readdir($handle)) !== false) - { + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { $filelist[] = $file; } closedir($handle); arsort($filelist); - foreach ($filelist as $file) - { - if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) - { - if (file_exists($dir.'/'.$file)) - { + foreach ($filelist as $file) { + if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { + if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) - 16); $classname = substr($file, 0, dol_strlen($file) - 12); @@ -357,21 +337,26 @@ foreach ($dirmodels as $reldir) $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + $modulequalified = 0; + } + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + $modulequalified = 0; + } - if ($modulequalified) - { + if ($modulequalified) { print ''; print (empty($module->name) ? $name : $module->name); print "\n"; - if (method_exists($module, 'info')) print $module->info($langs); - else print $module->description; + if (method_exists($module, 'info')) { + print $module->info($langs); + } else { + print $module->description; + } print ''; // Active - if (in_array($name, $def)) - { + if (in_array($name, $def)) { print ''."\n"; print '
scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); @@ -385,8 +370,7 @@ foreach ($dirmodels as $reldir) // Default print ''; - if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name") - { + if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; @@ -409,8 +393,7 @@ foreach ($dirmodels as $reldir) // Preview print ''; - if ($module->type == 'pdf') - { + if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'pdf').''; } else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); @@ -451,14 +434,15 @@ print "\n"; $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach ($substitutionarray as $key => $val) $htmltext .= $key.'
'; +foreach ($substitutionarray as $key => $val) { + $htmltext .= $key.'
'; +} $htmltext .= '
'; print ''; print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; $variablename = 'EXPENSEREPORT_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ +if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 9b56ac5901b..050c2b9455c 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -20,7 +20,7 @@ /** - * \file htdocs/admin/expensereport_ik.php + * \file htdocs/admin/expensereport_rules.php * \ingroup expensereport * \brief Page to display expense tax ik */ @@ -34,7 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.ph // Load translation files required by the page $langs->loadLangs(array("admin", "other", "trips", "errors", "dict")); -if (!$user->admin) accessforbidden(); +if (!$user->admin) { + accessforbidden(); +} //Init error $error = false; @@ -55,15 +57,15 @@ $amount = GETPOST('amount'); $restrictive = GETPOST('restrictive'); $object = new ExpenseReportRule($db); -if (!empty($id)) -{ +if (!empty($id)) { $result = $object->fetch($id); - if ($result < 0) dol_print_error('', $object->error, $object->errors); + if ($result < 0) { + dol_print_error('', $object->error, $object->errors); + } } // TODO do action -if ($action == 'save') -{ +if ($action == 'save') { $error = 0; // check parameters @@ -92,8 +94,7 @@ if ($action == 'save') setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitAmount")), null, 'errors'); } - if (empty($error)) - { + if (empty($error)) { $object->setValues($_POST); if ($apply_to == 'U') { @@ -116,18 +117,22 @@ if ($action == 'save') $object->entity = $conf->entity; $res = $object->create($user); - if ($res > 0) setEventMessages($langs->trans('ExpenseReportRuleSave'), null); - else dol_print_error($object->db); + if ($res > 0) { + setEventMessages($langs->trans('ExpenseReportRuleSave'), null); + } else { + dol_print_error($object->db); + } header('Location: '.$_SERVER['PHP_SELF']); exit; } -} elseif ($action == 'delete') -{ +} elseif ($action == 'delete') { // TODO add confirm $res = $object->delete($user); - if ($res < 0) dol_print_error($object->db); + if ($res < 0) { + dol_print_error($object->db); + } header('Location: '.$_SERVER['PHP_SELF']); exit; @@ -135,8 +140,17 @@ if ($action == 'save') $rules = ExpenseReportRule::getAllRule(); -$tab_apply = array('A' => $langs->trans('All'), 'G' => $langs->trans('Group'), 'U' => $langs->trans('User')); -$tab_rules_type = array('EX_DAY' => $langs->trans('Day'), 'EX_MON' => $langs->trans('Month'), 'EX_YEA' => $langs->trans('Year'), 'EX_EXP' => $langs->trans('OnExpense')); +$tab_apply = array( + 'A' => $langs->trans('All'), + 'G' => $langs->trans('Group'), + 'U' => $langs->trans('User') +); +$tab_rules_type = array( + 'EX_DAY' => $langs->trans('Day'), + 'EX_MON' => $langs->trans('Month'), + 'EX_YEA' => $langs->trans('Year'), + 'EX_EXP' => $langs->trans('OnExpense') +); /* @@ -156,8 +170,7 @@ print dol_get_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRul echo ''.$langs->trans('ExpenseReportRulesDesc').''; print '

'; -if ($action != 'edit') -{ +if ($action != 'edit') { echo '
'; echo ''; echo ''; @@ -199,8 +212,7 @@ if ($action != 'edit') echo ''; echo ''; -if ($action == 'edit') -{ +if ($action == 'edit') { echo ''; echo ''; } @@ -218,43 +230,47 @@ echo ''.$langs->trans('ExpenseReportRestrictive').''; echo ' '; echo ''; -foreach ($rules as $rule) -{ +foreach ($rules as $rule) { echo ''; echo ''; - if ($action == 'edit' && $object->id == $rule->id) - { + if ($action == 'edit' && $object->id == $rule->id) { $selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U'); echo '
'.$form->selectarray('apply_to', $tab_apply, $selected, 0).'
'; echo '
'.$form->select_dolusers($object->fk_user, 'fk_user').'
'; echo '
'.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').'
'; } else { - if ($rule->is_for_all > 0) echo $tab_apply['A']; - elseif ($rule->fk_usergroup > 0) echo $tab_apply['G'].' ('.$rule->getGroupLabel().')'; - elseif ($rule->fk_user > 0) echo $tab_apply['U'].' ('.$rule->getUserName().')'; - } - echo ''; - - - echo ''; - if ($action == 'edit' && $object->id == $rule->id) - { - echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1); - } else { - if ($rule->fk_c_type_fees == -1) echo $langs->trans('AllExpenseReport'); - else { - $key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id'); - if ($key != $langs->trans($key)) echo $langs->trans($key); - else echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code' + if ($rule->is_for_all > 0) { + echo $tab_apply['A']; + } elseif ($rule->fk_usergroup > 0) { + echo $tab_apply['G'].' ('.$rule->getGroupLabel().')'; + } elseif ($rule->fk_user > 0) { + echo $tab_apply['U'].' ('.$rule->getUserName().')'; } } echo ''; echo ''; - if ($action == 'edit' && $object->id == $rule->id) - { + if ($action == 'edit' && $object->id == $rule->id) { + echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1); + } else { + if ($rule->fk_c_type_fees == -1) { + echo $langs->trans('AllExpenseReport'); + } else { + $key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id'); + if ($key != $langs->trans($key)) { + echo $langs->trans($key); + } else { + echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code' + } + } + } + echo ''; + + + echo ''; + if ($action == 'edit' && $object->id == $rule->id) { echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0); } else { echo $tab_rules_type[$rule->code_expense_rules_type]; @@ -263,8 +279,7 @@ foreach ($rules as $rule) echo ''; - if ($action == 'edit' && $object->id == $rule->id) - { + if ($action == 'edit' && $object->id == $rule->id) { print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0); } else { echo dol_print_date($rule->dates, 'day'); @@ -273,8 +288,7 @@ foreach ($rules as $rule) echo ''; - if ($action == 'edit' && $object->id == $rule->id) - { + if ($action == 'edit' && $object->id == $rule->id) { print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0); } else { echo dol_print_date($rule->datee, 'day'); @@ -283,8 +297,7 @@ foreach ($rules as $rule) echo ''; - if ($action == 'edit' && $object->id == $rule->id) - { + if ($action == 'edit' && $object->id == $rule->id) { echo ''.$conf->currency; } else { echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency); @@ -293,8 +306,7 @@ foreach ($rules as $rule) echo ''; - if ($action == 'edit' && $object->id == $rule->id) - { + if ($action == 'edit' && $object->id == $rule->id) { echo $form->selectyesno('restrictive', $object->restrictive, 1); } else { echo yn($rule->restrictive, 1, 1); @@ -303,8 +315,7 @@ foreach ($rules as $rule) echo ''; - if ($object->id != $rule->id) - { + if ($object->id != $rule->id) { echo ''.img_edit().' '; echo ''.img_delete().''; } else { diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index cd0db2a1def..a21b2aa6e1d 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -71,10 +71,10 @@ if ($action == "set") if (! $res > 0) $error++; */ } else $error++; - + /* Moved to account $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ICS", GETPOST("PAYMENTBYBANKTRANSFER_ICS"), 'chaine', 0, '', $conf->entity); if (!$res > 0) $error++; - + */ if (GETPOST("PAYMENTBYBANKTRANSFER_USER") > 0) { $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_USER", GETPOST("PAYMENTBYBANKTRANSFER_USER"), 'chaine', 0, '', $conf->entity); @@ -156,11 +156,13 @@ print ''; $form->select_comptes($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT, 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 0, "courant=1", 1); print ''; +/* Moved to bank account data // ICS print ''.$langs->trans("ICS").''; print ''; print ''; print ''; +*/ //User print ''.$langs->trans("ResponsibleUser").''; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index c7bae90b373..1d6d35c8719 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -74,21 +74,23 @@ if ($action == "set") */ } else $error++; - $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity); - if (! ($res > 0)) $error++; + /* Moved to account - if (GETPOST("PRELEVEMENT_USER") > 0) { - $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity); - if (! ($res > 0)) $error++; - } - if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END") == "") { - $res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity); - if (! ($res > 0)) $error++; - } - if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD") == "") { - $res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity); - if (! ($res > 0)) $error++; - } + $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity); + if (!$res > 0) $error++; + */ + if (GETPOST("PRELEVEMENT_USER") > 0) { + $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity); + if (!$res > 0) $error++; + } + if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END") == "") { + $res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity); + if (!$res > 0) $error++; + } + if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD") == "") { + $res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity); + if (!$res > 0) $error++; + } $res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity); if (! ($res > 0)) $error++; @@ -146,13 +148,16 @@ print ''.$langs->trans("Parameter").''; print ''.$langs->trans("Value").''; print ""; + // Bank account (from Banks module) print ''.$langs->trans("BankToReceiveWithdraw").''; print ''; $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'PRELEVEMENT_ID_BANKACCOUNT', 0, "courant=1", 1); print ''; +/* Moved to bank account data // ICS + print ''; $htmltext = $langs->trans("AskThisIDToYourBank"); print $form->textwithpicto($langs->trans("ICS"), $htmltext); @@ -161,6 +166,7 @@ print ''; print ''; print ''; print ''; +*/ //User print ''.$langs->trans("ResponsibleUser").''; diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 80454403a32..1100b86f412 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -224,7 +224,7 @@ if (($thousand != ',' && $thousand != '.') || ($thousand != ' ')) print '  => price(1234.56)'.price(1234.56).''."\n"; // Timezone $txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'
'."\n"; -$txt .= $langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone") ?ini_get("date.timezone") : $langs->trans("NotDefined")).''."
\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php +$txt .= $langs->trans("PHPTZ").' (date_default_timezone_get() / php.ini date.timezone): '.(getServerTimeZoneString()." / ".(ini_get("date.timezone") ? ini_get("date.timezone") : $langs->trans("NotDefined")))."
\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php $txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ); print ''.$langs->trans("CurrentTimeZone").''; // Timezone server PHP $a = getServerTimeZoneInt('now'); diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 00c4bdc36dd..2b832910623 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -92,7 +92,15 @@ $date_endday = $tmp['mday']; $date_endmonth = $tmp['mon']; $date_endyear = $tmp['year']; -$arrayfields = array(); +// Add prefix session +$arrayfields = array( + 'e.prefix_session' => array( + 'label'=>'UserAgent', + 'checked'=>(empty($conf->global->AUDIT_ENABLE_PREFIX_SESSION) ? 0 : 1), + 'enabled'=>(empty($conf->global->AUDIT_ENABLE_PREFIX_SESSION) ? 0 : 1), + 'position'=>110 + ) +); /* @@ -211,7 +219,7 @@ if ($result) if ($search_user) $param .= '&search_user='.urlencode($search_user); if ($search_desc) $param .= '&search_desc='.urlencode($search_desc); if ($search_ua) $param .= '&search_ua='.urlencode($search_ua); - if ($search_prefix_sessiona) $param .= '&search_prefix_session='.urlencode($search_prefix_session); + if ($search_prefix_session) $param .= '&search_prefix_session='.urlencode($search_prefix_session); if ($date_startmonth) $param .= "&date_startmonth=".urlencode($date_startmonth); if ($date_startday) $param .= "&date_startday=".urlencode($date_startday); if ($date_startyear) $param .= "&date_startyear=".urlencode($date_startyear); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 2fe47ab39f1..7fc58b73c9f 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -233,6 +233,7 @@ if (empty($reshook)) $uploaddir = true; // Only users that can delete any event can remove records. $permissiontodelete = $user->rights->agenda->allactions->delete; + $permissiontoadd = $user->rights->agenda->myactions->create; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -296,7 +297,8 @@ if ($user->rights->agenda->allactions->delete) { $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); } -if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); +if ($user->rights->agenda->myactions->create) $arrayofmassactions['preaffecttag'] = ''.$langs->trans("AffectTag"); +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $sql = "SELECT"; @@ -532,6 +534,7 @@ if ($resql) print $s; + $objecttmp = new ActionComm($db); include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; $moreforfilter = ''; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 30e483fdfa9..af4fb6e571c 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -95,6 +95,9 @@ if ($action == 'add') $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'nohtml')); + $object->ics = trim(GETPOST("ics", 'alpha')); + $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha')); + $account_number = GETPOST('account_number', 'alphanohtml'); if (empty($account_number) || $account_number == '-1') { @@ -196,6 +199,9 @@ if ($action == 'update') $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'nohtml')); + $object->ics = trim(GETPOST("ics", 'alpha')); + $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha')); + $account_number = GETPOST('account_number', 'alpha'); if (empty($account_number) || $account_number == '-1') { @@ -730,6 +736,18 @@ if ($action == 'create') } print ''; + if ($conf->prelevement->enabled){ + print ''.$langs->trans("ICS").''; + print ''.$object->ics.''; + print ''; + } + + if ($conf->paymentbybanktransfer->enabled){ + print ''.$langs->trans("ICSTransfer").''; + print ''.$object->ics_transfer.''; + print ''; + } + print ''.$langs->trans("BankAccountDomiciliation").''; print nl2br($object->domiciliation); print "\n"; @@ -1010,6 +1028,16 @@ if ($action == 'create') print ''.$langs->trans($bickey).''; print ''; + if ($conf->prelevement->enabled){ + print ''.$langs->trans("ICS").''; + print ''; + } + + if ($conf->paymentbybanktransfer->enabled){ + print ''.$langs->trans("ICSTransfer").''; + print ''; + } + print ''.$langs->trans("BankAccountDomiciliation").''; print '