Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/ticket/class/ticket.class.php
This commit is contained in:
Laurent Destailleur 2019-07-20 13:29:10 +02:00
commit 865ebb9de2
36 changed files with 592 additions and 368 deletions

View File

@ -113,13 +113,14 @@ Also, some code changes need a prior approbation:
* if you add a new table, you must first create a page on http://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Than ask the project manager (@eldy) if the new data model you plan to add can be accepted as you suggest. * if you add a new table, you must first create a page on http://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Than ask the project manager (@eldy) if the new data model you plan to add can be accepted as you suggest.
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR.
every developer discuss about the PR.
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration.
If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR.
By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet. If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR and why the PR is kept open. By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet.
Around 95% of submitted PR are reviewed and tagged. Even if this is one of the most important ratio in Open Source world, don't expect the core team In most cases, it give you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the flag ask you. The majority of PR are waiting a developer action.
to reach the 100%. With the increasing popularity of Dolibarr, this ratio will probably decrease in future.
Around 95% of submitted PR are reviewed and tagged. Even if this is one of the most important ratio of answered PR in Open Source world, don't expect the core team to reach the 100%. With the increasing popularity of Dolibarr, this ratio will probably decrease in future.
### Resources ### Resources

View File

@ -374,9 +374,9 @@ if ($result) {
// Ref Product // Ref Product
print '<td>'; print '<td>';
if ($product_static->id) if ($product_static->id > 0) print $product_static->getNomUrl(1);
print $product_static->getNomUrl(1); if ($product_static->id > 0 && $objp->product_label) print '<br>';
if ($objp->product_label) print '<br>'.$objp->product_label; if ($objp->product_label) print $objp->product_label;
print '</td>'; print '</td>';
print '<td class="tdoverflowonsmartphone">'; print '<td class="tdoverflowonsmartphone">';

View File

@ -319,8 +319,8 @@ if ($result) {
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid); if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
if ($search_day) $param.='&search_day='.urlencode($search_day); if ($search_day) $param.='&search_day='.urlencode($search_day);
if ($search_month) $param.='&search_month='.urlencode($search_month); if ($search_month) $param.='&search_month='.urlencode($search_month);
@ -330,8 +330,8 @@ if ($result) {
if ($search_desc) $param.='&search_desc='.urlencode($search_desc); if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
if ($search_amount) $param.='&search_amount='.urlencode($search_amount); if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
if ($search_vat) $param.='&search_vat='.urlencode($search_vat); if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
if ($search_country) $param .= "&search_country=" . urlencode($search_country); if ($search_country) $param.= "&search_country=".urlencode($search_country);
if ($search_tvaintra) $param .= "&search_tvaintra=" . urlencode($search_tvaintra); if ($search_tvaintra) $param.= "&search_tvaintra=".urlencode($search_tvaintra);
$arrayofmassactions = array( $arrayofmassactions = array(
'ventil'=>$langs->trans("Ventilate") 'ventil'=>$langs->trans("Ventilate")
@ -403,7 +403,7 @@ if ($result) {
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 '); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);

View File

@ -384,9 +384,9 @@ if ($result) {
// Ref product // Ref product
print '<td>'; print '<td>';
if ($product_static->id) if ($product_static->id > 0) print $product_static->getNomUrl(1);
print $product_static->getNomUrl(1); if ($product_static->id > 0 && $objp->product_label) print '<br>';
if ($objp->product_label) print '<br>'.$objp->product_label; if ($objp->product_label) print $objp->product_label;
print '</td>'; print '</td>';
// Description // Description

View File

@ -405,7 +405,7 @@ if ($result) {
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 '); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);

View File

@ -40,7 +40,7 @@ $cancel = GETPOST('cancel', 'alpha');
$search_event = GETPOST('search_event', 'alpha'); $search_event = GETPOST('search_event', 'alpha');
// Get list of triggers available // Get list of triggers available
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype"; $sql = "SELECT a.rowid, a.code, a.label, a.elementtype, a.rang as position";
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a"; $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a";
$sql.= " ORDER BY a.rang ASC"; $sql.= " ORDER BY a.rang ASC";
$resql=$db->query($sql); $resql=$db->query($sql);
@ -55,6 +55,7 @@ if ($resql)
$triggers[$i]['code'] = $obj->code; $triggers[$i]['code'] = $obj->code;
$triggers[$i]['element'] = $obj->elementtype; $triggers[$i]['element'] = $obj->elementtype;
$triggers[$i]['label'] = ($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); $triggers[$i]['label'] = ($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label);
$triggers[$i]['position'] = $obj->position;
$i++; $i++;
} }
@ -65,6 +66,8 @@ else
dol_print_error($db); dol_print_error($db);
} }
//$triggers = dol_sort_array($triggers, 'code', 'asc', 0, 0, 1);
/* /*
* Actions * Actions

View File

@ -1027,15 +1027,35 @@ if ($mode == 'deploy')
print $langs->trans("YouCanSubmitFile"); print $langs->trans("YouCanSubmitFile");
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb $max=$conf->global->MAIN_UPLOAD_DOC; // In Kb
$maxphp=@ini_get('upload_max_filesize'); // En inconnu $maxphp=@ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1; if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1;
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024; if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024; if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024; if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
// Now $max and $maxphp are in Kb $maxphp2=@ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
// Now $max and $maxphp and $maxphp2 are in Kb
$maxmin = $max; $maxmin = $max;
if ($maxphp > 0) $maxmin=min($max, $maxphp); $maxphptoshow = $maxphptoshowparam = '';
if ($maxphp > 0)
{
$maxmin=min($max, $maxphp);
$maxphptoshow = $maxphp;
$maxphptoshowparam = 'upload_max_filesize';
}
if ($maxphp2 > 0)
{
$maxmin=min($max, $maxphp2);
if ($maxphp2 < $maxphp)
{
$maxphptoshow = $maxphp2;
$maxphptoshowparam = 'post_max_size';
}
}
if ($maxmin > 0) if ($maxmin > 0)
{ {
@ -1063,7 +1083,7 @@ if ($mode == 'deploy')
{ {
$langs->load('other'); $langs->load('other');
print ' '; print ' ';
print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphp), 1); print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow, $maxphptoshowparam), 1);
} }
} }
else else

View File

@ -48,14 +48,31 @@ if (isset($title))
} }
// Check PHP setup is OK
$maxphp=@ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1;
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
$maxphp2=@ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
{
$langs->load("errors");
print info_admin($langs->trans("WarningParamUploadMaxFileSizeHigherThanPostMaxSize", @ini_get('upload_max_filesize'), @ini_get('post_max_size')), 0, 0, 0, 'warning');
print '<br>';
}
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print "\n"; print "\n";
$var=false;
// Recupere la version de PHP // Get PHP version
$phpversion=version_php(); $phpversion=version_php();
print '<tr class="oddeven"><td width="220px">'.$langs->trans("Version")."</td><td>".$phpversion."</td></tr>\n"; print '<tr class="oddeven"><td width="220px">'.$langs->trans("Version")."</td><td>".$phpversion."</td></tr>\n";

View File

@ -43,7 +43,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
// Load translation files required by the page // Load translation files required by the page
$langs->load("propal"); $langs->load("propal");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc'); $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
$total=0; $ilink=0; $total=0; $ilink=0;
foreach($linkedObjectBlock as $key => $objectlink) foreach($linkedObjectBlock as $key => $objectlink)

View File

@ -2116,7 +2116,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">'; print '<table class="border tableforfield centpercent">';
if ($soc->outstanding_limit) if ($soc->outstanding_limit)
{ {
@ -2454,7 +2454,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>'; // Close fichecenter
print '<div class="clearboth"></div><br>'; print '<div class="clearboth"></div><br>';

View File

@ -39,7 +39,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
// Load translation files required by the page // Load translation files required by the page
$langs->load("orders"); $langs->load("orders");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc'); $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
$total=0; $ilink=0; $total=0; $ilink=0;
foreach($linkedObjectBlock as $key => $objectlink) foreach($linkedObjectBlock as $key => $objectlink)

View File

@ -38,7 +38,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
$langs->load("bills"); $langs->load("bills");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc'); $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
$total=0; $ilink=0; $total=0; $ilink=0;
foreach($linkedObjectBlock as $key => $objectlink) foreach($linkedObjectBlock as $key => $objectlink)

View File

@ -489,7 +489,10 @@ class Conf
if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES' if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
// By default, suppliers objects can be linked to all projects // By default, suppliers objects can be linked to all projects
$this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1; if (! isset($this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)) $this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
// By default we enable feature to bill time spent
if (! isset($this->global->PROJECT_BILL_TIME_SPENT)) $this->global->PROJECT_BILL_TIME_SPENT = 1;
// MAIN_HTML_TITLE // MAIN_HTML_TITLE
if (! isset($this->global->MAIN_HTML_TITLE)) $this->global->MAIN_HTML_TITLE='noapp,thirdpartynameonly,contactnameonly,projectnameonly'; if (! isset($this->global->MAIN_HTML_TITLE)) $this->global->MAIN_HTML_TITLE='noapp,thirdpartynameonly,contactnameonly,projectnameonly';

View File

@ -6672,7 +6672,8 @@ class Form
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'), 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'), 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'), 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn').')') 'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn').')'),
'ticket'=>array('enabled'=>$conf->ticket->enabled , 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('ticket').')')
); );
} }

View File

@ -130,15 +130,35 @@ class FormFile
$out .= '<td class="valignmiddle nowrap">'; $out .= '<td class="valignmiddle nowrap">';
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb $max=$conf->global->MAIN_UPLOAD_DOC; // In Kb
$maxphp=@ini_get('upload_max_filesize'); // En inconnu $maxphp=@ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1; if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1;
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024; if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024; if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024; if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
// Now $max and $maxphp are in Kb $maxphp2=@ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
// Now $max and $maxphp and $maxphp2 are in Kb
$maxmin = $max; $maxmin = $max;
if ($maxphp > 0) $maxmin=min($max, $maxphp); $maxphptoshow = $maxphptoshowparam = '';
if ($maxphp > 0)
{
$maxmin=min($max, $maxphp);
$maxphptoshow = $maxphp;
$maxphptoshowparam = 'upload_max_filesize';
}
if ($maxphp2 > 0)
{
$maxmin=min($max, $maxphp2);
if ($maxphp2 < $maxphp)
{
$maxphptoshow = $maxphp2;
$maxphptoshowparam = 'post_max_size';
}
}
if ($maxmin > 0) if ($maxmin > 0)
{ {
@ -168,7 +188,7 @@ class FormFile
{ {
$langs->load('other'); $langs->load('other');
$out .= ' '; $out .= ' ';
$out .= info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphp), 1); $out .= info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow), 1);
} }
} }
else else

View File

@ -733,40 +733,97 @@ class FormTicket
print ajax_combobox('select'.$htmlname); print ajax_combobox('select'.$htmlname);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Clear list of attached files in send mail form (also stored in session)
*
* @return void
*/
public function clear_attached_files()
{
// phpcs:enable
global $conf,$user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Set tmp user directory
$vardir=$conf->user->dir_output."/".$user->id;
$upload_dir = $vardir.'/temp/'; // TODO Add $keytoavoidconflict in upload_dir path
if (is_dir($upload_dir)) dol_delete_dir_recursive($upload_dir);
$keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined
unset($_SESSION["listofpaths".$keytoavoidconflict]);
unset($_SESSION["listofnames".$keytoavoidconflict]);
unset($_SESSION["listofmimes".$keytoavoidconflict]);
}
/** /**
* Show the form to add message on ticket * Show the form to add message on ticket
* *
* @param string $width Width of form * @param string $width Width of form
* @return void * @return void
*/ */
public function showMessageForm($width = '40%') public function showMessageForm($width = '40%')
{ {
global $conf, $langs, $user, $mysoc; global $conf, $langs, $user, $hookmanager, $form, $mysoc;
$formmail = new FormMail($this->db);
$addfileaction = 'addfile';
if (! is_object($form)) $form=new Form($this->db);
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('other', 'mails')); $langs->loadLangs(array('other', 'mails'));
$addfileaction = 'addfile'; // Clear temp files. Must be done at beginning, before call of triggers
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1'))
{
$this->clear_attached_files();
}
$form = new Form($this->db); // Define output language
$formmail = new FormMail($this->db); $outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->param['langsmodels'];
if (! empty($newlang))
{
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
$outputlangs->load('other');
}
// Get message template for $this->param["models"] into c_email_templates
$arraydefaultmessage = -1;
if ($this->param['models'] != 'none')
{
$model_id=0;
if (array_key_exists('models_id', $this->param))
{
$model_id=$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
}
// Define list of attached files // Define list of attached files
$listofpaths = array(); $listofpaths = array();
$listofnames = array(); $listofnames = array();
$listofmimes = array(); $listofmimes = array();
if (!empty($_SESSION["listofpaths"])) { $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined
$listofpaths = explode(';', $_SESSION["listofpaths"]);
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)
{
$this->add_attached_files($file, basename($file), dol_mimetype($file));
}
}
} }
if (!empty($_SESSION["listofnames"])) { if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';', $_SESSION["listofpaths".$keytoavoidconflict]);
$listofnames = explode(';', $_SESSION["listofnames"]); if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';', $_SESSION["listofnames".$keytoavoidconflict]);
} if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';', $_SESSION["listofmimes".$keytoavoidconflict]);
if (!empty($_SESSION["listofmimes"])) {
$listofmimes = explode(';', $_SESSION["listofmimes"]);
}
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
@ -808,6 +865,7 @@ class FormTicket
print '<form method="post" name="ticket" enctype="multipart/form-data" action="' . $this->param["returnurl"] . '">'; print '<form method="post" name="ticket" enctype="multipart/form-data" action="' . $this->param["returnurl"] . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="' . $this->action . '">'; print '<input type="hidden" name="action" value="' . $this->action . '">';
print '<input type="hidden" name="actionbis" value="add_message">';
foreach ($this->param as $key => $value) { foreach ($this->param as $key => $value) {
print '<input type="hidden" name="' . $key . '" value="' . $value . '">'; print '<input type="hidden" name="' . $key . '" value="' . $value . '">';
} }
@ -1000,7 +1058,7 @@ class FormTicket
$out .= '<div id="attachfile_' . $key . '">'; $out .= '<div id="attachfile_' . $key . '">';
$out .= img_mime($listofnames[$key]) . ' ' . $listofnames[$key]; $out .= img_mime($listofnames[$key]) . ' ' . $listofnames[$key];
if (!$this->withfilereadonly) { 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" id="removedfile_' . $key . '" name="removedfile_' . $key . '" />'; $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>'; $out .= '<br></div>';
} }

