Merge remote-tracking branch 'upstream/develop' into 17p6

This commit is contained in:
Alexandre SPANGARO 2022-10-01 07:52:48 +02:00
commit 51aa7e8027
37 changed files with 385 additions and 256 deletions

View File

@ -108,7 +108,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
$dirforimage = $conf->mycompany->dir_output.'/logos/';
$arrayofimages = array('logo', 'logo_squarred');
//var_dump($_FILES); exit;
foreach ($arrayofimages as $varforimage) {
if ($_FILES[$varforimage]["name"] && !preg_match('/(\.jpeg|\.jpg|\.png)$/i', $_FILES[$varforimage]["name"])) { // Logo can be used on a lot of different places. Only jpg and png can be supported.
$langs->load("errors");
@ -116,67 +116,71 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
break;
}
if ($_FILES[$varforimage]["tmp_name"]) {
// Remove to check file size to large
/*if ($_FILES[$varforimage]["tmp_name"]) {*/
$reg = array();
if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) {
$original_file = $reg[1];
if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) {
$original_file = $reg[1];
$isimage = image_format_supported($original_file);
if ($isimage >= 0) {
dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
if (!is_dir($dirforimage)) {
dol_mkdir($dirforimage);
$isimage = image_format_supported($original_file);
if ($isimage >= 0) {
dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
if (!is_dir($dirforimage)) {
dol_mkdir($dirforimage);
}
$result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
if ($result > 0) {
$constant = "MAIN_INFO_SOCIETE_LOGO";
if ($varforimage == 'logo_squarred') {
$constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
}
$result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
if ($result > 0) {
$constant = "MAIN_INFO_SOCIETE_LOGO";
if ($varforimage == 'logo_squarred') {
$constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
}
dolibarr_set_const($db, $constant, $original_file, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, $constant, $original_file, 'chaine', 0, '', $conf->entity);
// Create thumbs of logo (Note that PDF use original file and not thumbs)
if ($isimage > 0) {
// Create thumbs
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retrieve value with get...
// Create thumbs of logo (Note that PDF use original file and not thumbs)
if ($isimage > 0) {
// Create thumbs
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retrieve value with get...
// Create small thumb, Used on logon for example
$imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) {
$imgThumbSmall = $reg[1]; // Save only basename
dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
} else {
dol_syslog($imgThumbSmall);
}
// Create mini thumb, Used on menu or for setup page for example
$imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) {
$imgThumbMini = $reg[1]; // Save only basename
dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
} else {
dol_syslog($imgThumbMini);
}
// Create small thumb, Used on logon for example
$imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) {
$imgThumbSmall = $reg[1]; // Save only basename
dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
} else {
dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING);
dol_syslog($imgThumbSmall);
}
// Create mini thumb, Used on menu or for setup page for example
$imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) {
$imgThumbMini = $reg[1]; // Save only basename
dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
} else {
dol_syslog($imgThumbMini);
}
} elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
$error++;
$langs->load("errors");
$tmparray = explode(':', $result);
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
} else {
$error++;
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING);
}
} else {
} elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
$tmparray = explode(':', $result);
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
} elseif (preg_match('/^ErrorFileSizeTooLarge/', $result)) {
$error++;
setEventMessages($langs->trans("ErrorFileSizeTooLarge"), null, 'errors');
} else {
$error++;
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
}
} else {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
}
}
/*}*/
}
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
@ -475,11 +479,15 @@ if (isModEnabled('barcode')) {
print '</td></tr>';
}
// Logo
print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans("Logo"), 'png, jpg').'</label></td><td>';
print '<div class="centpercent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
// Tooltip for both Logo and LogSquarred
$tooltiplogo = $langs->trans('AvailableFormats').' : png, jpg, jpeg';
$maxfilesizearray = getMaxFileSizeArray();
$maxmin = $maxfilesizearray['maxmin'];
$tooltiplogo .= ($maxmin > 0) ? '<br>'.$langs->trans('MaxSize').' : '.$maxmin.' '.$langs->trans('Kb') : '';
// Logo
print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans("Logo"), $tooltiplogo).'</label></td><td>';
print '<div class="centpercent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
if ($maxmin > 0) {
print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
}
@ -518,7 +526,7 @@ print '</div>';
print '</td></tr>';
// Logo (squarred)
print '<tr class="oddeven"><td><label for="logo_squarred">'.$form->textwithpicto($langs->trans("LogoSquarred"), 'png, jpg').'</label></td><td>';
print '<tr class="oddeven"><td><label for="logo_squarred">'.$form->textwithpicto($langs->trans("LogoSquarred"), $tooltiplogo).'</label></td><td>';
print '<div class="centpercent nobordernopadding valignmiddle"><div class="inline-block marginrightonly">';
$maxfilesizearray = getMaxFileSizeArray();
$maxmin = $maxfilesizearray['maxmin'];

View File

