Debug v15

This commit is contained in:
Laurent Destailleur 2022-01-04 12:56:08 +01:00
parent a887e41600
commit 1d80b8394a
16 changed files with 559 additions and 342 deletions

View File

@ -60,12 +60,15 @@ $SECUREKEY = GETPOST("securekey"); // Secure key
$error = 0; $error = 0;
$response = ""; $response = "";
// Check securitykey
$securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN;
$type = $mode; $type = $mode;
$calculatedsecuritykey = dol_hash($securekeyseed.$type.$ref, '0');
if ($calculatedsecuritykey != $SECUREKEY) { // Check securitykey
$securekeyseed = '';
if ($type == 'proposal') {
$securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN;
}
if (!dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) {
http_response_code(403); http_response_code(403);
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref); print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
exit(-1); exit(-1);
@ -110,21 +113,26 @@ if ($action == "importSignature") {
$return = file_put_contents($upload_dir.$filename, $data); $return = file_put_contents($upload_dir.$filename, $data);
if ($return == false) { if ($return == false) {
$error++; $error++;
$response = 'error file_put_content'; $response = 'Error file_put_content: failed to create signature file.';
} }
} }
if (!$error) { if (!$error) {
$newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf";
$pdf = pdf_getInstance(); $pdf = pdf_getInstance();
$pdf->Open(); $pdf->Open();
$pdf->AddPage(); $pdf->AddPage();
$pagecount = $pdf->setSourceFile($upload_dir.$ref.".pdf"); $pagecount = $pdf->setSourceFile($upload_dir.$ref.".pdf"); // original PDF
$tppl = $pdf->importPage(1); $tppl = $pdf->importPage(1);
$pdf->useTemplate($tppl); $pdf->useTemplate($tppl);
$pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); $pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset.
$pdf->Close(); $pdf->Close();
$pdf->Output($upload_dir.$ref."_signed-".$date.".pdf", "F"); $pdf->Output($newpdffilename, "F");
// Index the new file and update the last_main_doc property of object.
$object->indexFile($newpdffilename, 1);
$sql = "UPDATE ".MAIN_DB_PREFIX."propal"; $sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql .= " SET fk_statut = ".((int) $object::STATUS_SIGNED).", note_private = '".$object->note_private."', date_signature='".$db->idate(dol_now())."'"; $sql .= " SET fk_statut = ".((int) $object::STATUS_SIGNED).", note_private = '".$object->note_private."', date_signature='".$db->idate(dol_now())."'";

View File

@ -5292,6 +5292,53 @@ abstract class CommonObject
// Index file in database // Index file in database
if (!empty($obj->result['fullpath'])) { if (!empty($obj->result['fullpath'])) {
$destfull = $obj->result['fullpath']; $destfull = $obj->result['fullpath'];
// Update the last_main_doc field into main object (if document generator has property ->update_main_doc_field set)
$update_main_doc_field = 0;
if (!empty($obj->update_main_doc_field)) {
$update_main_doc_field = 1;
}
$this->indexFile($destfull, $update_main_doc_field);
} else {
dol_syslog('Method ->write_file was called on object '.get_class($obj).' and return a success but the return array ->result["fullpath"] was not set.', LOG_WARNING);
}
// Success in building document. We build meta file.
dol_meta_create($this);
return 1;
} else {
$outputlangs->charset_output = $sav_charset_output;
dol_print_error($this->db, "Error generating document for ".__CLASS__.". Error: ".$obj->error, $obj->errors);
return -1;
}
} else {
if (!$filefound) {
$this->error = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelspath.' - modele='.$modele;
dol_print_error('', $this->error);
} else {
$this->error = $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $filefound);
dol_print_error('', $this->error);
}
return -1;
}
} else {
return $reshook;
}
}
/**
* Index a file into the ECM database
*
* @param string $destfull Full path of file to index
* @param int $update_main_doc_field Update field main_doc file into table of object
* @return int <0 if KO, >0 if OK
*/
public function indexFile($destfull, $update_main_doc_field)
{
global $user;
$upload_dir = dirname($destfull); $upload_dir = dirname($destfull);
$destfile = basename($destfull); $destfile = basename($destfull);
$rel_dir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $upload_dir); $rel_dir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $upload_dir);
@ -5307,10 +5354,9 @@ abstract class CommonObject
// Set the public "share" key // Set the public "share" key
$setsharekey = false; $setsharekey = false;
if ($this->element == 'propal') { if ($this->element == 'propal' || $this->element == 'proposal') {
$useonlinesignature = 1; // Replace this with 1 when feature to make online signature is ok if (!isset($conf->global->PROPOSAL_ALLOW_ONLINESIGN) || !empty($conf->global->PROPOSAL_ALLOW_ONLINESIGN)) {
if ($useonlinesignature) { $setsharekey = true; // feature to make online signature is not set or set to on (default)
$setsharekey = true;
} }
if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) { if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) {
$setsharekey = true; $setsharekey = true;
@ -5348,6 +5394,7 @@ abstract class CommonObject
$result = $ecmfile->update($user); $result = $ecmfile->update($user);
if ($result < 0) { if ($result < 0) {
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
return -1;
} }
} else { } else {
$ecmfile->entity = $conf->entity; $ecmfile->entity = $conf->entity;
@ -5364,6 +5411,7 @@ abstract class CommonObject
$result = $ecmfile->create($user); $result = $ecmfile->create($user);
if ($result < 0) { if ($result < 0) {
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
return -1;
} }
} }
@ -5372,11 +5420,6 @@ abstract class CommonObject
$this->result['filename']=$ecmfile->filename;*/ $this->result['filename']=$ecmfile->filename;*/
//var_dump($obj->update_main_doc_field);exit; //var_dump($obj->update_main_doc_field);exit;
// Update the last_main_doc field into main object (if document generator has property ->update_main_doc_field set)
$update_main_doc_field = 0;
if (!empty($obj->update_main_doc_field)) {
$update_main_doc_field = 1;
}
if ($update_main_doc_field && !empty($this->table_element)) { if ($update_main_doc_field && !empty($this->table_element)) {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET last_main_doc = '".$this->db->escape($ecmfile->filepath."/".$ecmfile->filename)."'"; $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET last_main_doc = '".$this->db->escape($ecmfile->filepath."/".$ecmfile->filename)."'";
$sql .= " WHERE rowid = ".((int) $this->id); $sql .= " WHERE rowid = ".((int) $this->id);
@ -5384,37 +5427,14 @@ abstract class CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
dol_print_error($this->db); dol_print_error($this->db);
return -1;
} else { } else {
$this->last_main_doc = $ecmfile->filepath.'/'.$ecmfile->filename; $this->last_main_doc = $ecmfile->filepath.'/'.$ecmfile->filename;
} }
} }
} }
} else {
dol_syslog('Method ->write_file was called on object '.get_class($obj).' and return a success but the return array ->result["fullpath"] was not set.', LOG_WARNING);
}
// Success in building document. We build meta file.
dol_meta_create($this);
return 1; return 1;
} else {
$outputlangs->charset_output = $sav_charset_output;
dol_print_error($this->db, "Error generating document for ".__CLASS__.". Error: ".$obj->error, $obj->errors);
return -1;
}
} else {
if (!$filefound) {
$this->error = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelspath.' - modele='.$modele;
dol_print_error('', $this->error);
} else {
$this->error = $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $filefound);
dol_print_error('', $this->error);
}
return -1;
}
} else {
return $reshook;
}
} }
/** /**

View File

@ -213,14 +213,14 @@ function getHtmlOnlinePaymentLink($type, $ref, $label = '')
* Return string with full Url * Return string with full Url
* *
* @param int $mode 0=True url, 1=Url formated with colors * @param int $mode 0=True url, 1=Url formated with colors
* @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member' ...) * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member', 'boothlocation', ...)
* @param string $ref Ref of object * @param string $ref Ref of object
* @param int $amount Amount (required for $type='free' only) * @param int $amount Amount (required and used for $type='free' only)
* @param string $freetag Free tag * @param string $freetag Free tag (required and used for $type='free' only)
* @param string $localorexternal 0=Url for browser, 1=Url for external access * @param string $localorexternal 0=Url for browser, 1=Url for external access
* @return string Url string * @return string Url string
*/ */
function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_tag', $localorexternal = 0) function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_tag', $localorexternal = 1)
{ {
global $conf, $dolibarr_main_url_root; global $conf, $dolibarr_main_url_root;
@ -248,7 +248,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
} }
//if ($mode) $out.='&noidempotency=1'; //if ($mode) $out.='&noidempotency=1';
} elseif ($type == 'order') { } elseif ($type == 'order') {
$out = $urltouse.'/public/payment/newpayment.php?source=order&ref='.($mode ? '<span style="color: #666666">' : ''); $out = $urltouse.'/public/payment/newpayment.php?source='.$type.'&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) { if ($mode == 1) {
$out .= 'order_ref'; $out .= 'order_ref';
} }
@ -271,7 +271,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
} }
} }
} elseif ($type == 'invoice') { } elseif ($type == 'invoice') {
$out = $urltouse.'/public/payment/newpayment.php?source=invoice&ref='.($mode ? '<span style="color: #666666">' : ''); $out = $urltouse.'/public/payment/newpayment.php?source='.$type.'&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) { if ($mode == 1) {
$out .= 'invoice_ref'; $out .= 'invoice_ref';
} }
@ -294,7 +294,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
} }
} }
} elseif ($type == 'contractline') { } elseif ($type == 'contractline') {
$out = $urltouse.'/public/payment/newpayment.php?source=contractline&ref='.($mode ? '<span style="color: #666666">' : ''); $out = $urltouse.'/public/payment/newpayment.php?source='.$type.'&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) { if ($mode == 1) {
$out .= 'contractline_ref'; $out .= 'contractline_ref';
} }
@ -340,9 +340,8 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
$out .= ($mode ? '</span>' : ''); $out .= ($mode ? '</span>' : '');
} }
} }
} } elseif ($type == 'donation') {
if ($type == 'donation') { $out = $urltouse.'/public/payment/newpayment.php?source='.$type.'&ref='.($mode ? '<span style="color: #666666">' : '');
$out = $urltouse.'/public/payment/newpayment.php?source=donation&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) { if ($mode == 1) {
$out .= 'donation_ref'; $out .= 'donation_ref';
} }
@ -364,6 +363,29 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
$out .= ($mode ? '</span>' : ''); $out .= ($mode ? '</span>' : '');
} }
} }
} elseif ($type == 'boothlocation') {
$out = $urltouse.'/public/payment/newpayment.php?source='.$type.'&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'invoice_ref';
}
if ($mode == 0) {
$out .= urlencode($ref);
}
$out .= ($mode ? '</span>' : '');
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
} else {
$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)";
}
if ($mode == 0) {
$out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
}
$out .= ($mode ? '</span>' : '');
}
}
} }
// For multicompany // For multicompany