View File

@ -2935,22 +2935,23 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
/** /**
* Show picto whatever it's its name (generic function) * Show picto whatever it's its name (generic function)
* *
* @param string $titlealt Text on title tag for tooltip. Not used if param notitle is set to 1. * @param string $titlealt Text on title tag for tooltip. Not used if param notitle is set to 1.
* @param string $picto Name of image file to show ('filenew', ...) * @param string $picto Name of image file to show ('filenew', ...)
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory. * If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img * Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img * Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"')
* @param boolean|int $pictoisfullpath If true or 1, image path is a full path * @param boolean|int $pictoisfullpath If true or 1, image path is a full path
* @param int $srconly Return only content of the src attribute of img. * @param int $srconly Return only content of the src attribute of img.
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
* @param string $alt Force alt for bind people * @param string $alt Force alt for bind people
* @param string $morecss Add more class css on img tag (For example 'myclascss'). Work only if $moreatt is empty. * @param string $morecss Add more class css on img tag (For example 'myclascss'). Work only if $moreatt is empty.
* @return string Return img tag * @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left maring on picto, 0 = No margin left. Works for fontawesome picto only.
* @return string Return img tag
* @see img_object(), img_picto_common() * @see img_object(), img_picto_common()
*/ */
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '') function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '', $marginleftonlyshort = 2)
{ {
global $conf, $langs; global $conf, $langs;
@ -2986,7 +2987,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fa='fas'; if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fa='fas';
$fakey = $pictowithoutext; $fakey = $pictowithoutext;
$facolor = ''; $fasize = ''; $facolor = ''; $fasize = '';
$marginleftonlyshort = 2;
if ($pictowithoutext == 'setup') { if ($pictowithoutext == 'setup') {
$fakey = 'fa-cog'; $fakey = 'fa-cog';
$fasize = '1.4em'; $fasize = '1.4em';

View File

@ -185,5 +185,5 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
print '</center><br>'; print '</center><br>';
} }
print '<div style="margin-left: 50px; margin-right: 50px;">'; print '<div class="ticketlargemargin">';
} }

View File

