update on specifications on suggesting a booth/conf since its now two separated pages
This commit is contained in:
parent
df78aaff88
commit
c56c7afa89
@ -378,7 +378,7 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
$errmsg .= $conforbooth->error;
|
$errmsg .= $conforbooth->error;
|
||||||
} else {
|
} else {
|
||||||
// If this is a paying booth, we have to redirect to payment page and create an invoice
|
// If this is a paying booth, we have to redirect to payment page and create an invoice
|
||||||
if (GETPOST("suggestbooth") && !empty(floatval($project->price_booth))) {
|
if (!empty(floatval($project->price_booth))) {
|
||||||
$productforinvoicerow = new Product($db);
|
$productforinvoicerow = new Product($db);
|
||||||
$resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION);
|
$resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION);
|
||||||
if ($resultprod < 0) {
|
if ($resultprod < 0) {
|
||||||
@ -437,7 +437,7 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If no price has been set for the booth or this is a conference, we confirm it as suggested and we update
|
// If no price has been set for the booth, we confirm it as suggested and we update
|
||||||
$conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED;
|
$conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED;
|
||||||
$conforbooth->update($user);
|
$conforbooth->update($user);
|
||||||
// Sending mail
|
// Sending mail
|
||||||
|
|||||||
@ -378,66 +378,6 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
$errmsg .= $conforbooth->error;
|
$errmsg .= $conforbooth->error;
|
||||||
} else {
|
} else {
|
||||||
// If this is a paying booth, we have to redirect to payment page and create an invoice
|
// If this is a paying booth, we have to redirect to payment page and create an invoice
|
||||||
if (GETPOST("suggestbooth") && !empty(floatval($project->price_booth))) {
|
|
||||||
$productforinvoicerow = new Product($db);
|
|
||||||
$resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION);
|
|
||||||
if ($resultprod < 0) {
|
|
||||||
$error++;
|
|
||||||
$errmsg .= $productforinvoicerow->error;
|
|
||||||
} else {
|
|
||||||
$facture = new Facture($db);
|
|
||||||
$facture->type = Facture::TYPE_STANDARD;
|
|
||||||
$facture->socid = $thirdparty->id;
|
|
||||||
$facture->paye = 0;
|
|
||||||
$facture->date = dol_now();
|
|
||||||
$facture->cond_reglement_id = $contact->cond_reglement_id;
|
|
||||||
|
|
||||||
if (empty($facture->cond_reglement_id)) {
|
|
||||||
$paymenttermstatic = new PaymentTerm($contact->db);
|
|
||||||
$facture->cond_reglement_id = $paymenttermstatic->getDefaultId();
|
|
||||||
if (empty($facture->cond_reglement_id)) {
|
|
||||||
$error++;
|
|
||||||
$contact->error = 'ErrorNoPaymentTermRECEPFound';
|
|
||||||
$contact->errors[] = $contact->error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$resultfacture = $facture->create($user);
|
|
||||||
if ($resultfacture <= 0) {
|
|
||||||
$contact->error = $facture->error;
|
|
||||||
$contact->errors = $facture->errors;
|
|
||||||
$error++;
|
|
||||||
} else {
|
|
||||||
$facture->add_object_linked($contact->element, $contact->id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error) {
|
|
||||||
// Add line to draft invoice
|
|
||||||
$vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id);
|
|
||||||
$result = $facture->addline($langs->trans("BoothLocationFee", $conforbooth->label, dol_print_date($conforbooth->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conforbooth->datep2, '%d/%m/%y %H:%M:%S')), floatval($project->price_booth), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, '', 'HT', 0, 1);
|
|
||||||
if ($result <= 0) {
|
|
||||||
$contact->error = $facture->error;
|
|
||||||
$contact->errors = $facture->errors;
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
if (!$error) {
|
|
||||||
$valid = true;
|
|
||||||
$sourcetouse = 'boothlocation';
|
|
||||||
$reftouse = $facture->id;
|
|
||||||
$redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$conforbooth->id;
|
|
||||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
|
||||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
|
||||||
$redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical
|
|
||||||
} else {
|
|
||||||
$redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Header("Location: ".$redirection);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// If no price has been set for the booth or this is a conference, we confirm it as suggested and we update
|
|
||||||
$conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED;
|
$conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED;
|
||||||
$conforbooth->update($user);
|
$conforbooth->update($user);
|
||||||
// Sending mail
|
// Sending mail
|
||||||
@ -485,7 +425,6 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
$encodedid = dol_encode($id, $dolibarr_main_instance_unique_id);
|
$encodedid = dol_encode($id, $dolibarr_main_instance_unique_id);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user