Commit e84ef7af5470e1fea0423df479e7413a3d33a527

Authored by Florian HENRY
1 parent f69a3946
Exists in 3.5 and in 1 other branch 3.6

reiview code

Showing 1 changed file with 30 additions and 27 deletions   Show diff stats
accountingex/admin/fiche.php
... ... @@ -56,35 +56,38 @@ $accounting = new AccountingAccount($db);
56 56  
57 57 // action
58 58 if ($action == 'add') {
59   -
60   - $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
61   -
62   - dol_syslog('accountingex/admin/fiche.php:: $sql=' . $sql);
63   - $result = $db->query($sql);
64   - $obj = $db->fetch_object($result);
65   -
66   - $accounting->fk_pcg_version = $obj->pcg_version;
67   - $accounting->pcg_type = GETPOST('pcg_type');
68   - $accounting->pcg_subtype = GETPOST('pcg_subtype');
69   - $accounting->account_number = GETPOST('account_number', 'int');
70   - $accounting->account_parent = GETPOST('account_parent', 'int');
71   - $accounting->label = GETPOST('label', 'alpha');
72   - $accounting->active = 1;
73   -
74   - $res = $accounting->create($user);
75   -
76   - if ($res == 0) {
77   - } else {
78   - if ($res == - 3) {
79   - $_error = 1;
80   - $action = "create";
81   - }
82   - if ($res == - 4) {
83   - $_error = 2;
84   - $action = "create";
  59 + if (GETPOST('cancel') != '')
  60 + Header("Location: account.php");
  61 + else {
  62 + $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
  63 +
  64 + dol_syslog('accountingex/admin/fiche.php:: $sql=' . $sql);
  65 + $result = $db->query($sql);
  66 + $obj = $db->fetch_object($result);
  67 +
  68 + $accounting->fk_pcg_version = $obj->pcg_version;
  69 + $accounting->pcg_type = GETPOST('pcg_type');
  70 + $accounting->pcg_subtype = GETPOST('pcg_subtype');
  71 + $accounting->account_number = GETPOST('account_number', 'int');
  72 + $accounting->account_parent = GETPOST('account_parent', 'int');
  73 + $accounting->label = GETPOST('label', 'alpha');
  74 + $accounting->active = 1;
  75 +
  76 + $res = $accounting->create($user);
  77 +
  78 + if ($res == 0) {
  79 + } else {
  80 + if ($res == - 3) {
  81 + $_error = 1;
  82 + $action = "create";
  83 + }
  84 + if ($res == - 4) {
  85 + $_error = 2;
  86 + $action = "create";
  87 + }
85 88 }
  89 + Header("Location: account.php");
86 90 }
87   - Header("Location: account.php");
88 91 } // Update record
89 92 else if ($action == 'edit') {
90 93 if (! GETPOST('cancel', 'alpha')) {
... ...