29 require
'../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/bankcateg.class.php';
34 $langs->loadLangs(array(
'banks',
'categories'));
36 $action =
GETPOST(
'action',
'aZ09');
37 $optioncss =
GETPOST(
'optioncss',
'aZ');
39 if (!$user->rights->banque->configurer)
56 $bankcateg->label =
GETPOST(
'label');
57 $bankcateg->create($user);
64 if ($bankcateg->fetch($categid) > 0) {
66 if (
GETPOST(
'update') && $label) {
67 $bankcateg->label = $label;
68 $bankcateg->update($user);
71 if ($action ==
'delete') {
72 $bankcateg->delete($user);
87 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
88 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
89 print '<input type="hidden" name="token" value="'.newToken().
'">';
90 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
91 print '<input type="hidden" name="action" value="list">';
98 print '<div class="div-table-responsive">';
99 print '<table class="noborder centpercent">';
100 print '<tr class="liste_titre">';
101 print '<td>'.$langs->trans(
"Ref").
'</td><td>'.$langs->trans(
"Label").
'</td>';
107 if ($action !=
'edit')
109 print '<tr class="oddeven">';
110 print '<td> </td><td><input name="label" type="text" class="maxwidth100"></td>';
112 print '<td class="center"><input type="submit" name="add" class="button" value="'.$langs->trans(
"Add").
'"></td>';
117 $sql =
"SELECT rowid, label";
118 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_categ";
119 $sql .=
" WHERE entity = ".$conf->entity;
120 $sql .=
" ORDER BY rowid";
122 $result = $db->query($sql);
125 $num = $db->num_rows($result);
130 $objp = $db->fetch_object($result);
132 print '<tr class="oddeven">';
133 print '<td>'.$objp->rowid.
'</td>';
134 if (
GETPOST(
'action',
'aZ09') ==
'edit' &&
GETPOST(
"categid") == $objp->rowid)
136 print '<td colspan="3">';
137 print '<input type="hidden" name="categid" value="'.$objp->rowid.
'">';
138 print '<input name="label" type="text" size=45 value="'.$objp->label.
'">';
139 print '<input type="submit" name="update" class="button" value="'.$langs->trans(
"Edit").
'">';
142 print "<td>".$objp->label.
"</td>";
146 print '<td class="center">';
147 print '<a class="editfielda reposition marginleftonly marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?categid='.$objp->rowid.
'&action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
148 print '<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?categid='.$objp->rowid.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
Class to manage bank categories.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
print
Draft customers invoices.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
img_delete($titlealt= 'default', $other= 'class="pictodelete"', $morecss= '')
Show delete logo.