@ -35,6 +35,8 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
$langs->load("interventions"); $langs->load("interventions");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
$ilink=0; $ilink=0;
foreach($linkedObjectBlock as $key => $objectlink) foreach($linkedObjectBlock as $key => $objectlink)
{ {

View File

@ -567,25 +567,46 @@ if ($step == 3 && $datatoimport)
//print '<tr class="liste_titre"><td colspan="6">'.$langs->trans("FileWithDataToImport").'</td></tr>'; //print '<tr class="liste_titre"><td colspan="6">'.$langs->trans("FileWithDataToImport").'</td></tr>';
// Input file name box // Input file name box
print '<tr class="oddeven"><td colspan="6">'; print '<tr class="oddeven nohover"><td colspan="6">';
print '<input type="file" name="userfile" size="20" maxlength="80"> &nbsp; &nbsp; '; print '<input type="file" name="userfile" size="20" maxlength="80"> &nbsp; &nbsp; ';
$out = (empty($conf->global->MAIN_UPLOAD_DOC)?' disabled':''); $out = (empty($conf->global->MAIN_UPLOAD_DOC)?' disabled':'');
print '<input type="submit" class="button" value="'.$langs->trans("AddFile").'"'.$out.' name="sendit">'; print '<input type="submit" class="button" value="'.$langs->trans("AddFile").'"'.$out.' name="sendit">';
$out=''; $out='';
if (! empty($conf->global->MAIN_UPLOAD_DOC)) if (! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb $max=$conf->global->MAIN_UPLOAD_DOC; // In Kb
$maxphp=@ini_get('upload_max_filesize'); // En inconnu $maxphp=@ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1; if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1;
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024; if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024; if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024; if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
// Now $max and $maxphp are in Kb $maxphp2=@ini_get('post_max_size'); // In unknown
if ($maxphp > 0) $max=min($max, $maxphp); if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
// Now $max and $maxphp and $maxphp2 are in Kb
$maxmin = $max;
$maxphptoshow = $maxphptoshowparam = '';
if ($maxphp > 0)
{
$maxmin=min($max, $maxphp);
$maxphptoshow = $maxphp;
$maxphptoshowparam = 'upload_max_filesize';
}
if ($maxphp2 > 0)
{
$maxmin=min($max, $maxphp2);
if ($maxphp2 < $maxphp)
{
$maxphptoshow = $maxphp2;
$maxphptoshowparam = 'post_max_size';
}
}
$langs->load('other'); $langs->load('other');
$out .= ' '; $out .= ' ';
$out.=info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphp), 1); $out .= info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow), 1);
} }
else else
{ {
@ -846,7 +867,7 @@ if ($step == 4 && $datatoimport)
print '<input type="hidden" name="enclosure" value="'.dol_escape_htmltag($enclosure).'">'; print '<input type="hidden" name="enclosure" value="'.dol_escape_htmltag($enclosure).'">';
print '<div class="marginbottomonly opacitymedium">'; print '<div class="marginbottomonly opacitymedium">';
print $langs->trans("SelectImportFields", img_picto('', 'grip_title', '')).' '; print $langs->trans("SelectImportFields", img_picto('', 'grip_title', '', false, 0, 0, '', '', 0)).' ';
$htmlother->select_import_model($importmodelid, 'importmodelid', $datatoimport, 1); $htmlother->select_import_model($importmodelid, 'importmodelid', $datatoimport, 1);
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
print '</div>'; print '</div>';

View File

@ -102,9 +102,9 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_PAYED','Expense report billed','Executed when an expense report is set as billed','expensereport',204); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_PAYED','Expense report billed','Executed when an expense report is set as billed','expensereport',204);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',204); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',205);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',211);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',212);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',143); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',143);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161);
@ -116,7 +116,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
-- actions not enabled by default (no constant created for that) when we enable module agenda -- actions not enabled by default (no constant created for that) when we enable module agenda
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',41); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',41);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',23); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',23);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','ficheinter',31); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','ficheinter',19);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',140); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',140);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',142); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',142);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',150); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',150);

View File

@ -219,6 +219,7 @@ ErrorURLMustStartWithHttp=URL %s must start with http:// or https://
ErrorNewRefIsAlreadyUsed=Error, the new reference is already used ErrorNewRefIsAlreadyUsed=Error, the new reference is already used
ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible=Error, delete payment linked to a closed invoice is not possible. ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible=Error, delete payment linked to a closed invoice is not possible.
# Warnings # Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.
WarningMandatorySetupNotComplete=Click here to setup mandatory parameters WarningMandatorySetupNotComplete=Click here to setup mandatory parameters
WarningEnableYourModulesApplications=Click here to enable your modules and applications WarningEnableYourModulesApplications=Click here to enable your modules and applications

View File

@ -759,6 +759,7 @@ LinkToSupplierProposal=Link to vendor proposal
LinkToSupplierInvoice=Link to vendor invoice LinkToSupplierInvoice=Link to vendor invoice
LinkToContract=Link to contract LinkToContract=Link to contract
LinkToIntervention=Link to intervention LinkToIntervention=Link to intervention
LinkToTicket=Link to ticket
CreateDraft=Create draft CreateDraft=Create draft
SetToDraft=Back to draft SetToDraft=Back to draft
ClickToEdit=Click to edit ClickToEdit=Click to edit

View File

@ -2,6 +2,7 @@
ProductRef=Product ref. ProductRef=Product ref.
ProductLabel=Product label ProductLabel=Product label
ProductLabelTranslated=Translated product label ProductLabelTranslated=Translated product label
ProductDescription=Product description
ProductDescriptionTranslated=Translated product description ProductDescriptionTranslated=Translated product description
ProductNoteTranslated=Translated product note ProductNoteTranslated=Translated product note
ProductServiceCard=Products/Services card ProductServiceCard=Products/Services card

View File

