From c79d617a50a6bb3573078211e6b05ada9d463c16 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Jul 2020 03:50:27 +0200 Subject: [PATCH] Add public page of job position offers --- htdocs/langs/en_US/main.lang | 4 +- htdocs/langs/en_US/recruitment.lang | 14 +- htdocs/public/onlinesign/newonlinesign.php | 6 +- htdocs/public/recruitment/view.php | 329 +++++++++--------- htdocs/recruitment/admin/public_interface.php | 194 +++++++++++ htdocs/recruitment/admin/setup.php | 6 +- htdocs/recruitment/lib/recruitment.lib.php | 8 +- ...recruitment_recruitmentjobposition.lib.php | 37 ++ .../recruitmentjobposition_card.php | 16 + 9 files changed, 426 insertions(+), 188 deletions(-) create mode 100644 htdocs/recruitment/admin/public_interface.php diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2f673ea445b..d52478dbbdb 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1041,4 +1041,6 @@ SwitchInEditModeToAddTranslation=Switch in edit mode to add translations for thi NotUsedForThisCustomer=Not used for this customer AmountMustBePositive=Amount must be positive ByStatus=By status -InformationMessage=Information \ No newline at end of file +InformationMessage=Information +ASAP=As Soon As Possible + \ No newline at end of file diff --git a/htdocs/langs/en_US/recruitment.lang b/htdocs/langs/en_US/recruitment.lang index de5f96fe082..4e20a42fbb5 100644 --- a/htdocs/langs/en_US/recruitment.lang +++ b/htdocs/langs/en_US/recruitment.lang @@ -27,8 +27,10 @@ ModuleRecruitmentDesc = Manage and follow recruitment campaigns for new job posi # RecruitmentSetup = Recruitment setup Settings = Settings -RecruitmentSetupPage = Recruitment setup page +RecruitmentSetupPage = Enter here the setup of main options for the recruitment module RecruitmentArea=Recruitement area +PublicInterfaceRecruitmentDesc=Public interface is public URLs to show and answer to open jobs. There is one different link for each open job. +EnablePublicRecruitmentPages=Enable public recruitment pages # # About page @@ -43,8 +45,10 @@ DateExpected=Expected date FutureManager=Future manager ResponsibleOfRecruitement=Responsible of recruitment IfJobIsLocatedAtAPartner=If job is located at a partner place -PositionToBeFilled=Position to be filled -PositionsToBeFilled=Positions to be filled -ListOfPositionsToBeFilled=List of positions to be filled -NewPositionToBeFilled=New position to be filled +PositionToBeFilled=Job offer to be filled +PositionsToBeFilled=Job offers to be filled +ListOfPositionsToBeFilled=List of job offers to be filled +NewPositionToBeFilled=New job offers to be filled +JobOfferToBeFilled=Job offer to be filled +ThisIsInformationOnJobPosition=Information of the job position to be filled \ No newline at end of file diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 2031c11a3ad..d29d441c611 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -45,6 +45,7 @@ $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", // Security check // No check on module enabled. Done later according to $validpaymentmethod +// Get parameters $action = GETPOST('action', 'aZ09'); // Input are: @@ -70,9 +71,6 @@ if (!$action) } - - - // 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 @@ -132,7 +130,7 @@ $conf->dol_hide_leftmenu = 1; $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); -// Check link validity +// Check link validity for param 'source' if (!empty($source) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', ''))) { $langs->load("errors"); diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index b4d13747d3f..253409c8b53 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -1,6 +1,5 @@ - * Copyright (C) 2018 Frédéric France +/* Copyright (C) 2020 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,18 +21,9 @@ * \brief Public file to show on job */ -if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); -} -// Do not check anti CSRF attack test -if (!defined('NOREQUIREMENU')) { - define('NOREQUIREMENU', '1'); -} -// If there is no need to load and show top and left menu -if (!defined("NOLOGIN")) { - define("NOLOGIN", '1'); -} -// If this page is public (can be called outside logged session) +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 require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php'; @@ -45,9 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; $langs->loadLangs(array("companies", "other", "recruitment")); // Get parameters -$cancel = GETPOST('cancel', 'alpha'); $action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); $email = GETPOST('email', 'alpha'); +$backtopage = ''; $ref = GETPOST('ref', 'alpha'); @@ -60,6 +51,22 @@ if (isset($_SESSION['email_customer'])) { $object = new RecruitmentJobPosition($db); +if (!$action) +{ + if (!$ref) + { + print $langs->trans('ErrorBadParameters')." - ref missing"; + exit; + } else { + $object->fetch('', $ref); + } +} + +// 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. For Paypal payment, we can use internal URL like localhost. + /* * Actions @@ -141,7 +148,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; * View */ -$form = new Form($db); +$head = ''; +if (!empty($conf->global->MAIN_RECRUITMENT_CSS_URL)) $head = ''."\n"; + +$conf->dol_hide_topmenu = 1; +$conf->dol_hide_leftmenu = 1; if (!$conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE) { print '
'.$langs->trans('PublicInterfaceForbidden').'
'; @@ -150,170 +161,148 @@ if (!$conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE) { } $arrayofjs = array(); -$arrayofcss = array('/ticket/css/styles.css.php'); +$arrayofcss = array(); -llxHeaderRecruitment($langs->trans("Jobs"), "", 0, 0, $arrayofjs, $arrayofcss); +$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; +llxHeader($head, $langs->trans("PositionToBeFilled"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); -print '
'; -if ($action == "view" || $action == "presend" || $action == "close" || $action == "confirm_public_close") { - if ($display_ticket) - { - // Confirmation close - if ($action == 'close') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?track_id=".$track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1); - } +print ''."\n"; +print '
'."\n"; +print '
'."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''; +print "\n"; +print ''."\n"; - print '
'; +print ''."\n"; - print '
'; - - // Ref - print ''; - - // Tracking ID - print ''; - - // Subject - print ''; - - // Statut - print ''; - - // Type - print ''; - - // Category - print ''; - - // Severity - print ''; - - // Creation date - print ''; - - // Author - print ''; - - // Read date - if (!empty($object->dao->date_read)) { - print ''; - } - - // Close date - if (!empty($object->dao->date_close)) { - print ''; - } - - // User assigned - print ''; - - // Progression - print ''; - - print '
'.$langs->trans("Ref").''; - print $object->dao->ref; - print '
'.$langs->trans("TicketTrackId").''; - print $object->dao->track_id; - print '
'.$langs->trans("Subject").''; - print $object->dao->subject; - print '
'.$langs->trans("Status").''; - print $object->dao->getLibStatut(2); - print '
'.$langs->trans("Type").''; - print $object->dao->type_label; - print '
'.$langs->trans("Category").''; - print $object->dao->category_label; - print '
'.$langs->trans("Severity").''; - print $object->dao->severity_label; - print '
'.$langs->trans("DateCreation").''; - print dol_print_date($object->dao->datec, 'dayhour'); - print '
'.$langs->trans("Author").''; - if ($object->dao->fk_user_create > 0) { - $langs->load("users"); - $fuser = new User($db); - $fuser->fetch($object->dao->fk_user_create); - print $fuser->getFullName($langs); - } else { - print dol_escape_htmltag($object->dao->origin_email); - } - - print '
'.$langs->trans("TicketReadOn").''; - print dol_print_date($object->dao->date_read, 'dayhour'); - print '
'.$langs->trans("TicketCloseOn").''; - print dol_print_date($object->dao->date_close, 'dayhour'); - print '
'.$langs->trans("AssignedTo").''; - if ($object->dao->fk_user_assign > 0) { - $fuser = new User($db); - $fuser->fetch($object->dao->fk_user_assign); - print $fuser->getFullName($langs, 1); - } - print '
'.$langs->trans("Progression").''; - print ($object->dao->progress > 0 ? $object->dao->progress : '0').'%'; - print '
'; - - print '
'; - - print '
'; - - if ($action == 'presend') { - print load_fiche_titre($langs->trans('AddMessage'), '', 'messages@ticket'); - - /*$formticket = new FormTicket($db); - - $formticket->action = "add_message"; - $formticket->track_id = $object->dao->track_id; - $formticket->id = $object->dao->id; - - $formticket->param = array('track_id' => $object->dao->track_id, 'fk_user_create' => '-1', 'returnurl' => DOL_URL_ROOT.'/public/ticket/view.php'); - - $formticket->withfile = 2; - $formticket->withcancel = 1; - - $formticket->showMessageForm('100%'); - */ - print 'TODO Show message form'; - } - - if ($action != 'presend') { - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print "
\n"; - - print '
'; - - // List ticket - print ''; - - if ($object->dao->fk_statut < Ticket::STATUS_CLOSED) { - // New message - print ''; - - // Close ticket - if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) { - print ''; - } - } - - print '
'; - } - - // Message list - print load_fiche_titre($langs->trans('JobMessagesList'), '', 'object_conversation'); - //$object->viewTicketMessages(false, true, $object->dao); - } else { - print ''; +// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) +$width = 0; +// Define logo and logosmall +$logosmall = $mysoc->logo_small; +$logo = $mysoc->logo; +$paramlogo = 'ONLINE_RECRUITMENT_LOGO_'.$suffix; +if (!empty($conf->global->$paramlogo)) $logosmall = $conf->global->$paramlogo; +elseif (!empty($conf->global->ONLINE_RECRUITMENT_LOGO)) $logosmall = $conf->global->ONLINE_RECRUITMENT_LOGO_; +//print ''."\n"; +// Define urllogo +$urllogo = ''; +$urllogofull = ''; +if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) +{ + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $width = 150; +} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) +{ + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $width = 150; +} +// Output html code for logo +if ($urllogo) +{ + print '
'; + print '
'; + print ''; + print '
'; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; } + print '
'; } -print "
"; +// Output introduction text +$text = ''; +if (!empty($conf->global->RECRUITMENT_NEWFORM_TEXT)) +{ + $langs->load("recruitment"); + if (preg_match('/^\((.*)\)$/', $conf->global->RECRUITMENT_NEWFORM_TEXT, $reg)) $text .= $langs->trans($reg[1])."
\n"; + else $text .= $conf->global->RECRUITMENT_NEWFORM_TEXT."
\n"; + $text = '
'.$text.'
'."\n"; +} +if (empty($text)) +{ + $text .= '
'.$langs->trans("JobOfferToBeFilled", $mysoc->name).''; + $text .= '   -   '.dol_print_date($object->date_creation); + $text .= ''."\n"; + $text .= '

