Merge remote-tracking branch 'upstream/develop' into socialnetworks

This commit is contained in:
Frédéric FRANCE 2019-10-05 20:02:16 +02:00
commit 6384e7eb67
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
31 changed files with 430 additions and 345 deletions

View File

@ -160,7 +160,6 @@ print '<ul>';
print '<li><a href="https://facebook.com/dolibarr" target="_blank" rel="external">FaceBook</a></li>';
print '<li><a href="https://twitter.com/dolibarr" target="_blank" rel="external">Twitter</a></li>';
print '<li><a href="https://plus.google.com/+DolibarrOrg" target="_blank" rel="external">Google Plus page</a></li>';
print '</ul>';

View File

@ -42,6 +42,12 @@ $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'ticket';
$error = 0;
/*
* Actions
*/
if ($action == 'updateMask') {
$maskconstticket = GETPOST('maskconstticket', 'alpha');
$maskticket = GETPOST('maskticket', 'alpha');
@ -91,7 +97,7 @@ if ($action == 'updateMask') {
$error++;
}
$mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha');
$mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'restricthtml');
if (!empty($mail_intro)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
} else {
@ -101,7 +107,7 @@ if ($action == 'updateMask') {
$error++;
}
$mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'alpha');
$mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'restricthtml');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity);
} else {
@ -110,16 +116,6 @@ if ($action == 'updateMask') {
if (!$res > 0) {
$error++;
}
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha');
if (!empty($text_help)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
}
if ($action == 'setvarother') {

View File

@ -42,6 +42,12 @@ $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'ticket';
$error = 0;
/*
* Actions
*/
if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE')
{
if (GETPOST('value')) dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
@ -51,95 +57,54 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE')
if ($action == 'setvar') {
include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
$notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha');
if (!empty($notification_email)) {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity);
$topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'nohtml');
if (!empty($topic_interface)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
$error++;
}
// altairis : differentiate notification email FROM and TO
$notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha');
if (!empty($notification_email_to)) {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity);
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'restricthtml');
if (!empty($text_home)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
$error++;
}
$mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'alpha');
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'restricthtml');
if (!empty($text_help)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'restricthtml');
if (!empty($mail_new_ticket)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha');
if (!empty($mail_intro)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
$error++;
}
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
if (!empty($url_interface)) {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha');
if (!empty($topic_interface)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha');
if (!empty($text_home)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha');
if (!empty($text_help)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
$error++;
}
}
@ -162,14 +127,11 @@ if ($action == 'setvarother') {
$error++;
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
}
$param_show_module_logo = GETPOST('TICKET_SHOW_COMPANY_LOGO', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
@ -179,12 +141,6 @@ if ($action == 'setvarother') {
$error++;
}
}
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
}
@ -238,8 +194,7 @@ print '<br><br>';
if (! empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
{
if (!$conf->use_javascript_ajax) {
if (empty($conf->use_javascript_ajax)) {
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="setvarother">';
@ -349,16 +304,6 @@ if (! empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
print "</tr>\n";
}
// Url public interface
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
print '<tr><td>' . $langs->trans("TicketUrlPublicInterfaceLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="' . $conf->global->TICKET_URL_PUBLIC_INTERFACE . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
print '</td></tr>';
// Interface topic
$url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTopicLabelAdmin") . '</label>';
@ -420,6 +365,16 @@ if (! empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
print '</td></tr>';
// Url public interface
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
print '<tr><td>' . $langs->trans("TicketUrlPublicInterfaceLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="' . $conf->global->TICKET_URL_PUBLIC_INTERFACE . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
print '</td></tr>';
print '</table>';
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></div>';

View File

@ -3050,7 +3050,7 @@ if ($action == 'create')
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
if (! $optionsav) $tmp.=' disabled';
if (! $optionsav && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) $tmp.=' disabled';
$tmp.= '> ';
// Show credit note options only if we checked credit note
print '<script type="text/javascript" language="javascript">
@ -4838,12 +4838,12 @@ elseif ($id > 0 || ! empty($ref))
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
if ($object->statut == Facture::STATUS_VALIDATED)
{
// We check that invlice lines are transferred into accountancy
// We check if lines of invoice are not already transfered into accountancy
$ventilExportCompta = $object->getVentilExportCompta();
if ($ventilExportCompta == 0)
{
if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == $object->total_ttc && empty($object->paye)))
if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye)))
{
if (! $objectidnext && $object->is_last_in_cycle())
{
@ -4873,7 +4873,7 @@ elseif ($id > 0 || ! empty($ref))
if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT)
|| ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id))
|| ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id)))
&& ($object->statut == 2 || $object->statut == 3 || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data
&& ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) // A paid invoice (partially or completely)
{
if ($object->close_code != 'replaced' || (! $objectidnext)) // Not replaced by another invoice or replaced but the replacement invoice has been deleted
@ -5055,7 +5055,7 @@ elseif ($id > 0 || ! empty($ref))
}
}
// remove situation from cycle
// Remove situation from cycle
if ($object->statut > Facture::STATUS_DRAFT
&& $object->type == Facture::TYPE_SITUATION
&& $usercancreate

View File

@ -639,7 +639,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<tr class="oddeven">';
print '<td>';
print '<td class="nowraponall">';
print $invoice->getNomUrl(1, '');
if ($objp->socid != $facture->thirdparty->id) print ' - '.$soc->getNomUrl(1).' ';
print "</td>\n";
@ -650,7 +650,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Due date
if ($objp->dlr > 0 )
{
print '<td align="center">';
print '<td class="nowraponall center">';
print dol_print_date($db->jdate($objp->dlr), 'day');
if ($invoice->hasDelay())

View File

@ -3744,7 +3744,7 @@ abstract class CommonObject
if (empty($totalVolume)) $totalVolume=0; // Avoid warning because $totalVolume is ''
//var_dump($line->volume_units);
if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch)
if ($weight_units < 50) // < 50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch)
{
$trueWeightUnit=pow(10, $weightUnit);
$totalWeight += $weight * $qty * $trueWeightUnit;

View File

@ -139,7 +139,7 @@ class DiscountAbsolute
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fsup ON sr.fk_invoice_supplier_source = fsup.rowid";
$sql.= " WHERE sr.entity = " . $conf->entity;
$sql.= " WHERE sr.entity IN (".getEntity('invoice').")";
if ($rowid) $sql.= " AND sr.rowid=".$rowid;
if ($fk_facture_source) $sql.= " AND sr.fk_facture_source=".$fk_facture_source;
if ($fk_invoice_supplier_source) $sql.= " AND sr.fk_invoice_supplier_source=".$fk_invoice_supplier_source;

View File

@ -941,7 +941,7 @@ class DolGraph
$tag=dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-','.'))));
$this->stringtoshow ='<!-- Build using '.$this->_library.' -->'."\n";
if (! empty($this->title)) $this->stringtoshow.='<div class="center" class="dolgraphtitle'.(empty($this->cssprefix)?'':' dolgraphtitle'.$this->cssprefix).'">'.$this->title.'</div>';
if (! empty($this->title)) $this->stringtoshow.='<div class="center dolgraphtitle'.(empty($this->cssprefix)?'':' dolgraphtitle'.$this->cssprefix).'">'.$this->title.'</div>';
if (! empty($this->shownographyet))
{
$this->stringtoshow.='<div style="width:'.$this->width.'px;height:'.$this->height.'px;" class="nographyet"></div>';

View File

@ -1285,14 +1285,14 @@ class FormFile
{
if ($useinecm == 5 || $useinecm == 6)
{
$minifile=getImageFileNameForSize($file['name'], ''); // There is no thumb for ECM module and Media filemanager, so we use true image
$smallfile=getImageFileNameForSize($file['name'], ''); // There is no thumb for ECM module and Media filemanager, so we use true image
}
else
{
$minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original
$smallfile=getImageFileNameForSize($file['name'], '_small'); // For new thumbs using same ext (in lower case however) than original
}
if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension
//print $file['path'].'/'.$minifile.'<br>';
if (! dol_is_file($file['path'].'/'.$smallfile)) $smallfile=getImageFileNameForSize($file['name'], '_small', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension
//print $file['path'].'/'.$smallfile.'<br>';
$urlforhref=getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity));
if (empty($urlforhref)) {
@ -1301,7 +1301,7 @@ class FormFile
} else {
print '<a href="'.$urlforhref['url'].'" class="'.$urlforhref['css'].'" target="'.$urlforhref['target'].'" mime="'.$urlforhref['mime'].'">';
}
print '<img class="photo" height="'.(($useinecm == 4 || $useinecm == 5 || $useinecm == 6)? '12' : $maxheightmini).'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$minifile).'" title="">';
print '<img class="photo" height="'.(($useinecm == 4 || $useinecm == 5 || $useinecm == 6)? '12' : $maxheightmini).'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$smallfile).'" title="">';
print '</a>';
}
else print '&nbsp;';

View File

@ -212,7 +212,7 @@ class FormMail extends Form
/**
* Remove a file from the list of attached files (stored in SECTION array)
*
* @param string $keytodelete Key in file array (0, 1, 2, ...)
* @param string $keytodelete Key index in file array (0, 1, 2, ...)
* @return void
*/
public function remove_attached_files($keytodelete)

View File

@ -939,13 +939,13 @@ class FormTicket
if (is_array($contacts) && count($contacts) > 0) {
foreach ($contacts as $key => $info_sendto) {
if ($info_sendto['email'] != '') {
$sendto[] = dol_escape_htmltag(trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . "> (" . $info_sendto['libelle'] . ")");
$sendto[] = dol_escape_htmltag(trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . ">")." <small>(" . dol_escape_htmltag($info_sendto['libelle']) . ")</small>";
}
}
}
if ($ticketstat->origin_email && !in_array($this->dao->origin_email, $sendto)) {
$sendto[] = $ticketstat->origin_email . "(origin)";
$sendto[] = dol_escape_htmltag($ticketstat->origin_email) . " <small>(".$langs->trans("TicketEmailOriginIssuer").")</small>";
}
if ($ticketstat->fk_soc > 0) {
@ -953,12 +953,12 @@ class FormTicket
$ticketstat->fetch_thirdparty();
if (is_array($ticketstat->thirdparty->email) && !in_array($ticketstat->thirdparty->email, $sendto)) {
$sendto[] = $ticketstat->thirdparty->email . '(' . $langs->trans('Customer') . ')';
$sendto[] = $ticketstat->thirdparty->email . ' <small>(' . $langs->trans('Customer') . ')</small>';
}
}
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS) {
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO . '(generic email)';
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO . ' <small>(generic email)</small>';
}
// Print recipient list

View File

@ -50,7 +50,7 @@ if (empty($conf->dol_no_mouse_hover))
{
print 'jQuery(".classfortooltip").tooltip({
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
hide: { delay: 50 },
hide: { delay: 250 },
tooltipClass: "mytooltip",
content: function () {
console.log("Return title for popup");

View File

@ -560,6 +560,9 @@ function GETPOST($paramname, $check = 'none', $method = 0, $filter = null, $opti
$out=dol_string_nohtmltag($out);
}
break;
case 'restricthtml': // Recommended for most html textarea
$out=dol_string_onlythesehtmltags($out, 0);
break;
case 'custom':
if (empty($filter)) return 'BadFourthParameterForGETPOST';
$out=filter_var($out, $filter, $options);
@ -4607,7 +4610,7 @@ function price2num($amount, $rounding = '', $alreadysqlnb = 0)
* Output a dimension with best unit
*
* @param float $dimension Dimension
* @param int $unit Unit scale of dimension (Example: 0=kg, -3=g, 98=ounce, 99=pound, ...)
* @param int $unit Unit scale of dimension (Example: 0=kg, -3=g, -6=mg, 98=ounce, 99=pound, ...)
* @param string $type 'weight', 'volume', ...
* @param Translate $outputlangs Translate language object
* @param int $round -1 = non rounding, x = number of decimal
@ -4651,7 +4654,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round
$unit = $forceunitoutput;
}*/
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type);
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string(0, $type, $unit);
return $ret;
}

View File

@ -125,12 +125,12 @@ function getValidOnlinePaymentMethods($paymentmethod = '')
*/
function showOnlinePaymentUrl($type, $ref)
{
global $conf, $langs;
global $langs;
// Load translation files required by the page
$langs->loadLangs(array('payment', 'paybox'));
$servicename='Online';
$servicename=$langs->transnoentitiesnoconv('Online');
$out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'<br>';
$url = getOnlinePaymentUrl(0, $type, $ref);

View File

@ -486,10 +486,11 @@ function show_stats_for_company($product, $socid)
* @param int $unit ID of unit (rowid in llx_c_units table)
* @param string $measuring_style Style of unit: weight, volume,...
* @param string $scale Scale of unit: '0', '-3', '6', ...
* @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated.
* @return string Unit string
* @see formproduct->selectMeasuringUnits
*/
function measuring_units_string($unit, $measuring_style = '', $scale = '')
function measuring_units_string($unit, $measuring_style = '', $scale = '', $use_short_label = 0)
{
global $langs, $db;
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
@ -517,7 +518,8 @@ function measuring_units_string($unit, $measuring_style = '', $scale = '')
return -1;
} else {
if (is_array($measuringUnits->records) && count($measuringUnits->records)>0) {
return $langs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label);
if ($use_short_label) return $measuringUnits->records[key($measuringUnits->records)]->short_label;
else return $langs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label);
} else {
return '';
}

View File

@ -139,6 +139,45 @@ function ticket_prepare_head($object)
return $head;
}
/**
* Return string with full Url. The file qualified is the one defined by relative path in $object->last_main_doc
*
* @param Object $object Object
* @return string Url string
*/
function showDirectPublicLink($object)
{
global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$email = CMailFile::getValidAddress($object->origin_email, 2);
if ($email)
{
$url = dol_buildpath('/public/ticket/view.php', 3).'?track_id='.$object->track_id.'&email='.$email;
}
$out='';
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
{
$out.= '<span class="opacitymedium">'.$langs->trans("PublicInterfaceNotEnabled").'</span>';
}
else
{
$out.= img_picto('', 'object_globe.png').' '.$langs->trans("TicketPublicAccess").':<br>';
if ($url)
{
$out.= '<input type="text" id="directpubliclink" class="quatrevingtpercent" value="'.$url.'">';
$out.= ajax_autoselect("directpubliclink", 0);
}
else
{
$out.= '<span class="opacitymedium">'.$langs->trans("TicketNotCreatedFromPublicInterface").'</span>';
}
}
return $out;
}
/**
* Generate a random id
*

View File

@ -392,6 +392,7 @@ class modProduct extends DolibarrModules
));
}
/* Disabled: The value of fields xxx_units is the scale for reference unit, not the rowid in table llx_c_unit !!!
$this->import_convertvalue_array[$r] = array(
'p.weight_units' => array(
'rule' => 'fetchidfromcodeunits',
@ -441,7 +442,7 @@ class modProduct extends DolibarrModules
'units' => 'volume',
'dict' => 'DictionaryMeasuringUnits'
)
);
);*/
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.recuperableonly'=>'NPR'));
@ -501,17 +502,17 @@ class modProduct extends DolibarrModules
'p.accountancy_code_sell_export' => "",
'p.accountancy_code_buy' => "",
'p.weight' => "",
'p.weight_units' => 'use a unit of measure from the dictionary. g/Kg/T etc....matches field "Short Label" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.weight_units' => 'use a unit of measure from the dictionary. g/Kg/T etc....matches field "Scale" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.length' => "",
'p.length_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short Label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.length_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Scale" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.width' => "",
'p.width_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short Label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.width_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Scale" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.height' => "",
'p.height_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short Label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.height_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Scale" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.surface' => "",
'p.surface_units' => 'use a unit of measure from the dictionary. m2/cm2/mm2 etc....matches field "Short Label" for unit type "surface" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.surface_units' => 'use a unit of measure from the dictionary. m2/cm2/mm2 etc....matches field "Scale" for unit type "surface" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.volume' => "",
'p.volume_units' => 'use a unit of measure from the dictionary. m3/cm3/mm3 etc....matches field "Short Label" for unit type "volume" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.volume_units' => 'use a unit of measure from the dictionary. m3/cm3/mm3 etc....matches field "Scale" for unit type "volume" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.finished' => '0 (raw material) / 1 (finished goods)'
);
//clauses copied from import_fields_array

