NEW hidden constant to be able to use a thirdparty for donation

This commit is contained in:
Laurent Destailleur 2018-09-12 18:04:33 +02:00
parent 2974ea72c4
commit a3881bfbce
2 changed files with 18 additions and 17 deletions

View File

@ -332,7 +332,7 @@ if ($action == 'create')
print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>';
// Company
if (! empty($conf->societe->enabled))
if (! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES))
{
// Thirdparty
print '<td>' . $langs->trans('Customer') . '</td>';
@ -377,7 +377,21 @@ if ($action == 'create')
print '</tr>' . "\n";
}
else
// Date
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>';
$form->select_date($donation_date?$donation_date:-1,'','','','',"add",1,1);
print '</td>';
// Amount
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.dol_escape_htmltag(GETPOST("amount")).'" size="10"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
// Public donation
print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1);
print "</td></tr>\n";
if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES))
{
print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.dol_escape_htmltag(GETPOST("societe")).'" class="maxwidth200"></td></tr>';
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.dol_escape_htmltag(GETPOST("lastname")).'" class="maxwidth200"></td></tr>';
@ -401,19 +415,6 @@ if ($action == 'create')
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>';
}
// Date
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>';
$form->select_date($donation_date?$donation_date:-1,'','','','',"add",1,1);
print '</td>';
// Amount
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.dol_escape_htmltag(GETPOST("amount")).'" size="10"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
// Public donation
print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1);
print "</td></tr>\n";
// Payment mode
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
$selected = GETPOST('modepayment','int');

View File

@ -423,8 +423,8 @@ class Don extends CommonObject
if (!$error && !empty($conf->global->MAIN_DISABLEDRAFTSTATUS))
{
$res = $this->setValid($user);
if ($res < 0) $error++;
//$res = $this->setValid($user);
//if ($res < 0) $error++;
}
if (!$error)