'.$object->label.'


'."\n"; +} +print $text; -// End of page -htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object); +// Output payment summary form +print ''; +print ''; +print ''."\n"; + +$error = 0; +$var = false; + +// Label + +print ''."\n"; + +// Date + +print ''."\n"; + + + + +if (!$found && !$mesg) $mesg = $langs->trans("ErrorBadParameters"); + +if ($mesg) print ''."\n"; + +print '
'.$langs->trans("ThisIsInformationOnJobPosition").' :
'.$langs->trans("JobLabel"); +print ''; +print ''.$object->label.''; +print '
'.$langs->trans("DateExpected"); +print ''; +if ($object->date_planned > $now) { + print dol_print_date('day', $object->date_planned); +} else { + print $langs->trans("ASAP"); +} +print ''; + +// Description + +$text = $object->description; +print '
'.$langs->trans("Description"); +print ''.$text; +print ''; +print '

'.$mesg.'
'."\n"; +print "\n"; + +if ($action != 'dosign') +{ + if ($found && !$error) // We are in a management option and no error + { + } else { + dol_print_error_email('ERRORNEWONLINESIGN'); + } +} else { + // Print +} + +print ''."\n"; + +print ''."\n"; +print ''."\n"; +print '
'."\n"; +print '
'; + + +htmlPrintOnlinePaymentFooter($mysoc, $langs); llxFooter('', 'public'); $db->close(); + diff --git a/htdocs/recruitment/admin/public_interface.php b/htdocs/recruitment/admin/public_interface.php new file mode 100644 index 00000000000..f8985507081 --- /dev/null +++ b/htdocs/recruitment/admin/public_interface.php @@ -0,0 +1,194 @@ + + * Copyright (C) 2006-2020 Laurent Destailleur + * Copyright (C) 2006-2012 Regis Houssin + * Copyright (C) 2011 Juanjo Menent + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/recruitment/admin/public_interface.php + * \ingroup recruitment + * \brief File of main public page for open job position + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array("admin", "recruitment")); + +$action = GETPOST('action', 'alpha'); + +if (!$user->admin) accessforbidden(); + +$error = 0; + + +/* + * Actions + */ + +if ($action == 'setRECRUITMENT_ENABLE_PUBLIC_INTERFACE') { + if (GETPOST('value')) dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity); + else dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity); +} + +if ($action == 'update') { + $public = GETPOST('RECRUITMENT_ENABLE_PUBLIC_INTERFACE'); + + $res = dolibarr_set_const($db, "RECRUITMENT_ENABLE_PUBLIC_INTERFACE", $public, 'chaine', 0, '', $conf->entity); + + if (!$res > 0) $error++; + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + + +/* + * View + */ + +$form = new Form($db); + +//$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; +$help_url = ''; +llxHeader('', $langs->trans("RecruitmentSetup"), $help_url); + + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("RecruitmentSetup"), $linkback, 'title_setup'); + +$head = recruitmentAdminPrepareHead(); + + + +print '
'; +print ''; +print ''; + +dol_fiche_head($head, 'publicurl', '', -1, ''); + + +print ''.$langs->trans("PublicInterfaceRecruitmentDesc").'

