Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
8ab67e674b
3 changed files with 130 additions and 4 deletions
|
|
@ -56,7 +56,7 @@ $oldvatrate = GETPOST('oldvatrate', 'alpha');
|
|||
$newvatrate = GETPOST('newvatrate', 'alpha');
|
||||
//$price_base_type=GETPOST('price_base_type');
|
||||
|
||||
|
||||
$hookmanager->initHooks(array('productvatadmin'));
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
|
@ -107,7 +107,7 @@ if ($action == 'convert') {
|
|||
if ($vat_src_code_old) {
|
||||
$sql .= " AND default_vat_code = '".$db->escape($vat_src_code_old)."'";
|
||||
} else {
|
||||
$sql .= " AND default_vat_code = IS NULL";
|
||||
$sql .= " AND default_vat_code IS NULL";
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
|
@ -209,7 +209,7 @@ if ($action == 'convert') {
|
|||
if ($vat_src_code_old) {
|
||||
$sql .= " AND default_vat_code = '".$db->escape($vat_src_code_old)."'";
|
||||
} else {
|
||||
$sql .= " AND default_vat_code = IS NULL";
|
||||
$sql .= " AND default_vat_code IS NULL";
|
||||
}
|
||||
$sql .= " AND s.fk_pays = ".((int) $country_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -335,6 +335,9 @@ class CompanyBankAccount extends Account
|
|||
*/
|
||||
public $datem;
|
||||
|
||||
const STATUS_OPEN = 0;
|
||||
const STATUS_CLOSED = 1;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
|
@ -342,6 +345,8 @@ class CompanyBankAccount extends Account
|
|||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
$this->socid = 0;
|
||||
|
|
@ -349,6 +354,11 @@ class CompanyBankAccount extends Account
|
|||
$this->balance = 0;
|
||||
$this->default_rib = 0;
|
||||
$this->type = "ban";
|
||||
|
||||
$this->labelStatus = array(
|
||||
self::STATUS_OPEN => $langs->transnoentitiesnoconv("StatusAccountOpened"),
|
||||
self::STATUS_CLOSED => $langs->transnoentitiesnoconv("StatusAccountClosed")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -465,6 +475,10 @@ class CompanyBankAccount extends Account
|
|||
$sql .= ",cle_rib='".$this->db->escape($this->cle_rib)."'";
|
||||
$sql .= ",bic='".$this->db->escape($this->bic)."'";
|
||||
$sql .= ",iban_prefix = '".$this->db->escape(dolEncrypt($this->iban))."'";
|
||||
$sql .= ",currency_code = '".$this->db->escape($this->currency_code)."'";
|
||||
$sql .= ",fk_country = '".((int) $this->fk_country)."'";
|
||||
$sql .= ",state_id = '".((int) $this->state_id)."'";
|
||||
$sql .= ",status = '".((int) $this->status)."'";
|
||||
$sql .= ",domiciliation = '".$this->db->escape($this->address)."'";
|
||||
$sql .= ",proprio = '".$this->db->escape($this->owner_name)."'";
|
||||
$sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'";
|
||||
|
|
@ -530,7 +544,7 @@ class CompanyBankAccount extends Account
|
|||
}
|
||||
|
||||
$sql = "SELECT rowid, label, type, fk_soc as socid, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban,";
|
||||
$sql .= " domiciliation as address,";
|
||||
$sql .= " currency_code, fk_country, state_id, status, domiciliation as address,";
|
||||
$sql .= " proprio as owner_name, owner_address, default_rib, datec, tms as datem, rum, frstrecur, date_rum,";
|
||||
$sql .= " stripe_card_ref, stripe_account, ext_payment_site,";
|
||||
$sql .= " last_main_doc, model_pdf";
|
||||
|
|
@ -568,6 +582,10 @@ class CompanyBankAccount extends Account
|
|||
$this->bic = $obj->bic;
|
||||
$this->iban = dolDecrypt($obj->iban);
|
||||
|
||||
$this->currency_code = $obj->currency_code;
|
||||
$this->fk_country = $obj->fk_country;
|
||||
$this->state_id = $obj->state_id;
|
||||
$this->status = $obj->status;
|
||||
$this->address = $obj->address;
|
||||
|
||||
$this->owner_name = $obj->owner_name;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companypaymentmode.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
|
||||
|
|
@ -49,6 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
|
|||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Translate $langs
|
||||
* @var Societe $mysoc
|
||||
* @var User $user
|
||||
*/
|
||||
|
||||
|
|
@ -191,6 +193,9 @@ if (empty($reshook)) {
|
|||
$companybankaccount->bic = GETPOST('bic', 'alpha');
|
||||
$companybankaccount->iban = GETPOST('iban', 'alpha');
|
||||
|
||||
$companybankaccount->currency_code = GETPOST('account_currency_code', 'alpha');
|
||||
$companybankaccount->fk_country = GETPOSTINT('account_country_id');
|
||||
$companybankaccount->state_id = GETPOSTINT('account_state_id');
|
||||
$companybankaccount->address = GETPOST('address', 'alpha');
|
||||
|
||||
$companybankaccount->owner_name = GETPOST('proprio', 'alpha');
|
||||
|
|
@ -203,6 +208,9 @@ if (empty($reshook)) {
|
|||
$companybankaccount->rum = $prelevement->buildRumNumber($object->code_client, $companybankaccount->datec, (string) $companybankaccount->id);
|
||||
}
|
||||
|
||||
$companybankaccount->status = GETPOSTINT('clos');
|
||||
|
||||
|
||||
if (GETPOST('stripe_card_ref', 'alpha') && GETPOST('stripe_card_ref', 'alpha') != $companypaymentmode->stripe_card_ref) {
|
||||
// If we set a stripe value that is different than previous one, we also set the stripe account
|
||||
$companypaymentmode->stripe_account = $stripecu.'@'.$site_account;
|
||||
|
|
@ -323,6 +331,9 @@ if (empty($reshook)) {
|
|||
$companybankaccount->bic = GETPOST('bic', 'alpha');
|
||||
$companybankaccount->iban = GETPOST('iban', 'alpha');
|
||||
|
||||
$companybankaccount->currency_code = GETPOST('account_currency_code', 'alpha');
|
||||
$companybankaccount->fk_country = GETPOSTINT('account_country_id');
|
||||
$companybankaccount->state_id = GETPOSTINT('account_state_id');
|
||||
$companybankaccount->address = GETPOST('address', 'alpha');
|
||||
|
||||
$companybankaccount->owner_name = GETPOST('proprio', 'alpha');
|
||||
|
|
@ -733,6 +744,7 @@ if (empty($reshook)) {
|
|||
|
||||
$db->begin();
|
||||
|
||||
$sql = '';
|
||||
if (empty($newsup)) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token WHERE fk_soc = ".((int) $object->id)." AND service = '".$db->escape($tmpservice)."' AND entity = ".((int) $conf->entity);
|
||||
// TODO Add site and site_account on oauth_token table
|
||||
|
|
@ -891,9 +903,12 @@ if (empty($reshook)) {
|
|||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||
|
||||
$title = $langs->trans("ThirdParty");
|
||||
if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {
|
||||
$title = $object->name." - ".$langs->trans('PaymentInformation');
|
||||
|
|
@ -2005,6 +2020,7 @@ if ($socid && $action == 'edit' && $permissiontoaddupdatepaymentinformation) {
|
|||
print '<td><input class="minwidth200" type="text" name="bank" value="'.$companybankaccount->bank.'" spellcheck="false"></td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$companybankaccount->fetch($id);
|
||||
$bankaccount = $companybankaccount;
|
||||
// Code here is similar as in bank.php for users
|
||||
foreach ($bankaccount->getFieldsToShow(1) as $val) {
|
||||
|
|
@ -2060,6 +2076,52 @@ if ($socid && $action == 'edit' && $permissiontoaddupdatepaymentinformation) {
|
|||
print '</tr>';
|
||||
}
|
||||
|
||||
// Currency
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Currency").'</td>';
|
||||
print '<td>';
|
||||
$selectedcode = $bankaccount->currency_code;
|
||||
if (!$selectedcode) {
|
||||
$selectedcode = $conf->currency;
|
||||
}
|
||||
print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
|
||||
//print $langs->trans("Currency".$conf->currency);
|
||||
//print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
$account_status = $bankaccount->status;
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||
print '<td>';
|
||||
print $form->selectarray("clos", $bankaccount->labelStatus, $account_status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100 maxwidth150onsmartphone');
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank country
|
||||
$country_codeid = GETPOST("account_country_id") ? GETPOST("account_country_id") : $bankaccount->fk_country;
|
||||
if (empty($country_codeid)) {
|
||||
$country_codeid = $mysoc->country_code;
|
||||
}
|
||||
$bankaccount->country_code = getCountry($country_codeid, '2'); // Force country code on account to have following field on bank fields matching country rules
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'country', 'class="pictofixedwidth"');
|
||||
print $form->select_country($country_codeid, 'account_country_id');
|
||||
if ($user->admin) {
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank state
|
||||
$selected_state_id = $bankaccount->state_id;
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||
if ($country_codeid) {
|
||||
print img_picto('', 'state', 'class="pictofixedwidth"');
|
||||
print $formcompany->select_state($selected_state_id, $country_codeid, 'account_state_id');
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("BankAccountDomiciliation").'</td><td>';
|
||||
print '<textarea name="address" rows="'.ROWS_4.'" cols="40" maxlength="255" spellcheck="false">';
|
||||
print dolPrintHTMLForTextArea($companybankaccount->address);
|
||||
|
|
@ -2241,6 +2303,52 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) {
|
|||
print '</tr>';
|
||||
}
|
||||
|
||||
// Currency
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Currency").'</td>';
|
||||
print '<td>';
|
||||
$selectedcode = $object->currency_code;
|
||||
if (!$selectedcode) {
|
||||
$selectedcode = $conf->currency;
|
||||
}
|
||||
print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
|
||||
//print $langs->trans("Currency".$conf->currency);
|
||||
//print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||
print '<td>';
|
||||
print $form->selectarray("clos", $object->labelStatus, (GETPOSTINT('clos') != '' ? GETPOSTINT('clos') : $object->status), 0, 0, 0, '', 0, 0, 0, '', 'minwidth100 maxwidth150onsmartphone');
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank country
|
||||
$selectedcode = '';
|
||||
if (GETPOSTISSET("account_country_id")) {
|
||||
$selectedcode = GETPOST("account_country_id") ? GETPOST("account_country_id") : $object->country_code;
|
||||
} elseif (empty($selectedcode)) {
|
||||
$selectedcode = $mysoc->country_code;
|
||||
}
|
||||
$object->country_code = getCountry($selectedcode, '2'); // Force country code on account to have following field on bank fields matching country rules
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'country', 'class="pictofixedwidth"');
|
||||
print $form->select_country($selectedcode, 'account_country_id');
|
||||
if ($user->admin) {
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank state
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||
if ($selectedcode) {
|
||||
print img_picto('', 'state', 'class="pictofixedwidth"');
|
||||
print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOSTINT("account_state_id") : 0, $selectedcode, 'account_state_id');
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("BankAccountDomiciliation").'</td><td>';
|
||||
print '<textarea name="address" rows="'.ROWS_4.'" class="quatrevingtpercent" maxlength="255">';
|
||||
print dolPrintHTMLForTextArea(GETPOST('address'));
|
||||
|
|
|
|||
Loading…
Reference in a new issue