@ -351,7 +351,7 @@ if (! defined('NOTOKENRENEWAL'))
} }
//var_dump(GETPOST('token').' '.$_SESSION['token'].' - '.$_SESSION['newtoken'].' '.$_SERVER['SCRIPT_FILENAME']); //var_dump(GETPOST('token').' '.$_SESSION['token'].' - '.$_SESSION['newtoken'].' '.$_SERVER['SCRIPT_FILENAME']);
//$dolibarr_nocsrfcheck=1;
// Check token // Check token
//var_dump((! defined('NOCSRFCHECK')).' '.empty($dolibarr_nocsrfcheck).' '.(! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)).' '.$_SERVER['REQUEST_METHOD'].' '.(! GETPOSTISSET('token'))); //var_dump((! defined('NOCSRFCHECK')).' '.empty($dolibarr_nocsrfcheck).' '.(! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)).' '.$_SERVER['REQUEST_METHOD'].' '.(! GETPOSTISSET('token')));
if ((! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && ! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) if ((! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && ! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN))

View File

@ -17,7 +17,7 @@
*/ */
/** /**
* \file htdocs/public/ticket/index.php * \file htdocs/public/ticket/create_ticket.php
* \ingroup ticket * \ingroup ticket
* \brief Display public form to add new ticket * \brief Display public form to add new ticket
*/ */

View File

@ -77,7 +77,7 @@ print '</div>';
print '</div>'; print '</div>';
// End of page // End of page
htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -210,7 +210,8 @@ if ($action == "view_ticketlist")
't.date_read' => array('label' => $langs->trans("TicketReadOn"), 'checked' => 0), 't.date_read' => array('label' => $langs->trans("TicketReadOn"), 'checked' => 0),
't.date_close' => array('label' => $langs->trans("TicketCloseOn"), 'checked' => 0), 't.date_close' => array('label' => $langs->trans("TicketCloseOn"), 'checked' => 0),
't.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1), 't.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1),
't.fk_statut' => array('label' => $langs->trans("Statut"), 'checked' => 1), //'t.track_id' => array('label' => $langs->trans("IDTracking"), 'checked' => 0),
't.fk_statut' => array('label' => $langs->trans("Statut"), 'checked' => 1),
't.subject' => array('label' => $langs->trans("Subject"), 'checked' => 1), 't.subject' => array('label' => $langs->trans("Subject"), 'checked' => 1),
'type.code' => array('label' => $langs->trans("Type"), 'checked' => 1), 'type.code' => array('label' => $langs->trans("Type"), 'checked' => 1),
'category.code' => array('label' => $langs->trans("Category"), 'checked' => 1), 'category.code' => array('label' => $langs->trans("Category"), 'checked' => 1),
@ -218,7 +219,7 @@ if ($action == "view_ticketlist")
't.progress' => array('label' => $langs->trans("Progression"), 'checked' => 0), 't.progress' => array('label' => $langs->trans("Progression"), 'checked' => 0),
//'t.fk_contract' => array('label' => $langs->trans("Contract"), 'checked' => 0), //'t.fk_contract' => array('label' => $langs->trans("Contract"), 'checked' => 0),
't.fk_user_create' => array('label' => $langs->trans("Author"), 'checked' => 1), 't.fk_user_create' => array('label' => $langs->trans("Author"), 'checked' => 1),
't.fk_user_assign' => array('label' => $langs->trans("AuthorAssign"), 'checked' => 0), 't.fk_user_assign' => array('label' => $langs->trans("AssignedTo"), 'checked' => 0),
//'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))), //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))),
//'t.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), //'t.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500),
@ -236,37 +237,37 @@ if ($action == "view_ticketlist")
} }
if (!empty($search_subject)) { if (!empty($search_subject)) {
$filter['t.subject'] = $search_subject; $filter['t.subject'] = $search_subject;
$param .= '&search_subject=' . $search_subject; $param .= '&search_subject=' .urlencode($search_subject);
} }
if (!empty($search_type)) { if (!empty($search_type)) {
$filter['t.type_code'] = $search_type; $filter['t.type_code'] = $search_type;
$param .= '&search_type=' . $search_type; $param .= '&search_type=' . urlencode($search_type);
} }
if (!empty($search_category)) { if (!empty($search_category)) {
$filter['t.category_code'] = $search_category; $filter['t.category_code'] = $search_category;
$param .= '&search_category=' . $search_category; $param .= '&search_category=' . urlencode($search_category);
} }
if (!empty($search_severity)) { if (!empty($search_severity)) {
$filter['t.severity_code'] = $search_severity; $filter['t.severity_code'] = $search_severity;
$param .= '&search_severity=' . $search_severity; $param .= '&search_severity=' . urlencode($search_severity);
} }
if (!empty($search_fk_user_assign)) { if (!empty($search_fk_user_assign)) {
// -1 value = all so no filter // -1 value = all so no filter
if ($search_fk_user_assign > 0) { if ($search_fk_user_assign > 0) {
$filter['t.fk_user_assign'] = $search_fk_user_assign; $filter['t.fk_user_assign'] = $search_fk_user_assign;
$param .= '&search_fk_user_assign=' . $search_fk_user_assign; $param .= '&search_fk_user_assign=' . urlencode($search_fk_user_assign);
} }
} }
if (!empty($search_fk_user_create)) { if (!empty($search_fk_user_create)) {
// -1 value = all so no filter // -1 value = all so no filter
if ($search_fk_user_create > 0) { if ($search_fk_user_create > 0) {
$filter['t.fk_user_create'] = $search_fk_user_create; $filter['t.fk_user_create'] = $search_fk_user_create;
$param .= '&search_fk_user_create=' . $search_fk_user_create; $param .= '&search_fk_user_create=' . urlencode($search_fk_user_create);
} }
} }
if ((isset($search_fk_status) && $search_fk_status != '') && $search_fk_status != '-1' && $search_fk_status != 'non_closed') { if ((isset($search_fk_status) && $search_fk_status != '') && $search_fk_status != '-1' && $search_fk_status != 'non_closed') {
$filter['t.fk_statut'] = $search_fk_status; $filter['t.fk_statut'] = $search_fk_status;
$param .= '&search_fk_status=' . $search_fk_status; $param .= '&search_fk_status=' . urlencode($search_fk_status);
} }
if (isset($search_fk_status) && $search_fk_status == 'non_closed') { if (isset($search_fk_status) && $search_fk_status == 'non_closed') {
$filter['t.fk_statut'] = array(0, 1, 3, 4, 5, 6); $filter['t.fk_statut'] = array(0, 1, 3, 4, 5, 6);
@ -387,62 +388,7 @@ if ($action == "view_ticketlist")
print '<table class="liste ' . ($moreforfilter ? "listwithfilterbefore" : "") . '">'; print '<table class="liste ' . ($moreforfilter ? "listwithfilterbefore" : "") . '">';
print '<tr class="liste_titre">'; // Filter bar
if (!empty($arrayfields['t.datec']['checked'])) {
print_liste_field_titre($arrayfields['t.datec']['label'], $url_page_current, 't.datec', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.date_read']['checked'])) {
print_liste_field_titre($arrayfields['t.date_read']['label'], $url_page_current, 't.date_read', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.date_close']['checked'])) {
print_liste_field_titre($arrayfields['t.date_close']['label'], $url_page_current, 't.date_close', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.ref']['checked'])) {
print_liste_field_titre($arrayfields['t.ref']['label'], $url_page_current, 't.ref', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.subject']['checked'])) {
print_liste_field_titre($arrayfields['t.subject']['label']);
}
if (!empty($arrayfields['type.code']['checked'])) {
print_liste_field_titre($arrayfields['type.code']['label'], $url_page_current, 'type.code', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['category.code']['checked'])) {
print_liste_field_titre($arrayfields['category.code']['label'], $url_page_current, 'category.code', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['severity.code']['checked'])) {
print_liste_field_titre($arrayfields['severity.code']['label'], $url_page_current, 'severity.code', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.progress']['checked'])) {
print_liste_field_titre($arrayfields['t.progress']['label'], $url_page_current, 't.progress', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.fk_user_create']['checked'])) {
print_liste_field_titre($arrayfields['t.fk_user_create']['label'], $url_page_current, 't.fk_user_create', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.fk_user_assign']['checked'])) {
print_liste_field_titre($arrayfields['t.fk_user_assign']['label'], $url_page_current, 't.fk_user_assign', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.tms']['checked'])) {
print_liste_field_titre($arrayfields['t.tms']['label'], $url_page_current, 't.tms', '', $param, '', $sortfield, $sortorder);
}
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (!empty($arrayfields["ef." . $key]['checked'])) {
$align = $extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key], $url_page_current, "ef." . $key, "", $param, ($align ? 'align="' . $align . '"' : ''), $sortfield, $sortorder);
}
}
}
if (!empty($arrayfields['t.fk_statut']['checked'])) {
print_liste_field_titre($arrayfields['t.fk_statut']['label'], $url_page_current, 't.fk_statut', '', $param, '', $sortfield, $sortorder);
}
print_liste_field_titre($selectedfields, $url_page_current, "", '', '', 'align="right"', $sortfield, $sortorder, 'maxwidthsearch ');
print '</tr>';
/*
* Filter bar
*/
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($arrayfields['t.datec']['checked'])) { if (!empty($arrayfields['t.datec']['checked'])) {
@ -462,13 +408,13 @@ if ($action == "view_ticketlist")
if (!empty($arrayfields['t.subject']['checked'])) { if (!empty($arrayfields['t.subject']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_subject" value="' . $search_subject . '" size="20">'; print '<input type="text" class="flat maxwidth100" name="search_subject" value="' . $search_subject . '">';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['type.code']['checked'])) { if (!empty($arrayfields['type.code']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$formTicket->selectTypesTickets($search_type, 'search_type', '', 2, 1, 1); $formTicket->selectTypesTickets($search_type, 'search_type', '', 2, 1, 1, 0, 'maxwidth150');
print '</td>'; print '</td>';
} }
@ -523,6 +469,59 @@ if ($action == "view_ticketlist")
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Field title
print '<tr class="liste_titre">';
if (!empty($arrayfields['t.datec']['checked'])) {
print_liste_field_titre($arrayfields['t.datec']['label'], $url_page_current, 't.datec', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.date_read']['checked'])) {
print_liste_field_titre($arrayfields['t.date_read']['label'], $url_page_current, 't.date_read', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.date_close']['checked'])) {
print_liste_field_titre($arrayfields['t.date_close']['label'], $url_page_current, 't.date_close', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.ref']['checked'])) {
print_liste_field_titre($arrayfields['t.ref']['label'], $url_page_current, 't.ref', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.subject']['checked'])) {
print_liste_field_titre($arrayfields['t.subject']['label']);
}
if (!empty($arrayfields['type.code']['checked'])) {
print_liste_field_titre($arrayfields['type.code']['label'], $url_page_current, 'type.code', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['category.code']['checked'])) {
print_liste_field_titre($arrayfields['category.code']['label'], $url_page_current, 'category.code', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['severity.code']['checked'])) {
print_liste_field_titre($arrayfields['severity.code']['label'], $url_page_current, 'severity.code', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.progress']['checked'])) {
print_liste_field_titre($arrayfields['t.progress']['label'], $url_page_current, 't.progress', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.fk_user_create']['checked'])) {
print_liste_field_titre($arrayfields['t.fk_user_create']['label'], $url_page_current, 't.fk_user_create', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.fk_user_assign']['checked'])) {
print_liste_field_titre($arrayfields['t.fk_user_assign']['label'], $url_page_current, 't.fk_user_assign', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.tms']['checked'])) {
print_liste_field_titre($arrayfields['t.tms']['label'], $url_page_current, 't.tms', '', $param, '', $sortfield, $sortorder);
}
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (!empty($arrayfields["ef." . $key]['checked'])) {
$align = $extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key], $url_page_current, "ef." . $key, "", $param, ($align ? 'align="' . $align . '"' : ''), $sortfield, $sortorder);
}
}
}
if (!empty($arrayfields['t.fk_statut']['checked'])) {
print_liste_field_titre($arrayfields['t.fk_statut']['label'], $url_page_current, 't.fk_statut', '', $param, '', $sortfield, $sortorder);
}
print_liste_field_titre($selectedfields, $url_page_current, "", '', '', 'align="right"', $sortfield, $sortorder, 'maxwidthsearch ');
print '</tr>';
while ($obj = $db->fetch_object($resql)) while ($obj = $db->fetch_object($resql))
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -550,7 +549,7 @@ if ($action == "view_ticketlist")
// Ref // Ref
if (!empty($arrayfields['t.ref']['checked'])) { if (!empty($arrayfields['t.ref']['checked'])) {
print '<td>'; print '<td class="nowraponall">';
print $obj->ref; print $obj->ref;
print '</td>'; print '</td>';
} }
@ -612,8 +611,6 @@ if ($action == "view_ticketlist")
$user_assign->lastname = (!empty($obj->user_assign_lastname) ? $obj->user_assign_lastname : ''); $user_assign->lastname = (!empty($obj->user_assign_lastname) ? $obj->user_assign_lastname : '');
$user_assign->id = (!empty($obj->fk_user_assign) ? $obj->fk_user_assign : ''); $user_assign->id = (!empty($obj->fk_user_assign) ? $obj->fk_user_assign : '');
print $user_assign->getFullName($langs); print $user_assign->getFullName($langs);
} else {
print $langs->trans('None');
} }
print '</td>'; print '</td>';
} }
@ -705,7 +702,7 @@ if ($action == "view_ticketlist")
print "</div>"; print "</div>";
// End of page // End of page
htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -17,7 +17,7 @@
*/ */
/** /**
* \file htdocs/public/ticket/index.php * \file htdocs/public/ticket/view.php
* \ingroup ticket * \ingroup ticket
* \brief Public file to add and manage ticket * \brief Public file to add and manage ticket
*/ */
@ -48,8 +48,9 @@ $langs->loadLangs(array("companies","other","ticket"));
// Get parameters // Get parameters
$track_id = GETPOST('track_id', 'alpha'); $track_id = GETPOST('track_id', 'alpha');
$action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha');
$email = GETPOST('email', 'alpha'); $action = GETPOST('action', 'aZ09');
$email = GETPOST('email', 'alpha');
if (GETPOST('btn_view_ticket')) { if (GETPOST('btn_view_ticket')) {
unset($_SESSION['email_customer']); unset($_SESSION['email_customer']);
@ -65,7 +66,17 @@ $object = new ActionsTicket($db);
* Actions * Actions
*/ */
if ($action == "view_ticket" || $action == "add_message" || $action == "close" || $action == "confirm_public_close" || $action == "new_public_message") { if ($cancel)
{
if (! empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
$action='view_ticket';
}
if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close" || $action == "add_message") {
$error = 0; $error = 0;
$display_ticket = false; $display_ticket = false;
if (!strlen($track_id)) { if (!strlen($track_id)) {
@ -73,7 +84,6 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketTrackId"))); array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketTrackId")));
$action = ''; $action = '';
} }
if (!strlen($email)) { if (!strlen($email)) {
$error++; $error++;
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email"))); array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email")));
@ -89,25 +99,52 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
if (!$error) { if (!$error) {
$ret = $object->fetch('', '', $track_id); $ret = $object->fetch('', '', $track_id);
if ($ret && $object->dao->id > 0) { if ($ret && $object->dao->id > 0) {
// vérifie si l'adresse email est bien dans les contacts du ticket // Check if emails provided is the one of author
$contacts = $object->dao->liste_contact(-1, 'external'); if ($object->dao->origin_email == $email)
foreach ($contacts as $contact) { {
if ($contact['email'] == $email) { $display_ticket = true;
$display_ticket = true; $_SESSION['email_customer'] = $email;
$_SESSION['email_customer'] = $email; }
break; // Check if emails provided is inside list of contacts
} else { else {
$display_ticket = false; $contacts = $object->dao->liste_contact(-1, 'external');
} foreach ($contacts as $contact) {
} if ($contact['email'] == $email) {
$display_ticket = true;
if ($object->dao->fk_soc > 0) { $_SESSION['email_customer'] = $email;
break;
} else {
$display_ticket = false;
}
}
}
// Check email of thirdparty of ticket
if ($object->dao->fk_soc > 0 || $object->dao->socid > 0) {
$object->dao->fetch_thirdparty(); $object->dao->fetch_thirdparty();
if ($email == $object->dao->thirdparty->email) {
$display_ticket = true;
$_SESSION['email_customer'] = $email;
}
} }
// Check if email is email of creator
if ($email == $object->dao->origin_email || $email == $object->dao->thirdparty->email) { if ($object->dao->fk_user_create > 0)
$display_ticket = true; {
$_SESSION['email_customer'] = $email; $tmpuser = new User($db);
$tmpuser->fetch($object->dao->fk_user_create);
if ($email == $tmpuser->email) {
$display_ticket = true;
$_SESSION['email_customer'] = $email;
}
}
// Check if email is email of creator
if ($object->dao->fk_user_assign > 0 && $object->dao->fk_user_assign != $object->dao->fk_user_create)
{
$tmpuser = new User($db);
$tmpuser->fetch($object->dao->fk_user_assign);
if ($email == $tmpuser->email) {
$display_ticket = true;
$_SESSION['email_customer'] = $email;
}
} }
} else { } else {
$error++; $error++;
@ -116,14 +153,56 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
} }
} }
if (! $error && $action == 'confirm_public_close' && $display_ticket)
{
if ($object->dao->close($user)) {
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
$url = 'view.php?action=view_ticket&track_id=' . GETPOST('track_id', 'alpha');
header("Location: " . $url);
} else {
$action = '';
setEventMessages($object->error, $object->errors, 'errors');
}
}
if (! $error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message'))
{
// TODO Add message...
$ret = $object->dao->newMessage($user, $action, 0);
if (! $error)
{
$action = 'view_ticket';
}
}
if ($error || $errors) { if ($error || $errors) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action = ''; if ($action == "add_message")
{
$action = 'presend';
}
else
{
$action = '';
}
} }
} }
//var_dump($action);
//$object->doActions($action); //$object->doActions($action);
// Actions to send emails (for ticket, we need to manage the addfile and removefile only)
$trigger_name='TICKET_SENTBYMAIL';
$paramname='id';
$autocopy='MAIN_MAIL_AUTOCOPY_TICKET_TO'; // used to know the automatic BCC to add
$trackid='tic'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
/* /*
@ -144,13 +223,13 @@ $arrayofcss = array('/ticket/css/styles.css.php');
llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
print '<div style="margin: 0 auto; width:60%" class="ticketpublicarea">'; print '<div style="margin: 0 auto;" class="ticketpublicarea">';
if ($action == "view_ticket" || $action == "add_message" || $action == "close" || $action == "confirm_public_close") { if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close") {
if ($display_ticket) { if ($display_ticket) {
// Confirmation close // Confirmation close
if ($action == 'close') { if ($action == 'close') {
print $form->form_confirm($_SERVER["PHP_SELF"] . "?track_id=" . $track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1); print $form->formconfirm($_SERVER["PHP_SELF"] . "?track_id=" . $track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1);
} }
print '<div id="form_view_ticket">'; print '<div id="form_view_ticket">';
@ -230,8 +309,6 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
$fuser = new User($db); $fuser = new User($db);
$fuser->fetch($object->dao->fk_user_assign); $fuser->fetch($object->dao->fk_user_assign);
print $fuser->getFullName($langs, 1); print $fuser->getFullName($langs, 1);
} else {
print $langs->trans('None');
} }
print '</td></tr>'; print '</td></tr>';
@ -246,21 +323,25 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
print '<div style="clear: both; margin-top: 1.5em;"></div>'; print '<div style="clear: both; margin-top: 1.5em;"></div>';
if ($action == 'add_message') { if ($action == 'presend') {
print load_fiche_titre($langs->trans('TicketAddMessage'), '', 'messages@ticket'); print load_fiche_titre($langs->trans('TicketAddMessage'), '', 'messages@ticket');
$formticket = new FormTicket($db); $formticket = new FormTicket($db);
$formticket->action = "new_public_message"; $formticket->action = "add_message";
$formticket->track_id = $object->dao->track_id; $formticket->track_id = $object->dao->track_id;
$formticket->id = $object->dao->id; $formticket->id = $object->dao->id;
$formticket->param = array('fk_user_create' => '-1'); $formticket->param = array('track_id' => $object->dao->track_id, 'fk_user_create' => '-1', 'returnurl' => DOL_URL_ROOT.'/public/ticket/view.php');
$formticket->withfile = 2; $formticket->withfile = 2;
$formticket->withcancel = 1;
$formticket->showMessageForm('100%'); $formticket->showMessageForm('100%');
} else { }
print '<form method="post" id="form_view_ticket_list" name="form_view_ticket_list" enctype="multipart/form-data" action="' . dol_buildpath('/public/ticket/list.php', 1) . '">';
if ($action != 'presend') {
print '<form method="post" id="form_view_ticket_list" name="form_view_ticket_list" enctype="multipart/form-data" action="'.DOL_URL_ROOT.'/public/ticket/list.php">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="view_ticketlist">'; print '<input type="hidden" name="action" value="view_ticketlist">';
print '<input type="hidden" name="track_id" value="'.$object->dao->track_id.'">'; print '<input type="hidden" name="track_id" value="'.$object->dao->track_id.'">';
@ -269,15 +350,16 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
print "</form>\n"; print "</form>\n";
print '<div class="tabsAction">'; print '<div class="tabsAction">';
// List ticket
print '<div class="inline-block divButAction"><a class="butAction" href="javascript:$(\'#form_view_ticket_list\').submit();">' . $langs->trans('ViewMyTicketList') . '</a></div>';
if ($object->dao->fk_statut < 8) { // List ticket
print '<div class="inline-block divButAction"><a class="left" style="padding-right: 50px" href="javascript:$(\'#form_view_ticket_list\').submit();">' . $langs->trans('ViewMyTicketList') . '</a></div>';
if ($object->dao->fk_statut < Ticket::STATUS_CLOSED) {
// New message // New message
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=add_message&track_id=' . $object->dao->track_id . '">' . $langs->trans('AddMessage') . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=presend&mode=init&track_id=' . $object->dao->track_id . '">' . $langs->trans('AddMessage') . '</a></div>';
// Close ticket // Close ticket
if ($object->dao->fk_statut > 0 && $object->dao->fk_statut < 8) { if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=close&track_id=' . $object->dao->track_id . '">' . $langs->trans('CloseTicket') . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=close&track_id=' . $object->dao->track_id . '">' . $langs->trans('CloseTicket') . '</a></div>';
} }
} }
@ -287,13 +369,7 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
// Message list // Message list
print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'messages@ticket'); print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'messages@ticket');
$object->viewTicketMessages(false); $object->viewTicketMessages(false, true, $object->dao);
print '<br>';
// Logs list
print load_fiche_titre($langs->trans('TicketHistory'), '', 'history@ticket');
$object->viewTicketLogs(false);
} 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>'; print '<div class="error">Not Allowed<br><a href="' . $_SERVER['PHP_SELF'] . '?track_id=' . $object->dao->track_id . '">' . $langs->trans('Back') . '</a></div>';
} }
@ -324,7 +400,7 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" |
print "</div>"; print "</div>";
// End of page // End of page
htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -5251,10 +5251,26 @@ div.tabsElem a.tab {
/* ============================================================================== */ /* ============================================================================== */
/* Ticket module */ /* Ticket module */
/* ============================================================================== */ /* ============================================================================== */
.ticketpublicarea {
width: 70%;
}
.publicnewticketform { .publicnewticketform {
margin-top: 25px !important; margin-top: 25px !important;
} }
.ticketlargemargin {
padding-left: 50px;
padding-right: 50px;
}
@media only screen and (max-width: 767px)
{
.ticketlargemargin {
padding-left: 5px; padding-right: 5px;
}
.ticketpublicarea {
width: 100%;
}
}
#cd-timeline { #cd-timeline {
position: relative; position: relative;
padding: 2em 0; padding: 2em 0;

View File

@ -5404,9 +5404,25 @@ border-top-right-radius: 6px;
/* Ticket module */ /* Ticket module */
/* ============================================================================== */ /* ============================================================================== */
.ticketpublicarea {
width: 70%;
}
.publicnewticketform { .publicnewticketform {
margin-top: 25px !important; margin-top: 25px !important;
} }
.ticketlargemargin {
padding-left: 50px;
padding-right: 50px;
}
@media only screen and (max-width: 767px)
{
.ticketlargemargin {
padding-left: 5px; padding-right: 5px;
}
.ticketpublicarea {
width: 100%;
}
}
#cd-timeline { #cd-timeline {
position: relative; position: relative;

View File

@ -75,7 +75,7 @@ if (empty($action) && empty($id) && empty($ref)) $action='view';
//Select mail models is same action as add_message //Select mail models is same action as add_message
if (GETPOST('modelselected', 'alpha')) { if (GETPOST('modelselected', 'alpha')) {
$action = 'create_message'; $action = 'presend';
} }
// Load object // Load object
@ -255,17 +255,17 @@ if (GETPOST('add', 'alpha') && $user->rights->ticket->write) {
if ($action == 'edit' && $user->rights->ticket->write) { if ($action == 'edit' && $user->rights->ticket->write) {
$error = 0; $error = 0;
if ($object->fetch(GETPOST('id')) < 0) { if ($object->fetch(GETPOST('id', 'int')) < 0) {
$error++; $error++;
array_push($object->errors, $langs->trans("ErrorTicketIsNotValid")); array_push($object->errors, $langs->trans("ErrorTicketIsNotValid"));
$_GET["action"] = $_POST["action"] = ''; $_GET["action"] = $_POST["action"] = '';
} }
} }
if (GETPOST('update') && GETPOST('id') && $user->rights->ticket->write) { if (GETPOST('update', 'alpha') && GETPOST('id', 'int') && $user->rights->ticket->write) {
$error = 0; $error = 0;
$ret = $object->fetch(GETPOST('id')); $ret = $object->fetch(GETPOST('id', 'int'));
if ($ret < 0) { if ($ret < 0) {
$error++; $error++;
array_push($object->errors, $langs->trans("ErrorTicketIsNotValid")); array_push($object->errors, $langs->trans("ErrorTicketIsNotValid"));
@ -385,7 +385,7 @@ if ($action == "add_message" && GETPOST('btn_add_message') && $user->rights->tic
exit; exit;
} else { } else {
setEventMessages($object->error, null, 'errors'); setEventMessages($object->error, null, 'errors');
$action = 'create_message'; $action = 'presend';
} }
} }
@ -394,9 +394,6 @@ if ($action == "confirm_close" && GETPOST('confirm', 'alpha') == 'yes' && $user-
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
if ($object->close($user)) { if ($object->close($user)) {
// Log action in ticket logs table
$log_action = $langs->trans('TicketLogClosedBy', $user->getFullName($langs));
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs'); setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
$url = 'card.php?action=view&track_id=' . GETPOST('track_id', 'alpha'); $url = 'card.php?action=view&track_id=' . GETPOST('track_id', 'alpha');
@ -409,13 +406,15 @@ if ($action == "confirm_close" && GETPOST('confirm', 'alpha') == 'yes' && $user-
if ($action == "confirm_public_close" && GETPOST('confirm', 'alpha') == 'yes') { if ($action == "confirm_public_close" && GETPOST('confirm', 'alpha') == 'yes') {
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
if (($_SESSION['email_customer'] == $object->origin_email || $_SESSION['email_customer'] == $object->thirdparty->email) && $object->close()) { if ($_SESSION['email_customer'] == $object->origin_email || $_SESSION['email_customer'] == $object->thirdparty->email) {
$object->close($user);
// Log action in ticket logs table // Log action in ticket logs table
$log_action = $langs->trans('TicketLogClosedBy', $_SESSION['email_customer']); $log_action = $langs->trans('TicketLogClosedBy', $_SESSION['email_customer']);
setEventMessages('<div class="confirm">' . $langs->trans('TicketMarkedAsClosed') . '</div>', null, 'mesgs'); setEventMessages('<div class="confirm">' . $langs->trans('TicketMarkedAsClosed') . '</div>', null, 'mesgs');
$url = 'view.php?action=view_ticket&track_id=' . GETPOST('track_id', 'alpha'); $url = 'card.php?action=view_ticket&track_id=' . GETPOST('track_id', 'alpha');
header("Location: " . $url); header("Location: " . $url);
} else { } else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -477,7 +476,6 @@ if ($action == 'setsubject') {
} }
} }
if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) { if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
// prevent browser refresh from reopening ticket several times // prevent browser refresh from reopening ticket several times
@ -601,6 +599,8 @@ $autocopy='MAIN_MAIL_AUTOCOPY_TICKET_TO'; // used to know the automatic BCC to
$trackid='tic'.$object->id; $trackid='tic'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Set $action to correct value for the case we used presend action to add a message
if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage';
/* /*
@ -640,7 +640,7 @@ if ($action == 'create' || $action == 'presend')
$formticket->showForm(1); $formticket->showForm(1);
} }
if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'create_message' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen'
|| $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') || $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink')
{ {
if ($res > 0) if ($res > 0)
@ -824,9 +824,11 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border tableforfield centpercent">';
// Track ID // Track ID
print '<tr><td class="titlefield">' . $langs->trans("TicketTrackId") . '</td><td>'; print '<tr><td class="titlefield">' . $langs->trans("TicketTrackId") . '</td><td>';
@ -956,7 +958,6 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
// View Original message // View Original message
$actionobject->viewTicketOriginalMessage($user, $action, $object); $actionobject->viewTicketOriginalMessage($user, $action, $object);
// Classification of ticket // Classification of ticket
print '<form method="post" name="formticketproperties" action="' . $url_page_current . '">'; print '<form method="post" name="formticketproperties" action="' . $url_page_current . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
@ -1011,29 +1012,20 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
// Type // Type
print '<tr><td class="titlefield">' . $langs->trans("Type") . '</td><td>'; print '<tr><td class="titlefield">' . $langs->trans("Type") . '</td><td>';
print $langs->getLabelFromKey($db, $object->type_code, 'c_ticket_type', 'code', 'label'); print $langs->getLabelFromKey($db, $object->type_code, 'c_ticket_type', 'code', 'label');
/*if ($user->admin && !$noadmininfo) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}*/
print '</td></tr>'; print '</td></tr>';
// Group // Group
print '<tr><td>' . $langs->trans("TicketGroup") . '</td><td>'; print '<tr><td>' . $langs->trans("TicketGroup") . '</td><td>';
print $langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label'); print $langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label');
/*if ($user->admin && !$noadmininfo) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}*/
print '</td></tr>'; print '</td></tr>';
// Severity // Severity
print '<tr><td>' . $langs->trans("TicketSeverity") . '</td><td>'; print '<tr><td>' . $langs->trans("TicketSeverity") . '</td><td>';
print $langs->getLabelFromKey($db, $object->severity_code, 'c_ticket_severity', 'code', 'label'); print $langs->getLabelFromKey($db, $object->severity_code, 'c_ticket_severity', 'code', 'label');
/*if ($user->admin && !$noadmininfo) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}*/
print '</td></tr>'; print '</td></tr>';
} }
print '</table>'; // End table actions print '</table>'; // End table actions
print '</div>';
print '</form>'; print '</form>';
print '</div>';
// Display navbar with links to change ticket status // Display navbar with links to change ticket status
print '<!-- navbar with status -->'; print '<!-- navbar with status -->';
@ -1163,7 +1155,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
// Buttons for actions // Buttons for actions
if ($action != 'presend' && $action != 'editline') { if ($action != 'presend' && $action != 'presend_addmessage' && $action != 'editline') {
print '<div class="tabsAction">'."\n"; print '<div class="tabsAction">'."\n";
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@ -1172,8 +1164,8 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
if (empty($reshook)) if (empty($reshook))
{ {
// Show link to add a message (if read and not closed) // Show link to add a message (if read and not closed)
if ($object->fk_statut < Ticket::STATUS_CLOSED && $action != "create_message") { if ($object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->track_id . '&action=create_message">' . $langs->trans('TicketAddMessage') . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->track_id . '&action=presend_addmessage&mode=init">' . $langs->trans('TicketAddMessage') . '</a></div>';
} }
// Link to create an intervention // Link to create an intervention
@ -1208,8 +1200,10 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
if (GETPOST('modelselected')) { if (GETPOST('modelselected')) {
$action = 'presend'; $action = 'presend';
} }
// Set $action to correct value for the case we used presend action to add a message
if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage';
if ($action != 'create_message') if ($action != 'presend' && $action != 'presend_addmessage')
{ {
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre print '<a name="builddoc"></a>'; // ancre
@ -1225,9 +1219,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
$formactions = new FormActions($db); $formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'ticket', $socid, 1); $somethingshown = $formactions->showactions($object, 'ticket', $socid, 1);
print '</div></div>'; print '</div></div></div>';
print '</div><!-- fichecenter -->';
print '<br style="clear: both">';
} }
else else
{ {
@ -1243,23 +1235,23 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
$substitutionarray['__THIRDPARTY_NAME__'] = $object->thirdparty->name; $substitutionarray['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
} }
$substitutionarray['__SIGNATURE__'] = $user->signature; $substitutionarray['__SIGNATURE__'] = $user->signature;
$substitutionarray['__TICKETSUP_TRACKID__'] = $object->track_id; $substitutionarray['__TICKET_TRACKID__'] = $object->track_id;
$substitutionarray['__TICKETSUP_REF__'] = $object->ref; $substitutionarray['__TICKET_REF__'] = $object->ref;
$substitutionarray['__TICKETSUP_SUBJECT__'] = $object->subject; $substitutionarray['__TICKET_SUBJECT__'] = $object->subject;
$substitutionarray['__TICKETSUP_TYPE__'] = $object->type_code; $substitutionarray['__TICKET_TYPE__'] = $object->type_code;
$substitutionarray['__TICKETSUP_SEVERITY__'] = $object->severity_code; $substitutionarray['__TICKET_SEVERITY__'] = $object->severity_code;
$substitutionarray['__TICKETSUP_CATEGORY__'] = $object->category_code; // For backward compatibility $substitutionarray['__TICKET_CATEGORY__'] = $object->category_code; // For backward compatibility
$substitutionarray['__TICKETSUP_ANALYTIC_CODE__'] = $object->category_code; $substitutionarray['__TICKET_ANALYTIC_CODE__'] = $object->category_code;
$substitutionarray['__TICKETSUP_MESSAGE__'] = $object->message; $substitutionarray['__TICKET_MESSAGE__'] = $object->message;
$substitutionarray['__TICKETSUP_PROGRESSION__'] = $object->progress; $substitutionarray['__TICKET_PROGRESSION__'] = $object->progress;
if ($object->fk_user_assign > 0) { if ($object->fk_user_assign > 0) {
$userstat->fetch($object->fk_user_assign); $userstat->fetch($object->fk_user_assign);
$substitutionarray['__TICKETSUP_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); $substitutionarray['__TICKET_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
} }
if ($object->fk_user_create > 0) { if ($object->fk_user_create > 0) {
$userstat->fetch($object->fk_user_create); $userstat->fetch($object->fk_user_create);
$substitutionarray['__TICKETSUP_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); $substitutionarray['__TICKET_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
} }
foreach ($substitutionarray as $key => $val) { foreach ($substitutionarray as $key => $val) {
$help.=$key.' -> '.$langs->trans($val).'<br>'; $help.=$key.' -> '.$langs->trans($val).'<br>';

View File

@ -167,72 +167,12 @@ class ActionsTicket
} }
} }
/**
* View html list of logs
*
* @param boolean $show_user Show user who make action
* @return void
*/
public function viewTicketLogs($show_user = true)
{
global $conf, $langs;
// Load logs in cache
$ret = $this->dao->loadCacheLogsTicket();
if (is_array($this->dao->cache_logs_ticket) && count($this->dao->cache_logs_ticket) > 0) {
print '<table class="border" style="width:100%;">';
print '<tr class="liste_titre">';
print '<th>';
print $langs->trans('DateCreation');
print '</th>';
if ($show_user) {
print '<th>';
print $langs->trans('User');
print '</th>';
}
foreach ($this->dao->cache_logs_ticket as $id => $arraylogs) {
print '<tr class="oddeven">';
print '<td><strong>';
print dol_print_date($arraylogs['datec'], 'dayhour');
print '</strong></td>';
if ($show_user) {
print '<td>';
if ($arraylogs['fk_user_create'] > 0) {
$userstat = new User($this->db);
$res = $userstat->fetch($arraylogs['fk_user_create']);
if ($res) {
print $userstat->getNomUrl(1);
}
}
print '</td>';
}
print '</tr>';
print '<tr class="oddeven">';
print '<td colspan="2">';
print dol_nl2br($arraylogs['message']);
print '</td>';
print '</tr>';
}
print '</table>';
} else {
print '<div class="info">' . $langs->trans('NoLogForThisTicket') . '</div>';
}
}
/** /**
* Show ticket original message * Show ticket original message
* *
* @param User $user User wich display * @param User $user User wich display
* @param string $action Action mode * @param string $action Action mode
* @param Ticket $object Object ticket * @param Ticket $object Object ticket
* @return void * @return void
*/ */
public function viewTicketOriginalMessage($user, $action, $object) public function viewTicketOriginalMessage($user, $action, $object)
@ -280,7 +220,7 @@ class ActionsTicket
//print '<div>' . $object->message . '</div>'; //print '<div>' . $object->message . '</div>';
} }
if ($user->rights->ticket->manage && $action == 'edit_message_init') { if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
print '<div class="center">'; print '<div class="center">';
print ' <input type="submit" class="button" value="' . $langs->trans('Modify') . '">'; print ' <input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print ' <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '">'; print ' <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '">';
@ -289,33 +229,42 @@ class ActionsTicket
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '</div>';
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
// MESSAGE
print '</form>';
}
} }
/** /**
* View html list of message for ticket * View html list of message for ticket
* *
* @param boolean $show_private Show private messages * @param boolean $show_private Show private messages
* @param boolean $show_user Show user who make action * @param boolean $show_user Show user who make action
* @return void * @param Ticket $object Object ticket
* @return void
*/ */
public function viewTicketMessages($show_private, $show_user = true) public function viewTicketMessages($show_private, $show_user, $object)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
// Load logs in cache // Load logs in cache
$ret = $this->dao->loadCacheMsgsTicket(); $ret = $this->dao->loadCacheMsgsTicket();
$action = GETPOST('action'); if ($ret < 0) dol_print_error($this->dao->db);
$this->viewTicketOriginalMessage($user, $action); $action = GETPOST('action', 'alpha');
if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) { $this->viewTicketOriginalMessage($user, $action, $object);
print load_fiche_titre($langs->trans('TicketMailExchanges'));
if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0)
{
print '<table class="border" style="width:100%;">'; print '<table class="border" style="width:100%;">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'; print '<td>';
print $langs->trans('DateCreation'); print $langs->trans('TicketMessagesList');
print '</td>'; print '</td>';
if ($show_user) { if ($show_user) {
@ -335,9 +284,9 @@ class ActionsTicket
print '<strong></td>'; print '<strong></td>';
if ($show_user) { if ($show_user) {
print '<td>'; print '<td>';
if ($arraymsgs['fk_user_action'] > 0) { if ($arraymsgs['fk_user_author'] > 0) {
$userstat = new User($this->db); $userstat = new User($this->db);
$res = $userstat->fetch($arraymsgs['fk_user_action']); $res = $userstat->fetch($arraymsgs['fk_user_author']);
if ($res) { if ($res) {
print $userstat->getNomUrl(0); print $userstat->getNomUrl(0);
} }

View File

@ -180,10 +180,10 @@ class Ticket extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'position'=>1, 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id"), 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'position'=>1, 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id"),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''),
'track_id' => array('type'=>'varchar(255)', 'label'=>'TrackID', 'visible'=>0, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"),
'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'nowraponall'), 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'nowraponall'),
'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"),
'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>""), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth75'),
'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'), 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'),
'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketGroup', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketGroup', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'),
'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'),
@ -1660,20 +1660,19 @@ class Ticket extends CommonObject
} }
/** /**
* Charge la liste des messages sur le ticket * Load the list of event on ticket into ->cache_msgs_ticket
* *
* @return int Number of lines loaded, 0 if already loaded, <0 if KO * @return int Number of lines loaded, 0 if already loaded, <0 if KO
*/ */
public function loadCacheMsgsTicket() public function loadCacheMsgsTicket()
{ {
global $langs;
if (is_array($this->cache_msgs_ticket) && count($this->cache_msgs_ticket)) { if (is_array($this->cache_msgs_ticket) && count($this->cache_msgs_ticket)) {
return 0; return 0;
} }
// Cache deja charge
$sql = "SELECT rowid, fk_user_author, datec, label, message, visibility"; // Cache already loaded
$sql = "SELECT id as rowid, fk_user_author, datec, label, note as message, visibility";
$sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm"; $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm";
$sql .= " WHERE fk_element = " . (int) $this->id; $sql .= " WHERE fk_element = " . (int) $this->id;
$sql .= " AND elementtype = 'ticket'"; $sql .= " AND elementtype = 'ticket'";
@ -1687,7 +1686,7 @@ class Ticket extends CommonObject
while ($i < $num) { while ($i < $num) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->cache_msgs_ticket[$i]['id'] = $obj->rowid; $this->cache_msgs_ticket[$i]['id'] = $obj->rowid;
$this->cache_msgs_ticket[$i]['fk_user_action'] = $obj->fk_user_action; $this->cache_msgs_ticket[$i]['fk_user_author'] = $obj->fk_user_author;
$this->cache_msgs_ticket[$i]['datec'] = $this->db->jdate($obj->datec); $this->cache_msgs_ticket[$i]['datec'] = $this->db->jdate($obj->datec);
$this->cache_msgs_ticket[$i]['subject'] = $obj->label; $this->cache_msgs_ticket[$i]['subject'] = $obj->label;
$this->cache_msgs_ticket[$i]['message'] = $obj->message; $this->cache_msgs_ticket[$i]['message'] = $obj->message;

View File

@ -499,10 +499,11 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
$cssforfield=''; $cssforfield=(empty($val['css'])?'':$val['css']);
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; if ($key == 'fk_statut') $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right';
if (! empty($arrayfields['t.'.$key]['checked'])) { if (! empty($arrayfields['t.'.$key]['checked'])) {
if ($key == 'type_code') { if ($key == 'type_code') {
print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'">'; print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'">';
@ -562,10 +563,11 @@ print '</tr>'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
$cssforfield=''; $cssforfield=(empty($val['css'])?'':$val['css']);
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
if ($key == 'fk_statut') $cssforfield.=($cssforfield?' ':'').'center'; if ($key == 'fk_statut') $cssforfield.=($cssforfield?' ':'').'center';
elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right';
if (! empty($arrayfields['t.'.$key]['checked'])) if (! empty($arrayfields['t.'.$key]['checked']))
{ {
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n";

View File

@ -13,8 +13,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf)) if (empty($conf) || ! is_object($conf))
@ -28,37 +27,65 @@ if (empty($conf) || ! is_object($conf))
<?php <?php
global $user;
global $noMoreLinkedObjectBlockAfter;
$langs = $GLOBALS['langs']; $langs = $GLOBALS['langs'];
$langs->load('ticket');
$linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
echo '<br>';
print load_fiche_titre($langs->trans('RelatedTickets')); // Load translation files required by the page
$langs->load('ticket');
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'datec', 'desc', 0, 0, 1);
$total=0; $ilink=0;
foreach($linkedObjectBlock as $key => $objectlink)
{
$ilink++;
$trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?> ?>
<table class="noborder" width="100%"> <tr class="<?php echo $trclass; ?>" >
<tr class="liste_titre"> <td class="linkedcol-element" ><?php echo $langs->trans("Ticket"); ?>
<td><?php echo $langs->trans("Subject"); ?></td> <?php if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a'; ?>
<td class="center"><?php echo $langs->trans("DateCreation"); ?></td> </td>
<td class="center"><?php echo $langs->trans("Customer"); ?></td> <td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="center"><?php echo $langs->trans("Status"); ?></td> <td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->datec, 'day'); ?></td>
<?php
//$objectlink->socid = $objectlink->fk_soc;
//$objectlink->fetch_thirdparty();
?>
<td class="linkedcol-amount right"><?php //echo $objectlink->thirdparty->getNomUrl(1); ?></td>
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="linkedcol-action right">
<?php
// For now, shipments must stay linked to order, so link is not deletable
if($object->element != 'shipping') {
?>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
<?php
}
?>
</td>
</tr> </tr>
<?php <?php
foreach ($linkedObjectBlock as $object) { }
?> if (count($linkedObjectBlock) > 1)
<tr class="oddeven"> {
<td> ?>
<a href="<?php echo dol_buildpath("/ticket/card.php", 1).'?track_id='.$object->track_id; ?>"> <tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
<?php echo img_object($langs->trans("ShowTicket"), "ticket") . ' ' . (! empty($object->subject) ? ' '.$object->subject : ''); ?> <td><?php echo $langs->trans("Total"); ?></td>
</a> <td></td>
</td> <td align="center"></td>
<td class="center"><?php echo dol_print_date($object->datec, 'day'); ?></td> <td align="center"></td>
<td class="right"><?php echo price($total); ?></td>
<td class="right"></td>
<td class="right"></td>
</tr>
<?php <?php
$object->socid = $object->fk_soc; }
$object->fetch_thirdparty(); ?>
?>
<td class="center"><?php echo $object->thirdparty->getNomUrl(1); ?></td>
<td class="center"><?php echo $object->getLibstatut(2); ?></td>
</tr>
<?php } ?>
</table>
<!-- END PHP TEMPLATE --> <!-- END PHP TEMPLATE -->