'; + + +$enabledisablehtml = $langs->trans("EnablePublicRecruitmentPages").' '; +if (empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) { + // Button off, click to enable + $enabledisablehtml .= ''; + $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); + $enabledisablehtml .= ''; +} else { + // Button on, click to disable + $enabledisablehtml .= ''; + $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); + $enabledisablehtml .= ''; +} +print $enabledisablehtml; +print ''; + + +print '
'; + +/* +if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) { + print '
'; + + print ''; + + print ''; + print ''; + print ''; + print "\n"; + + // Force Type + $adht = new AdherentType($db); + print '\n"; + + // Amount + print '\n"; + + // Can edit + print '\n"; + + // Jump to an online payment page + print '\n"; + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print $langs->trans("ForceMemberType"); + print ''; + $listofval = array(); + $listofval += $adht->liste_array(); + $forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1; + print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0); + print "
'; + print $langs->trans("DefaultAmount"); + print ''; + print ''; + print "
'; + print $langs->trans("CanEditAmount"); + print ''; + print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1); + print "
'; + print $langs->trans("MEMBER_NEWFORM_PAYONLINE"); + print ''; + $listofval = array(); + $listofval['-1'] = $langs->trans('No'); + $listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')'; + if (!empty($conf->paybox->enabled)) $listofval['paybox'] = 'Paybox'; + if (!empty($conf->paypal->enabled)) $listofval['paypal'] = 'PayPal'; + if (!empty($conf->stripe->enabled)) $listofval['stripe'] = 'Stripe'; + print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0); + print "
'; + + print '
'; + print ''; + print '
'; +} +*/ + +dol_fiche_end(); + +print '
'; + +/* +if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) { + print '
'; + //print $langs->trans('FollowingLinksArePublic').'
'; + print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').':
'; + if ($conf->multicompany->enabled) { + $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 ''.$urlwithroot.'/public/members/new.php'.$entity_qr.''; +} +*/ + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index 7de9764c1aa..562531262f9 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.php @@ -40,7 +40,7 @@ global $langs, $user; // Libraries require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; -require_once '../lib/recruitment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php'; require_once DOL_DOCUMENT_ROOT."/recruitment/class/recruitmentjobposition.class.php"; // Translations @@ -194,10 +194,10 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); // Configuration header $head = recruitmentAdminPrepareHead(); -dol_fiche_head($head, 'settings', '', -1, "object_recruitment"); +dol_fiche_head($head, 'settings', '', -1, ''); // Setup page goes here -echo ''.$langs->trans("RecruitmentSetupPage").'

