Fix fields too long for database

This commit is contained in:
phf 2016-09-27 10:06:22 +02:00
parent b50d92e712
commit 058cf61ae0
2 changed files with 7 additions and 4 deletions

View File

@ -111,6 +111,9 @@ class CompanyBankAccount extends Account
$this->create(); $this->create();
} }
if (dol_strlen($this->domiciliation) > 255) $this->domiciliation = dol_trunc($this->domiciliation, 254, 'right', 'UTF-8', 1);
if (dol_strlen($this->owner_address) > 255) $this->owner_address = dol_trunc($this->owner_address, 254, 'right', 'UTF-8', 1);
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET";
$sql.= " bank = '" .$this->db->escape($this->bank)."'"; $sql.= " bank = '" .$this->db->escape($this->bank)."'";
$sql.= ",code_banque='".$this->code_banque."'"; $sql.= ",code_banque='".$this->code_banque."'";

View File

@ -467,7 +467,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
print '<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.'"></td></tr>'; print '<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.'"></td></tr>';
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">'; print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
print '<textarea name="domiciliation" rows="4" cols="40">'; print '<textarea name="domiciliation" rows="4" cols="40" maxlength="255">';
print $account->domiciliation; print $account->domiciliation;
print "</textarea></td></tr>"; print "</textarea></td></tr>";
@ -476,7 +476,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">'; print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
print "<textarea name=\"owner_address\" rows=\"4\" cols=\"40\">"; print "<textarea name=\"owner_address\" rows=\"4\" cols=\"40\" maxlength=\"255\">";
print $account->owner_address; print $account->owner_address;
print "</textarea></td></tr>"; print "</textarea></td></tr>";
@ -570,7 +570,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
print '<td colspan="4"><input size="12" type="text" name="bic" value="'.GETPOST('bic').'"></td></tr>'; print '<td colspan="4"><input size="12" type="text" name="bic" value="'.GETPOST('bic').'"></td></tr>';
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">'; print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
print '<textarea name="domiciliation" rows="4" cols="40">'; print '<textarea name="domiciliation" rows="4" cols="40" maxlength="255">';
print GETPOST('domiciliation'); print GETPOST('domiciliation');
print "</textarea></td></tr>"; print "</textarea></td></tr>";
@ -579,7 +579,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">'; print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
print '<textarea name="owner_address" rows="4" cols="40">'; print '<textarea name="owner_address" rows="4" cols="40" maxlength="255">';
print GETPOST('owner_address'); print GETPOST('owner_address');
print "</textarea></td></tr>"; print "</textarea></td></tr>";