dolibarr  13.0.2
multicurrency_rate.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
5  * Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
6  * Copyright (C) 2013-2019 Juanjo Menent <jmenent@2byte.es>
7  * Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
8  * Copyright (C) 2013 Jean Heimburger <jean@tiaris.info>
9  * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
10  * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
11  * Copyright (C) 2013 Adolfo segura <adolfo.segura@gmail.com>
12  * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
13  * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
14  *
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program. If not, see <http://www.gnu.org/licenses/>.
27  */
28 
35 require '../main.inc.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php';
38 
39 // Load translation files required by the page
40 $langs->loadLangs(array('multicurrency'));
41 
42 $action = GETPOST('action', 'alpha');
43 $massaction = GETPOST('massaction', 'alpha');
44 $show_files = GETPOST('show_files', 'int');
45 $confirm = GETPOST('confirm', 'alpha');
46 $toselect = GETPOST('toselect', 'array');
47 $id_rate_selected = GETPOST('id_rate', 'int');
48 $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
49 $search_date_sync = GETPOST('search_date_sync', 'alpha');
50 $search_rate = GETPOST('search_rate', 'alpha');
51 $search_code = GETPOST('search_code', 'alpha');
52 $multicurrency_code = GETPOST('multicurrency_code', 'alpha');
53 $dateinput = dol_mktime(0, 0, 0, GETPOST('dateinputmonth', 'int'), GETPOST('dateinputday', 'int'), GETPOST('dateinputyear', 'int'));
54 $rateinput = price2num(GETPOST('rateinput', 'alpha'));
55 $optioncss = GETPOST('optioncss', 'alpha');
56 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
57 $sortfield = GETPOST("sortfield", 'alpha');
58 $sortorder = GETPOST("sortorder", 'alpha');
59 $page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0);
60 
61 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
62 $offset = $limit * $page;
63 $pageprev = $page - 1;
64 $pagenext = $page + 1;
65 if (!$sortfield) $sortfield = "cr.date_sync";
66 if (!$sortorder) $sortorder = "DESC";
67 
68 
69 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
70 $object = new CurrencyRate($db);
71 
72 $extrafields = new ExtraFields($db);
73 $form = new Form($db);
74 
75 $hookmanager->initHooks(array('EditorRatelist', 'globallist'));
76 
77 if (empty($action)) $action = 'list';
78 
79 // List of fields to search into when doing a "search in all"
80 $fieldstosearchall = array(
81  'cr.date_sync'=>"date_sync",
82  'cr.rate'=>"rate",
83  'm.code'=>"code",
84 );
85 
86 // Definition of fields for lists
87 $arrayfields = array(
88  'cr.date_sync'=>array('label'=>'Date', 'checked'=>1),
89  'cr.rate'=>array('label'=>'Rate', 'checked'=>1),
90  'm.code'=>array('label'=>'Code', 'checked'=>1),
91 );
92 
93 
94 $object->fields = dol_sort_array($object->fields, 'position');
95 $arrayfields = dol_sort_array($arrayfields, 'position');
96 
97 
98 
99 /*
100  * Actions
101  */
102 if ($action == "create") {
103  if (!empty($rateinput)) {
104  $currencyRate_static = new CurrencyRate($db);
105  $currency_static = new MultiCurrency($db);
106  $fk_currency = $currency_static->getIdFromCode($db, $multicurrency_code);
107 
108  $currencyRate_static->fk_multicurrency = $fk_currency;
109  $currencyRate_static->entity = $conf->entity;
110  $currencyRate_static->date_sync = $dateinput;
111  $currencyRate_static->rate = $rateinput;
112 
113  $result = $currencyRate_static->create(intval($fk_currency));
114  if ($result > 0) {
115  setEventMessages($langs->trans('successRateCreate', $multicurrency_code), null);
116  } else {
117  dol_syslog("currencyRate:createRate", LOG_WARNING);
118  setEventMessages($currencyRate_static->error, $currencyRate_static->errors, 'errors');
119  }
120  } else {
121  setEventMessages($langs->trans('NoEmptyRate'), null, "errors");
122  }
123 }
124 
125 if ($action == 'update') {
126  $currencyRate = new CurrencyRate($db);
127  $result = $currencyRate->fetch($id_rate_selected);
128  if ($result > 0) {
129  $currency_static = new MultiCurrency($db);
130  $fk_currency = $currency_static->getIdFromCode($db, $multicurrency_code);
131  $currencyRate->date_sync = $dateinput;
132  $currencyRate->fk_multicurrency = $fk_currency;
133  $currencyRate->rate = $rateinput;
134  $res = $currencyRate->update();
135  if ($res) {
136  setEventMessages($langs->trans('successUpdateRate'), null);
137  } else {
138  setEventMessages($currencyRate->error, $currencyRate->errors, "errors");
139  }
140  } else {
141  setEventMessages($langs->trans('Error'), null, "warnings");
142  }
143 }
144 
145 if ($action == "deleteRate") {
146  $current_rate = new CurrencyRate($db);
147  $current_rate->fetch(intval($id_rate_selected));
148 
149  if ($current_rate) {
150  $current_currency = new MultiCurrency($db);
151  $current_currency->fetch($current_rate->fk_multicurrency);
152  if ($current_currency) {
153  $delayedhtmlcontent = $form->formconfirm(
154  $_SERVER["PHP_SELF"].'?id_rate='.$id_rate_selected,
155  $langs->trans('DeleteLineRate'),
156  $langs->trans('ConfirmDeleteLineRate', $current_rate->rate, $current_currency->name, $current_rate->date_sync),
157  'confirm_delete',
158  '',
159  0,
160  1
161  );
162  } else {
163  dol_syslog("Multicurrency::fetch", LOG_WARNING);
164  }
165  } else {
166  setEventMessage($langs->trans('NoCurrencyRateSelected'), "warnings");
167  }
168 }
169 
170 if ($action == "confirm_delete") {
171  $current_rate = new CurrencyRate($db);
172  $current_rate->fetch(intval($id_rate_selected));
173  if ($current_rate) {
174  $result = $current_rate->delete();
175  if ($result) {
176  setEventMessages($langs->trans('successRateDelete'), null);
177  } else {
178  setEventMessages($current_rate->error, $current_rate->errors, 'errors');
179  }
180  } else {
181  setEventMessages($langs->trans('NoCurrencyRateSelected'), null, "warnings");
182  dol_syslog($langs->trans('NoCurrencyRateSelected'), LOG_WARNING);
183  }
184 }
185 
186 
187 if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
188 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
189 
190 $parameters = array();
191 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
192 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
193 if (empty($reshook))
194 {
195  // Selection of new fields
196  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
197 
198  // Purge search criteria
199  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
200  {
201  $sall = "";
202  $search_date_sync = "";
203  $search_rate = "";
204  $search_code = "";
205  $search_array_options = array();
206  }
207 
208  // Mass actions
209  $objectclass = "CurrencyRate";
210  $uploaddir = $conf->multicurrency->multidir_output; // define only because core/actions_massactions.inc.php want it
211  $permtoread = $user->admin;
212  $permtodelete = $user->admin;
213  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
214 }
215 
216 /*
217  * View
218  */
219 
220 $htmlother = new FormOther($db);
221 
222 $title = $langs->trans("CurrencyRate");
223 $page_name = "ListCurrencyRate";
224 
225 llxHeader('', $title, $helpurl, '');
226 // Subheader
227 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
228 print load_fiche_titre($langs->trans($page_name), $linkback);
229 
230 // Configuration header
232 print dol_get_fiche_head($head, 'ratelist', $langs->trans("ModuleSetup"), -1, "multicurrency");
233 
234 // ACTION
235 
236 if ($action != "updateRate") {
237  print '<table class="noborder centpercent">';
238  print '<tr class="liste_titre">';
239  print '<td>'.$langs->trans("FormCreateRate").'</td>'."\n";
240  print '</tr></table>';
241 
242  $form = new Form($db);
243  print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
244  print '<input type="hidden" name="token" value="'.newToken().'">';
245 
246  print '<table><tr>';
247 
248  print ' <td>'.$langs->trans('Date').'</td>';
249  print ' <td>';
250  print $form->selectDate($dateinput, 'dateinput');
251  print '</td>';
252 
253  print '<td> '.$langs->trans('Currency').'</td>';
254  print '<td>'.$form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code', 'alpha') : $multicurrency_code), 'multicurrency_code', 0, " code != '".$conf->currency."'", true).'</td>';
255 
256  print ' <td>'.$langs->trans('Rate').'</td>';
257  print ' <td><input type="number" min="0" step="any" class="maxwidth75" name="rateinput" value="'.dol_escape_htmltag($rateinput).'"></td>';
258 
259  print '<td>';
260  print '<input type="hidden" name="action" value="create">';
261  print '<input type="submit" class="butAction" name="btnCreateCurrencyRate" value="'.$langs->trans('CreateRate').'">';
262  print '</td>';
263 
264  print '</tr></table>';
265  print '</form>';
266 
267  print '<br>';
268 }
269 
270 if ($action == "updateRate") {
271  $current_rate = new CurrencyRate($db);
272  $current_rate->fetch(intval($id_rate_selected));
273 
274  if ($current_rate) {
275  $curr = new MultiCurrency($db);
276  $resultcurrentCurrency = $curr->fetch($current_rate->fk_multicurrency);
277 
278  if ($resultcurrentCurrency) {
279  $currency_code = $curr->code;
280  } else {
281  $currency_code = '';
282  }
283 
284  print '<table class="noborder centpercent">';
285  print '<tr class="liste_titre">';
286  print '<td>'.$langs->trans("FormUpdateRate").'</td>'."\n";
287  print '</tr></table>';
288 
289  $form = new Form($db);
290  print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formtoupdaterate">';
291  print '<input type="hidden" name="token" value="'.newToken().'">';
292 
293  print '<table><tr>';
294  print ' <td>'.$langs->trans('Date').'</td>';
295  print '<td>';
296  print $form->selectDate($current_rate->date_sync, 'dateinput');
297  print '</td>';
298 
299  print '<td> '.$langs->trans('Currency').'</td>';
300  print '<td>'.$form->selectMultiCurrency($currency_code, 'multicurrency_code', 0, " code != '".$conf->currency."'", true).'</td>';
301 
302  print '<td>'.$langs->trans('Rate').'</td>';
303  print '<td><input class="minwidth200" name="rateinput" value="'.dol_escape_htmltag($current_rate->rate).'" type="text"></td>';
304 
305  print '<td>';
306  print '<input type="hidden" name="action" value="update">';
307  print '<input type="hidden" name="id_rate" value="'.$current_rate->id.'">';
308  print '<input type="submit" class="butAction" name="btnupdateCurrencyRate" value="'.$langs->trans('UpdateRate').'">';
309  print '<a href="'.$_SERVER["PHP_SELF"].'" class="butAction">'.$langs->trans('CancelUpdate').'</a>';
310 
311  print '</td>';
312  print '</tr></table>';
313  print '</form>';
314  } else {
315  dol_syslog("currency_rate:list:update", LOG_WARNING);
316  }
317 }
318 
319 
320 $sql = 'SELECT cr.rowid, cr.date_sync, cr.rate, cr.entity, m.code, m.name ';
321 // Add fields from hooks
322 $parameters = array();
323 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
324 $sql .= $hookmanager->resPrint;
325 $sql .= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr ';
326 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid";
327 if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
328 if ($search_date_sync) $sql .= natural_search('cr.date_sync', $search_date_sync);
329 if ($search_rate) $sql .= natural_search('cr.rate', $search_rate);
330 if ($search_code) $sql .= natural_search('m.code', $search_code);
331 $sql .= " WHERE m.code <> '".$db->escape($conf->currency)."'";
332 
333 // Add where from hooks
334 $parameters = array();
335 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
336 $sql .= $hookmanager->resPrint;
337 $sql .= " GROUP BY cr.rowid, cr.date_sync, cr.rate, m.code, cr.entity, m.code, m.name";
338 
339 // Add fields from hooks
340 $parameters = array();
341 $reshook = $hookmanager->executeHooks('printFieldSelect', $parameters); // Note that $action and $object may have been modified by hook
342 $sql .= $hookmanager->resPrint;
343 
344 $sql .= $db->order($sortfield, $sortorder);
345 
346 
347 $nbtotalofrecords = '';
348 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
349 {
350  $result = $db->query($sql);
351 
352  if ($result) {
353  $nbtotalofrecords = $db->num_rows($result);
354  if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
355  {
356  $page = 0;
357  $offset = 0;
358  }
359  } else {
360  setEventMessage($langs->trans('No_record_on_multicurrency_rate'), 'warnings');
361  }
362 }
363 
364 $sql .= $db->plimit($limit + 1, $offset);
365 
366 $resql = $db->query($sql);
367 if ($resql)
368 {
369  $num = $db->num_rows($resql);
370  $arrayofselected = is_array($toselect) ? $toselect : array();
371 
372  $param = '';
373  if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
374  if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
375  if ($sall) $param .= "&sall=".urlencode($sall);
376 
377  if ($search_date_sync) $param = "&search_date_sync=".urlencode($search_date_sync);
378  if ($search_rate) $param = "&search_rate=".urlencode($search_rate);
379  if ($search_code != '') $param .= "&search_code=".urlencode($search_code);
380 
381  // Add $param from extra fields
382  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
383 
384  if ($user->admin) $arrayofmassactions['predelete'] = $langs->trans("Delete");
385  if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
386  $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
387 
388  print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formulaire">';
389  if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
390  print '<input type="hidden" name="token" value="'.newToken().'">';
391  print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
392  print '<input type="hidden" name="action" value="list">';
393  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
394  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
395  print '<input type="hidden" name="page" value="'.$page.'">';
396  print '<input type="hidden" name="type" value="'.$type.'">';
397 
398  print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_currency.png', 0, $newcardbutton, '', $limit);
399 
400  include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
401 
402  if ($sall)
403  {
404  foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
405  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
406  }
407 
408  // Filter on categories
409  $moreforfilter = '';
410 
411 
412  $parameters = array();
413  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
414  if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
415  else $moreforfilter = $hookmanager->resPrint;
416 
417  if ($moreforfilter)
418  {
419  print '<div class="liste_titre liste_titre_bydiv centpercent">';
420  print $moreforfilter;
421  print '</div>';
422  }
423 
424  $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
425  $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
426  if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
427 
428  print '<div class="div-table-responsive">';
429  print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
430 
431  // Lines with input filters
432  print '<tr class="liste_titre_filter">';
433 
434  // date
435  if (!empty($arrayfields['cr.date_sync']['checked']))
436  {
437  print '<td class="liste_titre" align="left">';
438  print '<input class="flat" type="text" name="search_date_sync" size="8" value="'.dol_escape_htmltag($search_date_sync).'">';
439  print '</td>';
440  }
441  // code
442  if (!empty($arrayfields['m.code']['checked']))
443  {
444  print '<td class="liste_titre" align="left">';
445  print '<input class="flat" type="text" name="search_code" size="12" value="'.dol_escape_htmltag($search_code).'">';
446  print '</td>';
447  }
448  // rate
449  if (!empty($arrayfields['cr.rate']['checked']))
450  {
451  print '<td class="liste_titre" align="left">';
452  print '<input class="flat" type="text" name="search_rate" size="8" value="'.dol_escape_htmltag($search_rate).'">';
453  print '</td>';
454  }
455 
456  // Fields from hook
457  $parameters = array('arrayfields'=>$arrayfields);
458  $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
459  print $hookmanager->resPrint;
460 
461  print '<td class="liste_titre" align="middle">';
462  $searchpicto = $form->showFilterButtons();
463  print $searchpicto;
464  print '</td>';
465 
466  print '</tr>';
467 
468  print '<tr class="liste_titre">';
469  if (!empty($arrayfields['cr.date_sync']['checked'])) print_liste_field_titre($arrayfields['cr.date_sync']['label'], $_SERVER["PHP_SELF"], "cr.date_sync", "", $param, "", $sortfield, $sortorder);
470  if (!empty($arrayfields['m.code']['checked'])) print_liste_field_titre($arrayfields['m.code']['label'], $_SERVER["PHP_SELF"], "m.code", "", $param, "", $sortfield, $sortorder);
471  if (!empty($arrayfields['cr.rate']['checked'])) print_liste_field_titre($arrayfields['cr.rate']['label'], $_SERVER["PHP_SELF"], "cr.rate", "", $param, "", $sortfield, $sortorder);
472 
473  // Hook fields
474  $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
475  $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
476  print $hookmanager->resPrint;
477 
478  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
479  print "</tr>\n";
480 
481  $i = 0;
482  $totalarray = array();
483  while ($i < min($num, $limit))
484  {
485  $obj = $db->fetch_object($resql);
486 
487  print '<tr class="oddeven">';
488 
489  // date_sync
490  if (!empty($arrayfields['cr.date_sync']['checked']))
491  {
492  print '<td class="tdoverflowmax200">';
493  print $obj->date_sync;
494  print "</td>\n";
495  if (!$i) $totalarray['nbfield']++;
496  }
497 
498  // code
499  if (!empty($arrayfields['m.code']['checked']))
500  {
501  print '<td class="tdoverflowmax200">';
502  print $obj->code." ".$obj->name;
503  print "</td>\n";
504 
505  if (!$i) $totalarray['nbfield']++;
506  }
507 
508  // rate
509  if (!empty($arrayfields['cr.rate']['checked']))
510  {
511  print '<td class="tdoverflowmax200">';
512  print $obj->rate;
513  print "</td>\n";
514  if (!$i) $totalarray['nbfield']++;
515  }
516 
517  // Fields from hook
518  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
519  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
520  print $hookmanager->resPrint;
521 
522  // Action
523  print '<td class="nowrap" align="center">';
524  if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
525  {
526  $selected = 0;
527  if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
528  print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?action=updateRate&amp;id_rate='.$obj->rowid.'">'.img_picto('edit', 'edit').'</a>';
529  print '<a class="marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?action=deleteRate&amp;id_rate='.$obj->rowid.'">'.img_picto('delete', 'delete').'</a>';
530  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
531  }
532  print '</td>';
533  if (!$i) $totalarray['nbfield']++;
534 
535  print "</tr>\n";
536  $i++;
537  }
538 
539  $db->free($resql);
540 
541  print "</table>";
542  print "</div>";
543 
544  print '</form>';
545 }
546 else {
547  dol_print_error($db);
548 }
549 
550 
551 llxFooter();
552 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
setEventMessage($mesgs, $style= 'mesgs')
Set event message in dol_events session object.
Class CurrencyRate.
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage standard extra fields.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is &#39;...
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Classe permettant la generation de composants html autre Only common components are here...
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
multicurrencyAdminPrepareHead()
Prepare array with list of tabs.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Class Currency.
llxFooter()
Empty footer.
Definition: wrapper.php:59