View File

@ -54,9 +54,10 @@ function showOnlineSignatureUrl($type, $ref)
* @param int $mode 0=True url, 1=Url formated with colors * @param int $mode 0=True url, 1=Url formated with colors
* @param string $type Type of URL ('proposal', ...) * @param string $type Type of URL ('proposal', ...)
* @param string $ref Ref of object * @param string $ref Ref of object
* @param string $localorexternal 0=Url for browser, 1=Url for external access
* @return string Url string * @return string Url string
*/ */
function getOnlineSignatureUrl($mode, $type, $ref = '') function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1)
{ {
global $conf, $db, $langs, $dolibarr_main_url_root; global $conf, $db, $langs, $dolibarr_main_url_root;
@ -68,16 +69,16 @@ function getOnlineSignatureUrl($mode, $type, $ref = '')
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$localorexternal = 1; // external
$urltouse = DOL_MAIN_URL_ROOT; $urltouse = DOL_MAIN_URL_ROOT;
if ($localorexternal) { if ($localorexternal) {
$urltouse = $urlwithroot; $urltouse = $urlwithroot;
} }
$securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN; $securekeyseed = '';
if ($type == 'proposal') { if ($type == 'proposal') {
$securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN;
$out = $urltouse.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ? '<span style="color: #666666">' : ''); $out = $urltouse.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) { if ($mode == 1) {
$out .= 'proposal_ref'; $out .= 'proposal_ref';

View File

@ -220,6 +220,8 @@ class pdf_azur extends ModelePDFPropales
// phpcs:enable // phpcs:enable
global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines; global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
dol_syslog("write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null'));
if (!is_object($outputlangs)) { if (!is_object($outputlangs)) {
$outputlangs = $langs; $outputlangs = $langs;
} }
@ -228,13 +230,22 @@ class pdf_azur extends ModelePDFPropales
$outputlangs->charset_output = 'ISO-8859-1'; $outputlangs->charset_output = 'ISO-8859-1';
} }
// Load traductions files required by page // Load translation files required by page
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "propal", "products")); $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "propal", "products"));
global $outputlangsbis;
$outputlangsbis = null;
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
}
$nblines = count($object->lines); $nblines = count($object->lines);
// Loop on each lines to detect if there is at least one image to show // Loop on each lines to detect if there is at least one image to show
$realpatharray = array(); $realpatharray = array();
$this->atleastonephoto = false;
if (!empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE)) { if (!empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE)) {
$objphoto = new Product($this->db); $objphoto = new Product($this->db);
@ -274,6 +285,7 @@ class pdf_azur extends ModelePDFPropales
$realpath = $dir.$filename; $realpath = $dir.$filename;
$arephoto = true; $arephoto = true;
$this->atleastonephoto = true;
} }
} }
} }
@ -321,6 +333,10 @@ class pdf_azur extends ModelePDFPropales
global $action; global $action;
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
// Set nblines with the new content of lines after hook
$nblines = count($object->lines);
//$nbpayments = count($object->getListOfPayments());
// Create pdf instance // Create pdf instance
$pdf = pdf_getInstance($this->format); $pdf = pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
@ -356,7 +372,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
// Positionne $this->atleastonediscount si on a au moins une remise // Set $this->atleastonediscount if you have at least one discount
for ($i = 0; $i < $nblines; $i++) { for ($i = 0; $i < $nblines; $i++) {
if ($object->lines[$i]->remise_percent) { if ($object->lines[$i]->remise_percent) {
$this->atleastonediscount++; $this->atleastonediscount++;
@ -389,7 +405,7 @@ class pdf_azur extends ModelePDFPropales
} }
//print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit; //print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit;
$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs); $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis);
$pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
@ -399,6 +415,7 @@ class pdf_azur extends ModelePDFPropales
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
// Incoterm // Incoterm
$height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) { if (!empty($conf->incoterm->enabled)) {
$desc_incoterms = $object->getIncotermsForPDF(); $desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) { if ($desc_incoterms) {
@ -414,10 +431,11 @@ class pdf_azur extends ModelePDFPropales
$pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
$tab_top = $nexY + 6; $tab_top = $nexY + 6;
$height_incoterms += 4;
} }
} }
// Affiche notes // Displays notes
$notetoshow = empty($object->note_public) ? '' : $object->note_public; $notetoshow = empty($object->note_public) ? '' : $object->note_public;
if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) { if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) {
// Get first sale rep // Get first sale rep
@ -438,14 +456,15 @@ class pdf_azur extends ModelePDFPropales
if (!empty($conf->global->MAIN_ADD_CREATOR_IN_NOTE) && $object->user_author_id > 0) { if (!empty($conf->global->MAIN_ADD_CREATOR_IN_NOTE) && $object->user_author_id > 0) {
$tmpuser = new User($this->db); $tmpuser = new User($this->db);
$tmpuser->fetch($object->user_author_id); $tmpuser->fetch($object->user_author_id);
$notetoshow .= $langs->trans("CaseFollowedBy").' '.$tmpuser->getFullName($langs);
if ($tmpuser->email) {
$notetoshow .= ', Mail: '.$tmpuser->email; $creator_info = $langs->trans("CaseFollowedBy").' '.$tmpuser->getFullName($langs);
} if ($tmpuser->email) $creator_info .= ', '.$langs->trans("EMail").': '.$tmpuser->email;
if ($tmpuser->office_phone) { if ($tmpuser->office_phone) $creator_info .= ', '.$langs->trans("Phone").': '.$tmpuser->office_phone;
$notetoshow .= ', Tel: '.$tmpuser->office_phone;
} $notetoshow = dol_concatdesc($notetoshow, $creator_info);
} }
if ($notetoshow) { if ($notetoshow) {
$tab_top -= 2; $tab_top -= 2;

View File

@ -321,7 +321,7 @@ class pdf_cyan extends ModelePDFPropales
global $action; global $action;
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
// Set nblines with the new facture lines content after hook // Set nblines with the new content of lines after hook
$nblines = count($object->lines); $nblines = count($object->lines);
//$nbpayments = count($object->getListOfPayments()); //$nbpayments = count($object->getListOfPayments());
@ -816,11 +816,11 @@ class pdf_cyan extends ModelePDFPropales
$pdf->setPage($pageposafter); $pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
//$pdf->SetDrawColor(190,190,200); //$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY); $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
$pdf->SetLineStyle(array('dash'=>0)); $pdf->SetLineStyle(array('dash'=>0));
} }
$nexY += 2; // Add space between lines
// Detect if some page were added automatically and output _tableau for past pages // Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter) { while ($pagenb < $pageposafter) {

View File

@ -135,7 +135,8 @@ class ConferenceOrBooth extends ActionComm
public $status; public $status;
// END MODULEBUILDER PROPERTIES // END MODULEBUILDER PROPERTIES
public $pubregister; //public $pubregister;
/** /**
* Constructor * Constructor
@ -252,8 +253,8 @@ class ConferenceOrBooth extends ActionComm
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey); $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1); /*$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
$this->pubregister = $link_subscription; $this->pubregister = $link_subscription;*/
$this->getActionCommFields(); $this->getActionCommFields();
return $result; return $result;

View File

@ -31,19 +31,23 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
global $dolibarr_main_url_root;
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("eventorganization", "projects")); $langs->loadLangs(array("eventorganization", "projects"));
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothcard'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$withproject = GETPOST('withproject', 'int'); $withproject = GETPOST('withproject', 'int');
$mode = GETPOST('mode', 'alpha'); $mode = GETPOST('mode', 'alpha');
@ -114,7 +118,7 @@ if (empty($reshook)) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist; $backtopage = $backurlforlist;
} else { } else {
$backtopage = dol_buildpath('/eventorganization/conferenceorbooth_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); $backtopage = dol_buildpath('/eventorganization/conferenceorbooth_card.php', 1).'?id='.($id > 0 ? $id : '__ID__').($withproject ? '&withproject=1' : '');
} }
} }
} }
@ -194,13 +198,13 @@ if (!empty($withproject)) {
// Title // Title
$morehtmlref .= $projectstatic->title; $morehtmlref .= $projectstatic->title;
// Thirdparty // Thirdparty
if ($projectstatic->thirdparty->id > 0) { if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project');
} }
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (empty($user->rights->projet->all->lire)) { if (empty($user->rights->project->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
} }
@ -275,7 +279,10 @@ if (!empty($withproject)) {
// Other attributes // Other attributes
$cols = 2; $cols = 2;
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; $objectconf = $object;
$object = $projectstatic;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
$object = $objectconf;
print '</table>'; print '</table>';
@ -284,17 +291,17 @@ if (!empty($withproject)) {
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border tableforfield centpercent">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($projectstatic->description); print nl2br($projectstatic->description);
print '</td></tr>'; print '</td></tr>';
// Categories // Categories
if ($conf->categorie->enabled) { if ($conf->categorie->enabled) {
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>'; print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($projectstatic->id, 'project', 1); print $form->showCategories($projectstatic->id, Categorie::TYPE_PROJECT, 1);
print "</td></tr>"; print "</td></tr>";
} }
@ -315,15 +322,15 @@ if (!empty($withproject)) {
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('PriceOfRegistration', 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td>'; print '</td><td>';
print $form->editfieldval('PriceOfRegistration', 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('PriceOfBooth', 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td>'; print '</td><td>';
print $form->editfieldval('PriceOfBooth', 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>"; print "</td></tr>";
print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>'; print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
@ -332,12 +339,46 @@ if (!empty($withproject)) {
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
// Show message // Show message
$message = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : ""); $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); $message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').'</a>'; $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
print $message; print $message;
print "</td></tr>"; print "</td></tr>";
// Link to the submit vote/register page
print '<tr><td>';
//print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
//print '</span>';
print '</td><td>';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.((int) $projectstatic->id);
$encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $projectstatic->id), 'md5');
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
print '<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
// Link to the subscribe
print '<tr><td>';
//print '<span class="opacitymedium">';
print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>';
print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.((int) $projectstatic->id).'&type=global';
$encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $projectstatic->id), 'md5');
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
print '<a target="_blank" rel="noopener noreferrer" rel="noopener noreferrer" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
@ -473,7 +514,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Object card // Object card
// ------------------------------------------------------------ // ------------------------------------------------------------
http://dolibarr.local/eventorganization/conferenceorbooth_list.php?projectid=7
$linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorbooth_list.php', 1).'?projectid='.$object->fk_project.$withProjectUrl.'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorbooth_list.php', 1).'?projectid='.$object->fk_project.$withProjectUrl.'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
@ -491,44 +531,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
//$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
//unset($object->fields['fk_project']); // Hide field already shown in banner //unset($object->fields['fk_project']); // Hide field already shown in banner
//unset($object->fields['fk_soc']); // Hide field already shown in banner //unset($object->fields['fk_soc']); // Hide field already shown in banner
$keyforbreak='pubregister'; $keyforbreak='num_vote';
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
$object->fetchObjectLinked();
if (is_array($object->linkedObjects) && count($object->linkedObjects)>0 && array_key_exists("facture", $object->linkedObjects)) {
foreach ($object->linkedObjects["facture"] as $fac) {
/**
* @var $fac Facture
*/
if (empty($fac->paye)) {
$key = 'paymentlink_'.$fac->id;
print '<tr class="field_'.$key.'"><td';
print ' class="titlefield fieldname_'.$key;
print '">';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePayment", $langs->transnoentitiesnoconv('Online')) . ' '. $fac->ref.'</span><br>';
print '</td>';
print '<td class="valuefield fieldname_'.$key;
print '">';
$sourcetouse = 'boothlocation';
$reftouse = $fac->id;
$redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$object->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;
}
}
print '<div class="urllink"><input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$redirection.'">';
print '<a href="'.$redirection.'" target="_blank" rel="noopener noreferrer">'.img_picto('', 'globe', 'class="paddingleft"').'</a></div>';
print '</td>';
print '</tr>';
}
}
}
//var_dump($object); //var_dump($object);
// Other attributes. Fields from hook formObjectOptions and Extrafields. // Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
@ -592,9 +598,29 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
// Show links to link elements // Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('conferenceorbooth')); //$linktoelem = $form->showLinkToObjectBlock($object, null, array('conferenceorbooth'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); //$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
$object->fetchObjectLinked();
if (is_array($object->linkedObjects) && count($object->linkedObjects)>0 && array_key_exists("facture", $object->linkedObjects)) {
foreach ($object->linkedObjects["facture"] as $fac) {
if (empty($fac->paye)) {
$key = 'paymentlink_'.$fac->id;
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePayment", $langs->transnoentitiesnoconv('Online')) . ' '. $fac->ref.'</span><br>';
$sourcetouse = 'boothlocation';
$reftouse = $fac->id;
$url = getOnlinePaymentUrl(0, $sourcetouse, $reftouse);
$url .= '&booth='.$object->id;
print '<div class="urllink"><input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">';
print '<a href="'.$url.'" target="_blank" rel="noopener noreferrer">'.img_picto('', 'globe', 'class="paddingleft"').'</a></div>';
}
}
}
print '</div><div class="fichehalfright">'; print '</div><div class="fichehalfright">';
print '</div></div>'; print '</div></div>';

View File

@ -17,41 +17,12 @@
*/ */
/** /**
* \file conferenceorbooth_contact.php * \file htdocs/eventorganization/conferenceorbooth_contact.php
* \ingroup eventorganization * \ingroup eventorganization
* \brief Tab for contacts linked to ConferenceOrBooth * \brief Tab for contacts linked to ConferenceOrBooth
*/ */
// Load Dolibarr environment require '../main.inc.php';
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
}
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
$i--; $j--;
}
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
}
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
}
// Try main.inc.php using relative path
if (!$res && file_exists("../main.inc.php")) {
$res = @include "../main.inc.php";
}
if (!$res && file_exists("../../main.inc.php")) {
$res = @include "../../main.inc.php";
}
if (!$res && file_exists("../../../main.inc.php")) {
$res = @include "../../../main.inc.php";
}
if (!$res) {
die("Include of main fails");
}
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@ -59,14 +30,25 @@ require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class
require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
// Load translation files required by the page require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
$langs->loadLangs(array("eventorganization@eventorganization", "companies", "other", "mails")); require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility // Load translation files required by the page
$langs->loadLangs(array("eventorganization", "projects", "companies", "other", "mails"));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$lineid = GETPOST('lineid', 'int'); $lineid = GETPOST('lineid', 'int');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$withproject = GETPOST('withproject', 'int'); $withproject = GETPOST('withproject', 'int');
// Initialize technical objects // Initialize technical objects
@ -78,8 +60,10 @@ $hookmanager->initHooks(array('conferenceorboothcontact', 'globalcard')); // Not
// Fetch optionals attributes and labels // Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Load object // Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check // Security check
if ($user->socid > 0) { if ($user->socid > 0) {
@ -88,13 +72,35 @@ if ($user->socid > 0) {
$isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); $result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
$permission = $user->rights->eventorganization->write; $permissiontoread = $user->rights->eventorganization->read;
$permissiontoadd = $user->rights->eventorganization->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->eventorganization->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1];
// Security check
if ($user->socid > 0) {
accessforbidden();
}
$isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
if (!$permissiontoread) {
accessforbidden();
}
/* /*
* Actions * Actions
*/ */
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if ($action == 'addcontact' && $permission) { // Add a new contact if ($action == 'addcontact' && $permission) { // Add a new contact
$contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); $contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
@ -131,16 +137,16 @@ if ($action == 'addcontact' && $permission) { // Add a new contact
* View * View
*/ */
$title = $langs->trans('ConferenceOrBooth')." - ".$langs->trans('ContactsAddresses');
$help_url = '';
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url);
$form = new Form($db); $form = new Form($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
$contactstatic = new Contact($db); $contactstatic = new Contact($db);
$userstatic = new User($db); $userstatic = new User($db);
$title = $langs->trans('ConferenceOrBooth')." - ".$langs->trans('ContactsAddresses');
$help_url = '';
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url);
/* *************************************************************************** */ /* *************************************************************************** */
/* */ /* */
@ -175,13 +181,13 @@ if (!empty($withproject)) {
// Title // Title
$morehtmlref .= $projectstatic->title; $morehtmlref .= $projectstatic->title;
// Thirdparty // Thirdparty
if ($projectstatic->thirdparty->id > 0) { if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project');
} }
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (empty($user->rights->projet->all->lire)) { if (empty($user->rights->project->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
} }
@ -256,7 +262,10 @@ if (!empty($withproject)) {
// Other attributes // Other attributes
$cols = 2; $cols = 2;
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; $objectconf = $object;
$object = $projectstatic;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
$object = $objectconf;
print '</table>'; print '</table>';
@ -265,17 +274,17 @@ if (!empty($withproject)) {
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border tableforfield centpercent">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($projectstatic->description); print nl2br($projectstatic->description);
print '</td></tr>'; print '</td></tr>';
// Categories // Categories
if ($conf->categorie->enabled) { if ($conf->categorie->enabled) {
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>'; print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($projectstatic->id, 'project', 1); print $form->showCategories($projectstatic->id, Categorie::TYPE_PROJECT, 1);
print "</td></tr>"; print "</td></tr>";
} }
@ -296,15 +305,15 @@ if (!empty($withproject)) {
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('PriceOfRegistration', 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td>'; print '</td><td>';
print $form->editfieldval('PriceOfRegistration', 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('PriceOfBooth', 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td>'; print '</td><td>';
print $form->editfieldval('PriceOfBooth', 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>"; print "</td></tr>";
print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>'; print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
@ -313,12 +322,46 @@ if (!empty($withproject)) {
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
// Show message // Show message
$message = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : ""); $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); $message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').'</a>'; $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
print $message; print $message;
print "</td></tr>"; print "</td></tr>";
// Link to the submit vote/register page
print '<tr><td>';
//print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
//print '</span>';
print '</td><td>';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.((int) $projectstatic->id);
$encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $projectstatic->id), 'md5');
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
print '<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
// Link to the subscribe
print '<tr><td>';
//print '<span class="opacitymedium">';
print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>';
print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.((int) $projectstatic->id).'&type=global';
$encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $projectstatic->id), 'md5');
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
print '<a target="_blank" rel="noopener noreferrer" rel="noopener noreferrer" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@ -32,13 +32,19 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("eventorganization", "companies", "other", "mails")); $langs->loadLangs(array("eventorganization", "projects", "companies", "other", "mails"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm'); $confirm = GETPOST('confirm');
$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); $cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$withproject = GETPOST('withproject', 'int'); $withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha'); $project_ref = GETPOST('project_ref', 'alpha');
@ -69,17 +75,25 @@ $extrafields = new ExtraFields($db);
$projectstatic = new Project($db); $projectstatic = new Project($db);
$diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id; $diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('conferenceorboothdocument', 'globalcard')); // Note that conf->hooks_modules contains array $hookmanager->initHooks(array('conferenceorboothdocument', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels // Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Load object // Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->eventorganization->multidir_output[$object->entity ? $object->entity : $conf->entity]."/conferenceorbooth/".get_exdir(0, 0, 0, 1, $object); $upload_dir = $conf->eventorganization->multidir_output[$object->entity ? $object->entity : $conf->entity]."/conferenceorbooth/".get_exdir(0, 0, 0, 1, $object);
} }
$permissiontoadd = $user->rights->eventorganization->conferenceorbooth->write; // Used by the include of actions_addupdatedelete.inc.php $permissiontoread = $user->rights->eventorganization->read;
$permissiontoadd = $user->rights->eventorganization->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->eventorganization->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1];
// Security check // Security check
if ($user->socid > 0) { if ($user->socid > 0) {
@ -88,11 +102,21 @@ if ($user->socid > 0) {
$isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); $result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
if (!$permissiontoread) {
accessforbidden();
}
/* /*
* Actions * Actions
*/ */
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
@ -104,7 +128,6 @@ $form = new Form($db);
$title = $langs->trans("ConferenceOrBooth").' - '.$langs->trans("Files"); $title = $langs->trans("ConferenceOrBooth").' - '.$langs->trans("Files");
$help_url = ''; $help_url = '';
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
$result = $projectstatic->fetch($object->fk_project); $result = $projectstatic->fetch($object->fk_project);
@ -121,6 +144,7 @@ $object->project = clone $projectstatic;
if (!empty($withproject)) { if (!empty($withproject)) {
// Tabs for project // Tabs for project
$tab = 'eventorganisation'; $tab = 'eventorganisation';
$withProjectUrl = "&withproject=1";
$head = project_prepare_head($projectstatic); $head = project_prepare_head($projectstatic);
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', ''); print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
@ -132,13 +156,13 @@ if (!empty($withproject)) {
// Title // Title
$morehtmlref .= $projectstatic->title; $morehtmlref .= $projectstatic->title;
// Thirdparty // Thirdparty
if ($projectstatic->thirdparty->id > 0) { if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project');
} }
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (empty($user->rights->projet->all->lire)) { if (empty($user->rights->project->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
} }
@ -213,7 +237,10 @@ if (!empty($withproject)) {
// Other attributes // Other attributes
$cols = 2; $cols = 2;
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; $objectconf = $object;
$object = $projectstatic;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
$object = $objectconf;
print '</table>'; print '</table>';
@ -222,17 +249,17 @@ if (!empty($withproject)) {
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border tableforfield centpercent">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($projectstatic->description); print nl2br($projectstatic->description);
print '</td></tr>'; print '</td></tr>';
// Categories // Categories
if ($conf->categorie->enabled) { if ($conf->categorie->enabled) {
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>'; print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($projectstatic->id, 'project', 1); print $form->showCategories($projectstatic->id, Categorie::TYPE_PROJECT, 1);
print "</td></tr>"; print "</td></tr>";
} }
@ -253,15 +280,15 @@ if (!empty($withproject)) {
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('PriceOfRegistration', 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td>'; print '</td><td>';
print $form->editfieldval('PriceOfRegistration', 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('PriceOfBooth', 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td>'; print '</td><td>';
print $form->editfieldval('PriceOfBooth', 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>"; print "</td></tr>";
print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>'; print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
@ -270,12 +297,46 @@ if (!empty($withproject)) {
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
// Show message // Show message
$message = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : ""); $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); $message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').'</a>'; $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
print $message; print $message;
print "</td></tr>"; print "</td></tr>";
// Link to the submit vote/register page
print '<tr><td>';
//print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
//print '</span>';
print '</td><td>';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.((int) $projectstatic->id);
$encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $projectstatic->id), 'md5');
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
print '<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
// Link to the subscribe
print '<tr><td>';
//print '<span class="opacitymedium">';
print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>';
print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.((int) $projectstatic->id).'&type=global';
$encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $projectstatic->id), 'md5');
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
print '<a target="_blank" rel="noopener noreferrer" rel="noopener noreferrer" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
@ -305,7 +366,6 @@ if ($object->id) {
} }
// Object card // Object card
// -------------
//----------------------------------------------- //-----------------------------------------------
$linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorbooth_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorbooth_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';

View File

@ -31,9 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
if ($conf->categorie->enabled) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
global $dolibarr_main_url_root; global $dolibarr_main_url_root;
@ -231,9 +229,9 @@ if (empty($reshook)) {
$form = new Form($db); $form = new Form($db);
$now = dol_now(); $now = dol_now();
$title = $langs->trans('ListOfConferencesOrBooths');
//$help_url="EN:Module_ConferenceOrBooth|FR:Module_ConferenceOrBooth_FR|ES:Módulo_ConferenceOrBooth"; //$help_url="EN:Module_ConferenceOrBooth|FR:Module_ConferenceOrBooth_FR|ES:Módulo_ConferenceOrBooth";
$help_url = ''; $help_url = '';
$title = $langs->trans('ListOfConferencesOrBooths');
if ($projectid > 0 || $projectref) { if ($projectid > 0 || $projectref) {
$project = new Project($db); $project = new Project($db);
@ -302,6 +300,7 @@ if ($projectid > 0) {
print '<table class="border tableforfield centpercent">'; print '<table class="border tableforfield centpercent">';
// Usage // Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
print '<tr><td class="tdtop">'; print '<tr><td class="tdtop">';
print $langs->trans("Usage"); print $langs->trans("Usage");
print '</td>'; print '</td>';
@ -318,7 +317,7 @@ if ($projectid > 0) {
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>'; print '<br>';
} }
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) { if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
print '<input type="checkbox" disabled name="usage_bill_time"'.($project->usage_bill_time ? ' checked="checked"' : '').'"> '; print '<input type="checkbox" disabled name="usage_bill_time"'.($project->usage_bill_time ? ' checked="checked"' : '').'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription"); $htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext); print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
@ -330,6 +329,7 @@ if ($projectid > 0) {
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext); print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
} }
print '</td></tr>'; print '</td></tr>';
}
// Visibility // Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
@ -381,7 +381,7 @@ if ($projectid > 0) {
// Categories // Categories
if ($conf->categorie->enabled) { if ($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>'; print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($project->id, Categorie::TYPE_PROJECT, 1); print $form->showCategories($project->id, Categorie::TYPE_PROJECT, 1);
print "</td></tr>"; print "</td></tr>";
} }

View File

@ -519,7 +519,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$moreparam .= '&fk_project='.((int) $fk_project); $moreparam .= '&fk_project='.((int) $fk_project);
} }
$head = conferenceorboothattendeePrepareHead($object); $head = conferenceorboothAttendeePrepareHead($object);
print dol_get_fiche_head($head, 'card', $langs->trans("ConferenceOrBoothAttendee"), -1, $object->picto); print dol_get_fiche_head($head, 'card', $langs->trans("ConferenceOrBoothAttendee"), -1, $object->picto);
$formconfirm = ''; $formconfirm = '';

View File

@ -136,7 +136,7 @@ llxHeader('', $langs->trans('ConferenceOrBoothAttendee'), $help_url);
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$head = conferenceorboothattendeePrepareHead($object); $head = conferenceorboothAttendeePrepareHead($object);
print dol_get_fiche_head($head, 'note', $langs->trans("ConferenceOrBoothAttendee"), -1, $object->picto); print dol_get_fiche_head($head, 'note', $langs->trans("ConferenceOrBoothAttendee"), -1, $object->picto);

View File

@ -47,11 +47,14 @@ function conferenceorboothPrepareHead($object, $with_project = 0)
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
/*
$head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_contact.php?id='.$object->id.$withProjectUrl; $head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_contact.php?id='.$object->id.$withProjectUrl;
$head[$h][1] = $langs->trans("ContactsAddresses"); $head[$h][1] = $langs->trans("ContactsAddresses");
$head[$h][2] = 'contact'; $head[$h][2] = 'contact';
$h++; $h++;
*/
/*
$head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php?conforboothid='.$object->id.$withProjectUrl; $head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php?conforboothid='.$object->id.$withProjectUrl;
$head[$h][1] = $langs->trans("Attendees"); $head[$h][1] = $langs->trans("Attendees");
$head[$h][2] = 'attendees'; $head[$h][2] = 'attendees';
@ -77,6 +80,7 @@ function conferenceorboothPrepareHead($object, $with_project = 0)
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbAttendees.'</span>'; $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbAttendees.'</span>';
} }
$h++; $h++;
*/
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
@ -188,7 +192,7 @@ function conferenceorboothProjectPrepareHead($object)
* @param ConferenceOrBoothAttendee $object ConferenceOrBoothAttendee * @param ConferenceOrBoothAttendee $object ConferenceOrBoothAttendee
* @return array Array of tabs * @return array Array of tabs
*/ */
function conferenceorboothattendeePrepareHead($object) function conferenceorboothAttendeePrepareHead($object)
{ {
global $db, $langs, $conf; global $db, $langs, $conf;

View File

@ -53,7 +53,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
// Load translation files // Load translation files
$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox","propal")); $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "members", "paybox", "propal"));
// Security check // Security check
// No check on module enabled. Done later according to $validpaymentmethod // No check on module enabled. Done later according to $validpaymentmethod
@ -61,6 +61,7 @@ $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors",
// Get parameters // Get parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$refusepropal = GETPOST('refusepropal', 'alpha'); $refusepropal = GETPOST('refusepropal', 'alpha');
$message = GETPOST('message', 'aZ09'); $message = GETPOST('message', 'aZ09');
@ -119,15 +120,23 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last &
$creditor = $mysoc->name; $creditor = $mysoc->name;
$object = new Propal($db); $type = $source;
$object->fetch(0, $ref); if ($source == 'proposal') {
$object = new Propal($db);
$object->fetch(0, $ref);
} else {
accessforbidden('Bad value for source');
exit;
}
// Check securitykey // Check securitykey
$securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN; $securekeyseed = '';
$type = $source; if ($source == 'proposal') {
$calculatedsecuritykey = dol_hash($securekeyseed.$type.$ref, '0'); $securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN;
}
if ($calculatedsecuritykey != $SECUREKEY) { if (!dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) {
http_response_code(403); http_response_code(403);
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref); print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
exit(-1); exit(-1);
@ -184,8 +193,8 @@ if ($action == 'refusepropal') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1); print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1);
} }
// Check link validity for param 'source' // Check link validity for param 'source' to avoid use of the examples as value
if (!empty($source) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', ''))) { if (!empty($source) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', 'proposal_ref', ''))) {
$langs->load("errors"); $langs->load("errors");
dol_print_error_email('BADREFINONLINESIGNFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $source, $ref)); dol_print_error_email('BADREFINONLINESIGNFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $source, $ref));
// End of page // End of page
@ -241,16 +250,15 @@ if ($urllogo) {
} }
print '</div>'; print '</div>';
} }
if (!empty($conf->global->PROPOSAL_IMAGE_PUBLIC_SIGN)) { if ($source == 'proposal' && !empty($conf->global->PROPOSAL_IMAGE_PUBLIC_SIGN)) {
print '<div class="backimagepublicproposalsign">'; print '<div class="backimagepublicproposalsign">';
print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="'.$conf->global->PROPOSAL_IMAGE_PUBLIC_SIGN.'">'; print '<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="'.$conf->global->PROPOSAL_IMAGE_PUBLIC_SIGN.'">';
print '</div>'; print '</div>';
} }
// Output introduction text // Output introduction text
$text = ''; $text = '';
if (!empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT)) { if (!empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT)) {
$langs->load("members");
$reg = array(); $reg = array();
if (preg_match('/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) { if (preg_match('/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) {
$text .= $langs->trans($reg[1])."<br>\n"; $text .= $langs->trans($reg[1])."<br>\n";
@ -364,12 +372,13 @@ if ($action != 'dosign') {
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr><td class="center">'; print '<tr><td class="center">';
if ($action == "dosign" && empty($cancel)) { if ($action == "dosign" && empty($cancel)) {
print '<div class="tablepublicpayment">'; print '<div class="tablepublicpayment">';
print '<input type="button" class="buttonDelete small" id="clearsignature" value="'.$langs->trans("ClearSignature").'">'; print '<input type="button" class="buttonDelete small" id="clearsignature" value="'.$langs->trans("ClearSignature").'">';
print '<div id="signature" style="border:solid;"></div>'; print '<div id="signature" style="border:solid;"></div>';
print '</div>'; print '</div>';
print '<input type="button" class="button" id="signpropal" value="'.$langs->trans("Sign").'">'; print '<input type="button" class="button" id="signbutton" value="'.$langs->trans("Sign").'">';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
// Add js code managed into the div #signature // Add js code managed into the div #signature
@ -380,9 +389,9 @@ if ($action == "dosign" && empty($cancel)) {
$("#signature").on("change",function(){ $("#signature").on("change",function(){
$("#clearsignature").css("display",""); $("#clearsignature").css("display","");
$("#signpropal").attr("disabled",false); $("#signbutton").attr("disabled",false);
if(!$._data($("#signpropal")[0], "events")){ if(!$._data($("#signbutton")[0], "events")){
$("#signpropal").on("click",function(){ $("#signbutton").on("click",function(){
var signature = $("#signature").jSignature("getData", "image"); var signature = $("#signature").jSignature("getData", "image");
$.ajax({ $.ajax({
type: "POST", type: "POST",
@ -410,15 +419,16 @@ if ($action == "dosign" && empty($cancel)) {
$("#clearsignature").on("click",function(){ $("#clearsignature").on("click",function(){
$("#signature").jSignature("clear"); $("#signature").jSignature("clear");
$("#signpropal").attr("disabled",true); $("#signbutton").attr("disabled",true);
/* $("#clearsignature").css("display","none"); */ /* $("#clearsignature").css("display","none"); */
}); });
/* $("#clearsignature").css("display","none"); */ /* $("#clearsignature").css("display","none"); */
$("#signpropal").attr("disabled",true); $("#signbutton").attr("disabled",true);
}); });
</script>'; </script>';
} else { } else {
if ($source == 'proposal') {
if ($object->status == $object::STATUS_SIGNED) { if ($object->status == $object::STATUS_SIGNED) {
print '<br>'; print '<br>';
if ($message == 'signed') { if ($message == 'signed') {
@ -437,6 +447,7 @@ if ($action == "dosign" && empty($cancel)) {
print '<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans("SignPropal").'">'; print '<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans("SignPropal").'">';
print '<input name="refusepropal" type="submit" class="butActionDelete small wraponsmartphone marginbottomonly marginleftonly marginrightonly" value="'.$langs->trans("RefusePropal").'">'; print '<input name="refusepropal" type="submit" class="butActionDelete small wraponsmartphone marginbottomonly marginleftonly marginrightonly" value="'.$langs->trans("RefusePropal").'">';
} }
}
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '</table>'."\n"; print '</table>'."\n";

View File

@ -300,21 +300,23 @@ if ($tmpsource == 'membersubscription') {
} }
$valid = true; $valid = true;
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
$token = ''; $tokenisok = false;
$tokenoldcompat = '';
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
if ($tmpsource && $REF) { if ($tmpsource && $REF) {
$token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$tmpsource.$REF, 2); // Use the source in the hash to avoid duplicates if the references are identical // Use the source in the hash to avoid duplicates if the references are identical
$tokenisok = dol_verifyHash($conf->global->PAYMENT_SECURITY_TOKEN.$tmpsource.$REF, $SECUREKEY, '2');
// Do a second test for retro-compatibility (token may have been hashed with membersubscription in external module)
if ($tmpsource != $source) { if ($tmpsource != $source) {
$tokenoldcompat = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$source.$REF, 2); // for retro-compatibility (token may have been hashed with membersubscription in external module) $tokenisok = dol_verifyHash($conf->global->PAYMENT_SECURITY_TOKEN.$source.$REF, $SECUREKEY, '2');
} }
} else { } else {
$token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); $tokenisok = dol_verifyHash($conf->global->PAYMENT_SECURITY_TOKEN, $SECUREKEY, '2');
} }
} else { } else {
$token = $conf->global->PAYMENT_SECURITY_TOKEN; $tokenisok = ($conf->global->PAYMENT_SECURITY_TOKEN == $SECUREKEY);
} }
if ($SECUREKEY != $token && (empty($tokenoldcompat) || $SECUREKEY != $tokenoldcompat)) {
if (! $tokenisok) {
if (empty($conf->global->PAYMENT_SECURITY_ACCEPT_ANY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_ACCEPT_ANY_TOKEN)) {
$valid = false; // PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is for backward compatibility $valid = false; // PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is for backward compatibility
} else { } else {
@ -324,7 +326,7 @@ if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
if (!$valid) { if (!$valid) {
print '<div class="error">Bad value for key.</div>'; print '<div class="error">Bad value for key.</div>';
//print 'SECUREKEY='.$SECUREKEY.' token='.$token.' valid='.$valid; //print 'SECUREKEY='.$SECUREKEY.' valid='.$valid;
exit; exit;
} }
} }