removed useless fetch, moved link to the fetch method of the conferenceorbooth class, wip on service to use on the invoice

This commit is contained in:
Dorian Vabre 2021-04-14 14:33:11 +02:00
parent 339596f134
commit 55afc59db2
5 changed files with 36 additions and 13 deletions

View File

@ -61,6 +61,8 @@ $arrayofparameters = array(
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1),
'SERVICE_BOOTH_LOCATION'=>array('type'=>'product', 'enabled'=>1),
'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array('type'=>'product', 'enabled'=>1),
);
$error = 0;
@ -276,6 +278,23 @@ if ($action == 'edit') {
});';
print '</script>';
}
} elseif ($var['type'] == 'product') {
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
print '<td>';
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname);
$form->select_produits($selected, $constname, '', 0);
print '</td>';
print "</tr>\n";
}
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
print '<td>';
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname);
$form->select_produits($selected, $constname, '', 0);
print '</td>';
}
print "</tr>\n";
} else {
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
}

View File

@ -237,7 +237,19 @@ class ConferenceOrBooth extends ActionComm
*/
public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '')
{
global $dolibarr_main_url_root, $dolibarr_main_instance_unique_id, $conf, $langs;
$result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
$encodedid = dol_encode($id, $dolibarr_main_instance_unique_id);
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$encodedid;
$encodedsecurekey = dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY.$encodedid, $dolibarr_main_instance_unique_id);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
$this->pubregister = $link_subscription;
$this->getActionCommFields();
return $result;
}

View File

@ -493,18 +493,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
//$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
//unset($object->fields['fk_project']); // Hide field already shown in banner
//unset($object->fields['fk_soc']); // Hide field already shown in banner
global $dolibarr_main_url_root;
$encodedid = dol_encode($id, $dolibarr_main_instance_unique_id);
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$encodedid;
$encodedsecurekey = dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY.$encodedid, $dolibarr_main_instance_unique_id);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
$object->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
$object->pubregister = $link_subscription;
$keyforbreak='pubregister';
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
//var_dump($object);
// Other attributes. Fields from hook formObjectOptions and Extrafields.

View File

@ -82,6 +82,8 @@ EventOrganizationICSLink=Link ICS for events
ConferenceOrBoothInformation=Conference Or Booth informations
Attendees = Attendees
EVENTORGANIZATION_SECUREKEY = Secure Key of the public registration link to a conference
SERVICE_BOOTH_LOCATION = Service used for the invoice row about a booth location
SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION = Service used for the invoice row about an attendee subscription to a conference
#
# Status
#

View File

@ -299,14 +299,14 @@ if (empty($reshook) && $action == 'add') {
$facture->paye = 0;
//@todo price and taxes to add
$tva = get_default_tva($mysoc, $thirdparty);
$facture->date = dol_now();
$resultfacture = $facture->create($user);
if ($resultfacture < 0){
$error++;
$errmsg .= $facture->error;
} else {
$thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email);
// @todo corriger la réf qui est surement celle de la facture au lieu du client
$redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?amount='.$project->price_registration.'&source=conferenceattendeesubscription&ref='.$thirdparty->ref;
Header("Location: ".$redirection);
exit;