Merge branch 'dev_EventOrganizer' of github.com:DorianVabre/dolibarr into dev_EventOrganizer_payment

This commit is contained in:
Dorian Vabre 2021-04-12 10:02:04 +02:00
commit 58abeb1e1e
2 changed files with 60 additions and 62 deletions

View File

@ -60,7 +60,7 @@ $arrayofparameters = array(
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1), '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_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1), 'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1),
); );
$error = 0; $error = 0;

View File

@ -81,8 +81,8 @@ $id = dol_decode(GETPOST('id'), $key);
// Securekey check // Securekey check
$securekey = GETPOST('securekey', 'alpha'); $securekey = GETPOST('securekey', 'alpha');
if ($securekey != $conf->global->EVENTORGANIZATION_SECUREKEY) { if ($securekey != $conf->global->EVENTORGANIZATION_SECUREKEY) {
print $langs->trans('MissingOrBadSecureKey'); print $langs->trans('MissingOrBadSecureKey');
exit; exit;
} }
// Load translation files // Load translation files
@ -176,15 +176,15 @@ if (empty($reshook) && $action == 'add') {
$error = 0; $error = 0;
$urlback = ''; $urlback = '';
$db->begin(); $db->begin();
if (!GETPOST("email")) { if (!GETPOST("email")) {
$error++; $error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
} }
if (!GETPOST("societe")) { if (!GETPOST("societe")) {
$error++; $error++;
@ -197,67 +197,65 @@ if (empty($reshook) && $action == 'add') {
} }
if (!$error) { if (!$error) {
// Vérifier si client existe // Vérifier si client existe
$thirdparty = new Societe($db); $thirdparty = new Societe($db);
$nomsociete = GETPOST("societe"); $nomsociete = GETPOST("societe");
$resultfetchthirdparty = $thirdparty->fetch('', $nomsociete); $resultfetchthirdparty = $thirdparty->fetch('', $nomsociete);
if($resultfetchthirdparty<0){ if ($resultfetchthirdparty<0) {
$error++; $error++;
$errmsg .= $thirdparty->error; $errmsg .= $thirdparty->error;
$readythirdparty = -1; $readythirdparty = -1;
} elseif ($resultfetchthirdparty==0) {
} elseif($resultfetchthirdparty==0){ // creation of a new thirdparty
// creation of a new thirdparty $thirdparty->name = $nomsociete;
$thirdparty->name = $nomsociete; $thirdparty->address = GETPOST("address");
$thirdparty->address = GETPOST("address"); $thirdparty->zip = GETPOST("zipcode");
$thirdparty->zip = GETPOST("zipcode"); $thirdparty->town = GETPOST("town");
$thirdparty->town = GETPOST("town"); $thirdparty->client = 2;
$thirdparty->client = 2; $thirdparty->fournisseur = 0;
$thirdparty->fournisseur = 0; $thirdparty->country_id = GETPOST("country_id", 'int');
$thirdparty->country_id = GETPOST("country_id", 'int'); $thirdparty->state_id = GETPOST("state_id", 'int');
$thirdparty->state_id = GETPOST("state_id", 'int');
// Load object modCodeTiers
$module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
$module = substr($module, 0, dol_strlen($module) - 4);
}
$dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
foreach ($dirsociete as $dirroot) {
$res = dol_include_once($dirroot.$module.'.php');
if ($res) {
break;
}
}
$modCodeClient = new $module($db);
if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { // Load object modCodeTiers
$tmpcode = $modCodeClient->getNextValue($thirdparty, 0); $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
} if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
$thirdparty->code_client = $tmpcode; $module = substr($module, 0, dol_strlen($module) - 4);
$readythirdparty = $thirdparty->create($user); }
$dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
foreach ($dirsociete as $dirroot) {
$res = dol_include_once($dirroot.$module.'.php');
if ($res) {
break;
}
}
$modCodeClient = new $module($db);
if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
$tmpcode = $modCodeClient->getNextValue($thirdparty, 0);
}
$thirdparty->code_client = $tmpcode;
$readythirdparty = $thirdparty->create($user);
} else { } else {
// We have an existing thirdparty ready to use // We have an existing thirdparty ready to use
$readythirdparty = 1; $readythirdparty = 1;
} }
if ($readythirdparty < 0){ if ($readythirdparty < 0) {
$error++; $error++;
$errmsg .= $thirdparty->error; $errmsg .= $thirdparty->error;
} else { } else {
// creation of an attendee // creation of an attendee
$confattendee = new ConferenceOrBoothAttendee($db); $confattendee = new ConferenceOrBoothAttendee($db);
$confattendee->fk_soc = $thirdparty->id; $confattendee->fk_soc = $thirdparty->id;
$confattendee->date_subscription = dol_now(); $confattendee->date_subscription = dol_now();
$confattendee->email = GETPOST("email"); $confattendee->email = GETPOST("email");
$confattendee->fk_actioncomm = $id; $confattendee->fk_actioncomm = $id;
$resultconfattendee = $confattendee->create($user); $resultconfattendee = $confattendee->create($user);
if ($resultconfattendee < 0){ if ($resultconfattendee < 0) {
$error++; $error++;
$errmsg .= $confattendee->error; $errmsg .= $confattendee->error;
} }
} }
} }
@ -293,8 +291,8 @@ $formcompany = new FormCompany($db);
$conference = new ConferenceOrBooth($db); $conference = new ConferenceOrBooth($db);
$resultconf = $conference->fetch($id); $resultconf = $conference->fetch($id);
if ($resultconf < 0){ if ($resultconf < 0) {
setEventMessages(null, $object->errors, "errors"); setEventMessages(null, $object->errors, "errors");
} }
llxHeaderVierge($langs->trans("NewSubscription")); llxHeaderVierge($langs->trans("NewSubscription"));