'; +//echo ''.$langs->trans("RecruitmentSetupPage").'

'; if ($action == 'edit') diff --git a/htdocs/recruitment/lib/recruitment.lib.php b/htdocs/recruitment/lib/recruitment.lib.php index ad03a4b30d1..44f356e8061 100644 --- a/htdocs/recruitment/lib/recruitment.lib.php +++ b/htdocs/recruitment/lib/recruitment.lib.php @@ -40,12 +40,10 @@ function recruitmentAdminPrepareHead() $head[$h][2] = 'settings'; $h++; - /* - $head[$h][0] = dol_buildpath("/recruitment/admin/about.php", 1); - $head[$h][1] = $langs->trans("About"); - $head[$h][2] = 'about'; + $head[$h][0] = dol_buildpath("/recruitment/admin/public_interface.php", 1); + $head[$h][1] = $langs->trans("PublicUrl"); + $head[$h][2] = 'publicurl'; $h++; - */ // Show more tabs from modules // Entries must be declared in modules descriptor with line diff --git a/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php b/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php index 052f4274526..f34bf5cbf59 100644 --- a/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php +++ b/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php @@ -88,3 +88,40 @@ function recruitmentjobpositionPrepareHead($object) return $head; } + + +/** + * Return string with full Url + * + * @param int $mode 0=True url, 1=Url formated with colors + * @param string $ref Ref of object + * @param string $localorexternal 0=Url for browser, 1=Url for external access + * @return string Url string + */ +function getPublicJobPositionUrl($mode, $ref = '', $localorexternal = 0) +{ + global $conf, $dolibarr_main_url_root; + + $ref = str_replace(' ', '', $ref); + $out = ''; + + // 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 + + $urltouse = DOL_MAIN_URL_ROOT; + if ($localorexternal) $urltouse = $urlwithroot; + + $out = $urltouse.'/public/recruitment/view.php?ref='.($mode ? '' : '').$ref.($mode ? '' : ''); + /*if (!empty($conf->global->RECRUITMENT_SECURITY_TOKEN)) + { + if (empty($conf->global->RECRUITMENT_SECURITY_TOKEN)) $out .= '&securekey='.$conf->global->RECRUITMENT_SECURITY_TOKEN; + else $out .= '&securekey='.dol_hash($conf->global->RECRUITMENT_SECURITY_TOKEN, 2); + }*/ + + // For multicompany + if (!empty($out) && !empty($conf->multicompany->enabled)) $out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities + + return $out; +} diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index 349624729e0..4c01e74a338 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -572,6 +572,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $linktoelem = $form->showLinkToObjectBlock($object, null, array('recruitmentjobposition')); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + // Show link to public job page + if ($object->status != RecruitmentJobPosition::STATUS_DRAFT) + { + print '
'."\n"; + // Load translation files required by the page + $langs->loadLangs(array('recruitment')); + + $out = img_picto('', 'globe').' '.$langs->trans("PublicUrl").'
'; + + $url = getPublicJobPositionUrl(0, $object->ref); + $out .= ''; + $out .= ''.img_picto('', 'globe').''; + $out .= ajax_autoselect("recruitmentjobpositionurl", 0); + + print $out; + } print '
';