@ -265,7 +265,7 @@ print '<br>';
*/
if (function_exists("ldap_connect")) {
if (!empty($conf->global->LDAP_SERVER_HOST)) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test">'.$langs->trans("LDAPTestConnect").'</a><br><br>';
print '<a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?action=test">'.$langs->trans("LDAPTestConnect").'</a><br><br>';
}
if ($action == 'test') {

View File

@ -82,6 +82,27 @@ if ($action == 'updateMask') {
dolibarr_del_const($db, 'TICKET_ADDON_PDF', $conf->entity);
}
}
} elseif (preg_match('/set_(.*)/', $action, $reg)) {
$code = $reg[1];
$value = GETPOSTISSET($code) ? GETPOST($code, 'int') : 1;
if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
} else {
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
} elseif (preg_match('/del_(.*)/', $action, $reg)) {
$code = $reg[1];
$res = dolibarr_del_const($db, $code, $conf->entity);
if (!($res > 0)) {
$error++;
}
} elseif ($action == 'setdoc') {
// Set default model
if (dolibarr_set_const($db, "TICKET_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
@ -101,16 +122,25 @@ if ($action == 'updateMask') {
dolibarr_set_const($db, "TICKET_ADDON", $value, 'chaine', 0, '', $conf->entity);
} elseif ($action == 'setvarworkflow') {
$param_auto_read = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_read, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
// For compatibility when javascript is not enabled
if (empty($conf->use_javascript_ajax)) {
$param_auto_read = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_read, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_auto_notify_close = GETPOST('TICKET_NOTIFY_AT_CLOSING', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFY_AT_CLOSING', $param_auto_notify_close, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
@ -138,12 +168,6 @@ if ($action == 'updateMask') {
if (!($res > 0)) {
$error++;
}
$param_auto_notify_close = GETPOST('TICKET_NOTIFY_AT_CLOSING', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFY_AT_CLOSING', $param_auto_notify_close, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
} elseif ($action == 'setvar') {
include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
@ -192,7 +216,8 @@ if ($action == 'updateMask') {
$error++;
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
// For compatibility when javascript is not enabled
if ($conf->global->MAIN_FEATURES_LEVEL >= 2 && empty($conf->use_javascript_ajax)) {
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
@ -639,28 +664,30 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
print '</tr>';
}
// Texte d'introduction
$mail_intro = $conf->global->TICKET_MESSAGE_MAIL_INTRO ? $conf->global->TICKET_MESSAGE_MAIL_INTRO : $langs->trans('TicketMessageMailIntroText');
print '<tr class="oddeven"><td>'.$langs->trans("TicketMessageMailIntroLabelAdmin");
// Message header
//$mail_intro = getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'));
$mail_intro = getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO', '');
print '<tr class="oddeven"><td>'.$langs->trans("TicketMessageMailIntro");
print '</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAIL'), ROWS_2, 70);
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 90, 'dolibarr_mailings', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAIL'), ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help');
print '</td></tr>';
// Texte de signature
$mail_signature = $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->trans('TicketMessageMailSignatureText');
print '<tr class="oddeven"><td>'.$langs->trans("TicketMessageMailSignatureLabelAdmin").'</label>';
// Message footer
//$mail_signature = getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailFooterText'));
$mail_signature = getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE');
print '<tr class="oddeven"><td>'.$langs->trans("TicketMessageMailFooter").'</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 120, 'dolibarr_mailings', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAIL'), ROWS_2, 70);
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 90, 'dolibarr_mailings', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAIL'), ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help');
print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailFooterHelpAdmin"), 1, 'help');
print '</td></tr>';
print '</table>';

View File

@ -152,7 +152,8 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') {
$errors[] = $db->lasterror();
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
// For compatibility when javascript is not enabled
if ($conf->global->MAIN_FEATURES_LEVEL >= 2 && empty($conf->use_javascript_ajax)) {
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
@ -163,32 +164,30 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') {
} elseif (preg_match('/set_(.*)/', $action, $reg)) {
$code = $reg[1];
$value = GETPOSTISSET($code) ? GETPOST($code, 'int') : 1;
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
if (!$error) {
if ($code == 'TICKET_EMAIL_MUST_EXISTS') {
$res = dolibarr_del_const($db, 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
} elseif ($code == 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
$res = dolibarr_del_const($db, 'TICKET_EMAIL_MUST_EXISTS', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
// enable captcha by default
// TODO Add a visible option in this setup page for this
$res = dolibarr_set_const($db, 'MAIN_SECURITY_ENABLECAPTCHA_TICKET', 1, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
} else {
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
if ($code == 'TICKET_EMAIL_MUST_EXISTS') {
$res = dolibarr_del_const($db, 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
} elseif ($code == 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
$res = dolibarr_del_const($db, 'TICKET_EMAIL_MUST_EXISTS', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
}
}
}
@ -292,13 +291,37 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print '</td>';
print '</tr>';
// Enable Captcha code
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TicketUseCaptchaCode").'</td>';
print '<td class="left">';
if (function_exists("imagecreatefrompng")) {
if (!empty($conf->use_javascript_ajax)) {
print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA_TICKET');
} else {
if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA_TICKET)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
}
}
} else {
$desc = $form->textwithpicto('', $langs->transnoentities("EnableGDLibraryDesc"), 1, 'warning');
print $desc;
}
print '</td>';
print '<td class="center width75">';
print $form->textwithpicto('', $langs->trans("TicketUseCaptchaCodeHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Check if email exists
print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
print '<td class="left">';
if (empty(getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS'))) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
}
print '</td>';
print '<td class="center width75">';
@ -310,9 +333,9 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
print '<td class="left">';
if (empty(getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'))) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
}
print '</td>';
print '<td class="center width75">';

View File

@ -50,7 +50,7 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) {
$sortfield = 'position';
$sortfield = 'b.position';
}
if (!$sortorder) {
$sortorder = 'ASC';

View File

@ -1307,7 +1307,8 @@ if ($resql) {
print '<td>';
if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
print $form->selectyesno('validate_invoices', 0, 1, 1);
print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
$langs->load("errors");
print ' ('.$langs->trans("WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").')';
} else {
print $form->selectyesno('validate_invoices', 0, 1);
}

View File

@ -648,7 +648,7 @@ if (!empty($date_start) && !empty($date_stop)) {
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.newToken().'&projectid='.$projectid.'&output=file&file='.urlencode($filename).$param.'"';
print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.currentToken().'&projectid='.$projectid.'&output=file&file='.urlencode($filename).$param.'"';
if (empty($TData)) {
print " disabled";
}

View File

@ -2209,9 +2209,12 @@ class ExtraFields
$dateparamname_end = $keysuffix . 'options_' . $key . $keyprefix . '_end';
if (GETPOSTISSET($dateparamname_start . 'year') && GETPOSTISSET($dateparamname_end . 'year')) {
// values provided as a date pair (start date + end date), each date being broken down as year, month, day, etc.
$dateparamname_end_hour = GETPOST($dateparamname_end . 'hour', 'int') !='-1' ? GETPOST($dateparamname_end . 'hour', 'int') : '23';
$dateparamname_end_min = GETPOST($dateparamname_end . 'min', 'int') !='-1' ? GETPOST($dateparamname_end . 'min', 'int') : '59';
$dateparamname_end_sec = GETPOST($dateparamname_end . 'sec', 'int') !='-1' ? GETPOST($dateparamname_end . 'sec', 'int') : '59';
$value_key = array(
'start' => dol_mktime(GETPOST($dateparamname_start . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int'), 'tzuserrel'),
'end' => dol_mktime(GETPOST($dateparamname_end . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'tzuserrel')
'end' => dol_mktime($dateparamname_end_hour, $dateparamname_end_min, $dateparamname_end_sec, GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'tzuserrel')
);
} elseif (GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) {
// Clean parameters

View File

@ -179,7 +179,7 @@ class FormFile
if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
if ($perm) {
$menudolibarrsetupmax = $langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("Security");
$menudolibarrsetupmax = $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Security");
$langs->load('other');
$out .= ' ';
$out .= info_admin($langs->trans("ThisLimitIsDefinedInSetupAt", $menudolibarrsetupmax, $max, $maxphptoshowparam, $maxphptoshow), 1);

View File

@ -428,7 +428,7 @@ class FormTicket
$doleditor->Create();
print '</td></tr>';
if ($public && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
if ($public && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA_TICKET)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td>';
print '<span class="span-icon-security inline-block">';
@ -1071,7 +1071,7 @@ class FormTicket
console.log("We select a new value into combo child_id="+child_id);
// Hide all selected box that are child of the one modified
// Hide all selected box that are child of the one modified
$(".groupticketchild").each(function(){
if ($(this).attr("child_id") > child_id) {
console.log("hide child_id="+$(this).attr("child_id"));
@ -1080,7 +1080,7 @@ class FormTicket
}
})
// Now we enable the next combo
// Now we enable the next combo
$("#'.$htmlname.'_child_'.$levelid.'").val("");
if (!arraynotparents.includes($(this).val()) && $("#'.$htmlname.'_child_'.$levelid.' option").length > 1) {
console.log($("#'.$htmlname.'_child_'.$levelid.' option").length);
@ -1230,7 +1230,11 @@ class FormTicket
dol_delete_dir_recursive($upload_dir);
}
$keytoavoidconflict = empty($this->track_id) ? '' : '-'.$this->track_id; // track_id instead of trackid
if (!empty($this->trackid)) { // TODO Always use trackid (ticXXX) instead of track_id (abcd123)
$keytoavoidconflict = '-'.$this->trackid;
} else {
$keytoavoidconflict = empty($this->track_id) ? '' : '-'.$this->track_id;
}
unset($_SESSION["listofpaths".$keytoavoidconflict]);
unset($_SESSION["listofnames".$keytoavoidconflict]);
unset($_SESSION["listofmimes".$keytoavoidconflict]);
@ -1278,7 +1282,7 @@ class FormTicket
if ($this->param['models'] != 'none') {
$model_id = 0;
if (array_key_exists('models_id', $this->param)) {
$model_id = $this->param["models_id"];
$model_id = (int) $this->param["models_id"];
}
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id); // If $model_id is empty, preselect the first one
@ -1288,8 +1292,13 @@ class FormTicket
$listofpaths = array();
$listofnames = array();
$listofmimes = array();
$keytoavoidconflict = empty($this->track_id) ? '' : '-'.$this->track_id; // track_id instead of trackid
if (!empty($this->trackid)) {
$keytoavoidconflict = '-'.$this->trackid;
} else {
$keytoavoidconflict = empty($this->track_id) ? '' : '-'.$this->track_id; // track_id instead of trackid
}
//var_dump($keytoavoidconflict);
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) {
foreach ($this->param['fileinit'] as $file) {
@ -1297,7 +1306,8 @@ class FormTicket
}
}
}
//var_dump($_SESSION);
//var_dump($_SESSION["listofpaths".$keytoavoidconflict]);
if (!empty($_SESSION["listofpaths".$keytoavoidconflict])) {
$listofpaths = explode(';', $_SESSION["listofpaths".$keytoavoidconflict]);
}
@ -1368,6 +1378,7 @@ class FormTicket
print '<input type="hidden" name="action" value="'.$this->action.'">';
print '<input type="hidden" name="actionbis" value="add_message">';
print '<input type="hidden" name="backtopage" value="'.$this->backtopage.'">';
print '<input type="hidden" name="trackid" value="'.$this->trackid.'">';
foreach ($this->param as $key => $value) {
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
}
@ -1395,6 +1406,16 @@ class FormTicket
$ticketstat = new Ticket($this->db);
$res = $ticketstat->fetch('', '', $this->track_id);
// Private message (not visible by customer/external user)
if (!$user->socid) {
print '<tr><td></td><td>';
$checkbox_selected = (GETPOST('private_message', 'alpha') == "1" ? ' checked' : '');
print '<input type="checkbox" name="private_message" value="1" id="private_message" '.$checkbox_selected.'/> ';
print '<label for="private_message">'.$langs->trans('MarkMessageAsPrivate').'</label>';
print ' '.$form->textwithpicto('', $langs->trans("TicketMessagePrivateHelp"), 1, 'help');
print '</td></tr>';
}
print '<tr><td></td><td>';
$checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':''));
print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';
@ -1413,16 +1434,6 @@ class FormTicket
print '</div></td>';
}
// Private message (not visible by customer/external user)
if (!$user->socid) {
print '<tr><td></td><td>';
$checkbox_selected = (GETPOST('private_message', 'alpha') == "1" ? ' checked' : '');
print '<input type="checkbox" name="private_message" value="1" id="private_message" '.$checkbox_selected.'/> ';
print '<label for="private_message">'.$langs->trans('MarkMessageAsPrivate').'</label>';
print ' '.$form->textwithpicto('', $langs->trans("TicketMessagePrivateHelp"), 1, 'help');
print '</td></tr>';
}
// Subject
print '<tr class="email_line"><td>'.$langs->trans('Subject').'</td>';
print '<td><input type="text" class="text minwidth500" name="subject" value="['.$conf->global->MAIN_INFO_SOCIETE_NOM.' - '.$langs->trans("Ticket").' '.$ticketstat->ref.'] '.$langs->trans('TicketNewMessage').'" />';
@ -1478,7 +1489,8 @@ class FormTicket
// Intro
// External users can't send message email
if ($user->rights->ticket->write && !$user->socid) {
/*
if ($user->rights->ticket->write && !$user->socid && !empty($conf->global->TICKET_MESSAGE_MAIL_INTRO)) {
$mail_intro = GETPOST('mail_intro') ? GETPOST('mail_intro') : $conf->global->TICKET_MESSAGE_MAIL_INTRO;
print '<tr class="email_line"><td><label for="mail_intro">';
print $form->textwithpicto($langs->trans("TicketMessageMailIntro"), $langs->trans("TicketMessageMailIntroHelp"), 1, 'help');
@ -1492,6 +1504,44 @@ class FormTicket
$doleditor->Create();
print '</td></tr>';
}
*/
// Attached files
if (!empty($this->withfile)) {
$out = '<tr>';
$out .= '<td width="180">'.$langs->trans("MailFile").'</td>';
$out .= '<td>';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
$out .= ' });';
$out .= '})';
$out .= '</script>'."\n";
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$out .= '<div id="attachfile_'.$key.'">';
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
if (!$this->withfilereadonly) {
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile reposition" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
}
$out .= '<br></div>';
}
} else {
//$out .= $langs->trans("NoAttachedFiles").'<br>';
}
if ($this->withfile == 2) { // Can add other files
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
$out .= ' ';
$out .= '<input type="submit" class="button smallpaddingimp reposition" id="'.$addfileaction.'" name="'.$addfileaction.'" value="'.$langs->trans("MailingAddFile").'" />';
}
$out .= "</td></tr>\n";
print $out;
}
// MESSAGE
@ -1516,11 +1566,24 @@ class FormTicket
$defaultmessage = preg_replace("/^\n+/", "", $defaultmessage);
}
print '<tr><td class="tdtop"><label for="message"><span class="fieldrequired">'.$langs->trans("Message").'</span>';
print '<tr><td colspan="2"><label for="message"><span class="fieldrequired">'.$langs->trans("Message").'</span>';
if ($user->rights->ticket->write && !$user->socid) {
print $form->textwithpicto('', $langs->trans("TicketMessageHelp"), 1, 'help');
$texttooltip = $langs->trans("TicketMessageHelp");
if (getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO') || getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE')) {
$texttooltip .= '<br><br>'.$langs->trans("ForEmailMessageWillBeCompletedWith").'...';
}
if (getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO')) {
$texttooltip .= '<br><u>'.$langs->trans("TicketMessageMailIntro").'</u><br>'.getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO');
}
if (getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE')) {
$texttooltip .= '<br><br><u>'.$langs->trans("TicketMessageMailFooter").'</u><br>'.getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE');
}
print $form->textwithpicto('', $texttooltip, 1, 'help');
}
print '</label></td><td>';
print '</label></td></tr>';
print '<tr><td colspan="2">';
//$toolbarname = 'dolibarr_details';
$toolbarname = 'dolibarr_notes';
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@ -1528,54 +1591,19 @@ class FormTicket
$doleditor->Create();
print '</td></tr>';
// Signature
// Footer
// External users can't send message email
if ($user->rights->ticket->write && !$user->socid) {
/*if ($user->rights->ticket->write && !$user->socid && !empty($conf->global->TICKET_MESSAGE_MAIL_SIGNATURE)) {
$mail_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
print '<tr class="email_line"><td><label for="mail_intro">'.$langs->trans("TicketMessageMailSignature").'</label>';
print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelp"), 1, 'help');
print '<tr class="email_line"><td><label for="mail_intro">'.$langs->trans("TicketMessageMailFooter").'</label>';
print $form->textwithpicto('', $langs->trans("TicketMessageMailFooterHelp"), 1, 'help');
print '</td><td>';
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('mail_signature', $mail_signature, '100%', 150, 'dolibarr_details', '', false, $uselocalbrowser, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_2, 70);
$doleditor = new DolEditor('mail_signature', $mail_signature, '100%', 90, 'dolibarr_details', '', false, $uselocalbrowser, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_2, 70);
$doleditor->Create();
print '</td></tr>';
}
// Attached files
if (!empty($this->withfile)) {
$out = '<tr>';
$out .= '<td width="180">'.$langs->trans("MailFile").'</td>';
$out .= '<td>';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
$out .= ' });';
$out .= '})';
$out .= '</script>'."\n";
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$out .= '<div id="attachfile_'.$key.'">';
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
if (!$this->withfilereadonly) {
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile reposition" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
}
$out .= '<br></div>';
}
} else {
$out .= $langs->trans("NoAttachedFiles").'<br>';
}
if ($this->withfile == 2) { // Can add other files
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
$out .= ' ';
$out .= '<input type="submit" class="button smallpaddingimp reposition" id="'.$addfileaction.'" name="'.$addfileaction.'" value="'.$langs->trans("MailingAddFile").'" />';
}
$out .= "</td></tr>\n";
print $out;
}
*/
print '</table>';

View File

@ -1060,7 +1060,7 @@ class Ldap
//print_r($info);
for ($i = 0; $i < $info["count"]; $i++) {
$recordid = $this->convToOutputCharset($info[$i][$useridentifier][0], $this->ldapcharset);
$recordid = $this->convToOutputCharset($info[$i][strtolower($useridentifier)][0], $this->ldapcharset);
if ($recordid) {
//print "Found record with key $useridentifier=".$recordid."<br>\n";
$fulllist[$recordid][$useridentifier] = $recordid;

View File

@ -1737,7 +1737,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$out .= '<td class="liste_titre"></td>';
$out .= '<td class="liste_titre"></td>';
$out .= '<td class="liste_titre">';
$out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, (empty($conf->global->AGENDA_USE_MULTISELECT_TYPE) ? 0 : 1), 1, 'minwidth200');
$out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, (empty($conf->global->AGENDA_USE_MULTISELECT_TYPE) ? 0 : 1), 1, 'minwidth100 maxwidth150');
$out .= '</td>';
$out .= '<td class="liste_titre maxwidth100onsmartphone"><input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="'.$filters['search_agenda_label'].'"></td>';
$out .= '<td class="liste_titre center">';
@ -1957,6 +1957,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$out .= "</tr>\n";
$i++;
}
if (empty($histo)) {
$colspan = 9;
$out .= '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$out .= "</table>\n";
$out .= "</div>\n";

View File

@ -10660,7 +10660,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
}
$class = 'btnTitle';
if (in_array($iconClass, array('fa fa-plus-circle', 'fa fa-plus-circle size15x', 'fa fa-comment-dots'))) {
if (in_array($iconClass, array('fa fa-plus-circle', 'fa fa-plus-circle size15x', 'fa fa-comment-dots', 'fa fa-paper-plane'))) {
$class .= ' btnTitlePlus';
}
$useclassfortooltip = 1;

View File

@ -86,7 +86,7 @@ function ticket_prepare_head($object)
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/ticket/card.php?action=view&track_id='.$object->track_id;
$head[$h][0] = DOL_URL_ROOT.'/ticket/card.php?track_id='.$object->track_id;
$head[$h][1] = $langs->trans("Ticket");
$head[$h][2] = 'tabTicket';
$h++;
@ -664,6 +664,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$actualCycleDate = false;
// Loop on each event to show it
foreach ($histo as $key => $value) {
$actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo
@ -702,14 +703,9 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out .= $actionstatic->getNomUrl(1, -1, 'valignmiddle').' ';
}
//if ($user->rights->agenda->allactions->read || $actionstatic->authorid == $user->id)
//{
// $out.='<a href="'.$url.'" class="timeline-btn" title="'.$langs->trans('Show').'" ><i class="fa fa-calendar" ></i>'.$langs->trans('Show').'</a>';
//}
if (!empty($user->rights->agenda->allactions->create) ||
(($actionstatic->authorid == $user->id || $actionstatic->userownerid == $user->id) && !empty($user->rights->agenda->myactions->create))) {
$out .= '<a class="timeline-btn" href="'.DOL_MAIN_URL_ROOT.'/comm/action/card.php?action=edit&token='.newToken().'&id='.$actionstatic->id.'"><i class="fa fa-pencil" title="'.$langs->trans("Modify").'" ></i></a>';
$out .= '<a class="timeline-btn" href="'.DOL_MAIN_URL_ROOT.'/comm/action/card.php?action=edit&token='.newToken().'&id='.$actionstatic->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'"><i class="fa fa-pencil" title="'.$langs->trans("Modify").'" ></i></a>';
}
$out .= '</span>';
@ -880,7 +876,12 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$i++;
}
$out .= "</ul>\n";
if (empty($histo)) {
$out .= '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
}
}
if ($noprint) {

View File

@ -464,7 +464,7 @@ class modSociete extends DolibarrModules
'extra' => MAIN_DB_PREFIX.'societe_extrafields'
); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r] = array(//field order as per structure of table llx_societe
's.nom' => "Name*",
's.nom' => "ThirdPartyName*",
's.name_alias' => "AliasNameShort",
's.parent' => "ParentCompany",
's.status' => "Status*",
@ -685,7 +685,7 @@ class modSociete extends DolibarrModules
's.accountancy_code_buy' => '607',
);
$this->import_updatekeys_array[$r] = array(
's.nom' => 'Name',
's.nom' => 'ThirdPartyName',
's.zip' => 'Zip',
's.email' => 'Email',
's.code_client' => 'CustomerCode',
@ -724,7 +724,7 @@ class modSociete extends DolibarrModules
$i++;
}
// Import list of contacts/additional addresses and attributes
// Import list of contacts/addresses of thirparties and attributes
$r++;
$this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = 'ImportDataset_company_2';
@ -767,7 +767,7 @@ class modSociete extends DolibarrModules
}
}
// Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on an old database (during a migration for example)
while ($obj = $this->db->fetch_object($resql)) {
@ -794,7 +794,7 @@ class modSociete extends DolibarrModules
'classfile' => '/core/class/cstate.class.php',
'class' => 'Cstate',
'method' => 'fetch',
'dict' => 'DictionaryStateCode'
'dict' => 'DictionaryCanton'
),
's.fk_pays' => array(
'rule' => 'fetchidfromcodeid',

View File

@ -104,7 +104,7 @@ class modTicket extends DolibarrModules
// List of particular constants to add when module is enabled
// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
// Example:
$default_signature = $langs->trans('TicketMessageMailSignatureText', getDolGlobalString('MAIN_INFO_SOCIETE_NOM'));
$default_footer = $langs->trans('TicketMessageMailFooterText', getDolGlobalString('MAIN_INFO_SOCIETE_NOM'));
$this->const = array(
1 => array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '0', 'Enable ticket public interface', 0),
2 => array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module', 0),
@ -116,8 +116,9 @@ class modTicket extends DolibarrModules
8 => array('TICKET_PRODUCT_CATEGORY', 'chaine', 0, 'The category of product that is being used for ticket accounting', 0),
9 => array('TICKET_NOTIFICATION_EMAIL_FROM', 'chaine', getDolGlobalString('MAIN_MAIL_EMAIL_FROM'), 'Email to use by default as sender for messages sent from Dolibarr', 0),
10 => array('TICKET_MESSAGE_MAIL_INTRO', 'chaine', $langs->trans('TicketMessageMailIntroText'), 'Introduction text of ticket replies sent from Dolibarr', 0),
11 => array('TICKET_MESSAGE_MAIL_SIGNATURE', 'chaine', $default_signature, 'Signature to use by default for messages sent from Dolibarr', 0),
12 => array('MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER', 'chaine', "1", 'Disable the rendering of headers in tickets', 0)
11 => array('TICKET_MESSAGE_MAIL_SIGNATURE', 'chaine', $default_footer, 'Signature to use by default for messages sent from Dolibarr', 0),
12 => array('MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER', 'chaine', "1", 'Disable the rendering of headers in tickets', 0),
13 => array('MAIN_SECURITY_ENABLECAPTCHA_TICKET', 'chaine', getDolGlobalInt('MAIN_SECURITY_ENABLECAPTCHA_TICKET'), 'Enable captcha code by default', 0)
);

View File

@ -145,7 +145,7 @@ class mod_propale_saphir extends ModeleNumRefPropales
// Get entities
$entity = getEntity('proposalnumber', 1, $propal);
$date = $propal->date;
$date = empty($propal->date) ? dol_now() : $propal->date;
$numFinal = get_next_value($db, $mask, 'propal', 'ref', '', $objsoc, $date, 'next', false, null, $entity);

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -445,8 +446,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if (is_array($list) && !empty($list)) {
$number_contracts_found = count($list);
if ($number_contracts_found == 1) {
$contractid = $list[0]->id;
$object->setContract($contractid);
foreach ($list as $linked_contract) {
$object->setContract($linked_contract->id);
}
break;
} elseif ($number_contracts_found > 1) {
foreach ($list as $linked_contract) {

View File

@ -996,7 +996,7 @@ if ($id > 0 || !empty($ref)) {
if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) {
// Price
print '<td class="right">';
print '<input id="pu'.$suffix.'" name="pu'.$suffix.'" type="text" size="8" value="'.price((GETPOST('pu'.$suffix) != '' ? GETPOST('pu'.$suffix) : $up_ht_disc)).'">';
print '<input id="pu'.$suffix.'" name="pu'.$suffix.'" type="text" size="8" value="'.price((GETPOST('pu'.$suffix) != '' ? price2num(GETPOST('pu'.$suffix)) : $up_ht_disc)).'">';
print '</td>';
// Discount

View File

@ -1110,7 +1110,7 @@ if ($step == 4 && $datatoimport) {
$height = '32px'; //needs px for css height attribute below
$i = 0;
$mandatoryfieldshavesource = true;
$more = "";
//var_dump($fieldstarget);
//var_dump($optionsall);
//exit;
@ -1176,10 +1176,10 @@ if ($step == 4 && $datatoimport) {
$filecolumntoshow = num2Alpha($i);
} else {
if ($objimport->array_import_convertvalue[0][$tmpcode]['rule'] == 'fetchidfromref') {
$htmltext .= $langs->trans("DataComeFromIdFoundFromRef", $filecolumn, $langs->transnoentitiesnoconv($entitylang)).'<br>';
$htmltext .= $langs->trans("DataComeFromIdFoundFromRef", $langs->transnoentitiesnoconv($entitylang)).'<br>';
}
if ($objimport->array_import_convertvalue[0][$tmpcode]['rule'] == 'fetchidfromcodeid') {
$htmltext .= $langs->trans("DataComeFromIdFoundFromCodeId", $filecolumn, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$code]['dict'])).'<br>';
$htmltext .= $langs->trans("DataComeFromIdFoundFromCodeId", $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$tmpcode]['dict'])).'<br>';
}
}
// Source required
@ -1191,9 +1191,9 @@ if ($step == 4 && $datatoimport) {
}
} else {
if ($objimport->array_import_convertvalue[0][$tmpcode]['rule'] == 'fetchidfromref') {
$htmltext .= $langs->trans("SourceExample").': <b>'.$langs->transnoentitiesnoconv("ExampleAnyRefFoundIntoElement", $entitylang).($example ? ' ('.$langs->transnoentitiesnoconv("Example").': '.$example.')' : '').'</b><br>';
$htmltext .= $langs->trans("SourceExample").': <b>'.$langs->transnoentitiesnoconv("ExampleAnyRefFoundIntoElement", $entitylang).($example ? ' ('.$langs->transnoentitiesnoconv("Example").': '.str_replace('"', '', $example).')' : '').'</b><br>';
} elseif ($objimport->array_import_convertvalue[0][$tmpcode]['rule'] == 'fetchidfromcodeid') {
$htmltext .= $langs->trans("SourceExample").': <b>'.$langs->trans("ExampleAnyCodeOrIdFoundIntoDictionary", $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$code]['dict'])).($example ? ' ('.$langs->transnoentitiesnoconv("Example").': '.$example.')' : '').'</b><br>';
$htmltext .= $langs->trans("SourceExample").': <b>'.$langs->trans("ExampleAnyCodeOrIdFoundIntoDictionary", $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$tmpcode]['dict'])).($example ? ' ('.$langs->transnoentitiesnoconv("Example").': '.str_replace('"', '', $example).')' : '').'</b><br>';
} elseif ($example) {
$htmltext .= $langs->trans("SourceExample").': <b>'.str_replace('"', '', $example).'</b><br>';
}
@ -1203,7 +1203,8 @@ if ($step == 4 && $datatoimport) {
$htmltext .= $langs->trans("FormatControlRule").': <b>'.str_replace('"', '', $objimport->array_import_regex[0][$tmpcode]).'</b><br>';
}
$htmltext .= $langs->trans("Table")."->".$langs->trans("Field").': &nbsp; <b>'.$tablename."->".preg_replace('/^.*\./', '', $tmpcode)."</b>";
//var_dump($htmltext);
$htmltext .= $langs->trans("InformationOnTargetTables").': &nbsp; <b>'.$tablename."->".preg_replace('/^.*\./', '', $tmpcode)."</b>";
$labelhtml = $label.' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 1);

View File

@ -183,3 +183,4 @@ ALTER TABLE llx_socpeople ADD INDEX idx_socpeople_lastname (lastname);
ALTER TABLE llx_societe ADD INDEX idx_societe_nom(nom);
ALTER TABLE llx_extrafields MODIFY COLUMN fielddefault text;

View File

@ -27,7 +27,7 @@ create table llx_extrafields
type varchar(8),
size varchar(8) DEFAULT NULL,
fieldcomputed text,
fielddefault varchar(255),
fielddefault text,
fieldunique integer DEFAULT 0,
fieldrequired integer DEFAULT 0,
perms varchar(255), -- not used yet

View File

@ -76,7 +76,7 @@ ErrorNoValueForCheckBoxType=Please fill value for checkbox list
ErrorNoValueForRadioType=Please fill value for radio list
ErrorBadFormatValueList=The list value cannot have more than one comma: <u>%s</u>, but need at least one: key,value
ErrorFieldCanNotContainSpecialCharacters=The field <b>%s</b> must not contains special characters.
ErrorFieldCanNotContainSpecialNorUpperCharacters=The field <b>%s</b> must not contain special characters, nor upper case characters and cannot contain only numbers.
ErrorFieldCanNotContainSpecialNorUpperCharacters=The field <b>%s</b> must not contain special characters, nor upper case characters, and must start with an alphabetical character (a-z)
ErrorFieldMustHaveXChar=The field <b>%s</b> must have at least %s characters.
ErrorNoAccountancyModuleLoaded=No accountancy module activated
ErrorExportDuplicateProfil=This profile name already exists for this export set.
@ -331,6 +331,7 @@ WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So y
WarningPaypalPaymentNotCompatibleWithStrict=The value 'Strict' makes the online payment features not working correctly. Use 'Lax' instead.
WarningThemeForcedTo=Warning, theme has been forced to <b>%s</b> by hidden constant MAIN_FORCETHEME
WarningPagesWillBeDeleted=Warning, this will also delete all existing pages/containers of the website. You should export your website before, so you have a backup to re-import it later.
WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal=Automatic validation is disabled when option to decrease stock is set on "Invoice validation".
# Validate
RequireValidValue = Value not valid

View File

@ -95,8 +95,8 @@ NbOfLinesOK=Number of lines with no errors and no warnings: <b>%s</b>.
NbOfLinesImported=Number of lines successfully imported: <b>%s</b>.
DataComeFromNoWhere=Value to insert comes from nowhere in source file.
DataComeFromFileFieldNb=Value to insert comes from column <b>%s</b> in source file.
DataComeFromIdFoundFromRef=Value that comes from column <b>%s</b> of source file will be used to find the id of the parent object to use (so the object <b>%s</b> that has the ref. from source file must exist in the database).
DataComeFromIdFoundFromCodeId=Code that comes from column <b>%s</b> of source file will be used to find the id of the parent object to use (so the code from source file must exist in the dictionary <b>%s</b>). Note that if you know the id, you can also use it in the source file instead of the code. Import should work in both cases.
DataComeFromIdFoundFromRef=The value that comes from the source file will be used to find the id of the parent object to use (so the object <b>%s</b> that has the ref. from source file must exist in the database).
DataComeFromIdFoundFromCodeId=The value of code that comes from source file will be used to find the id of the parent object to use (so the code from source file must exist in the dictionary <b>%s</b>). Note that if you know the id, you can also use it in the source file instead of the code. Import should work in both cases.
DataIsInsertedInto=Data coming from source file will be inserted into the following field:
DataIDSourceIsInsertedInto=The id of the parent object, that was found using the data in the source file, will be inserted into the following field:
DataCodeIDSourceIsInsertedInto=The id of the parent line, that was found from code, will be inserted into the following field:

View File

@ -111,6 +111,7 @@ Language_sv_SE=Swedish
Language_sq_AL=Albanian
Language_sk_SK=Slovakian
Language_sr_RS=Serbian
Language_sw_KE=Swahili
Language_sw_SW=Kiswahili
Language_th_TH=Thai
Language_uk_UA=Ukrainian

View File

@ -149,6 +149,8 @@ TicketsAutoNotifyCloseHelp=When closing a ticket, you will be proposed to send a
TicketWrongContact=Provided contact is not part of current ticket contacts. Email not sent.
TicketChooseProductCategory=Product category for ticket support
TicketChooseProductCategoryHelp=Select the product category of ticket support. This will be used to automatically link a contract to a ticket.
TicketUseCaptchaCode=Use graphical code (CAPTCHA) when creating a ticket
TicketUseCaptchaCodeHelp=Adds CAPTCHA verification when creating a new ticket.
#
# Index & list page
@ -219,18 +221,17 @@ SendMessageByEmail=Send message by email
TicketNewMessage=New message
ErrorMailRecipientIsEmptyForSendTicketMessage=Recipient is empty. No email send
TicketGoIntoContactTab=Please go into "Contacts" tab to select them
TicketMessageMailIntro=Introduction
TicketMessageMailIntro=Message header
TicketMessageMailIntroHelp=This text is added only at the beginning of the email and will not be saved.
TicketMessageMailIntroLabelAdmin=Introduction text to all ticket answers
TicketMessageMailIntroText=Hello,<br>A new answer has been added to a ticket that you follow. Here is the message:<br>
TicketMessageMailIntroHelpAdmin=This text will be inserted before the answer when replying to a ticket from Dolibarr
TicketMessageMailSignature=Signature
TicketMessageMailSignatureHelp=This text is added only at the end of the email and will not be saved.
TicketMessageMailSignatureText=Message sent by <b>%s</b> via Dolibarr
TicketMessageMailSignatureLabelAdmin=Signature of response email
TicketMessageMailSignatureHelpAdmin=This text will be inserted after the response message.
TicketMessageMailFooter=Message footer
TicketMessageMailFooterHelp=This text is added only at the end of the message sent by email and will not be saved.
TicketMessageMailFooterText=Message sent by <b>%s</b> via Dolibarr
TicketMessageMailFooterHelpAdmin=This text will be inserted after the response message.
TicketMessageHelp=Only this text will be saved in the message list on ticket card.
TicketMessageSubstitutionReplacedByGenericValues=Substitutions variables are replaced by generic values.
ForEmailMessageWillBeCompletedWith=For email messages sent to external users, the message will be completed with
TimeElapsedSince=Time elapsed since
TicketTimeToRead=Time elapsed before read
TicketTimeElapsedBeforeSince=Time elapsed before / since

View File

@ -95,8 +95,8 @@ NbOfLinesOK=Nombre de lignes sans erreur ni avertissement : <b>%s</b>.
NbOfLinesImported=Nombre de lignes importées avec succès : <b>%s</b>.
DataComeFromNoWhere=La valeur à insérer n'est issue d'aucun champ du fichier source.
DataComeFromFileFieldNb=La valeur à insérer provient de la colonne <b>%s</b> dans le fichier source.
DataComeFromIdFoundFromRef=La valeur provenant de la colonne <b>%s</b> du fichier source sera utilisée pour trouver l'identifiant de l'objet parent à utiliser (donc l'objet <b>%s</b> qui a la référence du fichier source doit exister dans la base de données).
DataComeFromIdFoundFromCodeId=Le code provenant de la colonne <b>%s</b> du fichier source sera utilisé pour trouver l'id de l'objet parent à utiliser (donc le code du fichier source doit exister dans le dictionnaire <b>%s</b> ). Notez que si vous connaissez l'identifiant, vous pouvez également l'utiliser dans le fichier source à la place du code. L'importation devrait fonctionner dans les deux cas.
DataComeFromIdFoundFromRef=La valeur provenant du fichier source sera utilisée pour trouver l'identifiant de l'objet parent à utiliser (donc l'objet <b>%s</b> qui a la référence du fichier source doit exister dans la base de données).
DataComeFromIdFoundFromCodeId=Le valeur du code provenant du fichier source sera utilisé pour trouver l'id de l'objet parent à utiliser (donc le code du fichier source doit exister dans le dictionnaire <b>%s</b> ). Notez que si vous connaissez l'identifiant, vous pouvez également l'utiliser dans le fichier source à la place du code. L'importation devrait fonctionner dans les deux cas.
DataIsInsertedInto=La donnée issue du fichier source sera insérée dans le champ suivant:
DataIDSourceIsInsertedInto=L'identifiant de l'objet père, retrouvé à partir de la donnée dans le fichier source, sera inséré dans le champ suivant :
DataCodeIDSourceIsInsertedInto=L'identifiant de la ligne père, retrouvé à partir du code, sera inséré dans le champ suivant :

View File

@ -166,7 +166,7 @@ if ($action == 'confirm_refusepropal' && $confirm == 'yes') {
$message = 'refused';
setEventMessages("PropalRefused", null, 'warnings');
if (method_exists($object, 'call_trigger')) {
//customer is not a user !?! so could we use same user as validation ?
// Online customer is not a user, so we use the use that validates the documents
$user = new User($db);
$user->fetch($object->user_valid_id);
$result = $object->call_trigger('PROPAL_CLOSE_REFUSED', $user);

View File

@ -221,7 +221,7 @@ if (empty($reshook)) {
}
// Check Captcha code if is enabled
if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) || !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA_TICKET)) {
if (!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) {

View File

@ -3285,7 +3285,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Subsidiaries list
if (!empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY) && empty($conf->global->SOCIETE_DISABLE_SHOW_SUBSIDIARIES)) {
if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY) && empty($conf->global->SOCIETE_DISABLE_SHOW_SUBSIDIARIES)) {
$result = show_subsidiaries($conf, $langs, $db, $object);
}

View File

@ -196,7 +196,7 @@ class Societe extends CommonObject
'fk_stcomm' =>array('type'=>'integer', 'label'=>'CommercialStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230),
'prefix_comm' =>array('type'=>'varchar(5)', 'label'=>'Prefix comm', 'enabled'=>'$conf->global->SOCIETE_USEPREFIX', 'visible'=>-1, 'position'=>235),
'prefix_comm' =>array('type'=>'varchar(5)', 'label'=>'Prefix comm', 'enabled'=>"getDolGlobalInt('SOCIETE_USEPREFIX')", 'visible'=>-1, 'position'=>235),
'client' =>array('type'=>'tinyint(4)', 'label'=>'Client', 'enabled'=>1, 'visible'=>-1, 'position'=>240),
'fournisseur' =>array('type'=>'tinyint(4)', 'label'=>'Fournisseur', 'enabled'=>1, 'visible'=>-1, 'position'=>245),
'supplier_account' =>array('type'=>'varchar(32)', 'label'=>'Supplier account', 'enabled'=>1, 'visible'=>-1, 'position'=>250),

View File

@ -2517,6 +2517,11 @@ a.tmenudisabled:link, a.tmenudisabled:visited, a.tmenudisabled:hover, a.tmenudis
text-decoration: none;
cursor: not-allowed;
}
span.mainmenuaspan.tmenudisabled {
color: var(--colortextbackhmenu);
opacity: 0.5;
cursor: not-allowed;
}
a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active {
padding: 0px 2px 0px 2px;

View File

@ -2565,6 +2565,11 @@ a.tmenudisabled:link, a.tmenudisabled:visited, a.tmenudisabled:hover, a.tmenudis
text-decoration: none;
cursor: not-allowed;
}
span.mainmenuaspan.tmenudisabled {
color: var(--colortextbackhmenu);
opacity: 0.5;
cursor: not-allowed;
}
a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active {
font-weight: normal;

View File

@ -247,9 +247,14 @@ if (!empty($object->id)) {
$messagingUrl = DOL_URL_ROOT.'/ticket/agenda.php?track_id='.$object->track_id;
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1, array('morecss'=>'btnTitleSelected'));
// Show link to send an email (if read and not closed)
$btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
$url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
$morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus);
// Show link to add a message (if read and not closed)
$btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
$url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init';
$url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
$morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
// Show link to add event (if read and not closed)

View File

@ -371,7 +371,7 @@ if (empty($reshook)) {
if ($object->markAsRead($user) > 0) {
setEventMessages($langs->trans('TicketMarkedAsRead'), null, 'mesgs');
header("Location: card.php?track_id=".$object->track_id."&action=view");
header("Location: card.php?track_id=".$object->track_id);
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
@ -429,7 +429,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans('TicketAssigned'), null, 'mesgs');
header("Location: card.php?track_id=".$object->track_id."&action=view");
header("Location: card.php?track_id=".$object->track_id);
exit;
} else {
array_push($object->errors, $object->error);
@ -437,7 +437,8 @@ if (empty($reshook)) {
$action = 'view';
}
// Action to add an action (not a message)
// Action to add an action (not a message).
// This may also send an email (concatenated with email_intro and email footer if checkbox was selected)
if ($action == 'add_message' && GETPOSTISSET('btn_add_message') && $user->rights->ticket->read) {
$ret = $object->newMessage($user, $action, (GETPOST('private_message', 'alpha') == "on" ? 1 : 0));
@ -449,7 +450,7 @@ if (empty($reshook)) {
$url = 'card.php?track_id='.urlencode($object->track_id);
}
} else {
$url = 'card.php?action=view&track_id='.urlencode($object->track_id);
$url = 'card.php?track_id='.urlencode($object->track_id);
}
header("Location: ".$url);
@ -466,7 +467,7 @@ if (empty($reshook)) {
if ($object->close($user, ($action == "confirm_abandon" ? 1 : 0))) {
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
$url = 'card.php?action=view&track_id='.GETPOST('track_id', 'alpha');
$url = 'card.php?track_id='.GETPOST('track_id', 'alpha');
header("Location: ".$url);
} else {
$action = '';
@ -484,7 +485,7 @@ if (empty($reshook)) {
setEventMessages('<div class="confirm">'.$langs->trans('TicketMarkedAsClosed').'</div>', null, 'mesgs');
$url = 'card.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha');
$url = 'card.php?track_id='.GETPOST('track_id', 'alpha');
header("Location: ".$url);
} else {
setEventMessages($object->error, $object->errors, 'errors');
@ -510,7 +511,7 @@ if (empty($reshook)) {
if ($action == 'set_thirdparty' && $user->rights->ticket->write) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setCustomer(GETPOST('editcustomer', 'int'));
$url = 'card.php?action=view&track_id='.GETPOST('track_id', 'alpha');
$url = 'card.php?track_id='.GETPOST('track_id', 'alpha');
header("Location: ".$url);
exit();
}
@ -520,7 +521,7 @@ if (empty($reshook)) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setProgression(GETPOST('progress', 'alpha'));
$url = 'card.php?action=view&track_id='.$object->track_id;
$url = 'card.php?track_id='.$object->track_id;
header("Location: ".$url);
exit();
}
@ -530,7 +531,7 @@ if (empty($reshook)) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setCategories(GETPOST('categories', 'array'));
$url = 'card.php?action=view&track_id='.$object->track_id;
$url = 'card.php?track_id='.$object->track_id;
header("Location: ".$url);
exit();
}
@ -568,7 +569,7 @@ if (empty($reshook)) {
// Log action in ticket logs table
//$log_action = $langs->trans('TicketLogReopen');
$url = 'card.php?action=view&track_id='.$object->track_id;
$url = 'card.php?track_id='.$object->track_id;
header("Location: ".$url);
exit();
} else {
@ -581,7 +582,7 @@ if (empty($reshook)) {
// Categorisation dans projet
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$object->setProject($projectid);
$url = 'card.php?action=view&track_id='.$object->track_id;
$url = 'card.php?track_id='.$object->track_id;
header("Location: ".$url);
exit();
}
@ -589,12 +590,11 @@ if (empty($reshook)) {
// Categorisation dans contrat
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$object->setContract(GETPOST('contractid', 'int'));
$url = 'card.php?action=view&track_id='.$object->track_id;
$url = 'card.php?track_id='.$object->track_id;
header("Location: ".$url);
exit();
}
} elseif ($action == "set_message" && $user->rights->ticket->manage) {
// altairis: manage cancel button
if (!GETPOST('cancel')) {
$object->fetch('', '', GETPOST('track_id', 'alpha'));
$oldvalue_message = $object->message;
@ -627,7 +627,7 @@ if (empty($reshook)) {
// Log action in ticket logs table
$log_action = $langs->trans('TicketLogStatusChanged', $langs->transnoentities($object->statuts_short[$old_status]), $langs->transnoentities($object->statuts_short[$new_status]));
$url = 'card.php?action=view&track_id='.$object->track_id;
$url = 'card.php?track_id='.$object->track_id;
header("Location: ".$url);
exit();
} else {
@ -689,7 +689,7 @@ if (empty($reshook)) {
$upload_dir = $conf->ticket->dir_output;
$permissiontoadd = $user->rights->ticket->write;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
//var_dump($action);exit;
// Actions to send emails
$triggersendname = 'TICKET_SENTBYMAIL';
$paramname = 'id';
@ -736,6 +736,7 @@ if ($action == 'create' || $action == 'presend') {
$formticket->withfile = 2;
$formticket->withextrafields = 1;
$formticket->param = array('origin' => GETPOST('origin'), 'originid' => GETPOST('originid'));
$formticket->trackid = 'tic'.$object->id;
$formticket->withcancel = 1;
@ -862,9 +863,6 @@ if ($action == 'create' || $action == 'presend') {
print dol_get_fiche_head($head, 'ticket', $langs->trans("Project"), 0, ($projectstat->public ? 'projectpub' : 'project'));
/*
* Projet synthese pour rappel
*/
print '<table class="border centpercent">';
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
@ -1073,7 +1071,7 @@ if ($action == 'create' || $action == 'presend') {
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
print $langs->trans("AssignedTo");
if (isset($object->status) && $object->status < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) {
print '</td><td class="right"><a class="editfielda" href="'.$url_page_current.'?track_id='.$object->track_id.'&action=view&set=assign_ticket">'.img_edit($langs->trans('Modify'), '').'</a>';
print '</td><td class="right"><a class="editfielda" href="'.$url_page_current.'?track_id='.$object->track_id.'&set=assign_ticket">'.img_edit($langs->trans('Modify'), '').'</a>';
}
print '</td></tr></table>';
print '</td><td>';
@ -1156,6 +1154,7 @@ if ($action == 'create' || $action == 'presend') {
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="change_property">';
print '<input type="hidden" name="track_id" value="'.$track_id.'">';
print '<input type="hidden" name="trackid" value="'.$trackid.'">';
print '<div class="underbanner clearboth"></div>';
@ -1219,7 +1218,7 @@ if ($action == 'create' || $action == 'presend') {
} else {
// Button to edit Properties
if (isset($object->status) && $object->status < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) {
print ' <a class="editfielda" href="card.php?track_id='.$object->track_id.'&action=view&set=properties">'.img_edit($langs->trans('Modify')).'</a>';
print ' <a class="editfielda" href="card.php?track_id='.$object->track_id.'&set=properties">'.img_edit($langs->trans('Modify')).'</a>';
}
}
print '</td>';
@ -1412,6 +1411,11 @@ if ($action == 'create' || $action == 'presend') {
}
if (empty($reshook)) {
// Email
if (isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend_addmessage&send_email=1&private_message=0&mode=init&token='.newToken().'&track_id='.$object->track_id, '');
}
// Show link to add a message (if read and not closed)
if (isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
print dolGetButtonAction('', $langs->trans('TicketAddMessage'), 'default', $_SERVER["PHP_SELF"].'?action=presend_addmessage&mode=init&token='.newToken().'&track_id='.$object->track_id, '');
@ -1497,6 +1501,8 @@ if ($action == 'create' || $action == 'presend') {
print '<div>';
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
print load_fiche_titre($langs->trans('TicketAddMessage'), $morehtmlright, 'messages@ticket');
print '<hr>';
@ -1507,6 +1513,7 @@ if ($action == 'create' || $action == 'presend') {
$formticket->track_id = $object->track_id;
$formticket->ref = $object->ref;
$formticket->id = $object->id;
$formticket->trackid = 'tic'.$object->id;
$formticket->withfile = 2;
$formticket->withcancel = 1;

View File

@ -2495,7 +2495,8 @@ class Ticket extends CommonObject
}
/**
* Add new message on a ticket (private/public area). Can also send it be email if GETPOST('send_email', 'int') is set.
* Add new message on a ticket (private/public area).
* Can also send it be email if GETPOST('send_email', 'int') is set. For such email, header and footer is added.
*
* @param User $user User for action
* @param string $action Action string
@ -2556,11 +2557,10 @@ class Ticket extends CommonObject
//var_dump($_SESSION);
//var_dump($listofpaths);exit;
/*
* Public area
*/
if (!empty($public_area)) {
/*
* Message created fromthe Public interface
*
* Send emails to assigned users (public area notification)
*/
if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED)) {
@ -2629,9 +2629,8 @@ class Ticket extends CommonObject
}
} else {
/*
* Private area
*/
/*
* Send from Backoffice / Private area
*
* Send emails to internal users (linked contacts)
*/
if ($send_email > 0) {
@ -2645,7 +2644,7 @@ class Ticket extends CommonObject
$subject = GETPOST('subject', 'alphanohtml') ? GETPOST('subject', 'alphanohtml') : '['.$label_title.'- ticket #'.$object->track_id.'] '.$langs->trans('TicketNewMessage');
$message_intro = $langs->trans('TicketNotificationEmailBody', "#".$object->id);
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE');
$message = $langs->trans('TicketMessageMailIntroText');
$message .= '<br><br>';
@ -2683,7 +2682,7 @@ class Ticket extends CommonObject
// URL ticket
$url_internal_ticket = dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id;
// altairis: make html link on url
// add html link on url
$message .= '<br>'.$langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal').' : <a href="'.$url_internal_ticket.'">'.$object->track_id.'</a><br>';
// Add global email address recipient
@ -2693,7 +2692,7 @@ class Ticket extends CommonObject
}
}
// altairis: dont try to send email if no recipient
// dont try to send email if no recipient
if (!empty($sendto)) {
$this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames);
}
@ -2724,8 +2723,8 @@ class Ticket extends CommonObject
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
$subject = GETPOST('subject') ? GETPOST('subject') : '['.$label_title.'- ticket #'.$object->track_id.'] '.$langs->trans('TicketNewMessage');
$message_intro = GETPOST('mail_intro') ? GETPOST('mail_intro', 'restricthtml') : $conf->global->TICKET_MESSAGE_MAIL_INTRO;
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature', 'restricthtml') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
$message_intro = GETPOST('mail_intro') ? GETPOST('mail_intro', 'restricthtml') : getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO');
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature', 'restricthtml') : getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE');
if (!dol_textishtml($message_intro)) {
$message_intro = dol_nl2br($message_intro);
}

View File

@ -244,10 +244,14 @@ if (!empty($object->id)) {
$messagingUrl = DOL_URL_ROOT.'/ticket/agenda.php?track_id='.$object->track_id;
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1);
// Show link to add a message (if read and not closed)
// Show link to send an email (if read and not closed)
$btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
$url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id);
$url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
$morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus);
// Show link to add a private message (if read and not closed)
$btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
$url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
$morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
// Show link to add event (if read and not closed)