Fix option DONATION_USE_THIRDPARTIES
This commit is contained in:
parent
a68721c5b4
commit
81f1bee10c
@ -44,7 +44,7 @@ if (!empty($conf->projet->enabled)) {
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
$langs->loadLangs(array("bills", "companies", "donations"));
|
||||
$langs->loadLangs(array("bills", "companies", "donations", "users"));
|
||||
|
||||
$id = GETPOST('rowid') ?GETPOST('rowid', 'int') : GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
@ -179,15 +179,18 @@ if ($action == 'add')
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (empty($donation_date))
|
||||
{
|
||||
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES) && !(GETPOST("socid", 'int') > 0)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
if (empty($donation_date)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (empty($amount))
|
||||
{
|
||||
if (empty($amount)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
@ -347,16 +350,16 @@ if ($action == 'create')
|
||||
print '<tbody>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans('Draft').'</td></tr>';
|
||||
|
||||
// Company
|
||||
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES))
|
||||
{
|
||||
// Thirdparty
|
||||
print '<td>'.$langs->trans('Customer').'</td>';
|
||||
if ($soc->id > 0 && !GETPOST('fac_rec', 'alpha'))
|
||||
if ($soc->id > 0)
|
||||
{
|
||||
print '<td colspan="2">';
|
||||
print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
|
||||
print '<td>';
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
||||
// Outstanding Bill
|
||||
@ -372,7 +375,8 @@ if ($action == 'create')
|
||||
print ')';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td colspan="2">';
|
||||
print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
|
||||
print '<td>';
|
||||
print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
||||
// Option to reload page to retrieve customer informations. Note, this clear other input
|
||||
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED))
|
||||
@ -389,7 +393,7 @@ if ($action == 'create')
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
@ -545,11 +549,15 @@ if (!empty($id) && $action == 'edit')
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
if ($object->socid && !empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
||||
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
||||
$company = new Societe($db);
|
||||
$result = $company->fetch($object->socid);
|
||||
|
||||
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2">'.$company->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="2">';
|
||||
if ($object->socid > 0) {
|
||||
$result = $company->fetch($object->socid);
|
||||
print $company->getNomUrl(1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
$langs->load("companies");
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="maxwidth200" value="'.dol_escape_htmltag($object->societe).'"></td></tr>';
|
||||
@ -707,11 +715,15 @@ if (!empty($id) && $action != 'edit')
|
||||
print yn($object->public);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($object->socid) {
|
||||
if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
||||
$company = new Societe($db);
|
||||
$result = $company->fetch($object->socid);
|
||||
|
||||
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2">'.$company->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="2">';
|
||||
if ($object->socid > 0) {
|
||||
$result = $company->fetch($object->socid);
|
||||
print $company->getNomUrl(1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2">'.$object->societe.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Lastname").'</td><td colspan="2">'.$object->lastname.'</td></tr>';
|
||||
|
||||
@ -32,4 +32,4 @@ DONATION_ART238=Show article 238 from CGI if you are concerned
|
||||
DONATION_ART885=Show article 885 from CGI if you are concerned
|
||||
DonationPayment=Donation payment
|
||||
DonationValidated=Donation %s validated
|
||||
DonationUseThirdparties=Ask a thirdparty on each donation record
|
||||
DonationUseThirdparties=Use an existing thirdparty as coordinates of donators
|
||||
|
||||
Loading…
Reference in New Issue
Block a user