Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
044ebeb98e
@ -162,6 +162,7 @@ class CompanyPaymentMode extends CommonObject
|
||||
public $preapproval_key;
|
||||
public $total_amount_of_all_payments;
|
||||
public $stripe_card_ref;
|
||||
public $stripe_account;
|
||||
|
||||
/**
|
||||
* @var int Status
|
||||
@ -443,7 +444,7 @@ class CompanyPaymentMode extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 0";
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 0, tms = tms";
|
||||
$sql2.= " WHERE default_rib <> 0 AND fk_soc = ".$obj->fk_soc;
|
||||
if ($type) $sql2.= " AND type = '".$this->db->escape($type)."'";
|
||||
dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG);
|
||||
|
||||
@ -194,13 +194,13 @@ if (empty($reshook))
|
||||
if ($action == 'updatecard')
|
||||
{
|
||||
// Modification
|
||||
if (!GETPOST('label', 'alpha') || !GETPOST('proprio', 'alpha') || !GETPOST('cardnumber', 'alpha') || !GETPOST('exp_date_month', 'alpha') || !GETPOST('exp_date_year', 'alpha') || !GETPOST('cvn', 'alpha'))
|
||||
if (!GETPOST('label', 'alpha') || !GETPOST('proprio', 'alpha') || !GETPOST('exp_date_month', 'alpha') || !GETPOST('exp_date_year', 'alpha'))
|
||||
{
|
||||
if (!GETPOST('label', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||
if (!GETPOST('proprio', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NameOnCard")), null, 'errors');
|
||||
if (!GETPOST('cardnumber', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardNumber")), null, 'errors');
|
||||
//if (!GETPOST('cardnumber', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardNumber")), null, 'errors');
|
||||
if (!(GETPOST('exp_date_month', 'alpha') > 0) || !(GETPOST('exp_date_year', 'alpha') > 0)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpiryDate")), null, 'errors');
|
||||
if (!GETPOST('cvn', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CVN")), null, 'errors');
|
||||
//if (!GETPOST('cvn', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CVN")), null, 'errors');
|
||||
$action = 'createcard';
|
||||
$error++;
|
||||
}
|
||||
@ -220,6 +220,10 @@ if (empty($reshook))
|
||||
$companypaymentmode->cvn = GETPOST('cvn', 'alpha');
|
||||
$companypaymentmode->country_code = $object->country_code;
|
||||
|
||||
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 = $site_account;
|
||||
}
|
||||
$companypaymentmode->stripe_card_ref = GETPOST('stripe_card_ref', 'alpha');
|
||||
|
||||
$result = $companypaymentmode->update($user);
|
||||
@ -346,13 +350,13 @@ if (empty($reshook))
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
if (!GETPOST('label', 'alpha') || !GETPOST('proprio', 'alpha') || !GETPOST('cardnumber', 'alpha') || !GETPOST('exp_date_month', 'alpha') || !GETPOST('exp_date_year', 'alpha') || !GETPOST('cvn', 'alpha'))
|
||||
if (!GETPOST('label', 'alpha') || !GETPOST('proprio', 'alpha') || !GETPOST('exp_date_month', 'alpha') || !GETPOST('exp_date_year', 'alpha'))
|
||||
{
|
||||
if (!GETPOST('label', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||
if (!GETPOST('proprio', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NameOnCard")), null, 'errors');
|
||||
if (!GETPOST('cardnumber', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardNumber")), null, 'errors');
|
||||
//if (!GETPOST('cardnumber', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardNumber")), null, 'errors');
|
||||
if (!(GETPOST('exp_date_month', 'alpha') > 0) || !(GETPOST('exp_date_year', 'alpha') > 0)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpiryDate")), null, 'errors');
|
||||
if (!GETPOST('cvn', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CVN")), null, 'errors');
|
||||
//if (!GETPOST('cvn', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CVN")), null, 'errors');
|
||||
$action = 'createcard';
|
||||
$error++;
|
||||
}
|
||||
@ -377,6 +381,10 @@ if (empty($reshook))
|
||||
$companypaymentmode->country_code = $object->country_code;
|
||||
$companypaymentmode->status = $servicestatus;
|
||||
|
||||
if (GETPOST('stripe_card_ref', 'alpha')) {
|
||||
// If we set a stripe value, we also set the stripe account
|
||||
$companypaymentmode->stripe_account = $site_account;
|
||||
}
|
||||
$companypaymentmode->stripe_card_ref = GETPOST('stripe_card_ref', 'alpha');
|
||||
|
||||
$db->begin();
|
||||
@ -1002,6 +1010,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
||||
{
|
||||
print '<td>'.$langs->trans('LocalID').'</td>';
|
||||
}
|
||||
print '<td>'.$langs->trans('Label').'</td>';
|
||||
print '<td>'.$langs->trans('StripeID').'</td>';
|
||||
print '<td>'.$langs->trans('Type').'</td>';
|
||||
print '<td>'.$langs->trans('Informations').'</td>';
|
||||
@ -1055,6 +1064,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
||||
print $companypaymentmodetemp->id;
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $companypaymentmodetemp->label;
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $companypaymentmodetemp->stripe_card_ref;
|
||||
if ($companypaymentmodetemp->stripe_card_ref)
|
||||
{
|
||||
@ -1148,6 +1160,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
}
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
// Src ID
|
||||
print '<td>';
|
||||
$connect = '';
|
||||
@ -1615,7 +1629,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
||||
// Edit BAN
|
||||
if ($socid && $action == 'edit' && $user->rights->societe->creer)
|
||||
{
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), -1, 'company');
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
@ -1721,7 +1735,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
|
||||
// Edit Card
|
||||
if ($socid && $action == 'editcard' && $user->rights->societe->creer)
|
||||
{
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), -1, 'company');
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
@ -1738,7 +1752,7 @@ if ($socid && $action == 'editcard' && $user->rights->societe->creer)
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("NameOnCard").'</td>';
|
||||
print '<td><input class="minwidth200" type="text" name="proprio" value="'.$companypaymentmode->proprio.'"></td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("CardNumber").'</td>';
|
||||
print '<tr><td>'.$langs->trans("CardNumber").'</td>';
|
||||
print '<td><input class="minwidth200" type="text" name="cardnumber" value="'.$companypaymentmode->number.'"></td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("ExpiryDate").'</td>';
|
||||
@ -1747,7 +1761,7 @@ if ($socid && $action == 'editcard' && $user->rights->societe->creer)
|
||||
print $formother->select_year($companypaymentmode->exp_date_year, 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("CVN").'</td>';
|
||||
print '<tr><td>'.$langs->trans("CVN").'</td>';
|
||||
print '<td><input size="8" type="text" name="cvn" value="'.$companypaymentmode->cvn.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("StripeID")." ('card_....')</td>";
|
||||
@ -1769,7 +1783,7 @@ if ($socid && $action == 'editcard' && $user->rights->societe->creer)
|
||||
// Create BAN
|
||||
if ($socid && $action == 'create' && $user->rights->societe->creer)
|
||||
{
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), -1, 'company');
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
@ -1869,7 +1883,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
|
||||
// Create Card
|
||||
if ($socid && $action == 'createcard' && $user->rights->societe->creer)
|
||||
{
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), -1, 'company');
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
@ -1886,7 +1900,7 @@ if ($socid && $action == 'createcard' && $user->rights->societe->creer)
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("NameOnCard").'</td>';
|
||||
print '<td><input class="minwidth200" type="text" name="proprio" value="'.GETPOST('proprio', 'alpha').'"></td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("CardNumber").'</td>';
|
||||
print '<tr><td>'.$langs->trans("CardNumber").'</td>';
|
||||
print '<td><input class="minwidth200" type="text" name="cardnumber" value="'.GETPOST('cardnumber', 'alpha').'"></td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("ExpiryDate").'</td>';
|
||||
@ -1895,8 +1909,8 @@ if ($socid && $action == 'createcard' && $user->rights->societe->creer)
|
||||
print $formother->select_year(GETPOST('exp_date_year', 'int'), 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("CVN").'</td>';
|
||||
print '<td><input size="8" type="text" name="cvn" value="'.GETPOST('cvn', 'alpha').'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("CVN").'</td>';
|
||||
print '<td><input class="width50" type="text" name="cvn" value="'.GETPOST('cvn', 'alpha').'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("StripeID")." ('card_....')</td>";
|
||||
print '<td><input class="minwidth300" type="text" name="stripe_card_ref" value="'.GETPOST('stripe_card_ref', 'alpha').'"></td></tr>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user