View File

@ -109,7 +109,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
{
print '<tr class="trextrafields_collapse'.$extrafields_collapse_num.'">';
print '<td class="titlefield">';
print '<table width="100%" class="nobordernopadding">';
print '<table class="nobordernopadding centpercent">';
print '<tr>';
print '<td class="';
//var_dump($action);exit;
@ -138,7 +138,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
{
$fieldid='id';
if ($object->table_element == 'societe') $fieldid='socid';
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '&ignorecollapsesetup=1">' . img_edit().'</a></td>';
print '<td class="right"><a class="reposition editfielda" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '&ignorecollapsesetup=1">' . img_edit().'</a></td>';
}
print '</tr></table>';
print '</td>';

View File

@ -3523,6 +3523,8 @@ class CommandeFournisseurLigne extends CommonOrderLine
$error=0;
$this->db->begin();
// Mise a jour ligne en base
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
$sql.= " description='".$this->db->escape($this->desc)."'";

View File

@ -1417,58 +1417,61 @@ if (empty($reshook))
$resteapayer = $object->total_ttc - $totalpaye;
// We check that lines of invoices are exported in accountancy
//$ventilExportCompta = $object->getVentilExportCompta();
$ventilExportCompta = $object->getVentilExportCompta();
// On verifie si aucun paiement n'a ete effectue
if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0)
{
$idwarehouse = GETPOST('idwarehouse');
if (! $ventilExportCompta)
{
// On verifie si aucun paiement n'a ete effectue
if ($resteapayer == price2num($object->total_ttc, 'MT', 1) && $object->statut == FactureFournisseur::STATUS_VALIDATED)
{
$idwarehouse = GETPOST('idwarehouse');
$object->fetch_thirdparty();
$object->fetch_thirdparty();
$qualified_for_stock_change=0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
$qualified_for_stock_change=$object->hasProductsOrServices(2);
}
else
{
$qualified_for_stock_change=$object->hasProductsOrServices(1);
}
$qualified_for_stock_change=0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
$qualified_for_stock_change=$object->hasProductsOrServices(2);
}
else
{
$qualified_for_stock_change=$object->hasProductsOrServices(1);
}
// Check parameters
if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
{
$langs->load("stocks");
if (! $idwarehouse || $idwarehouse == -1)
{
$error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$action='';
}
}
// Check parameters
if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
{
$langs->load("stocks");
if (! $idwarehouse || $idwarehouse == -1)
{
$error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$action='';
}
}
$object->setDraft($user, $idwarehouse);
$object->setDraft($user, $idwarehouse);
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) dol_print_error($db, $result);
}
$model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) dol_print_error($db, $result);
$action='';
}
$action='';
}
}
@ -3033,11 +3036,20 @@ else
// modified by hook
if (empty($reshook))
{
// Modify a validated invoice with no payments
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'confirm_edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans('Modify').'</a></div>';
// We check if lines of invoice are not already transfered into accountancy
$ventilExportCompta = $object->getVentilExportCompta(); // Should be 0 since the sum of payments are zero. But we keep the protection.
if ($ventilExportCompta == 0)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans('Modify').'</a></div>';
}
else
{
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseDispatchedInBookkeeping") . '">' . $langs->trans('Modify') . '</span></div>';
}
}
$discount = new DiscountAbsolute($db);
@ -3046,7 +3058,7 @@ else
// Reopen a standard paid invoice
if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT
|| ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && empty($discount->id)))
&& ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
&& ($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED)) // A paid invoice (partially or completely)
{
if (! $facidnext && $object->close_code != 'replaced' && $user->rights->fournisseur->facture->creer) // Not replaced by another invoice
{

View File

@ -178,14 +178,14 @@ INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VAL
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('Y','31557600','year','y', 'time', 1);
UPDATE llx_c_units SET short_label = 'i' WHERE code = 'MI';
UPDATE llx_c_units SET unit_type = 'weight', short_label = 'kg' WHERE code = 'KG';
UPDATE llx_c_units SET unit_type = 'weight', short_label = 'g' WHERE code = 'G';
UPDATE llx_c_units SET unit_type = 'weight', short_label = 'kg', scale = 0 WHERE code = 'KG';
UPDATE llx_c_units SET unit_type = 'weight', short_label = 'g', scale = -3 WHERE code = 'G';
UPDATE llx_c_units SET unit_type = 'time' WHERE code IN ('S','H','D');
UPDATE llx_c_units SET unit_type = 'size' WHERE code IN ('M','LM');
UPDATE llx_c_units SET label = 'SizeUnitm' WHERE code IN ('M');
UPDATE llx_c_units SET active = 0 WHERE code IN ('LM');
UPDATE llx_c_units SET unit_type = 'surface' WHERE code IN ('M2');
UPDATE llx_c_units SET unit_type = 'volume' WHERE code IN ('M3','L');
UPDATE llx_c_units SET label = 'SizeUnitm', scale = 0 WHERE code IN ('M');
UPDATE llx_c_units SET active = 0, scale = 0 WHERE code IN ('LM');
UPDATE llx_c_units SET unit_type = 'surface', scale = 0 WHERE code IN ('M2');
UPDATE llx_c_units SET unit_type = 'volume', scale = 0 WHERE code IN ('M3','L');
UPDATE llx_c_units SET scale = -3, active = 0 WHERE code IN ('L');
UPDATE llx_c_units SET label = 'VolumeUnitm3' WHERE code IN ('M3');
UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');

View File

@ -226,6 +226,8 @@ TicketConfirmChangeStatus=Confirm the status change: %s ?
TicketLogStatusChanged=Status changed: %s to %s
TicketNotNotifyTiersAtCreate=Not notify company at create
Unread=Unread
TicketNotCreatedFromPublicInterface=Not available. Ticket was not created from public interface.
PublicInterfaceNotEnabled=Public interface was not enabled
#
# Logs

View File

@ -1,22 +1,22 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2006 Auguria SARL <info@auguria.org>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2006 Auguria SARL <info@auguria.org>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -300,17 +300,17 @@ if (empty($reshook))
$object->desiredstock = GETPOST('desiredstock')?GETPOST('desiredstock'):0;
$object->canvas = GETPOST('canvas');
$object->weight = GETPOST('weight');
$object->weight_units = GETPOST('weight_units');
$object->weight_units = GETPOST('weight_units'); // This is not the fk_unit but the power of unit
$object->length = GETPOST('size');
$object->length_units = GETPOST('size_units');
$object->length_units = GETPOST('size_units'); // This is not the fk_unit but the power of unit
$object->width = GETPOST('sizewidth');
$object->height = GETPOST('sizeheight');
$object->surface = GETPOST('surface');
$object->surface_units = GETPOST('surface_units');
$object->surface_units = GETPOST('surface_units'); // This is not the fk_unit but the power of unit
$object->volume = GETPOST('volume');
$object->volume_units = GETPOST('volume_units');
$object->volume_units = GETPOST('volume_units'); // This is not the fk_unit but the power of unit
$object->finished = GETPOST('finished', 'alpha');
$object->fk_unit = GETPOST('units', 'alpha');
$object->fk_unit = GETPOST('units', 'alpha'); // This is the fk_unit of sale
$accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
$accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra', 'alpha');
@ -404,16 +404,16 @@ if (empty($reshook))
$object->canvas = GETPOST('canvas');
$object->weight = GETPOST('weight');
$object->weight_units = GETPOST('weight_units');
$object->weight_units = GETPOST('weight_units'); // This is not the fk_unit but the power of unit
$object->length = GETPOST('size');
$object->length_units = GETPOST('size_units');
$object->width = GETPOST('sizewidth');
$object->height = GETPOST('sizeheight');
$object->length_units = GETPOST('size_units'); // This is not the fk_unit but the power of unit
$object->width = GETPOST('sizewidth');
$object->height = GETPOST('sizeheight');
$object->surface = GETPOST('surface');
$object->surface_units = GETPOST('surface_units');
$object->surface_units = GETPOST('surface_units'); // This is not the fk_unit but the power of unit
$object->volume = GETPOST('volume');
$object->volume_units = GETPOST('volume_units');
$object->volume_units = GETPOST('volume_units'); // This is not the fk_unit but the power of unit
$object->finished = GETPOST('finished', 'alpha');
$units = GETPOST('units', 'int');
@ -1057,7 +1057,7 @@ else
// Weight
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="3">';
print '<input name="weight" size="4" value="'.GETPOST('weight').'">';
print $formproduct->selectMeasuringUnits("weight_units", "weight", (empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?0:$conf->global->MAIN_WEIGHT_DEFAULT_UNIT));
print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units')?GETPOST('weight_units', 'alpha'):(empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?0:$conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2);
print '</td></tr>';
// Length
if (empty($conf->global->PRODUCT_DISABLE_SIZE))
@ -1066,7 +1066,7 @@ else
print '<input name="size" size="4" value="'.GETPOST('size').'"> x ';
print '<input name="sizewidth" size="4" value="'.GETPOST('sizewidth').'"> x ';
print '<input name="sizeheight" size="4" value="'.GETPOST('sizeheight').'">';
print $formproduct->selectMeasuringUnits("size_units", "size");
print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units')?GETPOST('size_units', 'alpha'):'0', 0, 2);
print '</td></tr>';
}
if (empty($conf->global->PRODUCT_DISABLE_SURFACE))
@ -1074,7 +1074,7 @@ else
// Surface
print '<tr><td>'.$langs->trans("Surface").'</td><td colspan="3">';
print '<input name="surface" size="4" value="'.GETPOST('surface').'">';
print $formproduct->selectMeasuringUnits("surface_units", "surface");
print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units')?GETPOST('surface_units', 'alpha'):'0', 0, 2);
print '</td></tr>';
}
if (empty($conf->global->PRODUCT_DISABLE_VOLUME))
@ -1082,7 +1082,7 @@ else
// Volume
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="3">';
print '<input name="volume" size="4" value="'.GETPOST('volume').'">';
print $formproduct->selectMeasuringUnits("volume_units", "volume");
print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units')?GETPOST('volume_units', 'alpha'):'0', 0, 2);
print '</td></tr>';
}
}
@ -1430,7 +1430,7 @@ else
// Weight
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="3">';
print '<input name="weight" size="5" value="'.$object->weight.'"> ';
print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units);
print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2);
print '</td></tr>';
if (empty($conf->global->PRODUCT_DISABLE_SIZE))
{
@ -1439,7 +1439,7 @@ else
print '<input name="size" size="5" value="'.$object->length.'">x';
print '<input name="sizewidth" size="5" value="'.$object->width.'">x';
print '<input name="sizeheight" size="5" value="'.$object->height.'"> ';
print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units);
print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units, 0, 2);
print '</td></tr>';
}
if (empty($conf->global->PRODUCT_DISABLE_SURFACE))
@ -1447,7 +1447,7 @@ else
// Surface
print '<tr><td>'.$langs->trans("Surface").'</td><td colspan="3">';
print '<input name="surface" size="5" value="'.$object->surface.'"> ';
print $formproduct->selectMeasuringUnits("surface_units", "surface", $object->surface_units);
print $formproduct->selectMeasuringUnits("surface_units", "surface", $object->surface_units, 0, 2);
print '</td></tr>';
}
if (empty($conf->global->PRODUCT_DISABLE_VOLUME))
@ -1455,7 +1455,7 @@ else
// Volume
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="3">';
print '<input name="volume" size="5" value="'.$object->volume.'"> ';
print $formproduct->selectMeasuringUnits("volume_units", "volume", $object->volume_units);
print $formproduct->selectMeasuringUnits("volume_units", "volume", $object->volume_units, 0, 2);
print '</td></tr>';
}
}
@ -1618,7 +1618,9 @@ else
{
// TODO change for compatibility with edit in place
$typeformat='select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
print '<tr><td class="titlefield">'.$form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat).'</td><td colspan="2">';
print '<tr><td class="titlefield">';
print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type');
print '</td><td colspan="2">';
print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat);
print '</td></tr>';
}
@ -1831,11 +1833,12 @@ else
print '<tr><td class="titlefield">'.$langs->trans("Nature").'</td><td colspan="2">';
print $object->getLibFinished();
print '</td></tr>';
// Weight
print '<tr><td class="titlefield">'.$langs->trans("Weight").'</td><td colspan="2">';
if ($object->weight != '')
{
print $object->weight." ".measuring_units_string($object->weight_units, "weight");
print $object->weight." ".measuring_units_string(0, "weight", $object->weight_units);
}
else
{
@ -1851,7 +1854,7 @@ else
print $object->length;
if ($object->width) print " x ".$object->width;
if ($object->height) print " x ".$object->height;
print ' '.measuring_units_string($object->length_units, "size");
print ' '.measuring_units_string(0, "size", $object->length_units);
}
else
{
@ -1865,7 +1868,7 @@ else
print '<tr><td>'.$langs->trans("Surface").'</td><td colspan="2">';
if ($object->surface != '')
{
print $object->surface." ".measuring_units_string($object->surface_units, "surface");
print $object->surface." ".measuring_units_string(0, "surface", $object->surface_units);
}
else
{
@ -1879,7 +1882,7 @@ else
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="2">';
if ($object->volume != '')
{
print $object->volume." ".measuring_units_string($object->volume_units, "volume");
print $object->volume." ".measuring_units_string(0, "volume", $object->volume_units);
}
else
{

View File

@ -467,6 +467,41 @@ class Products extends DolibarrApi
);
}
/**
* Delete purchase price for a product
*
* @param int $id Product ID
* @param int $priceid purchase price ID
*
* @url DELETE {id}/purchase_prices/{priceid}
*
* @return array
*
* @throws 401
* @throws 404
*
*/
public function deletePurchasePrice($id, $priceid)
{
if(! DolibarrApiAccess::$user->rights->produit->supprimer) {
throw new RestException(401);
}
$result = $this->product->fetch($id);
if(! $result ) {
throw new RestException(404, 'Product not found');
}
if(! DolibarrApi::_checkAccessToResource('product', $this->product->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if($result) {
$this->product = new ProductFournisseur($this->db);
$this->product->fetch($id);
}
return $this->product->remove_product_fournisseur_price($priceid);
}
/**
* List purchase prices

View File

@ -333,7 +333,7 @@ class FormProduct
* @param string $measuring_style Unit to show: weight, size, surface, volume, time
* @param string $default Preselected value
* @param int $adddefault Add empty unit called "Default"
* @param int $mode 1=Use short label as value, 0=Use rowid
* @param int $mode 1=Use short label as value, 0=Use rowid, 2=Use scale (power)
* @return string
*/
public function selectMeasuringUnits($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0, $mode = 0)
@ -370,10 +370,12 @@ class FormProduct
{
$return .= '<option value="';
if ($mode == 1) $return .= $lines->short_label;
elseif ($mode == 2) $return .= $lines->scale;
else $return .= $lines->id;
$return .= '"';
if ($mode == 1 && $lines->short_label == $default) $return .= ' selected';
if ($mode == 0 && $lines->id == $default) $return .= ' selected';
elseif ($mode == 2 && $lines->scale == $default) $return .= ' selected';
elseif ($mode == 0 && $lines->id == $default) $return .= ' selected';
$return .= '>';
if ($measuring_style == 'time') $return.= $langs->trans(ucfirst($lines->label));
else $return .= $langs->trans($lines->label);

View File

@ -37,6 +37,7 @@ if (!defined("NOLOGIN")) {
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -95,7 +96,8 @@ if ($action == "view_ticketlist") {
$ret = $object->fetch('', '', $track_id);
if ($ret && $object->id > 0) {
// vérifie si l'adresse email est bien dans les contacts du ticket
// vérifie si l'adresse email est bien dans les contacts du ticket
$contacts = $object->liste_contact(-1, 'external');
foreach ($contacts as $contact) {
if ($contact['email'] == $email) {
@ -124,7 +126,9 @@ if ($action == "view_ticketlist") {
$_SESSION['track_id_customer'] = $track_id;
}
}
if ($email == $object->origin_email) {
$emailorigin = CMailFile::getValidAddress($object->origin_email, 2);
if ($email == $emailorigin) {
$display_ticket_list = true;
$_SESSION['email_customer'] = $email;
$_SESSION['track_id_customer'] = $track_id;
@ -638,7 +642,7 @@ if ($action == "view_ticketlist")
// Statut
if (!empty($arrayfields['t.fk_statut']['checked'])) {
print '<td>';
print '<td class="nowraponall">';
$object->fk_statut = $obj->fk_statut;
print $object->getLibStatut(2);
print '</td>';

View File

@ -38,6 +38,7 @@ if (!defined("NOLOGIN")) {
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -100,7 +101,8 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
$ret = $object->fetch('', '', $track_id);
if ($ret && $object->dao->id > 0) {
// Check if emails provided is the one of author
if ($object->dao->origin_email == $email)
$emailofticket = CMailFile::getValidAddress($object->dao->origin_email, 2);
if ($emailofticket == $email)
{
$display_ticket = true;
$_SESSION['email_customer'] = $email;
@ -174,7 +176,6 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
if (! $error)
{
$action = 'view_ticket';
@ -226,7 +227,8 @@ llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
print '<div style="margin: 0 auto;" class="ticketpublicarea">';
if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close") {
if ($display_ticket) {
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);
@ -284,7 +286,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
$fuser->fetch($object->dao->fk_user_create);
print $fuser->getFullName($langs);
} else {
print $object->dao->origin_email;
print dol_escape_htmltag($object->dao->origin_email);
}
print '</td></tr>';
@ -370,7 +372,9 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
// Message list
print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'messages@ticket');
$object->viewTicketMessages(false, true, $object->dao);
} else {
}
else
{
print '<div class="error">Not Allowed<br><a href="' . $_SERVER['PHP_SELF'] . '?track_id=' . $object->dao->track_id . '">' . $langs->trans('Back') . '</a></div>';
}
} else {

View File

@ -119,25 +119,7 @@ if ($socid)
dol_fiche_end();
/*
* Barre d'action
*/
/*print '<div class="tabsAction">';
if (! empty($conf->projet->enabled))
{
if (! empty($conf->projet->enabled) && ! empty($user->rights->projet->creer))
{*/
$addbutton = '<a href="'.DOL_URL_ROOT.'/projet/card.php?action=create&socid='.$object->id.'&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
/* }
else
{
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("AddProject").'</a>';
}
}
print '</div>'; */
$addbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/projet/card.php?action=create&socid='.$object->id.'&amp;backtopage='.urlencode($backtopage).'"><span class="text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print '<br>';

View File

@ -371,7 +371,7 @@ if ($action == "assign_user" && GETPOST('btn_assign_user', 'aplha') && $user->ri
$action = 'view';
}
if ($action == "add_message" && GETPOST('btn_add_message') && $user->rights->ticket->read) {
if ($action == 'add_message' && GETPOSTISSET('btn_add_message') && $user->rights->ticket->read) {
$ret = $object->newMessage($user, $action, (GETPOST('private_message', 'alpha') == "on" ? 1 : 0));
if ($ret > 0) {
@ -769,7 +769,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
}
if (!empty($object->origin_email)) {
$morehtmlref .= '<br>' . $langs->trans("CreatedBy") . ' : ';
$morehtmlref .= $object->origin_email . ' <small>(' . $langs->trans("TicketEmailOriginIssuer") . ')</small>';
$morehtmlref .= dol_escape_htmltag($object->origin_email) . ' <small>(' . $langs->trans("TicketEmailOriginIssuer") . ')</small>';
}
// Thirdparty
@ -983,6 +983,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
}
print '</td>';
print '</tr>';
if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) {
print '<tr>';
// Type
@ -1194,7 +1195,10 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
}
print '</div>'."\n";
}
else
{
print '<br>';
}
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
@ -1212,6 +1216,10 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
$linktoelem = $form->showLinkToObjectBlock($object, null, array('ticket'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
// Show direct link to public interface
print '<br><!-- Link to public interface -->'."\n";
print showDirectPublicLink($object).'<br>';
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of actions on element
@ -1256,7 +1264,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
foreach ($substitutionarray as $key => $val) {
$help.=$key.' -> '.$langs->trans($val).'<br>';
}
$morehtmlright.=$form->textwithpicto($langs->trans("TicketMessageSubstitutionReplacedByGenericValues"), $help);
$morehtmlright.=$form->textwithpicto('<span class="opacitymedium">'.$langs->trans("TicketMessageSubstitutionReplacedByGenericValues").'</span>', $help, 1, 'helpclickable', '', 0, 3, 'helpsubstitution');
print '<div>';
print load_fiche_titre($langs->trans('TicketAddMessage'), $morehtmlright, 'messages@ticket');
@ -1290,10 +1298,8 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
//$formticket->param['socid']=$object->fk_soc;
$formticket->param['returnurl']=$_SERVER["PHP_SELF"].'?track_id='.$object->track_id;
$formticket->withsubstit = 1;
$formticket->substit = $substitutionarray;
$formticket->showMessageForm('100%');
print '</div>';
}

View File

@ -1602,13 +1602,16 @@ class Ticket extends CommonObject
}
/**
* Add message into database
* Add message into database
*
* @param User $user User that creates
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK
* @param User $user User that creates
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @param array $filename_list List of files to attach (full path of filename on file system)
* @param array $mimetype_list List of MIME type of attached files
* @param array $mimefilename_list List of attached file name in message
* @return void
*/
public function createTicketMessage($user, $notrigger = 0)
public function createTicketMessage($user, $notrigger = 0, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array())
{
global $conf, $langs;
$error = 0;
@ -1644,6 +1647,19 @@ class Ticket extends CommonObject
$actioncomm->elementtype = 'ticket';
$actioncomm->fk_element = $this->id;
$attachedfiles = array();
$attachedfiles['paths'] = $filename_list;
$attachedfiles['names'] = $mimefilename_list;
$attachedfiles['mimes'] = $mimetype_list;
if (is_array($attachedfiles) && count($attachedfiles)>0) {
$actioncomm->attachedfiles = $attachedfiles;
}
if (! empty($mimefilename_list) && is_array($mimefilename_list))
{
$actioncomm->note_private=dol_concatdesc($actioncomm->note_private, "\n".$langs->transnoentities("AttachedFiles").': '.join(';', $mimefilename_list));
}
$actionid = $actioncomm->create($user);
if ($actionid <= 0)
{
@ -2392,10 +2408,11 @@ class Ticket extends CommonObject
/**
* Copy files into ticket directory
* Used for files linked into messages
* Copy files defined into $_SESSION array into the ticket directory of attached files.
* Used for files linked into messages.
* Files may be renamed during copy to avoid overwriting existing files.
*
* @return void
* @return array Array with final path/name/mime of files.
*/
public function copyFilesForTicket()
{
@ -2425,23 +2442,42 @@ class Ticket extends CommonObject
if (!dol_is_dir($destdir)) {
dol_mkdir($destdir);
}
$listofpaths = array();
$listofnames = array();
foreach ($filename as $i => $val) {
$res = dol_move($filepath[$i], $destdir . '/' . $filename[$i]);
if (image_format_supported($destdir . '/' . $filename[$i]) == 1) {
$destfile = $destdir . '/' . $filename[$i];
// If destination file already exists, we add a suffix to avoid to overwrite
if (is_file($destfile))
{
$now = dol_now();
$destfile.='.'.dol_print_date($now, 'dayhourlog');
}
$res = dol_move($filepath[$i], $destfile, 0, 1);
if (image_format_supported($destfile) == 1) {
// Create small thumbs for image (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($destdir . '/' . $filename[$i], $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs");
$imgThumbSmall = vignette($destfile, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs");
// Create mini thumbs for image (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($destdir . '/' . $filename[$i], $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
$imgThumbMini = vignette($destfile, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
}
$formmail->remove_attached_files($i);
// Fill array with new names
$listofpaths[$i] = $destfile;
$listofnames[$i] = basename($destfile);
}
return array('listofpaths'=>$listofpaths, 'listofnames'=>$listofnames, 'listofmimes'=>$mimetype);
}
/**
* Add new message on a ticket (private area)
* Add new message on a ticket (private area). Can also send it be email if GETPOST('send_email', 'int') is set.
*
* @param User $user User for action
* @param string $action Action string
@ -2452,19 +2488,15 @@ class Ticket extends CommonObject
{
global $mysoc, $conf, $langs;
if (!class_exists('Contact')) {
include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
}
$contactstatic = new Contact($this->db);
$object = new Ticket($this->db);
$error = 0;
$object = new Ticket($this->db);
$ret = $object->fetch('', '', GETPOST('track_id', 'alpha'));
$object->socid = $object->fk_soc;
$object->fetch_thirdparty();
if ($ret < 0) {
$error++;
array_push($this->errors, $langs->trans("ErrorTicketIsNotValid"));
@ -2481,9 +2513,17 @@ class Ticket extends CommonObject
$object->subject = GETPOST('subject', 'alphanohtml');
$object->message = GETPOST("message", "none");
$object->private = GETPOST("private_message", "alpha");
$send_email = GETPOST('send_email', 'int');
$id = $object->createTicketMessage($user);
// Copy attached files (saved into $_SESSION) as linked files to ticket. Return array with final name used.
$resarray = $object->copyFilesForTicket();
$listofpaths = $resarray['listofpaths'];
$listofnames = $resarray['listofnames'];
$listofmimes = $resarray['listofmimes'];
$id = $object->createTicketMessage($user, 0, $listofpaths, $listofmimes, $listofnames);
if ($id <= 0) {
$error++;
$this->errors = $object->error;
@ -2494,24 +2534,27 @@ class Ticket extends CommonObject
if (!$error && $id > 0) {
setEventMessages($langs->trans('TicketMessageSuccessfullyAdded'), null, 'mesgs');
//var_dump($_SESSION); var_dump($listofpaths);exit;
/*
* Send email to linked contacts
* Send emails to internal users (linked contacts)
*/
if ($send_email > 0) {
// Retrieve internal contact datas
$internal_contacts = $object->getInfosTicketInternalContact();
$sendto = array();
if (is_array($internal_contacts) && count($internal_contacts) > 0) {
// altairis: set default subject
$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');
$subject = GETPOST('subject', 'nohtml') ? GETPOST('subject', 'nohtml') : '[' . $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 = $langs->trans('TicketMessageMailIntroText');
$message .= "\n\n";
$message .= GETPOST('message');
$message .= GETPOST('message', 'restricthtml');
// Coordonnées client
$message .= "\n\n";
@ -2550,12 +2593,12 @@ class Ticket extends CommonObject
// altairis: dont try to send email if no recipient
if (!empty($sendto)) {
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
$this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames);
}
}
/*
* Email for externals users if not private
* Send emails for externals users if not private (linked contacts)
*/
if (empty($object->private)) {
// Retrieve email of all contacts (external)
@ -2602,47 +2645,42 @@ class Ticket extends CommonObject
// If public interface is not enable, use link to internal page into mail
$url_public_ticket = (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ?
(!empty($conf->global->TICKET_URL_PUBLIC_INTERFACE) ?
$conf->global->TICKET_URL_PUBLIC_INTERFACE . '/view.php' :
dol_buildpath('/public/ticket/view.php', 2)
) :
dol_buildpath('/ticket/card.php', 2)
) . '?track_id=' . $object->track_id;
$message .= "\n" . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : ' . '<a href="' . $url_public_ticket . '">' . $object->track_id . '</a>' . "\n";
(!empty($conf->global->TICKET_URL_PUBLIC_INTERFACE) ? $conf->global->TICKET_URL_PUBLIC_INTERFACE . '/view.php' : dol_buildpath('/public/ticket/view.php', 2)) :
dol_buildpath('/ticket/card.php', 2)) . '?track_id=' . $object->track_id;
$message .= "\n" . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : ' . '<a href="' . $url_public_ticket . '">' . $object->track_id . '</a>' . "\n";
// Build final message
$message = $message_intro . $message;
// Build final message
$message = $message_intro . $message;
// Add signature
$message .= '<br>' . $message_signature;
// Add signature
$message .= '<br>' . $message_signature;
if (!empty($object->origin_email)) {
$sendto[] = $object->origin_email;
}
if (!empty($object->origin_email)) {
$sendto[] = $object->origin_email;
}
if ($object->fk_soc > 0 && ! in_array($object->origin_email, $sendto)) {
$object->socid = $object->fk_soc;
$object->fetch_thirdparty();
if(!empty($object->thirdparty->email)) $sendto[] = $object->thirdparty->email;
}
if ($object->fk_soc > 0 && ! in_array($object->origin_email, $sendto)) {
$object->socid = $object->fk_soc;
$object->fetch_thirdparty();
if(!empty($object->thirdparty->email)) $sendto[] = $object->thirdparty->email;
}
// altairis: Add global email address reciepient
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
if(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
}
// altairis: Add global email address reciepient
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
if(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
}
// altairis: dont try to send email when no recipient
if (!empty($sendto)) {
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
}
// altairis: dont try to send email when no recipient
if (!empty($sendto)) {
$this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames);
}
}
}
}
$object->copyFilesForTicket();
// Set status to "answered" if not set yet, only for internal users
if ($object->fk_statut < 3 && !$user->societe_id) {
// Set status to "answered" if not set yet, but only if internal user
if ($object->fk_statut < 3 && ! $user->socid)
{
$object->setStatut(3);
}
@ -2661,13 +2699,16 @@ class Ticket extends CommonObject
/**
* Send ticket by email to linked contacts
*
* @param string $subject Email subject
* @param string $message Email message
* @param int $send_internal_cc Receive a copy on internal email ($conf->global->TICKET_NOTIFICATION_EMAIL_FROM)
* @param array $array_receiver Array of receiver. exemple array('name' => 'John Doe', 'email' => 'john@doe.com', etc...)
* @param string $subject Email subject
* @param string $message Email message
* @param int $send_internal_cc Receive a copy on internal email ($conf->global->TICKET_NOTIFICATION_EMAIL_FROM)
* @param array $array_receiver Array of receiver. exemple array('name' => 'John Doe', 'email' => 'john@doe.com', etc...)
* @param array $filename_list List of files to attach (full path of filename on file system)
* @param array $mimetype_list List of MIME type of attached files
* @param array $mimefilename_list List of attached file name in message
* @return void
*/
public function sendTicketMessageByEmail($subject, $message, $send_internal_cc = 0, $array_receiver = array())
public function sendTicketMessageByEmail($subject, $message, $send_internal_cc = 0, $array_receiver = array(), $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array())
{
global $conf, $langs;
@ -2693,15 +2734,12 @@ class Ticket extends CommonObject
$from = $conf->global->TICKET_NOTIFICATION_EMAIL_FROM;
if (is_array($array_receiver) && count($array_receiver) > 0) {
foreach ($array_receiver as $key => $receiver) {
// Create form object
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($this->db);
$attachedfiles = $formmail->get_attached_files();
$filepath = $attachedfiles['paths'];
$filename = $attachedfiles['names'];
$mimetype = $attachedfiles['mimes'];
foreach ($array_receiver as $key => $receiver)
{
$deliveryreceipt = 0;
$filepath = $filename_list;
$filename = $mimefilename_list;
$mimetype = $mimetype_list;
$message_to_send = dol_nl2br($message);

View File

@ -229,8 +229,8 @@ foreach($search as $key => $val)
if ($key == 'fk_statut')
{
$tmpstatus='';
if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) $tmpstatus.=($tmpstatus?',':'')."'0', '1', '3', '4', '5', '6'";
if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) $tmpstatus.=($tmpstatus?',':'')."'8', '9'";
if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) $tmpstatus.=($tmpstatus?',':'')."'".Ticket::STATUS_NOT_READ."', '".Ticket::STATUS_READ."', '".Ticket::STATUS_ASSIGNED."', '".Ticket::STATUS_IN_PROGRESS."', '".Ticket::STATUS_NEED_MORE_INFO."', '".Ticket::STATUS_WAITING."'";
if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) $tmpstatus.=($tmpstatus?',':'')."'".Ticket::STATUS_CLOSED."', '".Ticket::STATUS_CANCELED."'";
if ($tmpstatus) $sql.=" AND fk_statut IN (".$tmpstatus.")";
elseif (is_array($search[$key]) && count($search[$key])) $sql.=natural_search($key, join(',', $search[$key]), 2);
continue;