From 594bbcb1f194460dfa59543ed5a37c8cbb14ccd3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 31 Aug 2022 17:32:38 +0200 Subject: [PATCH 01/10] Fix regression --- htdocs/compta/accounting-files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 0db718f28b4..40449d5da1f 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -130,7 +130,7 @@ $error = 0; $listofchoices = array( 'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills', 'enabled' => isModEnabled('facture'), 'perms' => !empty($user->rights->facture->lire)), 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => isModEnabled('supplier_invoice'), 'perms' => !empty($user->rights->fournisseur->facture->lire)), - 'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => !isModEnabled('expensereport'), 'perms' => !empty($user->rights->expensereport->lire)), + 'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => !empty($user->rights->expensereport->lire)), 'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => isModEnabled('don'), 'perms' => !empty($user->rights->don->lire)), 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'enabled' => isModEnabled('tax'), 'perms' => !empty($user->rights->tax->charges->lire)), 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries', 'enabled' => isModEnabled('salaries'), 'perms' => !empty($user->rights->salaries->read)), From 0bfa7a2a8f864cd079c63bb56bb39258b9e2e4bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 31 Aug 2022 18:09:46 +0200 Subject: [PATCH 02/10] Fix delete dir --- build/makepack-dolibarr.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 3024d3b1e61..abf16cee764 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -632,7 +632,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`; From dd8a9ac1f7ff41cfc34a218799c4f84f48e1652f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 31 Aug 2022 22:15:43 +0200 Subject: [PATCH 03/10] Fix perms --- dev/tools/fixperms.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tools/fixperms.sh b/dev/tools/fixperms.sh index 5b027ad1580..6b11f25112b 100755 --- a/dev/tools/fixperms.sh +++ b/dev/tools/fixperms.sh @@ -24,6 +24,7 @@ fi if [ "x$1" = "xfix" ] then find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \; + find ./htdocs/install/ -type d -exec chmod ug+rw {} \; chmod a+x ./scripts/*/*.php chmod a+x ./scripts/*/*.sh chmod g-w ./scripts/*/*.php From 9b7ec2dbc8798732003b4d12a1284fddcd16d947 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 31 Aug 2022 22:56:45 +0200 Subject: [PATCH 04/10] Fix missing img --- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index e2f11c9544c..cdba19dd38a 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1812,11 +1812,11 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if (isModEnabled('comptabilite')) { // Files if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { - $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files'); + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); } // Bilan, resultats - $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca'); + $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/report/', $leftmenu)) { $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire); From 8bf8beb8980f7b351bc25921e1f12da1fc340404 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Sep 2022 10:54:20 +0200 Subject: [PATCH 05/10] Debug module ticket --- htdocs/admin/ihm.php | 28 +- htdocs/admin/ticket_public.php | 8 +- htdocs/core/class/html.formticket.class.php | 6 +- htdocs/exports/export.php | 2 +- htdocs/imports/import.php | 6 +- htdocs/langs/en_US/ticket.lang | 2 +- htdocs/main.inc.php | 5 + htdocs/public/ticket/create_ticket.php | 552 ++++++++++--------- htdocs/public/ticket/index.php | 12 +- htdocs/public/ticket/list.php | 30 +- htdocs/public/ticket/view.php | 13 +- htdocs/theme/eldy/main_menu_fa_icons.inc.php | 4 - htdocs/theme/md/main_menu_fa_icons.inc.php | 4 - htdocs/user/class/user.class.php | 4 +- 14 files changed, 348 insertions(+), 328 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 7763c190482..48541310372 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -375,6 +375,20 @@ if ($mode == 'other') { print ''; print ''; + // Show Quick Add link + print '' . $langs->trans("ShowQuickAddLink") . ''; + print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); + print ''; + print ''; + + // Hide wiki link on login page + $pictohelp = ''; + print '' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . ''; + print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); + //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); + print ''; + print ''; + // Max size of lists print '' . $langs->trans("DefaultMaxSizeList") . ''; print ''; @@ -439,12 +453,6 @@ if ($mode == 'other') { print ''; */ - // Show Quick Add link - print '' . $langs->trans("ShowQuickAddLink") . ''; - print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); - print ''; - print ''; - // Show bugtrack link print ''; print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc")); @@ -453,14 +461,6 @@ if ($mode == 'other') { print ''; print ''; - // Hide wiki link on login page - $pictohelp = ''; - print '' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . ''; - print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); - //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); - print ''; - print ''; - // Disable javascript and ajax print '' . $form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")) . ''; print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index fdb3117423b..a0df28a8f84 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -101,7 +101,7 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') { } $text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'restricthtml'); - if (!empty($text_home)) { + if (GETPOSTISSET('TICKET_PUBLIC_TEXT_HOME')) { $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity); } else { $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity); @@ -371,8 +371,8 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help'); print ''; - // Texte d'accueil homepage - $public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome'); + // Text on home page + $public_text_home = getDolGlobalString('TICKET_PUBLIC_TEXT_HOME', ''.$langs->trans("TicketPublicDesc").''); print ''.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").''; print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -383,7 +383,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help'); print ''; - // Texte d'aide à la saisie du message + // Text to help to enter a ticket $public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'); print ''.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").''; print ''; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 62965413a5d..32e6912b9ea 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -315,7 +315,7 @@ class FormTicket // Type print ''; - $this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', 2, 0, 0, 0, 'minwidth200'); + $this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', 2, 1, 0, 0, 'minwidth200'); print ''; // Group @@ -328,7 +328,7 @@ class FormTicket print ''; // Severity - print ''; + print ''; $this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', 2, 0); print ''; @@ -643,7 +643,7 @@ class FormTicket print dol_get_fiche_end(); } - print '
'; + print '

'; print $form->buttonsSaveCancel(((isset($this->withreadid) && $this->withreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : "")); diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index f06e83f4c40..4591ccd0bf3 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -451,7 +451,7 @@ if ($step == 1 || !$datatoexport) { print $label; print ''; if ($objexport->array_export_perms[$key]) { - print ''.img_picto($langs->trans("NewExport"), 'next', 'class="fa-15x"').''; + print ''.img_picto($langs->trans("NewExport"), 'next', 'class="fa-15"').''; } else { print ''.$langs->trans("NotEnoughPermissions").''; } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 564a41ab7a0..a66814ce1b1 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -394,7 +394,7 @@ if ($step == 1 || !$datatoimport) { print $objimport->array_import_label[$key]; print ''; if ($objimport->array_import_perms[$key]) { - print ''.img_picto($langs->trans("NewImport"), 'next', 'class="fa-15x"').''; + print ''.img_picto($langs->trans("NewImport"), 'next', 'class="fa-15"').''; } else { print $langs->trans("NotEnoughPermissions"); } @@ -499,7 +499,7 @@ if ($step == 2 && $datatoimport) { print ''; // Action button print ''; - print ''.img_picto($langs->trans("SelectFormat"), 'next', 'class="fa-15x"').''; + print ''.img_picto($langs->trans("SelectFormat"), 'next', 'class="fa-15"').''; print ''; print ''; } @@ -727,7 +727,7 @@ if ($step == 3 && $datatoimport) { print '">'.img_delete().''; // Action button print ''; - print ''.img_picto($langs->trans("NewImport"), 'next', 'class="fa-15x"').''; + print ''.img_picto($langs->trans("NewImport"), 'next', 'class="fa-15"').''; print ''; print ''; } diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index f34f338c931..3e252e407e4 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -296,7 +296,7 @@ TicketNewEmailBodyInfosTrackUrlCustomer=You can view the progress of the ticket TicketCloseEmailBodyInfosTrackUrlCustomer=You can consult the history of this ticket by clicking the following link TicketEmailPleaseDoNotReplyToThisEmail=Please do not reply directly to this email! Use the link to reply into the interface. TicketPublicInfoCreateTicket=This form allows you to record a support ticket in our management system. -TicketPublicPleaseBeAccuratelyDescribe=Please accurately describe the problem. Provide the most information possible to allow us to correctly identify your request. +TicketPublicPleaseBeAccuratelyDescribe=Please accurately describe your question. Provide the most information possible to allow us to correctly identify your request. TicketPublicMsgViewLogIn=Please enter ticket tracking ID TicketTrackId=Public Tracking ID OneOfTicketTrackId=One of your tracking ID diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 49c427ace71..3cbef0d799e 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1153,6 +1153,11 @@ if (!defined('NOLOGIN')) { $conf->theme = $user->conf->MAIN_THEME; $conf->css = "/theme/".$conf->theme."/style.css.php"; } +} else { + // We may have NOLOGIN set, but NOREQUIREUSER not + if (!empty($user) && method_exists($user, 'loadDefaultValues')) { + $user->loadDefaultValues(); // Load default values for everybody (works even if $user->id = 0 + } } diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 1c302c33b2e..669c5e8d512 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -22,9 +22,10 @@ * \brief Display public form to add new ticket */ +/* We need object $user->default_values if (!defined('NOREQUIREUSER')) { define('NOREQUIREUSER', '1'); -} +}*/ if (!defined('NOTOKENRENEWAL')) { define('NOTOKENRENEWAL', '1'); } @@ -37,9 +38,6 @@ if (!defined('NOREQUIREHTML')) { if (!defined('NOLOGIN')) { define("NOLOGIN", 1); // This means this output page does not require to be logged. } -if (!defined('NOCSRFCHECK')) { - define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. -} if (!defined('NOIPCHECK')) { define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip } @@ -73,6 +71,9 @@ $id = GETPOST('id', 'int'); $msg_id = GETPOST('msg_id', 'int'); $action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); + +$backtopage = ''; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('publicnewticketcard', 'globalcard')); @@ -105,298 +106,265 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } // Add file in email form -if (empty($reshook) && GETPOST('addfile', 'alpha') && !GETPOST('save', 'alpha')) { - ////$res = $object->fetch('','',GETPOST('track_id')); - ////if($res > 0) - ////{ - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +if (empty($reshook)) { + if ($cancel) { + $backtopage = DOL_URL_ROOT.'/public/ticket/index.php'; - // Set tmp directory TODO Use a dedicated directory for temp mails files - $vardir = $conf->ticket->dir_output; - $upload_dir_tmp = $vardir.'/temp/'.session_id(); - if (!dol_is_dir($upload_dir_tmp)) { - dol_mkdir($upload_dir_tmp); + header("Location: ".$backtopage); + exit; } - dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, '', 0); - $action = 'create_ticket'; - ////} -} + if (GETPOST('addfile', 'alpha') && !GETPOST('save', 'alpha')) { + ////$res = $object->fetch('','',GETPOST('track_id')); + ////if($res > 0) + ////{ + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -// Remove file -if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('save', 'alpha')) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + // Set tmp directory TODO Use a dedicated directory for temp mails files + $vardir = $conf->ticket->dir_output; + $upload_dir_tmp = $vardir.'/temp/'.session_id(); + if (!dol_is_dir($upload_dir_tmp)) { + dol_mkdir($upload_dir_tmp); + } - // Set tmp directory - $vardir = $conf->ticket->dir_output.'/'; - $upload_dir_tmp = $vardir.'/temp/'.session_id(); + dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, '', 0); + $action = 'create_ticket'; + ////} + } - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile'), 0, 0); - $action = 'create_ticket'; -} + // Remove file + if (GETPOST('removedfile', 'alpha') && !GETPOST('save', 'alpha')) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { - $error = 0; - $origin_email = GETPOST('email', 'alpha'); - if (empty($origin_email)) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email"))); - $action = ''; - } else { - // Search company saved with email - $searched_companies = $object->searchSocidByEmail($origin_email, '0'); + // Set tmp directory + $vardir = $conf->ticket->dir_output.'/'; + $upload_dir_tmp = $vardir.'/temp/'.session_id(); - // Chercher un contact existant avec cette adresse email - // Le premier contact trouvé est utilisé pour déterminer le contact suivi - $contacts = $object->searchContactByEmail($origin_email); + // TODO Delete only files that was uploaded from email form + dol_remove_file_process(GETPOST('removedfile'), 0, 0); + $action = 'create_ticket'; + } - // Option to require email exists to create ticket - if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && !$contacts[0]->socid) { + if ($action == 'create_ticket' && GETPOST('save', 'alpha')) { + $error = 0; + $origin_email = GETPOST('email', 'alpha'); + if (empty($origin_email)) { $error++; - array_push($object->errors, $langs->trans("ErrorEmailMustExistToCreateTicket")); + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email"))); $action = ''; - } - } + } else { + // Search company saved with email + $searched_companies = $object->searchSocidByEmail($origin_email, '0'); - $contact_lastname = ''; - $contact_firstname = ''; - $company_name = ''; - $contact_phone = ''; - if ($with_contact) { - // set linked contact to add in form - if (is_array($contacts) && count($contacts) == 1) { - $with_contact = current($contacts); - } + // Chercher un contact existant avec cette adresse email + // Le premier contact trouvé est utilisé pour déterminer le contact suivi + $contacts = $object->searchContactByEmail($origin_email); - // check mandatory fields on contact - $contact_lastname = trim(GETPOST('contact_lastname', 'alphanohtml')); - $contact_firstname = trim(GETPOST('contact_firstname', 'alphanohtml')); - $company_name = trim(GETPOST('company_name', 'alphanohtml')); - $contact_phone = trim(GETPOST('contact_phone', 'alphanohtml')); - if (!($with_contact->id > 0)) { - // check lastname - if (empty($contact_lastname)) { + // Option to require email exists to create ticket + if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && !$contacts[0]->socid) { $error++; - array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Lastname'))); - $action = ''; - } - // check firstname - if (empty($contact_firstname)) { - $error++; - array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Firstname'))); + array_push($object->errors, $langs->trans("ErrorEmailMustExistToCreateTicket")); $action = ''; } } - } - if (!GETPOST("subject", "restricthtml")) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"))); - $action = ''; - } - if (!GETPOST("message", "restricthtml")) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Message"))); - $action = ''; - } + $contact_lastname = ''; + $contact_firstname = ''; + $company_name = ''; + $contact_phone = ''; + if ($with_contact) { + // set linked contact to add in form + if (is_array($contacts) && count($contacts) == 1) { + $with_contact = current($contacts); + } - // Check email address - if (!empty($origin_email) && !isValidEmail($origin_email)) { - $error++; - array_push($object->errors, $langs->trans("ErrorBadEmailAddress", $langs->transnoentities("email"))); - $action = ''; - } + // check mandatory fields on contact + $contact_lastname = trim(GETPOST('contact_lastname', 'alphanohtml')); + $contact_firstname = trim(GETPOST('contact_firstname', 'alphanohtml')); + $company_name = trim(GETPOST('company_name', 'alphanohtml')); + $contact_phone = trim(GETPOST('contact_phone', 'alphanohtml')); + if (!($with_contact->id > 0)) { + // check lastname + if (empty($contact_lastname)) { + $error++; + array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Lastname'))); + $action = ''; + } + // check firstname + if (empty($contact_firstname)) { + $error++; + array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Firstname'))); + $action = ''; + } + } + } - // Check Captcha code if is enabled - if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) || !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA_TICKET)) { - $sessionkey = 'dol_antispam_value'; - $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) === strtolower(GETPOST('code', 'restricthtml')))); - if (!$ok) { + if (!GETPOST("subject", "restricthtml")) { $error++; - array_push($object->errors, $langs->trans("ErrorBadValueForCode")); + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"))); $action = ''; } - } - - if (!$error) { - $object->db->begin(); - - $object->track_id = generate_random_id(16); - - $object->subject = GETPOST("subject", "restricthtml"); - $object->message = GETPOST("message", "restricthtml"); - $object->origin_email = $origin_email; - - $object->type_code = GETPOST("type_code", 'aZ09'); - $object->category_code = GETPOST("category_code", 'aZ09'); - $object->severity_code = GETPOST("severity_code", 'aZ09'); - - if (!is_object($user)) { - $user = new User($db); + if (!GETPOST("message", "restricthtml")) { + $error++; + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Message"))); + $action = ''; } - // create third-party with contact - $usertoassign = 0; - if ($with_contact && !($with_contact->id > 0)) { - $company = new Societe($db); - if (!empty($company_name)) { - $company->name = $company_name; - } else { - $company->particulier = 1; - $company->name = dolGetFirstLastname($contact_firstname, $contact_lastname); - } - $result = $company->create($user); - if ($result < 0) { + // Check email address + if (!empty($origin_email) && !isValidEmail($origin_email)) { + $error++; + array_push($object->errors, $langs->trans("ErrorBadEmailAddress", $langs->transnoentities("email"))); + $action = ''; + } + + // Check Captcha code if is enabled + if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) || !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA_TICKET)) { + $sessionkey = 'dol_antispam_value'; + $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) === strtolower(GETPOST('code', 'restricthtml')))); + if (!$ok) { $error++; - $errors = ($company->error ? array($company->error) : $company->errors); - array_push($object->errors, $errors); + array_push($object->errors, $langs->trans("ErrorBadValueForCode")); + $action = ''; + } + } + + if (!$error) { + $object->db->begin(); + + $object->track_id = generate_random_id(16); + + $object->subject = GETPOST("subject", "restricthtml"); + $object->message = GETPOST("message", "restricthtml"); + $object->origin_email = $origin_email; + + $object->type_code = GETPOST("type_code", 'aZ09'); + $object->category_code = GETPOST("category_code", 'aZ09'); + $object->severity_code = GETPOST("severity_code", 'aZ09'); + + if (!is_object($user)) { + $user = new User($db); + } + + // create third-party with contact + $usertoassign = 0; + if ($with_contact && !($with_contact->id > 0)) { + $company = new Societe($db); + if (!empty($company_name)) { + $company->name = $company_name; + } else { + $company->particulier = 1; + $company->name = dolGetFirstLastname($contact_firstname, $contact_lastname); + } + $result = $company->create($user); + if ($result < 0) { + $error++; + $errors = ($company->error ? array($company->error) : $company->errors); + array_push($object->errors, $errors); + $action = 'create_ticket'; + } + + // create contact and link to this new company + if (!$error) { + $with_contact->email = $origin_email; + $with_contact->lastname = $contact_lastname; + $with_contact->firstname = $contact_firstname; + $with_contact->socid = $company->id; + $with_contact->phone_pro = $contact_phone; + $result = $with_contact->create($user); + if ($result < 0) { + $error++; + $errors = ($with_contact->error ? array($with_contact->error) : $with_contact->errors); + array_push($object->errors, $errors); + $action = 'create_ticket'; + } else { + $contacts = array($with_contact); + } + } + } + + if (is_array($searched_companies)) { + $object->fk_soc = $searched_companies[0]->id; + } + + if (is_array($contacts) and count($contacts) > 0) { + $object->fk_soc = $contacts[0]->socid; + $usertoassign = $contacts[0]->id; + } + + $ret = $extrafields->setOptionalsFromPost(null, $object); + + // Generate new ref + $object->ref = $object->getDefaultRef(); + + $object->context['disableticketemail'] = 1; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later + + $id = $object->create($user); + if ($id <= 0) { + $error++; + $errors = ($object->error ? array($object->error) : $object->errors); + array_push($object->errors, $object->error ? array($object->error) : $object->errors); $action = 'create_ticket'; } - // create contact and link to this new company + if (!$error && $id > 0) { + if ($usertoassign > 0) { + $object->add_contact($usertoassign, "SUPPORTCLI", 'external', 0); + } + } + if (!$error) { - $with_contact->email = $origin_email; - $with_contact->lastname = $contact_lastname; - $with_contact->firstname = $contact_firstname; - $with_contact->socid = $company->id; - $with_contact->phone_pro = $contact_phone; - $result = $with_contact->create($user); - if ($result < 0) { - $error++; - $errors = ($with_contact->error ? array($with_contact->error) : $with_contact->errors); - array_push($object->errors, $errors); - $action = 'create_ticket'; - } else { - $contacts = array($with_contact); - } + $object->db->commit(); + $action = "infos_success"; + } else { + $object->db->rollback(); + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'create_ticket'; } - } - if (is_array($searched_companies)) { - $object->fk_soc = $searched_companies[0]->id; - } + if (!$error) { + $res = $object->fetch($id); + if ($res) { + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $formmail = new FormMail($db); - if (is_array($contacts) and count($contacts) > 0) { - $object->fk_soc = $contacts[0]->socid; - $usertoassign = $contacts[0]->id; - } + // Init to avoid errors + $filepath = array(); + $filename = array(); + $mimetype = array(); - $ret = $extrafields->setOptionalsFromPost(null, $object); + $attachedfiles = $formmail->get_attached_files(); + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; - // Generate new ref - $object->ref = $object->getDefaultRef(); + // Send email to customer - $object->context['disableticketemail'] = 1; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref, $object->track_id); + $message = ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody')).'

'; + $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket').'
'; - $id = $object->create($user); - if ($id <= 0) { - $error++; - $errors = ($object->error ? array($object->error) : $object->errors); - array_push($object->errors, $object->error ? array($object->error) : $object->errors); - $action = 'create_ticket'; - } + $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; + $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'').'
'; + $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl').'

'; - if (!$error && $id > 0) { - if ($usertoassign > 0) { - $object->add_contact($usertoassign, "SUPPORTCLI", 'external', 0); - } - } + $message .= $infos_new_ticket; + $message .= getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE', $langs->transnoentities('TicketMessageMailSignatureText', $mysoc->name)); - if (!$error) { - $object->db->commit(); - $action = "infos_success"; - } else { - $object->db->rollback(); - setEventMessages($object->error, $object->errors, 'errors'); - $action = 'create_ticket'; - } + $sendto = GETPOST('email', 'alpha'); - if (!$error) { - $res = $object->fetch($id); - if ($res) { - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $formmail = new FormMail($db); - - // Init to avoid errors - $filepath = array(); - $filename = array(); - $mimetype = array(); - - $attachedfiles = $formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Send email to customer - - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref, $object->track_id); - $message = ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody')).'

'; - $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket').'
'; - - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; - $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'').'
'; - $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl').'

'; - - $message .= $infos_new_ticket; - $message .= getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE', $langs->transnoentities('TicketMessageMailSignatureText', $mysoc->name)); - - $sendto = GETPOST('email', 'alpha'); - - $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; - $replyto = $from; - $sendtocc = ''; - $deliveryreceipt = 0; - - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; - $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; - } - include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket'); - if ($mailfile->error || $mailfile->errors) { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } else { - $result = $mailfile->sendfile(); - } - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; - } - - // Send email to TICKET_NOTIFICATION_EMAIL_TO - $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; - if ($sendto) { - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref, $object->track_id); - $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id).'

'; - $message_admin .= '
  • '.$langs->trans('Title').' : '.$object->subject.'
  • '; - $message_admin .= '
  • '.$langs->trans('Type').' : '.$object->type_label.'
  • '; - $message_admin .= '
  • '.$langs->trans('Category').' : '.$object->category_label.'
  • '; - $message_admin .= '
  • '.$langs->trans('Severity').' : '.$object->severity_label.'
  • '; - $message_admin .= '
  • '.$langs->trans('From').' : '.$object->origin_email.'
  • '; - // Extrafields - $extrafields->fetch_name_optionals_label($object->table_element); - if (is_array($object->array_options) && count($object->array_options) > 0) { - foreach ($object->array_options as $key => $value) { - $key = substr($key, 8); // remove "options_" - $message_admin .= '
  • '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' : '.$extrafields->showOutputField($key, $value, '', $object->table_element).'
  • '; - } - } - $message_admin .= '
'; - - $message_admin .= '

'.$langs->trans('Message').' :
'.$object->message.'

'; - $message_admin .= '

'.$langs->trans('SeeThisTicketIntomanagementInterface').'

'; - - $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; + $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; $replyto = $from; + $sendtocc = ''; + $deliveryreceipt = 0; if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; } include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket'); + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket'); if ($mailfile->error || $mailfile->errors) { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); } else { @@ -405,36 +373,77 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; } + + // Send email to TICKET_NOTIFICATION_EMAIL_TO + $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + if ($sendto) { + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref, $object->track_id); + $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id).'

'; + $message_admin .= '
  • '.$langs->trans('Title').' : '.$object->subject.'
  • '; + $message_admin .= '
  • '.$langs->trans('Type').' : '.$object->type_label.'
  • '; + $message_admin .= '
  • '.$langs->trans('Category').' : '.$object->category_label.'
  • '; + $message_admin .= '
  • '.$langs->trans('Severity').' : '.$object->severity_label.'
  • '; + $message_admin .= '
  • '.$langs->trans('From').' : '.$object->origin_email.'
  • '; + // Extrafields + $extrafields->fetch_name_optionals_label($object->table_element); + if (is_array($object->array_options) && count($object->array_options) > 0) { + foreach ($object->array_options as $key => $value) { + $key = substr($key, 8); // remove "options_" + $message_admin .= '
  • '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' : '.$extrafields->showOutputField($key, $value, '', $object->table_element).'
  • '; + } + } + $message_admin .= '
'; + + $message_admin .= '

'.$langs->trans('Message').' :
'.$object->message.'

'; + $message_admin .= '

'.$langs->trans('SeeThisTicketIntomanagementInterface').'

'; + + $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; + $replyto = $from; + + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; + $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; + } + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket'); + if ($mailfile->error || $mailfile->errors) { + setEventMessages($mailfile->error, $mailfile->errors, 'errors'); + } else { + $result = $mailfile->sendfile(); + } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; + } + } } - } - // Copy files into ticket directory - $destdir = $conf->ticket->dir_output.'/'.$object->ref; - if (!dol_is_dir($destdir)) { - dol_mkdir($destdir); - } - foreach ($filename as $i => $val) { - dol_move($filepath[$i], $destdir.'/'.$filename[$i], 0, 1); - $formmail->remove_attached_files($i); - } + // Copy files into ticket directory + $destdir = $conf->ticket->dir_output.'/'.$object->ref; + if (!dol_is_dir($destdir)) { + dol_mkdir($destdir); + } + foreach ($filename as $i => $val) { + dol_move($filepath[$i], $destdir.'/'.$filename[$i], 0, 1); + $formmail->remove_attached_files($i); + } - //setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs'); + //setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs'); - // Make a redirect to avoid to have ticket submitted twice if we make back - $messagetoshow = $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '{s1}', '{s2}'); - $messagetoshow = str_replace(array('{s1}', '{s2}'), array(''.$object->track_id.'', ''.$object->ref.''), $messagetoshow); - setEventMessages($messagetoshow, null, 'warnings'); - setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings'); - header("Location: index.php".(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'')); - exit; + // Make a redirect to avoid to have ticket submitted twice if we make back + $messagetoshow = $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '{s1}', '{s2}'); + $messagetoshow = str_replace(array('{s1}', '{s2}'), array(''.$object->track_id.'', ''.$object->ref.''), $messagetoshow); + setEventMessages($messagetoshow, null, 'warnings'); + setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings'); + header("Location: index.php".(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'')); + exit; + } + } else { + setEventMessages($object->error, $object->errors, 'errors'); } - } else { - setEventMessages($object->error, $object->errors, 'errors'); } } - /* * View */ @@ -466,6 +475,7 @@ if ($action != "infos_success") { $formticket->ispublic = 1; $formticket->withfile = 2; $formticket->action = 'create_ticket'; + $formticket->withcancel = 1; $formticket->param = array('returnurl' => $_SERVER['PHP_SELF'].($conf->entity > 1 ? '?entity='.$conf->entity : '')); @@ -478,7 +488,7 @@ if ($action != "infos_success") { print $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentities("Ticket")); print ''; } else { - print '
'.$langs->trans('TicketPublicInfoCreateTicket').'
'; + //print '
'.$langs->trans('TicketPublicInfoCreateTicket').'
'; $formticket->showForm(0, 'edit', 1, $with_contact); } } diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index f7abe746832..ece2b41aff7 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -22,9 +22,6 @@ * \brief Public page to add and manage ticket */ -if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); -} if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); } @@ -82,11 +79,12 @@ $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); print '
'; -print '

'.($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")).'

'; +print '

'.(!empty($conf->global->TICKET_PUBLIC_TEXT_HOME) ? $conf->global->TICKET_PUBLIC_TEXT_HOME : ''.$langs->trans("TicketPublicDesc")).'

'; +print '
'; print ''; print '
'; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index a15beff2856..2259945033b 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -21,10 +21,6 @@ * \brief Public file to list tickets */ -if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); -} -// Do not check anti CSRF attack test if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); } @@ -60,8 +56,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->loadLangs(array("companies", "other", "ticket")); // Get parameters -$track_id = GETPOST('track_id', 'alpha'); $action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); + +$track_id = GETPOST('track_id', 'alpha'); $email = strtolower(GETPOST('email', 'alpha')); if (GETPOST('btn_view_ticket_list')) { @@ -90,6 +88,13 @@ if (empty($conf->ticket->enabled)) { * Actions */ +if ($cancel) { + $backtopage = DOL_URL_ROOT.'/public/ticket/index.php'; + + header("Location: ".$backtopage); + exit; +} + if ($action == "view_ticketlist") { $error = 0; $display_ticket_list = false; @@ -185,9 +190,10 @@ $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); -print '
'; if ($action == "view_ticketlist") { + print '
'; + print '
'; if ($display_ticket_list) { // Filters @@ -708,8 +714,12 @@ if ($action == "view_ticketlist") { } else { print ''; } + + print '
'; } else { - print '

'.$langs->trans("TicketPublicMsgViewLogIn").'

'; + print '
'; + + print '

'.$langs->trans("TicketPublicMsgViewLogIn").'

'; print '
'; print '
'; @@ -728,13 +738,15 @@ if ($action == "view_ticketlist") { print '

'; print ''; + print '   '; + print ''; print "

\n"; print "\n"; print "
\n"; -} -print "
"; + print "
"; +} // End of page htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object); diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 29a850128ed..e78b1e1b9ee 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -22,10 +22,6 @@ * \brief Public file to show one ticket */ -if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); -} -// Do not check anti CSRF attack test if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); } @@ -61,9 +57,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->loadLangs(array("companies", "other", "ticket")); // Get parameters -$track_id = GETPOST('track_id', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); $action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); + +$track_id = GETPOST('track_id', 'alpha'); $email = GETPOST('email', 'email'); if (GETPOST('btn_view_ticket')) { @@ -85,6 +82,8 @@ if (empty($conf->ticket->enabled)) { */ if ($cancel) { + $backtopage = DOL_URL_ROOT.'/public/ticket/index.php'; + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -406,6 +405,8 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a print '

'; print ''; + print '   '; + print ''; print "

\n"; print "\n"; diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index ada1ae23a12..395ab219056 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -18,10 +18,6 @@ /* font-size: ; */ } -.fa-15x { - font-size: 1.5em; -} - div.mainmenu.menu { background-image: none; } diff --git a/htdocs/theme/md/main_menu_fa_icons.inc.php b/htdocs/theme/md/main_menu_fa_icons.inc.php index 0e0b144d187..f2f5e247e78 100644 --- a/htdocs/theme/md/main_menu_fa_icons.inc.php +++ b/htdocs/theme/md/main_menu_fa_icons.inc.php @@ -18,10 +18,6 @@ color: var(--colortextbackhmenu); } -.fa-15x { - font-size: 1.5em; -} - div.mainmenu.menu { background-image: none; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index fa38df82147..1fc536d10bd 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -316,7 +316,9 @@ class User extends CommonObject * @var stdClass To store personal config */ public $conf; - public $default_values; // To store default values for user + + public $default_values; // To store default values for user. Loaded by loadDefaultValues(). + public $lastsearch_values_tmp; // To store current search criterias for user public $lastsearch_values; // To store last saved search criterias for user From e3f9b15db3faa03c1a64f524af2436dfd4b84570 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Sep 2022 11:18:46 +0200 Subject: [PATCH 06/10] FIX list of email in public ticket interface --- htdocs/public/ticket/list.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 2259945033b..e309e68c029 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -354,25 +354,25 @@ if ($action == "view_ticketlist") { } } $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as uc ON uc.rowid=t.fk_user_create"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON ua.rowid=t.fk_user_assign"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact as ec ON ec.element_id=t.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON ec.fk_c_type_contact=tc.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople sp ON ec.fk_socpeople=sp.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code = t.type_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code = t.category_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code = t.severity_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as uc ON uc.rowid = t.fk_user_create"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON ua.rowid = t.fk_user_assign"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact as ec ON ec.element_id = t.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON ec.fk_c_type_contact = tc.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople sp ON ec.fk_socpeople = sp.rowid"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."ticket_extrafields as ef on (t.rowid = ef.fk_object)"; } $sql .= " WHERE t.entity IN (".getEntity('ticket').")"; $sql .= " AND ((tc.source = 'external'"; $sql .= " AND tc.element='".$db->escape($object->element)."'"; - $sql .= " AND tc.active=1)"; - $sql .= " OR (sp.email='".$db->escape($_SESSION['email_customer'])."'"; - $sql .= " OR s.email='".$db->escape($_SESSION['email_customer'])."'"; - $sql .= " OR t.origin_email='".$db->escape($_SESSION['email_customer'])."'))"; + $sql .= " AND tc.active=1"; + $sql .= " AND sp.email='".$db->escape($_SESSION['email_customer'])."')"; // email found into an external contact + $sql .= " OR s.email='".$db->escape($_SESSION['email_customer'])."'"; // or email of the linked company + $sql .= " OR t.origin_email='".$db->escape($_SESSION['email_customer'])."')"; // or email of the requester // Manage filter if (!empty($filter)) { foreach ($filter as $key => $value) { @@ -710,6 +710,8 @@ if ($action == "view_ticketlist") { } '; } + } else { + dol_print_error($db); } } else { print ''; From 6c45b13178555adf8f5b32c5e3ae4b8e81569572 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Sep 2022 12:32:27 +0200 Subject: [PATCH 07/10] NEW Add filter "Product subject to lot/Serial" in stock per lot/serial --- htdocs/core/class/html.formticket.class.php | 2 +- htdocs/core/menus/init_menu_auguria.sql | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/langs/en_US/stocks.lang | 1 + htdocs/product/reassort.php | 12 ++++++------ htdocs/product/reassortlot.php | 20 ++++++++++++++------ 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 83071830ae7..df24aa38327 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -190,7 +190,7 @@ class FormTicket // TITLE $email = GETPOSTISSET('email') ? GETPOST('email', 'alphanohtml') : ''; if ($this->withemail) { - print ''; + print ''; print ''; print ''; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 0580c6c8cc0..8a9186e49c0 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -119,7 +119,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/card.php?mainmenu=products&leftmenu=product&action=create&type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/list.php?mainmenu=products&leftmenu=product&type=0', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?mainmenu=products&type=0', 'MenuStocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassortlot.php?mainmenu=products&type=0', 'StocksByLotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassortlot.php?mainmenu=products&type=0&search_subjecttolotserial=1', 'StocksByLotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2806__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stock/productlot_list.php?mainmenu=products', 'LotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->variants->enabled', __HANDLER__, 'left', 2807__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/variants/list.php?mainmenu=products', 'VariantAttributes', 1, 'products', '$user->rights->produit->lire', '', 2, 7, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 4707657d3e3..49aca30d3e0 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1998,7 +1998,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme } if (isModEnabled('productbatch')) { $langs->load("stocks"); - $newmenu->add("/product/reassortlot.php?type=0", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + $newmenu->add("/product/reassortlot.php?type=0&search_subjecttolotserial=1", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); } if (isModEnabled('variants')) { diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 47483bb8f3b..492cdd48864 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -24,6 +24,7 @@ StockAtDateInFuture=Date in the future StocksByLotSerial=Stocks by lot/serial LotSerial=Lots/Serials LotSerialList=List of lot/serials +SubjectToLotSerialOnly=Products subject to lot/serial only Movements=Movements ErrorWarehouseRefRequired=Warehouse reference name is required ListOfWarehouses=List of warehouses diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 10e70545af6..bec2b772d58 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -41,7 +41,7 @@ $snom = GETPOST("snom", 'alpha'); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $type = GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT; $search_barcode = GETPOST("search_barcode", 'alpha'); -$toolowstock = GETPOST('toolowstock'); +$search_toolowstock = GETPOST('search_toolowstock'); $tosell = GETPOST("tosell"); $tobuy = GETPOST("tobuy"); $fourn_id = GETPOST("fourn_id", 'int'); @@ -116,7 +116,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $tobuy = ""; $search_sale = ""; $search_categ = ""; - $toolowstock = ''; + $search_toolowstock = ''; $fourn_id = ''; $sbarcode = ''; $search_stock_physique = ''; @@ -210,7 +210,7 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql_having = ''; -if ($toolowstock) { +if ($search_toolowstock) { $sql_having .= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte"; } if ($search_stock_physique != '') { @@ -296,8 +296,8 @@ if ($resql) { if ($search_categ > 0) { $param .= "&search_categ=".urlencode($search_categ); } - if ($toolowstock) { - $param .= "&toolowstock=".urlencode($toolowstock); + if ($search_toolowstock) { + $param .= "&search_toolowstock=".urlencode($search_toolowstock); } if ($sbarcode) { $param .= "&sbarcode=".urlencode($sbarcode); @@ -336,7 +336,7 @@ if ($resql) { } $moreforfilter .= '
'; - $moreforfilter .= $langs->trans("StockTooLow").' '; + $moreforfilter .= ''; $moreforfilter .= '
'; if (!empty($moreforfilter)) { diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index a39dc246772..87a49e1bce1 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -52,7 +52,8 @@ $type = GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT; $search_barcode = GETPOST("search_barcode", 'alpha'); $search_warehouse = GETPOST('search_warehouse', 'alpha'); $search_batch = GETPOST('search_batch', 'alpha'); -$toolowstock = GETPOST('toolowstock'); +$search_toolowstock = GETPOST('search_toolowstock'); +$search_subjecttolotserial = GETPOST('search_subjecttolotserial'); $tosell = GETPOST("tosell"); $tobuy = GETPOST("tobuy"); $fourn_id = GETPOST("fourn_id", 'int'); @@ -173,7 +174,8 @@ if (empty($reshook)) { $tobuy = ""; $search_sale = ""; $search_categ = ""; - $toolowstock = ''; + $search_toolowstock = ''; + $search_subjecttolotserial = ''; $search_batch = ''; $search_warehouse = ''; $fourn_id = ''; @@ -252,6 +254,9 @@ if (dol_strlen($type)) { $sql .= " AND p.fk_product_type <> '1'"; } } +if ($search_subjecttolotserial) { + $sql .= " AND p.tobatch > 0"; +} if ($sref) { $sql .= natural_search("p.ref", $sref); } @@ -318,7 +323,7 @@ $sql .= " e.ref, e.lieu, e.fk_parent,"; $sql .= " pb.batch, pb.eatby, pb.sellby,"; $sql .= " pl.rowid, pl.eatby, pl.sellby"; $sql_having = ''; -if ($toolowstock) { +if ($search_toolowstock) { $sql_having .= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet } if ($search_stock_physique != '') { @@ -437,8 +442,11 @@ if ($sbarcode) { if ($search_warehouse) { $param .= "&search_warehouse=".urlencode($search_warehouse); } -if ($toolowstock) { - $param .= "&toolowstock=".urlencode($toolowstock); +if ($search_toolowstock) { + $param .= "&search_toolowstock=".urlencode($search_toolowstock); +} +if ($search_subjecttolotserial) { + $param .= "&search_subjecttolotserial=".urlencode($search_subjecttolotserial); } if ($search_sale) { $param .= "&search_sale=".urlencode($search_sale); @@ -487,7 +495,7 @@ if (!empty($conf->categorie->enabled)) { $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1); $moreforfilter .= ''; } -//$moreforfilter.=$langs->trans("StockTooLow").' '; +$moreforfilter.=''; if (!empty($moreforfilter)) { print '
'; From e5e59e1de04038d05d7b6cf1fb9915cbad007d4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Sep 2022 13:11:11 +0200 Subject: [PATCH 08/10] Look and feel --- htdocs/adherents/admin/website.php | 45 ++++++++++++++---------------- htdocs/admin/ticket_public.php | 29 +++++++++++++++---- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 3c7775dc6b8..41ea43c4cec 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -167,10 +167,30 @@ if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) { print $enabledisablehtml; print ''; +print '

'; -print '
'; if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { + print '
'; + //print $langs->trans('FollowingLinksArePublic').'
'; + print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').'
'; + if (isModEnabled('multicompany')) { + $entity_qr = '?entity='.$conf->entity; + } else { + $entity_qr = ''; + } + + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $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 + + print ''; + print ajax_autoselect('publicurlmember'); + print '
'; print '
'; @@ -248,29 +268,6 @@ print dol_get_fiche_end(); print ''; - -if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { - print '
'; - //print $langs->trans('FollowingLinksArePublic').'
'; - print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').'
'; - if (isModEnabled('multicompany')) { - $entity_qr = '?entity='.$conf->entity; - } else { - $entity_qr = ''; - } - - // Define $urlwithroot - $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $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 - - print ''; - print ajax_autoselect('publicurlmember'); -} - // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index a0df28a8f84..3e4c088620d 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -235,12 +235,10 @@ $head = ticketAdminPrepareHead(); print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket"); -print ''.$langs->trans("TicketPublicAccess").' : '.dol_buildpath('/public/ticket/index.php?entity='.$conf->entity, 2).''; - -print dol_get_fiche_end(); - $param = ''; +print '
'; + $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' '; if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { // Button off, click to enable @@ -256,9 +254,30 @@ if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print $enabledisablehtml; print ''; -print '

'; +print dol_get_fiche_end(); + + if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { + print '
'; + + + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $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 + + print ''.$langs->trans("TicketPublicAccess").' :
'; + print ''; + print ajax_autoselect('publicurlmember'); + + + print '

'; + + print '
'; print ''; print ''; From 065c96e1bedfed765b42811ebb22ac8c1491c130 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Sep 2022 13:57:15 +0200 Subject: [PATCH 09/10] Trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 24343c773d5..ced1f23ed39 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2223,7 +2223,7 @@ NoExternalModuleWithUpdate=No updates found for external modules SwaggerDescriptionFile=Swagger API description file (for use with redoc for example) YouEnableDeprecatedWSAPIsUseRESTAPIsInstead=You enabled deprecated WS API. You should use REST API instead. RandomlySelectedIfSeveral=Randomly selected if several pictures are available -SalesRepresentativeInfo=For Proposals, Orders, Invoces. +SalesRepresentativeInfo=For Proposals, Orders, Invoices. DatabasePasswordObfuscated=Database password is obfuscated in conf file DatabasePasswordNotObfuscated=Database password is NOT obfuscated in conf file APIsAreNotEnabled=APIs modules are not enabled From a865388b9c471be122a813c838c000a53b0c2543 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Sep 2022 15:38:31 +0200 Subject: [PATCH 10/10] FIX fatal error abs on non int --- htdocs/public/recruitment/view.php | 6 ++++++ htdocs/user/class/user.class.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index b92dcbf9824..2eaa51ac2fe 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -217,7 +217,13 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb if ($urllogo) { print '
'; print '
'; + if (!empty($mysoc->url)) { + print ''; + } print ''; + if (!empty($mysoc->url)) { + print ''; + } print '
'; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f8558e11a24..5a7a3bc030d 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2827,7 +2827,7 @@ class User extends CommonObject $result .= (($option == 'nolink') ? '' : $linkstart); if ($withpictoimg) { $paddafterimage = ''; - if (abs($withpictoimg) == 1) { + if (abs((int) $withpictoimg) == 1) { $paddafterimage = 'style="margin-'.($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right').': 3px;"'; } // Only picto