Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into dev_scrunit

This commit is contained in:
florian HENRY 2018-03-19 08:37:50 +01:00
commit 9c58bfafdd
52 changed files with 732 additions and 632 deletions

View File

@ -53,7 +53,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($objectlink->amount);
} ?></td>
<td align="right"></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($objectlink->total_ht);
} ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
// 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_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
<?php
}
?>

View File

@ -67,7 +67,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
}
} ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -62,7 +62,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
print $objectlink->getLibStatut(3);
?>
</td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -33,13 +33,12 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("banks");
$langs->load("categories");
$langs->load("bills");
$langs->load("withdrawals");
// Security check
if ($user->societe_id > 0) accessforbidden();
$langs->load("bills");
$langs->load("withdrawals");
// Get supervariables
$action = GETPOST('action','alpha');
$id = GETPOST('id','int');

View File

@ -1640,13 +1640,14 @@ else
print '<td align="right" class="nowrap">';
if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0))
{
print '<a style="padding-left: 5px;" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=move&amp;rowid='.$objp->rowid.'">';
print '<!-- link to move service line into another contract -->';
print '<a class="reposition" style="padding-left: 5px;" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=move&amp;rowid='.$objp->rowid.'">';
print img_picto($langs->trans("MoveToAnotherContract"),'uparrow');
print '</a>';
}
if ($user->rights->contrat->creer && ($object->statut >= 0))
{
print '<a style="padding-left: 5px;" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=editline&amp;rowid='.$objp->rowid.'">';
print '<a class="reposition" style="padding-left: 5px;" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=editline&amp;rowid='.$objp->rowid.'">';
print img_edit();
print '</a>';
}

View File

@ -52,10 +52,10 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td></td>
<td align="center"><?php echo dol_print_date($objectlink->date_contrat,'day'); ?></td>
<td align="right"><?php
// Price of contract is not shown by default because a contract is a list of service with
// Price of contract is not shown by default because a contract is a list of service with
// start and end date that change with time andd that may be different that the period of reference for price.
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE))
if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE))
{
$totalcontrat = 0;
foreach ($objectlink->lines as $linecontrat) {
@ -65,7 +65,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($totalcontrat);
} ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(7); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php } ?>

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,7 +21,7 @@
/**
* \file htdocs/core/boxes/box_contacts.php
* \ingroup societes
* \ingroup contacts
* \brief Module to show box of contacts
*/
@ -57,7 +58,7 @@ class box_contacts extends ModeleBoxes
$this->db=$db;
$this->hidden=! ($user->rights->societe->lire);
$this->hidden=! ($user->rights->societe->lire && $user->rights->societe->contact->lire);
}
/**
@ -75,12 +76,12 @@ class box_contacts extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedContacts",$max));
if ($user->rights->societe->lire)
if ($user->rights->societe->lire && $user->rights->societe->contact->lire)
{
$sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc, sp.statut as status";
$sql.= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile";
$sql.= ", s.nom as socname, s.name_alias";
$sql.= ", s.client, s.fournisseur, s.code_client, s.code_fournisseur";
$sql.= ", s.client, s.fournisseur, s.code_client, s.code_fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -91,98 +92,97 @@ class box_contacts extends ModeleBoxes
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);
if ($result) {
if ($result) {
$num = $db->num_rows($result);
$contactstatic=new Contact($db);
$societestatic=new Societe($db);
$line = 0;
while ($line < $num)
{
while ($line < $num)
{
$objp = $db->fetch_object($result);
$datec=$db->jdate($objp->datec);
$datem=$db->jdate($objp->tms);
$contactstatic->id=$objp->id;
$contactstatic->id=$objp->id;
$contactstatic->lastname=$objp->lastname;
$contactstatic->firstname=$objp->firstname;
$contactstatic->civility_id=$objp->civility_id;
$contactstatic->firstname=$objp->firstname;
$contactstatic->civility_id=$objp->civility_id;
$contactstatic->statut=$objp->status;
$contactstatic->phone_pro = $objp->phone;
$contactstatic->phone_perso = $objp->phone_perso;
$contactstatic->phone_mobile = $objp->phone_mobile;
$contactstatic->address = $objp->address;
$contactstatic->zip = $objp->zip;
$contactstatic->town = $objp->town;
$contactstatic->phone_pro = $objp->phone;
$contactstatic->phone_perso = $objp->phone_perso;
$contactstatic->phone_mobile = $objp->phone_mobile;
$contactstatic->address = $objp->address;
$contactstatic->zip = $objp->zip;
$contactstatic->town = $objp->town;
$societestatic->id = $objp->fk_soc;
$societestatic->name = $objp->socname;
$societestatic->name_alias = $objp->name_alias;
$societestatic->code_client = $objp->code_client;
$societestatic->code_fournisseur = $objp->code_fournisseur;
$societestatic->client = $objp->client;
$societestatic->fournisseur = $objp->fournisseur;
$societestatic->name = $objp->socname;
$societestatic->name_alias = $objp->name_alias;
$societestatic->code_client = $objp->code_client;
$societestatic->code_fournisseur = $objp->code_fournisseur;
$societestatic->client = $objp->client;
$societestatic->fournisseur = $objp->fournisseur;
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $contactstatic->getNomUrl(1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $contactstatic->getNomUrl(1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => ($objp->fk_soc > 0 ? $societestatic->getNomUrl(1) : ''),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => ($objp->fk_soc > 0 ? $societestatic->getNomUrl(1) : ''),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => dol_print_date($datem, "day"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => dol_print_date($datem, "day"),
);
$this->info_box_contents[$line][] = array(
'td' => 'align="right" class="nowrap" width="18"',
'text' => $contactstatic->getLibStatut(3),
'asis'=>1,
);
$this->info_box_contents[$line][] = array(
'td' => 'align="right" class="nowrap" width="18"',
'text' => $contactstatic->getLibStatut(3),
'asis'=>1,
);
$line++;
}
$line++;
}
if ($num==0)
$this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedContacts"),
);
if ($num==0)
$this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedContacts"),
);
$db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'text' => ($db->error().' sql='.$sql),
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'align="left" class="nohover opacitymedium"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
$db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'text' => ($db->error().' sql='.$sql),
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'align="left" class="nohover opacitymedium"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
function showBox($head = null, $contents = null, $nooutput=0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}

View File

@ -134,7 +134,7 @@ class ExtraFields
*
* @param string $attrname Code of attribute
* @param string $label label of attribute
* @param int $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
* @param int $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price','phone','mail','password','url','select','checkbox','separate',...)
* @param int $pos Position of attribute
* @param string $size Size/length of attribute
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)

View File

@ -996,7 +996,7 @@ class FormMail extends Form
* @param string $type_template Get message for type=$type_template, type='all' also included.
* @param string $user Use template public or limited to this user
* @param Translate $outputlangs Output lang object
* @param int $id Id of template to find, or -1 for first found with lower position, or 0 for first found whatever is position
* @param int $id Id of template to find, or -1 for first found with position 0, or 0 for first found whatever is position or -2 for exact match with label (no aswer if not found)
* @param int $active 1=Only active template, 0=Only disabled, -1=All
* @param string $label Label of template
* @return ModelMail
@ -1005,14 +1005,20 @@ class FormMail extends Form
{
$ret = new ModelMail();
if ($id == -2 && empty($label))
{
$this->error = 'LabelIsMandatoryWhenIdIs-2';
return -1;
}
$sql = "SELECT label, topic, joinfiles, content, content_lines, lang";
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql.= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')";
$sql.= " AND entity IN (".getEntity('c_email_templates').")";
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned
if ($active >= 0) $sql.=" AND active = ".$active;
if ($label) $sql.=" AND label ='".$this->db->escape($label)."'";
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
if ($label) $sql.=" AND label ='".$db->escape($label)."'";
if (is_object($outputlangs)) $sql.= " AND (lang = '".$db->escape($outputlangs->defaultlang)."' OR lang IS NULL OR lang = '')";
if ($id > 0) $sql.= " AND rowid=".$id;
if ($id == -1) $sql.= " AND position=0";
if (is_object($outputlangs)) $sql.= $db->order("position,lang,label","ASC,DESC,ASC"); // We want line with lang set first, then with lang null or ''
@ -1034,8 +1040,11 @@ class FormMail extends Form
$ret->content_lines = $obj->content_lines;
$ret->joinfiles = $obj->joinfiles;
}
else // If there is no template at all
{
elseif($id == -2) {
// Not found with the provided label
return -1;
}
else { // If there is no template at all
$defaultmessage='';
if ($type_template=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); }
elseif ($type_template=='facture_relance') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder"); }

View File

@ -173,12 +173,12 @@ class FormTicketsup
print "</td></tr>\n";
}
// Customer
// Customer or supplier
if ($this->withcompany) {
// altairis: force company and contact id for external user
if (empty($user->socid)) {
// Company
print '<tr><td class="titlefield">' . $langs->trans("Customer") . '</td><td>';
print '<tr><td class="titlefield">' . $langs->trans("ThirdParty") . '</td><td>';
$events = array();
$events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, '', $events);
@ -242,7 +242,7 @@ class FormTicketsup
// If no socid, set to first one (id=1) to avoid full contacts list
$selectedCompany = $this->withfromsocid > 0 ? $this->withfromsocid : 1;
$nbofcontacts = $form->select_contacts($selectedCompany, $this->withfromcontactid, 'contactid', 0, '', '', 0, 'minwidth200');
$formcompany->selectTypeContact($ticketstatic, '', 'type', 'external');
$formcompany->selectTypeContact($ticketstatic, '', 'type', 'external', '', 0, 'maginleftonly');
print '</td></tr>';
} else {
print '<tr><td class="titlefield"><input type="hidden" name="socid" value="' . $user->socid . '"/></td>';
@ -296,9 +296,9 @@ class FormTicketsup
print $this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2');
print '</td></tr>';
// Not notify tiers at create
print '<tr><td><label for="not_notify_tiers_at_create">' . $langs->trans("TicketNotNotifyTiersAtCreate") . '</label></td><td>';
print '<input type="checkbox" id="not_notify_tiers_at_create" name="not_notify_tiers_at_create"'.($this->withnotnotifytiersatcreate?' checked="checked"':'').'>';
// Notify thirdparty at creation
print '<tr><td><label for="notify_tiers_at_create">' . $langs->trans("TicketNotifyTiersAtCreation") . '</label></td><td>';
print '<input type="checkbox" id="notify_tiers_at_create" name="notify_tiers_at_create"'.($this->withnotifytiersatcreate?' checked="checked"':'').'>';
print '</td></tr>';
// TITLE

View File

@ -1340,6 +1340,25 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
//}
}
}
elseif ($object->element == 'ticketsup')
{
$width=80; $cssclass='photoref';
$showimage=$object->is_photo_available($conf->ticketsup->dir_output.'/'.$object->track_id);
$maxvisiblephotos=(isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO)?$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO:2);
if ($conf->browser->phone) $maxvisiblephotos=1;
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos($conf->ticketsup->dir_output,'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
else
{
if (!empty($conf->global->TICKETSUP_NODISPLAYIFNOPHOTO)) {
$nophoto='';
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"></div>';
}
//elseif ($conf->browser->layout != 'phone') { // Show no photo link
$nophoto='/public/theme/common/nophoto.png';
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
//}
}
}
else
{
if ($showimage)
@ -3063,7 +3082,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$pictowithoutext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (in_array($pictowithoutext, array('delete', 'edit', 'off', 'on', 'resize', 'switch_off', 'switch_on')))
if (in_array($pictowithoutext, array('delete', 'edit', 'off', 'on', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow')))
{
$fakey = $pictowithoutext; $facolor=''; $fasize='';
if ($pictowithoutext == 'switch_off') { $fakey = 'fa-toggle-off'; $facolor='#999'; $fasize='2em'; }
@ -3072,7 +3091,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
elseif ($pictowithoutext == 'on') { $fakey = 'fa-check-square-o'; $fasize='1.3em'; }
elseif ($pictowithoutext == 'delete') { $fakey = 'fa-trash'; $facolor='#444'; }
elseif ($pictowithoutext == 'edit') { $fakey = 'fa-pencil'; $facolor='#444'; }
elseif ($pictowithoutext == 'printer') { $fakey = 'fa-print'; $fasize='1.2em'; $facolor='#444'; }
elseif ($pictowithoutext == 'resize') { $fakey = 'fa-crop'; $facolor='#444'; }
elseif ($pictowithoutext == 'uparrow') { $fakey = 'fa-mail-forward'; $facolor='#555'; }
elseif ($pictowithoutext == 'unlink') { $fakey = 'fa-chain-broken'; $facolor='#555'; }
else { $fakey = 'fa-'.$pictowithoutext; $facolor='#999'; }
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) { $morecss.=($morecss?' ':'').$reg[1]; }

View File

@ -46,11 +46,9 @@ class pdf_sepamandate extends ModeleBankAccountDoc
function __construct($db)
{
global $conf,$langs,$mysoc;
$langs->load("main");
$langs->load("bank");
$langs->load("withdrawals");
$langs->load("companies");
// Translations
$langs->loadLangs(array("main", "bank", "withdrawals", "companies"));
$this->db = $db;
$this->name = "sepamandate";
@ -104,13 +102,9 @@ class pdf_sepamandate extends ModeleBankAccountDoc
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("projects");
$outputlangs->load("withdrawals");
$outputlangs->load("bills");
// Translations
$outputlangs->loadLangs(array("main", "dict", "withdrawals", "companies", "projects", "bills"));
if (! empty($conf->bank->dir_output))
{

View File

@ -320,7 +320,7 @@ class modProduct extends DolibarrModules
'sp.unitprice'=>'50',
'sp.remise_percent'=>'0'
);
$this->import_updatekeys_array[$r]=array('sp.fk_product'=>'ProductOrService','sp.ref_fourn'=>'SupplierRef');
$this->import_updatekeys_array[$r]=array('sp.fk_product'=>'ProductOrService','sp.ref_fourn'=>'SupplierRef','sp.fk_soc'=>'Supplier');
}
if (! empty($conf->global->PRODUIT_MULTIPRICES))

View File

@ -131,8 +131,8 @@ $langs->load("modulebuilder");
});
</script>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>?attrname=<?php echo $attrname; ?>" method="post">
<!-- Form to edit an extra field -->
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>?attrname=<?php echo $attrname; ?>" id="formeditextrafield" method="post">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="attrname" value="<?php echo $attrname; ?>">
<input type="hidden" name="action" value="update">

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010-2017 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2010-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2017 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -91,7 +91,7 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
if (! empty($conf->multicompany->enabled)) {
print '<td align="center">'.($extrafields->attributes[$elementtype]['entityid'][$key]==0?$langs->trans("All"):$extrafields->attributes[$elementtype]['entitylabel'][$key]).'</td>';
}
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'#formeditextrafield">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
}

View File

@ -172,39 +172,56 @@ class InterfaceStripe
if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object->type == 'card') {
dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
$stripeacc = $stripe->getStripeAccount($service); // No need of network access for this
$stripeacc = $stripe->getStripeAccount($service); // No need of network access for this
$stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this
$thirdparty=new Societe($this->db);
$thirdparty->fetch($object->fk_soc);
if ($stripecu) {
// Get customer (required to get a card)
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
$customer = \Stripe\Customer::retrieve($stripecu);
} else {
$customer = \Stripe\Customer::retrieve($stripecu, array("stripe_account" => $stripeacc));
}
if ($object->client != 0) {
$card = $stripe->cardStripe($thirdparty, $object, $stripeacc, $servicestatus);
if (card) {
/*if (! empty($object->email))
{
$customer->email = $object->email;
if ($customer)
{
$card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus);
if ($card) {
$card->metadata=array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']));
try {
$card->save($dataforcard);
}
catch(Exception $e)
{
$this->error = $e->getMessages();
}
}
$customer->description = $object->name;
// TODO More data
//$customer->vat = $object->tva_intra
card->save();
*/
}
}
}
if ($action == 'COMPANYPAYMENTMODE_DELETE' && $object->type == 'card') {
dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
$stripeacc = $stripe->getStripeAccount($service); // No need of network access for this
$stripeacc = $stripe->getStripeAccount($service); // No need of network access for this
$stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this
$thirdparty=new Societe($this->db);
$thirdparty->fetch($object->fk_soc);
if ($stripecu)
{
// Get customer (required to get a card)
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
$customer = \Stripe\Customer::retrieve($stripecu);
} else {
$customer = \Stripe\Customer::retrieve($stripecu, array("stripe_account" => $stripeacc));
}
$card = $stripe->cardStripe($thirdparty, $object, $stripeacc, $servicestatus);
if ($card) {
if (method_exists($card, 'detach')) $card->detach();
else $card->delete();
if ($customer)
{
$card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus);
if ($card) {
if (method_exists($card, 'detach')) $card->detach();
else $card->delete();
}
}
}
}

View File

@ -61,7 +61,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
// For now, shipments must stay linked to order, so link is not deletable
if($object->element != 'commande') {
?>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<?php
}
?>

View File

@ -52,7 +52,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($objectlink->total_ht);
} ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -51,7 +51,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td align="center"><?php echo dol_print_date($objectlink->datev,'day'); ?></td>
<td></td>
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -57,7 +57,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($objectlink->total_ht);
} ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -68,7 +68,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
}
} ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -232,7 +232,7 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (20
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (202,'SI','SVN','Slovénie',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (203,'SB','SLB','Iles Salomon',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (204,'SO','SOM','Somalie',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (205,'ZA','ZAF','Afrique du Sud',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (205,'ZA','ZAF','South Africa',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (206,'GS','SGS','Iles Géorgie du Sud et Sandwich du Sud',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (207,'LK','LKA','Sri Lanka',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (208,'SD','SDN','Soudan',1,0);

View File

@ -259,6 +259,10 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (20
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2022, 202,'9.5', '0', 'VAT reduced rate', 1);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2023, 202, '0', '0', 'VAT Rate 0', 1);
-- SOUTH AFRICA (id country=205)
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2051, 205, '15', '0', 'VAT standard rate', 1);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2053, 205, '0', '0', 'VAT Rate 0', 1);
-- SPAIN (id country=4)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 41, 4,'21','0','5.2','3','-19:-15:-9','5','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 42, 4,'10','0','1.4','3','-19:-15:-9','5','VAT reduced rate',1);

View File

@ -222,4 +222,6 @@ NoAssignedTasks=No assigned tasks (assign project/tasks the current user from th
# Comments trans
AllowCommentOnTask=Allow user comments on tasks
AllowCommentOnProject=Allow user comments on projects
DontHavePermissionForCloseProject=You do not have permissions to close the project %s
DontHaveTheValidateStatus=The project %s must be open to be closed
RecordsClosed=%s project(s) closed

View File

@ -61,3 +61,4 @@ DeleteACard=Delete Card record
ConfirmDeleteCard=Are you sure you want to delete this Card record?
CreateCustomerOnStripe=Create customer on Stripe
CreateCardOnStripe=Create card on Stripe
ShowInStripe=Show in Stripe

View File

@ -44,8 +44,8 @@ TicketSeverityShortBLOCKING=Critical/Blocking
ErrorBadEmailAddress=Field '%s' incorrect
MenuTicketsupMyAssign=My tickets
MenuTicketsupMyAssignNonClosed=My tickets non closed
MenuListNonClosed=Non closed tickets
MenuTicketsupMyAssignNonClosed=My open tickets
MenuListNonClosed=Open tickets
TypeContact_ticketsup_internal_CONTRIBUTOR=Contributor
TypeContact_ticketsup_internal_SUPPORTTEC=Assigned user
@ -123,7 +123,7 @@ TicketsActivatePublicInterfaceHelp=Public interface allow any visitors to create
TicketsAutoAssignTicket=Automatically assign the user who created the ticket
TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automatically assigned to the ticket.
TicketSupNumberingModules=Tickets numbering module
TicketNotNotifyTiersAtCreate=Do not notify the company to the creation
TicketNotifyTiersAtCreation=Notify thirdparty at creation
#
# About page
@ -143,8 +143,8 @@ TicketList=List of tickets
TicketAssignedToMeInfos=This page display ticket list which are assigned to current user
NoTicketsFound=No ticket found
TicketViewAllTickets=View all tickets
TicketViewNonClosedOnly=View only non closed tickets
TicketStatByStatus=Tickets par statut
TicketViewNonClosedOnly=View only open tickets
TicketStatByStatus=Tickets by status
#
# Ticket card
@ -180,7 +180,7 @@ TicketMessageSuccessfullyAdded=Message successfully added
TicketMessagesList=Message list
NoMsgForThisTicket=No message for this ticket
Properties=Classification
LatestNewTickets=Last %s tickets newest (not read)
LatestNewTickets=Latest %s newest tickets (not read)
TicketSeverity=Severity
ShowTicket=See ticket
RelatedTickets=Related tickets
@ -224,7 +224,7 @@ TicketEmailOriginIssuer=Issuer at origin of the tickets
InitialMessage=Initial Message
LinkToAContract=Link to a contract
TicketSupPleaseSelectAContract=Select a contract
UnableToCreateInterIfNoSocid=Can not create a response file without defining a thirdparty
UnableToCreateInterIfNoSocid=Can not create an intervention when no third party are defined
TicketMailExchanges=Mail exchanges
TicketInitialMessageModified=Initial message modified
TicketMessageSuccesfullyUpdated=Message successfully updated

View File

@ -1,8 +1,8 @@
# Dolibarr language file - Source file is en_US - withdrawals
CustomersStandingOrdersArea=Direct debit payment orders area
SuppliersStandingOrdersArea=Direct credit payment orders area
StandingOrders=Direct debit payment orders
StandingOrder=Direct debit payment order
StandingOrdersPayment=Direct debit payment orders
StandingOrderPayment=Direct debit payment order
NewStandingOrder=New direct debit order
StandingOrderToProcess=To process
WithdrawalsReceipts=Direct debit orders

View File

@ -182,8 +182,8 @@ if (empty($reshook))
$object->datestart = $datestart;
$object->dateend = $dateend;
$object->capital = $capital;
$object->nbterm = GETPOST("nbterm");
$object->rate = GETPOST("rate");
$object->nbterm = GETPOST("nbterm",'int');
$object->rate = price2num(GETPOST("rate",'alpha'));
$accountancy_account_capital = GETPOST('accountancy_account_capital');
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');

View File

@ -292,11 +292,18 @@ class Loan extends CommonObject
{
$this->db->begin();
if (! is_numeric($this->nbterm))
{
$this->error='BadValueForParameterForNbTerm';
return -1;
}
$sql = "UPDATE ".MAIN_DB_PREFIX."loan";
$sql.= " SET label='".$this->db->escape($this->label)."',";
$sql.= " capital='".price2num($this->db->escape($this->capital))."',";
$sql.= " datestart='".$this->db->idate($this->datestart)."',";
$sql.= " dateend='".$this->db->idate($this->dateend)."',";
$sql.= " nbterm=".$this->nbterm.",";
$sql.= " accountancy_account_capital = '".$this->db->escape($this->account_capital)."',";
$sql.= " accountancy_account_insurance = '".$this->db->escape($this->account_insurance)."',";
$sql.= " accountancy_account_interest = '".$this->db->escape($this->account_interest)."',";
@ -431,12 +438,12 @@ class Loan extends CommonObject
$linkstart = '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$this->id.'" title="'.str_replace('\n', '', dol_escape_htmltag($tooltip, 1)).'" class="classfortooltip">';
$linkend = '</a>';
$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->ref,$maxlen):$this->ref);
$result .= $linkend;
return $result;
}

View File

@ -502,7 +502,7 @@ if (! defined('NOLOGIN'))
$allowedmethodtopostusername = 2;
if (defined('MAIN_AUTHENTICATION_POST_METHOD')) $allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD');
$usertotest = (! empty($_COOKIE['login_dolibarr']) ? $_COOKIE['login_dolibarr'] : GETPOST("username","alpha",$allowedmethodtopostusername));
$passwordtotest = GETPOST('password','none',2);
$passwordtotest = GETPOST('password','none',$allowedmethodtopostusername);
$entitytotest = (GETPOST('entity','int') ? GETPOST('entity','int') : (!empty($conf->entity) ? $conf->entity : 1));
// Define if we received data to test the login.

View File

@ -81,7 +81,7 @@ class MyObject extends CommonObject
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text'),
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text'),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>'LinkToThirparty'),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>0, 'help'=>'LinkToThirparty'),
'description' =>array('type'=>'text', 'label'=>'Descrption', 'enabled'=>1, 'visible'=>0, 'position'=>60),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
@ -461,10 +461,11 @@ class MyObject extends CommonObject
/**
* Action executed by scheduler
* CAN BE A CRON TASK
* CAN BE A CRON TASK. In such a case, paramerts come from the schedule job setup field 'Parameters'
*
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
*/
//public function doScheduledJob($param1, $param2, ...)
public function doScheduledJob()
{
global $conf, $langs;

View File

@ -272,7 +272,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
* Last modified products
*/
$max=15;
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell, p.tobuy, p.fk_price_expression,";
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell, p.tobuy, p.tobatch, p.fk_price_expression,";
$sql.= " p.entity,";
$sql.= " p.tms as datem";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
@ -336,7 +336,8 @@ if ($result)
$product_static->ref=$objp->ref;
$product_static->label = $objp->label;
$product_static->type=$objp->fk_product_type;
$product_static->entity = $objp->entity;
$product_static->entity = $objp->entity;
$product_static->status_batch = $objp->tobatch;
print $product_static->getNomUrl(1,'',16);
print "</td>\n";
print '<td>'.dol_trunc($objp->label,32).'</td>';

View File

@ -698,6 +698,7 @@ else
$product_static->type = $obj->fk_product_type;
$product_static->status_buy = $obj->tobuy;
$product_static->status = $obj->tosell;
$product_static->status_batch = $obj->tobatch;
$product_static->entity = $obj->entity;
$product_static->pmp = $obj->pmp;

View File

@ -446,7 +446,7 @@ else
$totalunit=0;
$totalvalue=$totalvaluesell=0;
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc, p.entity,";
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc, p.entity,";
$sql.= " ps.reel as value";
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE ps.fk_product = p.rowid";
@ -487,10 +487,11 @@ else
print '<tr class="oddeven">';
print "<td>";
$productstatic->id=$objp->rowid;
$productstatic->ref = $objp->ref;
$productstatic->label = $objp->produit;
$productstatic->ref = $objp->ref;
$productstatic->label = $objp->produit;
$productstatic->type=$objp->type;
$productstatic->entity=$objp->entity;
$productstatic->status_batch=$objp->tobatch;
print $productstatic->getNomUrl(1,'stock',16);
print '</td>';

View File

@ -415,7 +415,7 @@ $formother=new FormOther($db);
$formproduct=new FormProduct($db);
if (!empty($conf->projet->enabled)) $formproject=new FormProjets($db);
$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.fk_product_type as type, p.entity,";
$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,";
$sql.= " e.ref as stock, e.rowid as entrepot_id, e.lieu,";
$sql.= " m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
$sql.= " m.batch, m.price,";
@ -891,6 +891,7 @@ if ($resql)
$productstatic->label=$objp->produit;
$productstatic->type=$objp->type;
$productstatic->entity=$objp->entity;
$productstatic->status_batch=$objp->tobatch;
$productlot->id = $objp->lotid;
$productlot->batch= $objp->batch;

View File

@ -195,6 +195,52 @@ if (empty($reshook))
$permtodelete = $user->rights->projet->supprimer;
$uploaddir = $conf->projet->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
// Close records
if (! $error && $massaction == 'close' && $user->rights->projet->creer)
{
$db->begin();
$objecttmp=new $objectclass($db);
$nbok = 0;
foreach($toselect as $toselectid)
{
$result=$objecttmp->fetch($toselectid);
if ($result > 0)
{
$userWrite = $object->restrictedProjectArea($user,'write');
if ($userWrite > 0 && $objecttmp->statut == 1) {
$result = $objecttmp->setClose($user);
if ($result <= 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
} else $nbok++;
} elseif($userWrite <= 0) {
setEventMessages($langs->trans("DontHavePermissionForCloseProject", $objecttmp->ref), null, 'warnings');
} else {
setEventMessages($langs->trans("DontHaveTheValidateStatus", $objecttmp->ref), null, 'warnings');
}
}
else
{
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
}
}
if (! $error)
{
if ($nbok > 1) setEventMessages($langs->trans("RecordsClosed", $nbok), null, 'mesgs');
else setEventMessages($langs->trans("RecordsClosed", $nbok), null, 'mesgs');
$db->commit();
}
else
{
$db->rollback();
}
}
}
@ -390,7 +436,9 @@ $arrayofmassactions = array(
);
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if ($user->rights->projet->creer) $arrayofmassactions['close']=$langs->trans("Close");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
$langs->loadLangs(array("companies","commercial","banks","bills"));
$langs->loadLangs(array("companies","commercial","banks","bills",'paypal','stripe'));
// Security check
@ -210,7 +210,7 @@ if (empty($reshook))
$companypaymentmode->exp_date_month = GETPOST('exp_date_month','int');
$companypaymentmode->exp_date_year = GETPOST('exp_date_year','int');
$companypaymentmode->cvn = GETPOST('cvn','alpha');
$companypaymentmode->country_code = $mysoc->country_code;
$companypaymentmode->country_code = $object->country_code;
$companypaymentmode->stripe_card_ref = GETPOST('stripe_card_ref','alpha');

View File

@ -223,15 +223,17 @@ class Stripe extends CommonObject
{
try {
if (empty($key)) { // If the Stripe connect account not set, we use common API usage
$card = \Stripe\Card::retrieve("$cardref");
$card = $cu->sources->retrieve($cardref);
} else {
$card = \Stripe\Card::retrieve("$cardref", array("stripe_account" => $key));
$card = $cu->sources->retrieve($cardref, array("stripe_account" => $key));
}
}
catch(Exception $e)
{
$this->error = $e->getMessage();
dol_syslog($this->error, LOG_WARNING);
}
}
elseif ($createifnotlinkedtostripe)
{
@ -277,6 +279,7 @@ class Stripe extends CommonObject
catch(Exception $e)
{
$this->error = $e->getMessage();
dol_syslog($this->error, LOG_WARNING);
}
}
}

View File

@ -55,7 +55,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo price($objectlink->total_ht);
} ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>
<?php
}

View File

@ -830,6 +830,9 @@ div.fiche>form>div.div-table-responsive {
div.fiche>div.tabBar>form>div.div-table-responsive {
min-height: 392px;
}
div.fiche {
text-align: justify;
}
.flexcontainer {
<?php if (in_array($conf->browser->name, array('chrome','firefox'))) echo 'display: inline-flex;'."\n"; ?>
@ -1331,7 +1334,8 @@ div.nopadding {
.pictowarning {
vertical-align: text-bottom;
}
.fiche img.pictoedit, .fiche span.pictoedit {
.fiche .arearef img.pictoedit, .fiche .arearef span.pictoedit,
.fiche .fichecenter img.pictoedit, .fiche .fichecenter span.pictoedit {
opacity: 0.4;
}
.colorthumb {
@ -3116,8 +3120,8 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
{
.boxstats, .boxstats130 {
margin: 3px;
border: 1px solid #ccc;
box-shadow: none;
/*border: 1px solid #ccc;
box-shadow: none; */
}
.boxstats130 {
text-align: <?php echo $left; ?>

View File

@ -1339,7 +1339,8 @@ table.noborder tr.liste_titre td {
.pictowarning {
vertical-align: text-bottom;
}
.fiche img.pictoedit, .fiche span.pictoedit {
.fiche .arearef img.pictoedit, .fiche .arearef span.pictoedit,
.fiche .fichecenter img.pictoedit, .fiche .fichecenter span.pictoedit {
opacity: 0.9;
}
img.hideonsmartphone.pictoactionview {

View File

@ -23,15 +23,15 @@
*/
require '../main.inc.php';
require_once 'class/actions_ticketsup.class.php';
require_once DOL_DOCUMENT_ROOT . '/ticketsup/class/actions_ticketsup.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formticketsup.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/ticketsup.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
if (!empty($conf->projet->enabled)) {
include DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
}
@ -41,30 +41,23 @@ if (!empty($conf->contrat->enabled)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formcontract.class.php';
}
if (!class_exists('Contact')) {
include DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
}
// Load traductions files requiredby by page
$langs->load("companies");
$langs->load("other");
$langs->load("ticketsup");
$langs->loadLangs(array("companies","other","ticketsup"));
// Get parameters
$id = GETPOST('id', 'int');
$track_id = GETPOST('track_id', 'alpha', 3);
$action = GETPOST('action', 'alpha', 3);
$ref = GETPOST('ref', 'alpha');
$projectid = GETPOST('projectid', 'int');
$action = GETPOST('action', 'alpha', 3);
// Initialize technical object to manage hooks of ticketsup. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('ticketsupcard','globalcard'));
$object = new ActionsTicketsup($db);
$object->doActions($action);
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->dao->table_element);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$object = new Ticketsup($db);
if (!$action) {
$action = 'view';
@ -75,14 +68,14 @@ if (GETPOST('modelselected')) {
}
// Store current page url
$url_page_current = dol_buildpath('/ticketsup/card.php', 1);
$url_page_current = DOL_URL_ROOT.'/ticketsup/card.php';
if ($action == 'view' || $action == 'add_message' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' || $action == 'editsubject' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') {
if ($id || $track_id || $ref) {
$res = $object->fetch($id, $track_id, $ref);
}
// Security check
$result = restrictedArea($user, 'ticketsup', $object->dao->id);
$result = restrictedArea($user, 'ticketsup', $object->id);
@ -90,6 +83,9 @@ $result = restrictedArea($user, 'ticketsup', $object->dao->id);
* Actions
*/
$actionobject = new ActionsTicketsup($db);
$actionobject->doActions($action, $object);
$permissiondellink = $user->rights->ticketsup->write;
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
@ -105,38 +101,38 @@ $form = new Form($db);
$formticket = new FormTicketsup($db);
if ($action == 'view' || $action == 'add_message' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' || $action == 'editsubject' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') {
$res = $object->fetch($id, $track_id, $ref);
if ($res > 0) {
// or for unauthorized internals users
if (!$user->societe_id && ($conf->global->TICKETS_LIMIT_VIEW_ASSIGNED_ONLY && $object->dao->fk_user_assign != $user->id) && !$user->rights->ticketsup->manage) {
if (!$user->societe_id && ($conf->global->TICKETS_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticketsup->manage) {
accessforbidden('', 0);
}
$help_url = 'FR:DocumentationModuleTicket';
$page_title = $object->getTitle($action);
$page_title = $actionobject->getTitle($action);
llxHeader('', $page_title, $help_url);
// Confirmation close
if ($action == 'close') {
print $form->formconfirm($url_page_current . "?track_id=" . $track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_close", '', '', 1);
print $form->formconfirm($url_page_current . "?track_id=" . $object->track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_close", '', '', 1);
if ($ret == 'html') {
print '<br>';
}
}
// Confirmation delete
if ($action == 'delete') {
print $form->formconfirm($url_page_current . "?track_id=" . $track_id, $langs->trans("Delete"), $langs->trans("ConfirmDeleteTicket"), "confirm_delete_ticket", '', '', 1);
print $form->formconfirm($url_page_current . "?track_id=" . $object->track_id, $langs->trans("Delete"), $langs->trans("ConfirmDeleteTicket"), "confirm_delete_ticket", '', '', 1);
}
// Confirm reopen
if ($action == 'reopen') {
print $form->formconfirm($url_page_current . '?track_id=' . $track_id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenTicket'), 'confirm_reopen', '', '', 1);
print $form->formconfirm($url_page_current . '?track_id=' . $object->track_id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenTicket'), 'confirm_reopen', '', '', 1);
}
// Confirmation status change
if ($action == 'set_status') {
$new_status = GETPOST('new_status');
print $form->formconfirm($url_page_current . "?track_id=" . $track_id . "&new_status=" . GETPOST('new_status'), $langs->trans("TicketChangeStatus"), $langs->trans("TicketConfirmChangeStatus", $langs->transnoentities($object->dao->statuts_short[$new_status])), "confirm_set_status", '', '', 1);
//var_dump($url_page_current . "?track_id=" . $object->track_id);
print $form->formconfirm($url_page_current . "?track_id=" . $object->track_id . "&new_status=" . GETPOST('new_status'), $langs->trans("TicketChangeStatus"), $langs->trans("TicketConfirmChangeStatus", $langs->transnoentities($object->statuts_short[$new_status])), "confirm_set_status", '', '', 1);
}
// project info
@ -205,39 +201,44 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
print "ErrorRecordNotFound";
}
} elseif ($socid > 0) {
$object->dao->fetch_thirdparty();
$head = societe_prepare_head($object->dao->thirdparty);
$object->fetch_thirdparty();
$head = societe_prepare_head($object->thirdparty);
dol_fiche_head($head, 'ticketsup', $langs->trans("ThirdParty"), 0, 'company');
dol_banner_tab($object->dao->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom');
dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom');
dol_fiche_end();
}
if (!$user->societe_id && $conf->global->TICKETS_LIMIT_VIEW_ASSIGNED_ONLY) {
$object->dao->next_prev_filter = "te.fk_user_assign = '" . $user->id . "'";
$object->next_prev_filter = "te.fk_user_assign = '" . $user->id . "'";
} elseif ($user->societe_id > 0) {
$object->dao->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'";
$object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'";
}
$head = ticketsup_prepare_head($object->dao);
$head = ticketsup_prepare_head($object);
dol_fiche_head($head, 'tabTicketsup', $langs->trans("Ticket"), -1, 'ticketsup');
$object->dao->label = $object->dao->ref;
$morehtmlref ='<div class="refidno">';
$morehtmlref.= $object->subject;
// Author
if ($object->dao->fk_user_create > 0) {
$object->dao->label .= ' - ' . $langs->trans("CreatedBy") . ' ';
if ($object->fk_user_create > 0) {
$morehtmlref .= '<br>' . $langs->trans("CreatedBy") . ' ';
$langs->load("users");
$fuser = new User($db);
$fuser->fetch($object->dao->fk_user_create);
$object->dao->label .= $fuser->getNomUrl(0);
$fuser->fetch($object->fk_user_create);
$morehtmlref .= $fuser->getNomUrl(0);
}
if (!empty($object->dao->origin_email)) {
$object->dao->label .= ' - ' . $langs->trans("CreatedBy") . ' ';
$object->dao->label .= $object->dao->origin_email . ' <small>(' . $langs->trans("TicketEmailOriginIssuer") . ')</small>';
if (!empty($object->origin_email)) {
$morehtmlref .= '<br>' . $langs->trans("CreatedBy") . ' ';
$morehtmlref .= $object->origin_email . ' <small>(' . $langs->trans("TicketEmailOriginIssuer") . ')</small>';
}
$morehtmlref.='</div>';
$linkback = '<a href="' . dol_buildpath('/ticketsup/list.php', 1) . '"><strong>' . $langs->trans("BackToList") . '</strong></a> ';
$object->dao->ticketsupBannerTab('ref', '', ($user->societe_id ? 0 : 1), 'ref', 'subject', '', '', '', $morehtmlleft, $linkback);
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
@ -245,12 +246,12 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
// Track ID
print '<tr><td class="titlefield">' . $langs->trans("TicketTrackId") . '</td><td>';
if (!empty($object->dao->track_id)) {
if (empty($object->dao->ref)) {
$object->ref = $object->dao->id;
if (!empty($object->track_id)) {
if (empty($object->ref)) {
$object->ref = $object->id;
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'track_id');
} else {
print $object->dao->track_id;
print $object->track_id;
}
} else {
print $langs->trans('None');
@ -259,51 +260,51 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
// Subject
print '<tr><td>';
print $form->editfieldkey("Subject", 'subject', $object->dao->subject, $object->dao, $user->rights->ticketsup->write && !$user->societe_id, 'string');
print $form->editfieldkey("Subject", 'subject', $object->subject, $object, $user->rights->ticketsup->write && !$user->societe_id, 'string');
print '</td><td>';
print $form->editfieldval("Subject", 'subject', $object->dao->subject, $object->dao, $user->rights->ticketsup->write && !$user->societe_id, 'string');
print $form->editfieldval("Subject", 'subject', $object->subject, $object, $user->rights->ticketsup->write && !$user->societe_id, 'string');
print '</td></tr>';
// Creation date
print '<tr><td>' . $langs->trans("DateCreation") . '</td><td>';
print dol_print_date($object->dao->datec, 'dayhour');
print dol_print_date($object->datec, 'dayhour');
print '</td></tr>';
// Read date
if (!empty($object->dao->date_read)) {
if (!empty($object->date_read)) {
print '<tr><td>' . $langs->trans("TicketReadOn") . '</td><td>';
print dol_print_date($object->dao->date_read, 'dayhour');
print dol_print_date($object->date_read, 'dayhour');
print '</td></tr>';
print '<tr><td>' . $langs->trans("TicketTimeToRead") . '</td><td>';
print '<strong>' . convertSecondToTime($object->dao->date_read - $object->dao->datec) . '</strong>';
print '<strong>' . convertSecondToTime($object->date_read - $object->datec) . '</strong>';
print '</td></tr>';
}
// Close date
if (!empty($object->dao->date_close)) {
if (!empty($object->date_close)) {
print '<tr><td>' . $langs->trans("TicketCloseOn") . '</td><td>';
print dol_print_date($object->dao->date_close, 'dayhour');
print dol_print_date($object->date_close, 'dayhour');
print '</td></tr>';
}
print '</td></tr>';
// Customer
// Thirdparty
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Customer');
print $langs->trans('ThirdParty');
print '</td>';
if ($action != 'editcustomer' && $object->dao->fk_statut < 8 && !$user->societe_id && $user->rights->ticketsup->write) {
print '<td align="right"><a href="' . $url_page_current . '?action=editcustomer&amp;track_id=' . $object->dao->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a></td>';
if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticketsup->write) {
print '<td align="right"><a href="' . $url_page_current . '?action=editcustomer&amp;track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a></td>';
}
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editcustomer') {
$form->form_thirdparty($url_page_current . '?track_id=' . $object->dao->track_id, $object->dao->fk_soc, 'editcustomer', ($object->dao->fk_soc ? 's.rowid <> ' . $object->dao->fk_soc : ''), 1);
$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->fk_soc, 'editcustomer', ($object->fk_soc ? 's.rowid <> ' . $object->fk_soc : ''), 1);
} else {
$form->form_thirdparty($url_page_current . '?track_id=' . $object->dao->track_id, $object->dao->fk_soc, 'none', 's.rowid <> ' . $object->dao->fk_soc, 1);
$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->fk_soc, 'none', 's.rowid <> ' . $object->fk_soc, 1);
}
print '</td></tr>';
@ -315,41 +316,41 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
print $langs->trans('Project');
print '</td>';
if ($action != 'classify' && $user->rights->ticketsup->write) {
print '<td align="right"><a href="' . $url_page_current . '?action=classify&amp;track_id=' . $object->dao->track_id . '">' . img_edit($langs->trans('SetProject')) . '</a></td>';
print '<td align="right"><a href="' . $url_page_current . '?action=classify&amp;track_id=' . $object->track_id . '">' . img_edit($langs->trans('SetProject')) . '</a></td>';
}
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'classify') {
$form->form_project($url_page_current . '?track_id=' . $object->dao->track_id, $object->dao->socid, $object->dao->fk_project, 'projectid');
$form->form_project($url_page_current . '?track_id=' . $object->track_id, $object->socid, $object->fk_project, 'projectid');
} else {
$form->form_project($url_page_current . '?track_id=' . $object->dao->track_id, $object->dao->socid, $object->dao->fk_project, 'none');
$form->form_project($url_page_current . '?track_id=' . $object->track_id, $object->socid, $object->fk_project, 'none');
}
print '</td></tr>';
}
// User assigned
print '<tr><td>' . $langs->trans("UserAssignedTo") . '</td><td>';
if ($object->dao->fk_user_assign > 0) {
$userstat->fetch($object->dao->fk_user_assign);
if ($object->fk_user_assign > 0) {
$userstat->fetch($object->fk_user_assign);
print $userstat->getNomUrl(1);
} else {
print $langs->trans('None');
}
// Show user list to assignate one if status is "read"
if (GETPOST('set') == "assign_ticket" && $object->dao->fk_statut < 8 && !$user->societe_id && $user->rights->ticketsup->write) {
if (GETPOST('set') == "assign_ticket" && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticketsup->write) {
print '<form method="post" name="ticketsup" enctype="multipart/form-data" action="' . $url_page_current . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="assign_user">';
print '<input type="hidden" name="track_id" value="' . $object->dao->track_id . '">';
print '<input type="hidden" name="track_id" value="' . $object->track_id . '">';
print '<label for="fk_user_assign">' . $langs->trans("AssignUser") . '</label> ';
print $form->select_dolusers($user->id, 'fk_user_assign', 0);
print ' <input class="button" type="submit" name="btn_assign_user" value="' . $langs->trans("Validate") . '" />';
print '</form>';
}
if ($object->dao->fk_statut < 8 && GETPOST('set') != "assign_ticket" && $user->rights->ticketsup->manage) {
print '<a href="' . $url_page_current . '?track_id=' . $object->dao->track_id . '&action=view&set=assign_ticket">' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . '</a>';
if ($object->fk_statut < 8 && GETPOST('set') != "assign_ticket" && $user->rights->ticketsup->manage) {
print '<a href="' . $url_page_current . '?track_id=' . $object->track_id . '&action=view&set=assign_ticket">' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . '</a>';
}
print '</td></tr>';
@ -358,8 +359,8 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
print $langs->trans('Progression') . '</td><td align="left">';
print '</td>';
if ($action != 'progression' && $object->dao->fk_statut < 8 && !$user->societe_id) {
print '<td align="right"><a href="' . $url_page_current . '?action=progression&amp;track_id=' . $object->dao->track_id . '">' . img_edit($langs->trans('Modify')) . '</a></td>';
if ($action != 'progression' && $object->fk_statut < 8 && !$user->societe_id) {
print '<td align="right"><a href="' . $url_page_current . '?action=progression&amp;track_id=' . $object->track_id . '">' . img_edit($langs->trans('Modify')) . '</a></td>';
}
print '</tr></table>';
print '</td><td colspan="5">';
@ -368,21 +369,21 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="track_id" value="' . $track_id . '">';
print '<input type="hidden" name="action" value="set_progression">';
print '<input type="text" class="flat" size="20" name="progress" value="' . $object->dao->progress . '">';
print '<input type="text" class="flat" size="20" name="progress" value="' . $object->progress . '">';
print ' <input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
} else {
print($object->dao->progress > 0 ? $object->dao->progress : '0') . '%';
print($object->progress > 0 ? $object->progress : '0') . '%';
}
print '</td>';
print '</tr>';
// Timing (Duration sum of linked fichinter
$object->dao->fetchObjectLinked();
$num = count($object->dao->linkedObjects);
$object->fetchObjectLinked();
$num = count($object->linkedObjects);
$timing = 0;
if ($num) {
foreach ($object->dao->linkedObjects as $objecttype => $objects) {
foreach ($object->linkedObjects as $objecttype => $objects) {
if ($objecttype = "fichinter") {
foreach ($objects as $fichinter) {
$timing += $fichinter->duration;
@ -404,28 +405,28 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
print '<form method="post" name="form_edit_extrafields" enctype="multipart/form-data" action="' . $url_page_current . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="set_extrafields">';
print '<input type="hidden" name="track_id" value="' . $object->dao->track_id . '">';
print '<input type="hidden" name="track_id" value="' . $object->track_id . '">';
print $object->dao->showOptionals($extrafields, 'edit');
print $object->showOptionals($extrafields, 'edit');
print '<tr><td colspan="2" align="center">';
print ' <input class="button" type="submit" name="btn_edit_extrafields" value="' . $langs->trans("Modify") . '" />';
print ' <input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '" />';
print '</tr>';
print '</form>';
} else {
print $object->dao->showOptionals($extrafields);
print $object->showOptionals($extrafields);
if ($user->rights->ticketsup->write) {
print '<tr><td colspan="2" align="center">';
print '<a href="' . $url_page_current . '?track_id=' . $object->dao->track_id . '&action=edit_extrafields">' . img_picto('', 'edit') . ' ' . $langs->trans('Edit') . '</a>';
print '<a href="' . $url_page_current . '?track_id=' . $object->track_id . '&action=edit_extrafields">' . img_picto('', 'edit') . ' ' . $langs->trans('Edit') . '</a>';
print '</tr>';
}
}
}
print '</table>';
// View Original message
$object->viewTicketOriginalMessage($user, $action);
// View Original message
$actionobject->viewTicketOriginalMessage($user, $action);
// Fin colonne gauche et début colonne droite
@ -481,7 +482,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
print '<td width="40%">';
print '<label for="type_code">' . $langs->trans($property['label']) . '</label> ';
print '</td><td width="50%">';
print $formticket->{$property['list_function']}($object->dao->type_code, 'update_value', '', 0);
print $formticket->{$property['list_function']}($object->type_code, 'update_value', '', 0);
print '</td><td>';
print ' <input class="button" type="submit" name="btn_update_ticket_prop" value="' . $langs->trans("Modify") . '" />';
print '</td>';
@ -494,7 +495,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
} else {
// Type
print '<tr><td width="40%">' . $langs->trans("Type") . '</td><td>';
print $object->dao->type_label;
print $object->type_label;
if ($user->admin && !$noadmininfo) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
@ -503,7 +504,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
// Category
print '<tr><td>' . $langs->trans("Category") . '</td><td>';
print $object->dao->category_label;
print $object->category_label;
if ($user->admin && !$noadmininfo) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
@ -512,7 +513,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
// Severity
print '<tr><td>' . $langs->trans("TicketSeverity") . '</td><td>';
print $object->dao->severity_label;
print $object->severity_label;
if ($user->admin && !$noadmininfo) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
@ -522,14 +523,16 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
print '</table>'; // End table actions
// Display navbar with links to change ticket status
if (!$user->societe_id && $user->rights->ticketsup->write && $object->dao->fk_status < 8 && GETPOST('set') !== 'properties') {
$object->viewStatusActions();
print '<!-- navbar with status -->';
if (!$user->societe_id && $user->rights->ticketsup->write && $object->fk_status < 8 && GETPOST('set') !== 'properties') {
$actionobject->viewStatusActions($object);
}
print load_fiche_titre($langs->trans('Contacts'), '', 'title_companies.png');
print '<div class="div-table-responsive-no-min">';
print '<div class="tagtable centpercent noborder allwidth">';
print '<div class="tagtr liste_titre">';
print '<div class="tagtd ">' . $langs->trans("Source") . '</div>
@ -545,7 +548,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
$contactstatic = new Contact($db);
$userstatic = new User($db);
foreach (array('internal', 'external') as $source) {
$tmpobject = $object->dao;
$tmpobject = $object;
$tab = $tmpobject->listeContact(-1, $source);
$num = count($tab);
$i = 0;
@ -607,7 +610,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
print '<div class="tagtd" align="center">';
if ($object->statut >= 0) {
echo '<a href="contact.php?track_id=' . $object->dao->track_id . '&amp;action=swapstatut&amp;ligne=' . $tab[$i]['rowid'] . '">';
echo '<a href="contact.php?track_id=' . $object->track_id . '&amp;action=swapstatut&amp;ligne=' . $tab[$i]['rowid'] . '">';
}
if ($tab[$i]['source'] == 'internal') {
@ -635,6 +638,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
}
print '</div><!-- contact list -->';
print '</div>';
// Contract
if ($action == 'sel_contract') {
@ -644,8 +648,8 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
$form_contract = new FormContract($db);
$form_contract->formSelectContract(
$url_page_current.'?track_id='.$object->dao->track_id,
$object->dao->fk_soc,
$url_page_current.'?track_id='.$object->track_id,
$object->fk_soc,
GETPOST('contractid'),
'contractid'
);
@ -657,53 +661,47 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
print dol_fiche_end();
/* ActionBar */
print '<div class="tabsAction">';
// Show button to mark as read
if (($object->dao->fk_statut == '0' || empty($object->dao->date_read)) && !$user->societe_id) {
print '<div class="inline-block divButAction">';
print '<a class="butAction" href="card.php?track_id=' . $object->dao->track_id . '&action=mark_ticket_read">' . img_picto('', 'mark-read@ticketsup', 'height="12px"') . ' ' . $langs->trans('MarkAsRead') . '</a>';
print '</div';
}
// Show link to add a message (if read and not closed)
if ($object->dao->fk_statut < 8 && $action != "add_message") {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->dao->track_id . '&action=add_message">' . $langs->trans('TicketAddMessage') . '</a></div>';
if ($object->fk_statut < 8 && $action != "add_message") {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->track_id . '&action=add_message">' . $langs->trans('TicketAddMessage') . '</a></div>';
}
// Link to create an intervention
// socid is needed otherwise fichinter ask it and forgot origin after form submit :\
if (!$object->dao->fk_soc && $user->rights->ficheinter->creer) {
if (!$object->fk_soc && $user->rights->ficheinter->creer) {
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans('UnableToCreateInterIfNoSocid') . '">' . $langs->trans('TicketAddIntervention') . '</a></div>';
}
if ($object->dao->fk_soc > 0 && $object->dao->fk_statut < 8 && $user->rights->ficheinter->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . dol_buildpath('/fichinter/card.php', 1) . '?action=create&socid=' . $object->dao->fk_soc . '&origin=ticketsup_ticketsup&originid=' . $object->dao->id . '">' . $langs->trans('TicketAddIntervention') . '</a></div>';
if ($object->fk_soc > 0 && $object->fk_statut < 8 && $user->rights->ficheinter->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . dol_buildpath('/fichinter/card.php', 1) . '?action=create&socid=' . $object->fk_soc . '&origin=ticketsup_ticketsup&originid=' . $object->id . '">' . $langs->trans('TicketAddIntervention') . '</a></div>';
}
// Button to edit Properties
if ($object->dao->fk_statut < 5 && $user->rights->ticketsup->write) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->dao->track_id . '&action=view&set=properties">' . $langs->trans('TicketEditProperties') . '</a></div>';
if ($object->fk_statut < 5 && $user->rights->ticketsup->write) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->track_id . '&action=view&set=properties">' . $langs->trans('TicketEditProperties') . '</a></div>';
}
// Button to link to a contract
if ($user->rights->ticketsup->write && $object->dao->fk_statut < 5 && $user->rights->contrat->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->dao->track_id . '&action=sel_contract">' . $langs->trans('LinkToAContract') . '</a></div>';
if ($user->rights->ticketsup->write && $object->fk_statut < 5 && $user->rights->contrat->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->track_id . '&action=sel_contract">' . $langs->trans('LinkToAContract') . '</a></div>';
}
// Close ticket if statut is read
if ($object->dao->fk_statut > 0 && $object->dao->fk_statut < 8 && $user->rights->ticketsup->write) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->dao->track_id . '&action=close">' . $langs->trans('CloseTicket') . '</a></div>';
if ($object->fk_statut > 0 && $object->fk_statut < 8 && $user->rights->ticketsup->write) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->track_id . '&action=close">' . $langs->trans('CloseTicket') . '</a></div>';
}
// Re-open ticket
if (!$user->socid && $object->dao->fk_statut == 8 && !$user->societe_id) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->dao->track_id . '&action=reopen">' . $langs->trans('ReOpen') . '</a></div>';
if (!$user->socid && $object->fk_statut == 8 && !$user->societe_id) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->track_id . '&action=reopen">' . $langs->trans('ReOpen') . '</a></div>';
}
// Delete ticket
if ($user->rights->ticketsup->delete && !$user->societe_id) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?track_id=' . $object->dao->track_id . '&action=delete">' . $langs->trans('Delete') . '</a></div>';
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?track_id=' . $object->track_id . '&action=delete">' . $langs->trans('Delete') . '</a></div>';
}
print '</div>';
@ -715,7 +713,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
// Message list
print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'messages@ticketsup');
$show_private_message = ($user->societe_id ? 0 : 1);
$object->viewTicketTimelineMessages($show_private_message);
$actionobject->viewTicketTimelineMessages($show_private_message, true, $object);
print '</div><!-- fichehalfleft --> ';
@ -741,8 +739,8 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
$formticket = new FormTicketsup($db);
$formticket->action = $action;
$formticket->track_id = $object->dao->track_id;
$formticket->id = $object->dao->id;
$formticket->track_id = $object->track_id;
$formticket->id = $object->id;
$formticket->withfile = 2;
$formticket->param = array('fk_user_create' => $user->id);
@ -751,32 +749,32 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
// Tableau des parametres complementaires du post
$formticket->param['models']=$modelmail;
$formticket->param['models_id']=GETPOST('modelmailselected', 'int');
//$formticket->param['socid']=$object->dao->fk_soc;
$formticket->param['returnurl']=$_SERVER["PHP_SELF"].'?track_id='.$object->dao->track_id;
//$formticket->param['socid']=$object->fk_soc;
$formticket->param['returnurl']=$_SERVER["PHP_SELF"].'?track_id='.$object->track_id;
$formticket->withsubstit = 1;
if ($object->dao->fk_soc > 0) {
$object->dao->fetch_thirdparty();
$formticket->substit['__THIRDPARTY_NAME__'] = $object->dao->thirdparty->name;
if ($object->fk_soc > 0) {
$object->fetch_thirdparty();
$formticket->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
}
$formticket->substit['__SIGNATURE__'] = $user->signature;
$formticket->substit['__TICKETSUP_TRACKID__'] = $object->dao->track_id;
$formticket->substit['__TICKETSUP_REF__'] = $object->dao->ref;
$formticket->substit['__TICKETSUP_SUBJECT__'] = $object->dao->subject;
$formticket->substit['__TICKETSUP_TYPE__'] = $object->dao->type_code;
$formticket->substit['__TICKETSUP_CATEGORY__'] = $object->dao->category_code;
$formticket->substit['__TICKETSUP_SEVERITY__'] = $object->dao->severity_code;
$formticket->substit['__TICKETSUP_MESSAGE__'] = $object->dao->message;
$formticket->substit['__TICKETSUP_PROGRESSION__'] = $object->dao->progress;
if ($object->dao->fk_user_assign > 0) {
$userstat->fetch($object->dao->fk_user_assign);
$formticket->substit['__TICKETSUP_TRACKID__'] = $object->track_id;
$formticket->substit['__TICKETSUP_REF__'] = $object->ref;
$formticket->substit['__TICKETSUP_SUBJECT__'] = $object->subject;
$formticket->substit['__TICKETSUP_TYPE__'] = $object->type_code;
$formticket->substit['__TICKETSUP_CATEGORY__'] = $object->category_code;
$formticket->substit['__TICKETSUP_SEVERITY__'] = $object->severity_code;
$formticket->substit['__TICKETSUP_MESSAGE__'] = $object->message;
$formticket->substit['__TICKETSUP_PROGRESSION__'] = $object->progress;
if ($object->fk_user_assign > 0) {
$userstat->fetch($object->fk_user_assign);
$formticket->substit['__TICKETSUP_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
}
if ($object->dao->fk_user_create > 0) {
$userstat->fetch($object->dao->fk_user_create);
if ($object->fk_user_create > 0) {
$userstat->fetch($object->fk_user_create);
$formticket->substit['__TICKETSUP_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
}
@ -792,7 +790,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
*
* Put here code to view linked object
****************************************************/
$somethingshown = $form->showLinkedObjectBlock($object->dao);
$somethingshown = $form->showLinkedObjectBlock($object);
// End of page
llxFooter('');

View File

@ -79,21 +79,20 @@ class ActionsTicketsup
* doActions
*
* @param string $action Action type
* @param Ticketsup $object Object Ticketsup
* @return int 0
*/
public function doActions(&$action = '')
public function doActions(&$action = '', Ticketsup $object=null)
{
global $conf, $user, $langs, $mysoc;
$this->getInstanceDao();
/*
* Add file in email form
*/
if (GETPOST('addfile')) {
// altairis : allow files from public interface
if (GETPOST('track_id')) {
$res = $this->dao->fetch('', GETPOST('track_id','alpha'));
$res = $object->fetch('', GETPOST('track_id','alpha'));
}
////if($res > 0)
@ -101,13 +100,13 @@ class ActionsTicketsup
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
// Set tmp directory TODO Use a dedicated directory for temp mails files
$vardir = $conf->ticketsup->dir_output . (!empty($this->dao->track_id) ? '/' . dol_sanitizeFileName($this->dao->track_id) : '');
$vardir = $conf->ticketsup->dir_output . (!empty($object->track_id) ? '/' . dol_sanitizeFileName($object->track_id) : '');
$upload_dir_tmp = $vardir . '/temp';
if (!dol_is_dir($upload_dir_tmp)) {
dol_mkdir($upload_dir_tmp);
}
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', dol_print_date(dol_now(), '%Y%m%d%H%M%S') . '-__file__');
$action = !empty($this->dao->track_id) ? 'add_message' : 'create_ticket';
$action = !empty($object->track_id) ? 'add_message' : 'create_ticket';
////}
}
@ -117,7 +116,7 @@ class ActionsTicketsup
if (GETPOST('removedfile')) {
// altairis : allow files from public interface
if (GETPOST('track_id')) {
$res = $this->dao->fetch('', GETPOST('track_id'));
$res = $object->fetch('', GETPOST('track_id'));
}
////if($res > 0)
@ -125,12 +124,12 @@ class ActionsTicketsup
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
// Set tmp directory
$vardir = $conf->ticketsup->dir_output . (!empty($this->dao->track_id) ? '/' . dol_sanitizeFileName($this->dao->track_id) : '');
$vardir = $conf->ticketsup->dir_output . (!empty($object->track_id) ? '/' . dol_sanitizeFileName($object->track_id) : '');
$upload_dir_tmp = $vardir . '/temp';
// TODO Delete only files that was uploaded from email form
dol_remove_file_process($_POST['removedfile'], 0);
$action = !empty($this->dao->track_id) ? 'add_message' : 'create_ticket';
$action = !empty($object->track_id) ? 'add_message' : 'create_ticket';
////}
}
@ -150,32 +149,33 @@ class ActionsTicketsup
if (!$error) {
$this->db->begin();
$this->dao->track_id = generate_random_id(16);
$object->track_id = generate_random_id(16);
$this->dao->ref = GETPOST("ref", 'alpha');
$this->dao->fk_soc = GETPOST("socid", 'int');
$this->dao->subject = GETPOST("subject", 'alpha');
$this->dao->message = GETPOST("message");
$object->ref = GETPOST("ref", 'alpha');
$object->fk_soc = GETPOST("socid", 'int') > 0 ? GETPOST("socid", 'int') : 0;
$object->subject = GETPOST("subject", 'alpha');
$object->message = GETPOST("message");
$this->dao->type_code = GETPOST("type_code", 'alpha');
$this->dao->category_code = GETPOST("category_code", 'alpha');
$this->dao->severity_code = GETPOST("severity_code", 'alpha');
$notNotifyTiers = GETPOST("not_notify_tiers_at_create", 'alpha');
$this->dao->notify_tiers_at_create = empty($notNotifyTiers) ? 1 : 0;
$object->type_code = GETPOST("type_code", 'alpha');
$object->category_code = GETPOST("category_code", 'alpha');
$object->severity_code = GETPOST("severity_code", 'alpha');
$notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
$object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1;
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($this->dao->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $this->dao);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
$id = $this->dao->create($user);
$id = $object->create($user);
if ($id <= 0) {
$error++;
$this->error = $this->dao->error;
$this->errors = $this->dao->errors;
$this->error = $object->error;
$this->errors = $object->errors;
$action = 'create_ticket';
}
if (!$error && $id > 0) {
if (!$error && $id > 0)
{
$this->db->commit();
// File transfer
@ -186,46 +186,47 @@ class ActionsTicketsup
$type_contact = GETPOST("type", 'alpha');
if ($contactid > 0 && $type_contact) {
$result = $this->dao->add_contact($contactid, GETPOST("type"), 'external');
$result = $object->add_contact($contactid, GETPOST("type"), 'external');
}
// altairis: link ticket to project
if (GETPOST('projectid')) {
$this->dao->setProject(GETPOST('projectid'));
if (GETPOST('projectid') > 0) {
$object->setProject(GETPOST('projectid'));
}
// Auto assign user
if ($conf->global->TICKETS_AUTO_ASSIGN_USER_CREATE) {
$result = $this->dao->assignUser($user, $user->id, 1);
$this->dao->add_contact($user->id, "SUPPORTTEC", 'internal');
$result = $object->assignUser($user, $user->id, 1);
$object->add_contact($user->id, "SUPPORTTEC", 'internal');
}
// Auto assign contrat
$contractid = 0;
if ($conf->global->TICKETS_AUTO_ASSIGN_CONTRACT_CREATE) {
$contrat = new Contrat($this->db);
$contrat->socid = $this->dao->fk_soc;
$contrat->socid = $object->fk_soc;
$list = $contrat->getListOfContracts();
if (is_array($list) && !empty($list)) {
if (count($list) == 1) {
$contractid = $list[0]->id;
$this->dao->setContract($contractid);
$object->setContract($contractid);
} else {
}
}
}
// Auto create fiche intervention
if ($conf->global->TICKETS_AUTO_CREATE_FICHINTER_CREATE) {
if ($conf->global->TICKETS_AUTO_CREATE_FICHINTER_CREATE)
{
$fichinter = new Fichinter($this->db);
$fichinter->socid = $this->dao->fk_soc;
$fichinter->socid = $object->fk_soc;
$fichinter->fk_project = GETPOST('projectid', 'int');
$fichinter->fk_contrat = $contractid;
$fichinter->author = $user->id;
$fichinter->modelpdf = 'soleil';
$fichinter->origin = $this->dao->element;
$fichinter->origin_id = $this->dao->id;
$fichinter->origin = $object->element;
$fichinter->origin_id = $object->id;
// Extrafields
$extrafields = new ExtraFields($this->db);
@ -242,7 +243,7 @@ class ActionsTicketsup
if (!empty($backtopage)) {
$url = $backtopage;
} else {
$url = 'card.php?track_id=' . $this->dao->track_id;
$url = 'card.php?track_id=' . $object->track_id;
}
header("Location: " . $url);
@ -259,7 +260,7 @@ class ActionsTicketsup
if ($action == 'edit' && $user->rights->ticketsup->write) {
$error = 0;
if ($this->dao->fetch(GETPOST('id')) < 0) {
if ($object->fetch(GETPOST('id')) < 0) {
$error++;
array_push($this->errors, $langs->trans("ErrorTicketIsNotValid"));
$_GET["action"] = $_POST["action"] = '';
@ -269,7 +270,7 @@ class ActionsTicketsup
if (GETPOST('update') && GETPOST('id') && $user->rights->ticketsup->write) {
$error = 0;
$ret = $this->dao->fetch(GETPOST('id'));
$ret = $object->fetch(GETPOST('id'));
if ($ret < 0) {
$error++;
array_push($this->errors, $langs->trans("ErrorTicketIsNotValid"));
@ -287,15 +288,15 @@ class ActionsTicketsup
if (!$error) {
$this->db->begin();
$this->dao->label = GETPOST("label");
$this->dao->description = GETPOST("description");
$object->label = GETPOST("label");
$object->description = GETPOST("description");
//...
$ret = $this->dao->update(GETPOST('id'), $user);
$ret = $object->update(GETPOST('id'), $user);
if ($ret <= 0) {
$error++;
$this->errors = $this->dao->error;
$this->errors = $this->dao->errors;
$this->errors = $object->error;
$this->errors = $object->errors;
$action = 'edit';
}
@ -308,29 +309,29 @@ class ActionsTicketsup
}
if ($action == "mark_ticket_read" && $user->rights->ticketsup->write) {
$this->dao->fetch('', GETPOST("track_id"));
$object->fetch('', GETPOST("track_id"));
if ($this->dao->markAsRead($user) > 0) {
if ($object->markAsRead($user) > 0) {
// Log action in ticket logs table
$log_action = $langs->trans('TicketLogMesgReadBy', $user->getFullName($langs));
$ret = $this->dao->createTicketLog($user, $log_action);
$ret = $object->createTicketLog($user, $log_action);
if ($ret > 0) {
setEventMessages($langs->trans('TicketMarkedAsRead'), null, 'mesgs');
} else {
setEventMessages($langs->trans('TicketMarkedAsReadButLogActionNotSaved'), null, 'errors');
}
header("Location: card.php?track_id=" . $this->dao->track_id . "&action=view");
header("Location: card.php?track_id=" . $object->track_id . "&action=view");
exit;
} else {
array_push($this->errors, $this->dao->error);
array_push($this->errors, $object->error);
}
$action = 'view';
}
if ($action == "assign_user" && GETPOST('btn_assign_user') && $user->rights->ticketsup->write) {
$this->dao->fetch('', GETPOST("track_id"));
$object->fetch('', GETPOST("track_id"));
$useroriginassign = $this->dao->fk_user_assign;
$useroriginassign = $object->fk_user_assign;
$usertoassign = GETPOST('fk_user_assign');
if (!$usertoassign) {
$error++;
@ -339,38 +340,38 @@ class ActionsTicketsup
}
if (!$error) {
$ret = $this->dao->assignUser($user, $usertoassign);
$ret = $object->assignUser($user, $usertoassign);
if ($ret) {
// Si déjà un user assigné on le supprime des contacts
if ($useroriginassign > 0) {
$internal_contacts = $this->dao->listeContact(-1, 'internal');
$internal_contacts = $object->listeContact(-1, 'internal');
foreach ($internal_contacts as $key => $contact) {
if ($contact['code'] == "SUPPORTTEC" && $contact['id'] == $useroriginassign) {
}
{
//print "user à effacer : ".$useroriginassign;
$this->dao->delete_contact($contact['rowid']);
$object->delete_contact($contact['rowid']);
}
}
}
$this->dao->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0);
$object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0);
}
// Log action in ticket logs table
$this->dao->fetch_user($usertoassign);
$log_action = $langs->trans('TicketLogAssignedTo', $this->dao->user->getFullName($langs));
$ret = $this->dao->createTicketLog($user, $log_action);
$object->fetch_user($usertoassign);
$log_action = $langs->trans('TicketLogAssignedTo', $object->user->getFullName($langs));
$ret = $object->createTicketLog($user, $log_action);
if ($ret > 0) {
setEventMessages($langs->trans('TicketAssigned'), null, 'mesgs');
} else {
setEventMessages($langs->trans('TicketAssignedButLogActionNotSaved'), null, 'errors');
}
header("Location: card.php?track_id=" . $this->dao->track_id . "&action=view");
header("Location: card.php?track_id=" . $object->track_id . "&action=view");
exit;
} else {
array_push($this->errors, $this->dao->error);
array_push($this->errors, $object->error);
}
$action = 'view';
}
@ -381,18 +382,18 @@ class ActionsTicketsup
$fieldtomodify = GETPOST('property') . '_code';
$fieldtomodify_label = GETPOST('property') . '_label';
$oldvalue_code = $this->dao->$fieldtomodify;
$newvalue_code = $this->dao->getValueFrom('c_ticketsup_' . GETPOST('property'), GETPOST('update_value'), 'code');
$oldvalue_code = $object->$fieldtomodify;
$newvalue_code = $object->getValueFrom('c_ticketsup_' . GETPOST('property'), GETPOST('update_value'), 'code');
$oldvalue_label = $this->dao->$fieldtomodify_label;
$newvalue_label = $this->dao->getValueFrom('c_ticketsup_' . GETPOST('property'), GETPOST('update_value'), 'label');
$oldvalue_label = $object->$fieldtomodify_label;
$newvalue_label = $object->getValueFrom('c_ticketsup_' . GETPOST('property'), GETPOST('update_value'), 'label');
$this->dao->$fieldtomodify = $newvalue_code;
$object->$fieldtomodify = $newvalue_code;
$ret = $this->dao->update($user);
$ret = $object->update($user);
if ($ret > 0) {
$log_action = $langs->trans('TicketLogPropertyChanged', $oldvalue_label, $newvalue_label);
$ret = $this->dao->createTicketLog($user, $log_action);
$ret = $object->createTicketLog($user, $log_action);
if ($ret > 0) {
setEventMessages($langs->trans('TicketUpdated'), null, 'mesgs');
}
@ -406,13 +407,13 @@ class ActionsTicketsup
if (!empty($backtopage)) {
$url = $backtopage;
} else {
$url = 'card.php?action=view&track_id=' . $this->dao->track_id;
$url = 'card.php?action=view&track_id=' . $object->track_id;
}
header("Location: " . $url);
exit;
} else {
setEventMessages($this->dao->error, null, 'errors');
setEventMessages($object->error, null, 'errors');
$action = 'add_message';
}
}
@ -423,10 +424,10 @@ class ActionsTicketsup
if ($action == "confirm_close" && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticketsup->write) {
$this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha'));
if ($this->dao->close()) {
if ($object->close()) {
// Log action in ticket logs table
$log_action = $langs->trans('TicketLogClosedBy', $user->getFullName($langs));
$ret = $this->dao->createTicketLog($user, $log_action);
$ret = $object->createTicketLog($user, $log_action);
if ($ret > 0) {
setEventMessages('<div class="confirm">' . $langs->trans('TicketMarkedAsClosed') . '</div>');
} else {
@ -442,10 +443,10 @@ class ActionsTicketsup
if ($action == "confirm_public_close" && GETPOST('confirm', 'alpha') == 'yes') {
$this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha'));
if (($_SESSION['email_customer'] == $this->dao->origin_email || $_SESSION['email_customer'] == $this->dao->thirdparty->email) && $this->dao->close()) {
if (($_SESSION['email_customer'] == $object->origin_email || $_SESSION['email_customer'] == $object->thirdparty->email) && $object->close()) {
// Log action in ticket logs table
$log_action = $langs->trans('TicketLogClosedBy', $_SESSION['email_customer']);
$ret = $this->dao->createTicketLog($user, $log_action);
$ret = $object->createTicketLog($user, $log_action);
if ($ret > 0) {
setEventMessages('<div class="confirm">' . $langs->trans('TicketMarkedAsClosed') . '</div>', null, 'mesgs');
} else {
@ -461,9 +462,9 @@ class ActionsTicketsup
if ($action == 'confirm_delete_ticket' && GETPOST('confirm', 'alpha') == "yes" && $user->rights->ticketsup->delete) {
if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
if ($this->dao->delete($user) > 0) {
if ($object->delete($user) > 0) {
setEventMessages('<div class="confirm">' . $langs->trans('TicketDeletedSuccess') . '</div>', null, 'mesgs');
Header("Location: index.php");
Header("Location: ".DOL_URL_ROOT."/ticketsup/list.php");
exit;
} else {
$langs->load("errors");
@ -476,7 +477,7 @@ class ActionsTicketsup
// Set parent company
if ($action == 'set_thirdparty' && $user->rights->societe->creer) {
if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
$result = $this->dao->setCustomer(GETPOST('editcustomer', 'int'));
$result = $object->setCustomer(GETPOST('editcustomer', 'int'));
$url = 'card.php?action=view&track_id=' . GETPOST('track_id', 'alpha');
header("Location: " . $url);
exit();
@ -485,11 +486,11 @@ class ActionsTicketsup
if ($action == 'set_progression' && $user->rights->ticketsup->write) {
if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
$result = $this->dao->setProgression(GETPOST('progress'));
$result = $object->setProgression(GETPOST('progress'));
// Log action in ticket logs table
$log_action = $langs->trans('TicketLogProgressSetTo', GETPOST('progress'));
$ret = $this->dao->createTicketLog($user, $log_action);
$url = 'card.php?action=view&track_id=' . $this->dao->track_id;
$ret = $object->createTicketLog($user, $log_action);
$url = 'card.php?action=view&track_id=' . $object->track_id;
header("Location: " . $url);
exit();
}
@ -498,19 +499,19 @@ class ActionsTicketsup
if ($action == 'setsubject') {
if ($this->fetch(GETPOST('id', 'int'))) {
if ($action == 'setsubject') {
$this->dao->subject = trim(GETPOST('subject', 'alpha'));
$object->subject = trim(GETPOST('subject', 'alpha'));
}
if ($action == 'setsubject' && empty($this->dao->subject)) {
if ($action == 'setsubject' && empty($object->subject)) {
$mesg .= ($mesg ? '<br>' : '') . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"));
}
if (!$mesg) {
if ($this->dao->update($user) >= 0) {
header("Location: " . $_SERVER['PHP_SELF'] . "?track_id=" . $this->dao->track_id);
if ($object->update($user) >= 0) {
header("Location: " . $_SERVER['PHP_SELF'] . "?track_id=" . $object->track_id);
exit;
}
$mesg = $this->dao->error;
$mesg = $object->error;
}
}
}
@ -519,13 +520,13 @@ class ActionsTicketsup
$res = $this->fetch('', GETPOST('track_id'));
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($this->dao->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $this->dao);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
$ret = $this->dao->update($user);
$ret = $object->update($user);
if ($ret > 0) {
setEventMessages($langs->trans('TicketUpdated'), null, 'mesgs');
$url = 'card.php?action=view&track_id=' . $this->dao->track_id;
$url = 'card.php?action=view&track_id=' . $object->track_id;
header("Location: " . $url);
exit();
}
@ -535,13 +536,13 @@ class ActionsTicketsup
elseif ($action == 'confirm_reopen' && $user->rights->ticketsup->manage && !GETPOST('cancel')) {
if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
// prevent browser refresh from reopening ticket several times
if ($this->dao->fk_statut == 8) {
$res = $this->dao->setStatut(4);
if ($object->fk_statut == 8) {
$res = $object->setStatut(4);
if ($res) {
// Log action in ticket logs table
$log_action = $langs->trans('TicketLogReopen');
$ret = $this->dao->createTicketLog($user, $log_action);
$url = 'card.php?action=view&track_id=' . $this->dao->track_id;
$ret = $object->createTicketLog($user, $log_action);
$url = 'card.php?action=view&track_id=' . $object->track_id;
header("Location: " . $url);
exit();
}
@ -550,16 +551,16 @@ class ActionsTicketsup
} // Categorisation dans projet
elseif ($action == 'classin' && $user->rights->ticketsup->write) {
if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
$this->dao->setProject(GETPOST('projectid'));
$url = 'card.php?action=view&track_id=' . $this->dao->track_id;
$object->setProject(GETPOST('projectid'));
$url = 'card.php?action=view&track_id=' . $object->track_id;
header("Location: " . $url);
exit();
}
} // Categorisation dans contrat
elseif ($action == 'setcontract' && $user->rights->ticketsup->write) {
if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
$this->dao->setContract(GETPOST('contractid'));
$url = 'card.php?action=view&track_id=' . $this->dao->track_id;
$object->setContract(GETPOST('contractid'));
$url = 'card.php?action=view&track_id=' . $object->track_id;
header("Location: " . $url);
exit();
}
@ -567,19 +568,19 @@ class ActionsTicketsup
// altairis: manage cancel button
if (!GETPOST('cancel')) {
$this->fetch('', GETPOST('track_id'));
$oldvalue_message = $this->dao->message;
$oldvalue_message = $object->message;
$fieldtomodify = GETPOST('message_initial');
$this->dao->message = $fieldtomodify;
$ret = $this->dao->update($user);
$object->message = $fieldtomodify;
$ret = $object->update($user);
if ($ret > 0) {
$log_action = $langs->trans('TicketInitialMessageModified') . " \n";
// include the Diff class
dol_include_once('/ticketsup/class/utils_diff.class.php');
// output the result of comparing two files as plain text
$log_action .= Diff::toString(Diff::compare(strip_tags($oldvalue_message), strip_tags($this->dao->message)));
$log_action .= Diff::toString(Diff::compare(strip_tags($oldvalue_message), strip_tags($object->message)));
$ret = $this->dao->createTicketLog($user, $log_action);
$ret = $object->createTicketLog($user, $log_action);
if ($ret > 0) {
setEventMessages($langs->trans('TicketMessageSuccesfullyUpdated'), null, 'mesgs');
}
@ -591,13 +592,13 @@ class ActionsTicketsup
elseif ($action == 'confirm_set_status' && $user->rights->ticketsup->write && !GETPOST('cancel')) {
if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
$new_status = GETPOST('new_status', 'int');
$old_status = $this->dao->fk_statut;
$res = $this->dao->setStatut($new_status);
$old_status = $object->fk_statut;
$res = $object->setStatut($new_status);
if ($res) {
// Log action in ticket logs table
$log_action = $langs->trans('TicketLogStatusChanged', $langs->transnoentities($this->dao->statuts_short[$old_status]), $langs->transnoentities($this->dao->statuts_short[$new_status]));
$ret = $this->dao->createTicketLog($user, $log_action);
$url = 'card.php?action=view&track_id=' . $this->dao->track_id;
$log_action = $langs->trans('TicketLogStatusChanged', $langs->transnoentities($object->statuts_short[$old_status]), $langs->transnoentities($object->statuts_short[$new_status]));
$ret = $object->createTicketLog($user, $log_action);
$url = 'card.php?action=view&track_id=' . $object->track_id;
header("Location: " . $url);
exit();
}
@ -624,9 +625,11 @@ class ActionsTicketsup
$contactstatic = new Contact($this->db);
$error = 0;
$ret = $this->dao->fetch('', GETPOST('track_id'));
$this->dao->socid = $this->dao->fk_soc;
$this->dao->fetch_thirdparty();
$object = new Ticketsup($this->db);
$ret = $object->fetch('', GETPOST('track_id'));
$object->socid = $object->fk_soc;
$object->fetch_thirdparty();
if ($ret < 0) {
$error++;
array_push($this->errors, $langs->trans("ErrorTicketIsNotValid"));
@ -640,15 +643,15 @@ class ActionsTicketsup
}
if (!$error) {
$this->dao->message = GETPOST("message");
$this->dao->private = GETPOST("private_message");
$object->message = GETPOST("message");
$object->private = GETPOST("private_message");
$send_email = GETPOST('send_email', 'int');
$id = $this->dao->createTicketMessage($user);
$id = $object->createTicketMessage($user);
if ($id <= 0) {
$error++;
$this->errors = $this->dao->error;
$this->errors = $this->dao->errors;
$this->errors = $object->error;
$this->errors = $object->errors;
$action = 'add_message';
}
@ -660,14 +663,14 @@ class ActionsTicketsup
*/
if ($send_email > 0) {
// Retrieve internal contact datas
$internal_contacts = $this->dao->getInfosTicketInternalContact();
$internal_contacts = $object->getInfosTicketInternalContact();
$sendto = array();
if (is_array($internal_contacts) && count($internal_contacts) > 0) {
// altairis: set default subject
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
$subject = GETPOST('subject') ? GETPOST('subject') : '[' . $label_title . '- ticket #' . $this->dao->track_id . '] ' . $langs->trans('TicketNewMessage');
$subject = GETPOST('subject') ? GETPOST('subject') : '[' . $label_title . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
$message_intro = $langs->trans('TicketNotificationEmailBody', "#" . $this->dao->id);
$message_intro = $langs->trans('TicketNotificationEmailBody', "#" . $object->id);
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKETS_MESSAGE_MAIL_SIGNATURE;
$message = $langs->trans('TicketMessageMailIntroText');
@ -677,9 +680,9 @@ class ActionsTicketsup
// Coordonnées client
$message .= "\n\n";
$message .= "==============================================\n";
$message .= !empty($this->dao->thirdparty->name) ? $langs->trans('Thirdparty') . " : " . $this->dao->thirdparty->name : '';
$message .= !empty($this->dao->thirdparty->town) ? "\n" . $langs->trans('Town') . " : " . $this->dao->thirdparty->town : '';
$message .= !empty($this->dao->thirdparty->phone) ? "\n" . $langs->trans('Phone') . " : " . $this->dao->thirdparty->phone : '';
$message .= !empty($object->thirdparty->name) ? $langs->trans('Thirdparty') . " : " . $object->thirdparty->name : '';
$message .= !empty($object->thirdparty->town) ? "\n" . $langs->trans('Town') . " : " . $object->thirdparty->town : '';
$message .= !empty($object->thirdparty->phone) ? "\n" . $langs->trans('Phone') . " : " . $object->thirdparty->phone : '';
// Build array to display recipient list
foreach ($internal_contacts as $key => $info_sendto) {
@ -698,10 +701,10 @@ class ActionsTicketsup
}
$message .= "\n";
// URL ticket
$url_internal_ticket = dol_buildpath('/ticketsup/card.php', 2) . '?track_id=' . $this->dao->track_id;
$url_internal_ticket = dol_buildpath('/ticketsup/card.php', 2) . '?track_id=' . $object->track_id;
// altairis: make html link on url
$message .= "\n" . $langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal') . ' : ' . '<a href="' . $url_internal_ticket . '">' . $this->dao->track_id . '</a>' . "\n";
$message .= "\n" . $langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal') . ' : ' . '<a href="' . $url_internal_ticket . '">' . $object->track_id . '</a>' . "\n";
// Add global email address recipient
// altairis: use new TICKETS_NOTIFICATION_EMAIL_TO configuration variable
@ -718,18 +721,18 @@ class ActionsTicketsup
/*
* Email for externals users if not private
*/
if (empty($this->dao->private)) {
if (empty($object->private)) {
// Retrieve email of all contacts (external)
$external_contacts = $this->dao->getInfosTicketExternalContact();
$external_contacts = $object->getInfosTicketExternalContact();
// If no contact, get email from thirdparty
if (is_array($external_contacts) && count($external_contacts) === 0) {
if (!empty($this->dao->fk_soc)) {
$this->dao->fetch_thirdparty($this->dao->fk_soc);
$array_company = array(array('firstname' => '', 'lastname' => $this->dao->thirdparty->name, 'email' => $this->dao->thirdparty->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $this->dao->thirdparty->id));
if (!empty($object->fk_soc)) {
$object->fetch_thirdparty($object->fk_soc);
$array_company = array(array('firstname' => '', 'lastname' => $object->thirdparty->name, 'email' => $object->thirdparty->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $object->thirdparty->id));
$external_contacts = array_merge($external_contacts, $array_company);
} elseif (empty($this->dao->fk_soc) && !empty($this->dao->origin_email)) {
$array_external = array(array('firstname' => '', 'lastname' => $this->dao->origin_email, 'email' => $this->dao->thirdparty->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $this->dao->thirdparty->id));
} elseif (empty($object->fk_soc) && !empty($object->origin_email)) {
$array_external = array(array('firstname' => '', 'lastname' => $object->origin_email, 'email' => $object->thirdparty->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $object->thirdparty->id));
$external_contacts = array_merge($external_contacts, $array_external);
}
}
@ -738,7 +741,7 @@ class ActionsTicketsup
if (is_array($external_contacts) && count($external_contacts) > 0) {
// altairis: get default subject for email to external contacts
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
$subject = GETPOST('subject') ? GETPOST('subject') : '[' . $label_title . '- ticket #' . $this->dao->track_id . '] ' . $langs->trans('TicketNewMessage');
$subject = GETPOST('subject') ? GETPOST('subject') : '[' . $label_title . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
$message_intro = GETPOST('mail_intro') ? GETPOST('mail_intro') : $conf->global->TICKETS_MESSAGE_MAIL_INTRO;
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKETS_MESSAGE_MAIL_SIGNATURE;
@ -753,7 +756,7 @@ class ActionsTicketsup
continue;
}
if ($info_sendto['email'] != '' && $info_sendto['email'] != $this->dao->origin_email) {
if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) {
if(!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . ">";
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
@ -768,8 +771,8 @@ class ActionsTicketsup
dol_buildpath('/ticketsup/public/view.php', 2)
) :
dol_buildpath('/ticketsup/card.php', 2)
) . '?track_id=' . $this->dao->track_id;
$message .= "\n" . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : ' . '<a href="' . $url_public_ticket . '">' . $this->dao->track_id . '</a>' . "\n";
) . '?track_id=' . $object->track_id;
$message .= "\n" . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : ' . '<a href="' . $url_public_ticket . '">' . $object->track_id . '</a>' . "\n";
// Build final message
$message = $message_intro . $message;
@ -777,14 +780,14 @@ class ActionsTicketsup
// Add signature
$message .= '<br>' . $message_signature;
if (!empty($this->dao->origin_email)) {
$sendto[] = $this->dao->origin_email;
if (!empty($object->origin_email)) {
$sendto[] = $object->origin_email;
}
if ($this->dao->fk_soc > 0 && ! in_array($this->dao->origin_email, $sendto)) {
$this->dao->socid = $this->dao->fk_soc;
$this->dao->fetch_thirdparty();
if(!empty($this->dao->thirdparty->email)) $sendto[] = $this->dao->thirdparty->email;
if ($object->fk_soc > 0 && ! in_array($object->origin_email, $sendto)) {
$object->socid = $object->fk_soc;
$object->fetch_thirdparty();
if(!empty($object->thirdparty->email)) $sendto[] = $object->thirdparty->email;
}
// altairis: Add global email address reciepient
@ -803,13 +806,13 @@ class ActionsTicketsup
$this->copyFilesForTicket();
// Set status to "answered" if not set yet, only for internal users
if ($this->dao->fk_statut < 3 && !$user->societe_id) {
$this->dao->setStatut(3);
if ($object->fk_statut < 3 && !$user->societe_id) {
$object->setStatut(3);
}
return 1;
} else {
setEventMessages($this->dao->error, $this->dao->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
return -1;
}
} else {
@ -830,9 +833,9 @@ class ActionsTicketsup
global $mysoc, $conf, $langs;
$error = 0;
$ret = $this->dao->fetch('', GETPOST('track_id'));
$this->dao->socid = $this->dao->fk_soc;
$this->dao->fetch_thirdparty();
$ret = $object->fetch('', GETPOST('track_id'));
$object->socid = $object->fk_soc;
$object->fetch_thirdparty();
if ($ret < 0) {
$error++;
array_push($this->errors, $langs->trans("ErrorTicketIsNotValid"));
@ -846,12 +849,12 @@ class ActionsTicketsup
}
if (!$error) {
$this->dao->message = GETPOST("message");
$id = $this->dao->createTicketMessage($user);
$object->message = GETPOST("message");
$id = $object->createTicketMessage($user);
if ($id <= 0) {
$error++;
$this->errors = $this->dao->error;
$this->errors = $this->dao->errors;
$this->errors = $object->error;
$this->errors = $object->errors;
$action = 'add_message';
}
@ -859,24 +862,24 @@ class ActionsTicketsup
setEventMessages($langs->trans('TicketMessageSuccessfullyAdded'), null, 'mesgs');
// Retrieve internal contact datas
$internal_contacts = $this->dao->getInfosTicketInternalContact();
$internal_contacts = $object->getInfosTicketInternalContact();
$sendto = array();
if (is_array($internal_contacts) && count($internal_contacts) > 0) {
$subject = '[' . $mysoc->name . '- ticket #' . $this->dao->track_id . '] ' . $langs->trans('TicketNewMessage');
$subject = '[' . $mysoc->name . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
$message = $langs->trans('TicketMessageMailIntroAutoNewPublicMessage', $this->dao->subject);
$message = $langs->trans('TicketMessageMailIntroAutoNewPublicMessage', $object->subject);
$message .= "\n";
$message .= GETPOST('message');
$message .= "\n";
// Coordonnées client
if ($this->dao->thirdparty->id > 0) {
if ($object->thirdparty->id > 0) {
$message .= "\n\n";
$message .= "==============================================\n";
$message .= $langs->trans('Thirparty') . " : " . $this->dao->thirdparty->name;
$message .= !empty($this->dao->thirdparty->town) ? $langs->trans('Town') . " : " . $this->dao->thirdparty->town : '';
$message .= $langs->trans('Thirparty') . " : " . $object->thirdparty->name;
$message .= !empty($object->thirdparty->town) ? $langs->trans('Town') . " : " . $object->thirdparty->town : '';
$message .= "\n";
$message .= !empty($this->dao->thirdparty->phone) ? $langs->trans('Phone') . " : " . $this->dao->thirdparty->phone : '';
$message .= !empty($object->thirdparty->phone) ? $langs->trans('Phone') . " : " . $object->thirdparty->phone : '';
$message .= "\n";
}
@ -893,7 +896,7 @@ class ActionsTicketsup
}
// URL ticket
$url_internal_ticket = dol_buildpath('/ticketsup/card.php', 2) . '?track_id=' . $this->dao->track_id;
$url_internal_ticket = dol_buildpath('/ticketsup/card.php', 2) . '?track_id=' . $object->track_id;
$message .= "\n" . $langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal') . ' : ' . $url_internal_ticket . "\n";
$message .= "\n\n";
@ -913,12 +916,12 @@ class ActionsTicketsup
*/
// Retrieve email of all contacts external
$external_contacts = $this->dao->getInfosTicketExternalContact();
$external_contacts = $object->getInfosTicketExternalContact();
$sendto = array();
if (is_array($external_contacts) && count($external_contacts) > 0) {
$subject = '[' . $mysoc->name . '- ticket #' . $this->dao->track_id . '] ' . $langs->trans('TicketNewMessage');
$subject = '[' . $mysoc->name . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
$message = $langs->trans('TicketMessageMailIntroAutoNewPublicMessage', $this->dao->subject);
$message = $langs->trans('TicketMessageMailIntroAutoNewPublicMessage', $object->subject);
$message .= "\n";
$message .= GETPOST('message');
@ -934,28 +937,28 @@ class ActionsTicketsup
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . "\n" : '');
}
$url_public_ticket = ($conf->global->TICKETS_URL_PUBLIC_INTERFACE ? $conf->global->TICKETS_URL_PUBLIC_INTERFACE . '/view.php' : dol_buildpath('/ticketsup/public/view.php', 2)) . '?track_id=' . $this->dao->track_id;
$url_public_ticket = ($conf->global->TICKETS_URL_PUBLIC_INTERFACE ? $conf->global->TICKETS_URL_PUBLIC_INTERFACE . '/view.php' : dol_buildpath('/ticketsup/public/view.php', 2)) . '?track_id=' . $object->track_id;
$message .= "\n\n" . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : ' . $url_public_ticket . "\n";
// Add signature
$message .= '\n\n' . $message_signature;
if (!empty($this->dao->origin_email) && !in_array($this->dao->origin_email, $sendto)) {
$sendto[] = $this->dao->origin_email;
if (!empty($object->origin_email) && !in_array($object->origin_email, $sendto)) {
$sendto[] = $object->origin_email;
}
if ($this->dao->fk_soc > 0 && !in_array($this->dao->origin_email, $sendto)) {
$sendto[] = $this->dao->thirdparty->email;
if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) {
$sendto[] = $object->thirdparty->email;
}
$this->sendTicketMessageByEmail($subject, $message, '', $sendto);
}
$this->copyFilesForTicket();
$url = 'view.php?action=view_ticket&track_id=' . $this->dao->track_id;
$url = 'view.php?action=view_ticket&track_id=' . $object->track_id;
header("Location: " . $url);
exit;
} else {
setEventMessages($this->dao->error, $this->dao->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
} else {
setEventMessages($this->error, $this->errors, 'errors');
@ -1090,19 +1093,20 @@ class ActionsTicketsup
/**
* View list of logs with timeline view
*
* @param boolean $show_user Show user who make action
* @param boolean $show_user Show user who make action
* @param Ticketsup $object Object
*/
public function viewTimelineTicketLogs($show_user = true)
public function viewTimelineTicketLogs($show_user = true, $object = true)
{
global $conf, $langs, $bc;
// Load logs in cache
$ret = $this->dao->loadCacheLogsTicket();
$ret = $object->loadCacheLogsTicket();
if (is_array($this->dao->cache_logs_ticket) && count($this->dao->cache_logs_ticket) > 0) {
if (is_array($object->cache_logs_ticket) && count($object->cache_logs_ticket) > 0) {
print '<section id="cd-timeline">';
foreach ($this->dao->cache_logs_ticket as $id => $arraylogs) {
foreach ($object->cache_logs_ticket as $id => $arraylogs) {
print '<div class="cd-timeline-block">';
print '<div class="cd-timeline-img">';
//print '<img src="img/history.png" alt="">';
@ -1263,21 +1267,22 @@ class ActionsTicketsup
/**
* View list of message for ticket with timeline display
*
* @param boolean $show_private Show private messages
* @param boolean $show_user Show user who make action
* @param boolean $show_private Show private messages
* @param boolean $show_user Show user who make action
* @param Ticketsup $object Object ticketsup
*/
public function viewTicketTimelineMessages($show_private, $show_user = true)
public function viewTicketTimelineMessages($show_private, $show_user, Ticketsup $object)
{
global $conf, $langs, $user, $bc;
// Load logs in cache
$ret = $this->dao->loadCacheMsgsTicket();
$ret = $object->loadCacheMsgsTicket();
$action = GETPOST('action');
if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) {
if (is_array($object->cache_msgs_ticket) && count($object->cache_msgs_ticket) > 0) {
print '<section id="cd-timeline">';
foreach ($this->dao->cache_msgs_ticket as $id => $arraymsgs) {
foreach ($object->cache_msgs_ticket as $id => $arraymsgs) {
if (!$arraymsgs['private']
|| ($arraymsgs['private'] == "1" && $show_private)
) {
@ -1460,49 +1465,43 @@ class ActionsTicketsup
/**
* Print html navbar with link to set ticket status
<<<<<<< HEAD
* $selected : 0=>'NotRead', 1=>'Read', 3=>'Answered', 4=>'Assigned', 5 => 'InProgress', 6=> 'Waiting', 8=>'Closed', 9=>'Deleted'
*
* @param Ticketsup $object Ticket sup
* @return void
=======
*
* @global type $langs
>>>>>>> branch 'develop' of git@github.com:Dolibarr/dolibarr.git
*/
public function viewStatusActions()
public function viewStatusActions(Ticketsup $object)
{
global $langs;
print '<div class="div-table-responsive-no-min">';
print '<div class="tagtable noborder ">';
print '<div class="tagtr liste_titre">';
print '<div class="tagtd">';
print '<strong>' . $langs->trans('TicketChangeStatus') . '</strong>';
print '</div>';
// Exclude status which requires specific method
$exclude_status = array(4, 9, 8);
$exclude_status = array(Ticketsup::STATUS_CLOSED, Ticketsup::STATUS_CANCELED);
// Exclude actual status
$exclude_status = array_merge($exclude_status, array(intval($this->dao->fk_statut)));
// If status is new, don't show link which allow mark ticket as read
// Specific method exists to mark a ticket as read
if ($this->dao->fk_statut == '0') {
$exclude_status = array_merge($exclude_status, array(1));
}
$exclude_status = array_merge($exclude_status, array(intval($object->fk_statut)));
// Sort results to be similar to status object list
sort($exclude_status);
//sort($exclude_status);
//print '<br><div>';
foreach ($this->dao->statuts_short as $status => $statut_label) {
foreach ($object->statuts_short as $status => $statut_label) {
if (!in_array($status, $exclude_status)) {
print '<div class="tagtd">';
print '<a class="button" href="' . $_SERVER['PHP_SELF'] . '?track_id=' . $this->dao->track_id . '&action=set_status&new_status=' . $status . '">';
print img_picto($langs->trans($this->dao->statuts_short[$status]), 'statut' . $status . '.png@ticketsup') . ' ' . $langs->trans($this->dao->statuts_short[$status]);
if ($object->fk_statut == Ticketsup::STATUS_READ || $status == Ticketsup::STATUS_READ|| empty($object->date_read)) $urlforbutton = $_SERVER['PHP_SELF'] . '?track_id=' . $object->track_id . '&action=mark_ticket_read'; // To set as read, we use a dedicated action
else $urlforbutton = $_SERVER['PHP_SELF'] . '?track_id=' . $object->track_id . '&action=set_status&new_status=' . $status;
print '<a class="button" href="' . $urlforbutton . '">';
print img_picto($langs->trans($object->statuts_short[$status]), 'statut' . $status . '.png@ticketsup') . ' ' . $langs->trans($object->statuts_short[$status]);
print '</a>';
print '</div>';
}
}
print '</div></div><br>';
print '</div></div></div><br>';
}

View File

@ -191,9 +191,24 @@ class Ticketsup extends CommonObject
'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1),
'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>501, 'notnull'=>1),
'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'NotRead', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted'))
'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted'))
);
/**
* Status
*/
const STATUS_NOT_READ = 0;
const STATUS_READ = 1;
const STATUS_ANSWERED = 3;
const STATUS_ASSIGNED = 4;
const STATUS_IN_PROGRESS = 5;
const STATUS_WAITING = 6;
const STATUS_CLOSED = 8;
const STATUS_CANCELED = 9;
/**
* Constructor
*
@ -203,8 +218,8 @@ class Ticketsup extends CommonObject
{
$this->db = $db;
$this->statuts_short = array(0 => 'NotRead', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted');
$this->statuts = array(0 => 'NotRead', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted');
$this->statuts_short = array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted');
$this->statuts = array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted');
}
/**
@ -337,8 +352,8 @@ class Ticketsup extends CommonObject
$sql .= ") VALUES (";
$sql .= " " . (!isset($this->ref) ? '' : "'" . $this->db->escape($this->ref) . "'") . ",";
$sql .= " " . (!isset($this->track_id) ? 'NULL' : "'" . $this->db->escape($this->track_id) . "'") . ",";
$sql .= " " . (!isset($this->fk_soc) ? '0' : "'" . $this->db->escape($this->fk_soc) . "'") . ",";
$sql .= " " . (!isset($this->fk_project) ? '0' : "'" . $this->db->escape($this->fk_project) . "'") . ",";
$sql .= " " . ($this->fk_soc > 0 ? $this->db->escape($this->fk_soc) : "null") . ",";
$sql .= " " . ($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "null") . ",";
$sql .= " " . (!isset($this->origin_email) ? 'NULL' : "'" . $this->db->escape($this->origin_email) . "'") . ",";
$sql .= " " . ($this->fk_user_create > 0 ? $this->fk_user_create : ($user->id > 0 ? $user->id : 'NULL')) . ",";
$sql .= " " . ($this->fk_user_assign > 0 ? $this->fk_user_assign : 'NULL') . ",";
@ -422,7 +437,7 @@ class Ticketsup extends CommonObject
global $langs;
// Check parameters
if (!$id && !$track_id && !$ref) {
if (! $id && ! $track_id && ! $ref) {
$this->error = 'ErrorWrongParameters';
dol_print_error(get_class($this) . "::fetch " . $this->error);
return -1;
@ -2397,78 +2412,6 @@ class Ticketsup extends CommonObject
return $defaultref;
}
/**
* Show tab footer of a card
*
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link
* @param string $morehtml More html content to output just before the nav bar
* @param int $shownav Show Condition (navigation is shown if value is 1)
* @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field)
* @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
* @param string $morehtmlref More html to show after ref
* @param string $moreparam More param to add in nav link url.
* @param int $nodbprefix Do not include DB prefix to forge table name
* @param string $morehtmlleft More html code to show before ref
* @param string $morehtmlright More html code to show before navigation arrows
* @param string $onlybanner 1
* @return void
*/
public function ticketsupBannerTab($paramid, $morehtml = '', $shownav = 1, $fieldid = 'id', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlright = '', $onlybanner=0)
{
global $conf, $form, $user, $langs;
$maxvisiblephotos = 1;
$showimage = 1;
$showbarcode = empty($conf->barcode->enabled) ? 0 : ($this->barcode ? 1 : 0);
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) {
$showbarcode = 0;
}
$modulepart = 'ticketsup';
print '<div class="'.($onlybanner?'arearefnobottom':'arearef').' heightref valignmiddle" width="100%">';
$width = 80;
$height = 70;
$cssclass = 'photoref';
//$showimage=$this->is_photo_available($conf->ticketsup->multidir_output[$this->entity]);
$showimage = $this->is_photo_available($conf->ticketsup->dir_output . '/' . $this->track_id);
$maxvisiblephotos = (isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO) ? $conf->global->PRODUCT_MAX_VISIBLE_PHOTO : $maxvisiblephotos);
if ($conf->browser->phone) {
$maxvisiblephotos = 1;
}
if ($showimage) {
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'
. $this->show_photos($conf->ticketsup->dir_output, 'small', $maxvisiblephotos, 0, 0, 0, $height, $width, 0)
. '</div>';
} else {
$nophoto = '/public/theme/common/nophoto.png';
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '"></div>';
}
$morehtmlright .= $this->getLibStatut(2);
if (!empty($this->name_alias)) {
$morehtmlref .= '<div class="refidno">' . $this->name_alias . '</div>';
}
// For thirdparty
if (!empty($this->label)) {
$morehtmlref .= '<div class="refidno">' . $this->label . '</div>';
}
// For product
if ($this->element != 'product') {
$morehtmlref .= '<div class="refidno">';
$morehtmlref .= $this->getBannerAddress('refaddress', $this);
$morehtmlref .= '</div>';
}
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
$morehtmlref .= '<div style="clear: both;"></div><div class="refidno">';
$morehtmlref .= $langs->trans("TechnicalID") . ': ' . $this->id;
$morehtmlref .= '</div>';
}
print $form->showrefnav($this, 'ref', $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlright);
print '</div>';
print '<div class="underrefbanner clearboth"></div>';
}
/**
* Return if at least one photo is available

View File

@ -149,17 +149,26 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
dol_fiche_head($head, 'contact', $langs->trans("Ticket"), -1, 'ticketsup');
$object->label = $object->ref;
$morehtmlref ='<div class="refidno">';
$morehtmlref.= $object->subject;
// Author
if ($object->fk_user_create > 0) {
$object->label .= ' - ' . $langs->trans("CreatedBy") . ' ';
$langs->load("users");
$fuser = new User($db);
$fuser->fetch($object->fk_user_create);
$object->label .= $fuser->getNomUrl(0);
$morehtmlref .= '<br>' . $langs->trans("CreatedBy") . ' ';
$langs->load("users");
$fuser = new User($db);
$fuser->fetch($object->fk_user_create);
$morehtmlref .= $fuser->getNomUrl(0);
}
if (!empty($object->origin_email)) {
$morehtmlref .= '<br>' . $langs->trans("CreatedBy") . ' ';
$morehtmlref .= $object->origin_email . ' <small>(' . $langs->trans("TicketEmailOriginIssuer") . ')</small>';
}
$morehtmlref.='</div>';
$linkback = '<a href="' . dol_buildpath('/ticketsup/list.php', 1) . '"><strong>' . $langs->trans("BackToList") . '</strong></a> ';
$object->ticketsupBannerTab('ref', '', ($user->societe_id ? 0 : 1), 'ref', 'subject', '', '', '', $morehtmlleft, $linkback, 1);
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref);
dol_fiche_end();

View File

@ -123,18 +123,29 @@ if ($object->id) {
$object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'";
}
$head = ticketsup_prepare_head($object);
dol_fiche_head($head, 'tabTicketDocument', $langs->trans("Ticket"), 0, 'ticketsup');
$object->label = $object->ref;
$morehtmlref ='<div class="refidno">';
$morehtmlref.= $object->subject;
// Author
if ($object->fk_user_create > 0) {
$object->label .= ' - ' . $langs->trans("CreatedBy") . ' ';
$langs->load("users");
$fuser = new User($db);
$fuser->fetch($object->fk_user_create);
$object->label .= $fuser->getNomUrl(0);
$morehtmlref .= '<br>' . $langs->trans("CreatedBy") . ' ';
$langs->load("users");
$fuser = new User($db);
$fuser->fetch($object->fk_user_create);
$morehtmlref .= $fuser->getNomUrl(0);
}
if (!empty($object->origin_email)) {
$morehtmlref .= '<br>' . $langs->trans("CreatedBy") . ' ';
$morehtmlref .= $object->origin_email . ' <small>(' . $langs->trans("TicketEmailOriginIssuer") . ')</small>';
}
$morehtmlref.='</div>';
$linkback = '<a href="' . dol_buildpath('/ticketsup/list.php', 1) . '"><strong>' . $langs->trans("BackToList") . '</strong></a> ';
$object->ticketsupBannerTab('ref', '', ($user->societe_id ? 0 : 1), 'ref', 'subject', '', '', '', $morehtmlleft, $linkback);
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref);
dol_fiche_end();

View File

@ -49,25 +49,33 @@ if (!$user->rights->ticketsup->read) {
accessforbidden();
}
$object = new ActionsTicketsup($db);
$object->doActions($action);
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->dao->table_element);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
if (!$action) {
$action = 'view';
$action = 'view';
}
/***************************************************
* PAGE
*
* Put here all code to build page
****************************************************/
$object = new Ticketsup($db);
$object->fetch($id, $track_id, $ref);
/*
* Actions
*/
$actionobject = new ActionsTicketsup($db);
$actionobject->doActions($action, $object);
/*
* View
*/
$help_url = 'FR:DocumentationModuleTicket';
$page_title = $object->getTitle($action);
$page_title = $actionobject->getTitle($action);
llxHeader('', $page_title, $help_url);
$userstat = new User($db);
@ -79,20 +87,20 @@ if ($action == 'view') {
if ($res > 0) {
// restrict access for externals users
if ($user->societe_id > 0 && ($object->dao->fk_soc != $user->societe_id)
if ($user->societe_id > 0 && ($object->fk_soc != $user->societe_id)
) {
accessforbidden('', 0);
}
// or for unauthorized internals users
if (!$user->societe_id && ($conf->global->TICKETS_LIMIT_VIEW_ASSIGNED_ONLY && $object->dao->fk_user_assign != $user->id) && !$user->rights->ticketsup->manage) {
if (!$user->societe_id && ($conf->global->TICKETS_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticketsup->manage) {
accessforbidden('', 0);
}
if ($socid > 0) {
$object->dao->fetch_thirdparty();
$head = societe_prepare_head($object->dao->thirdparty);
$object->fetch_thirdparty();
$head = societe_prepare_head($object->thirdparty);
dol_fiche_head($head, 'ticketsup', $langs->trans("ThirdParty"), 0, 'company');
dol_banner_tab($object->dao->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom');
dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom');
dol_fiche_end();
}
@ -101,26 +109,37 @@ if ($action == 'view') {
} elseif ($user->societe_id > 0) {
$object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'";
}
$head = ticketsup_prepare_head($object->dao);
$head = ticketsup_prepare_head($object);
dol_fiche_head($head, 'tabTicketLogs', $langs->trans("Ticket"), 0, 'ticketsup');
$object->dao->label = $object->dao->ref;
$morehtmlref ='<div class="refidno">';
$morehtmlref.= $object->subject;
// Author
if ($object->dao->fk_user_create > 0) {
$object->dao->label .= ' - ' . $langs->trans("CreatedBy") . ' ';
$langs->load("users");
$fuser = new User($db);
$fuser->fetch($object->dao->fk_user_create);
$object->dao->label .= $fuser->getNomUrl(0);
if ($object->fk_user_create > 0) {
$morehtmlref .= '<br>' . $langs->trans("CreatedBy") . ' ';
$langs->load("users");
$fuser = new User($db);
$fuser->fetch($object->fk_user_create);
$morehtmlref .= $fuser->getNomUrl(0);
}
if (!empty($object->origin_email)) {
$morehtmlref .= '<br>' . $langs->trans("CreatedBy") . ' ';
$morehtmlref .= $object->origin_email . ' <small>(' . $langs->trans("TicketEmailOriginIssuer") . ')</small>';
}
$morehtmlref.='</div>';
$linkback = '<a href="' . dol_buildpath('/ticketsup/list.php', 1) . '"><strong>' . $langs->trans("BackToList") . '</strong></a> ';
$object->dao->ticketsupBannerTab('ref', '', ($user->societe_id ? 0 : 1), 'ref', 'subject', '', '', '', $morehtmlleft, $linkback);
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref);
dol_fiche_end();
print '<div class="fichecenter">';
// Logs list
print load_fiche_titre($langs->trans('TicketHistory'), '', 'history@ticketsup');
$object->viewTimelineTicketLogs();
$actionobject->viewTimelineTicketLogs(true, $object);
print '</div><!-- fichecenter -->';
print '<br style="clear: both">';
}

View File

@ -53,7 +53,7 @@ $year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear;
$startyear = $year - 1;
$endyear = $year;
$object = new ActionsTicketsup($db);
$object = new Ticketsup($db);
/*
@ -180,7 +180,7 @@ if ($result) {
if ((round($tick['unread']) ? 1 : 0) +(round($tick['read']) ? 1 : 0) +(round($tick['answered']) ? 1 : 0) +(round($tick['assigned']) ? 1 : 0) +(round($tick['inprogress']) ? 1 : 0) +(round($tick['waiting']) ? 1 : 0) +(round($tick['closed']) ? 1 : 0) +(round($tick['deleted']) ? 1 : 0) >= 2
) {
$dataseries = array();
$dataseries[] = array('label' => $langs->trans("NotRead"), 'data' => round($tick['unread']));
$dataseries[] = array('label' => $langs->trans("Unread"), 'data' => round($tick['unread']));
$dataseries[] = array('label' => $langs->trans("Read"), 'data' => round($tick['read']));
$dataseries[] = array('label' => $langs->trans("Answered"), 'data' => round($tick['answered']));
$dataseries[] = array('label' => $langs->trans("Assigned"), 'data' => round($tick['assigned']));
@ -300,6 +300,8 @@ if ($result) {
$i = 0;
$transRecordedType = $langs->trans("LatestNewTickets", $max);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th>' . $transRecordedType . '</th>';
print '<th>' . $langs->trans('Ref') . '</th>';
@ -355,6 +357,7 @@ if ($result) {
}
print "</table>";
print '</div>';
} else {
dol_print_error($db);
}

View File

@ -17,7 +17,7 @@
*/
/**
* Tickets List
* Tickets List
*
* @package ticketsup
*/

View File

@ -38,8 +38,7 @@ $id = GETPOST('id', 'int');
$socid = GETPOST('socid', 'int');
$contactid = GETPOST('contactid', 'int');
$msg_id = GETPOST('msg_id', 'int');
$notNotifyTiers = GETPOST("not_notify_tiers_at_create", 'alpha');
$notnotifytiersatcreate = !empty($notNotifyTiers);
$notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
$action = GETPOST('action', 'alpha', 3);
@ -48,14 +47,15 @@ if (!$user->rights->ticketsup->read || !$user->rights->ticketsup->write) {
accessforbidden();
}
$object = new ActionsTicketsup($db);
$object = new Ticketsup($db);
$actionobject = new ActionsTicketsup($db);
/*
* Actions
*/
$object->doActions($action);
$actionobject->doActions($action, $object);
@ -63,11 +63,12 @@ $object->doActions($action);
* View
*/
$form = new Form($db);
$help_url = 'FR:DocumentationModuleTicket';
$page_title = $object->getTitle($action);
$page_title = $actionobject->getTitle($action);
llxHeader('', $page_title, $help_url);
$form = new Form($db);
if ($action == 'create_ticket') {
$formticket = new FormTicketsup($db);
@ -77,7 +78,7 @@ if ($action == 'create_ticket') {
$formticket->withfromsocid = $socid ? $socid : $user->societe_id;
$formticket->withfromcontactid = $contactid ? $contactid : '';
$formticket->withtitletopic = 1;
$formticket->withnotnotifytiersatcreate = $notnotifytiersatcreate;
$formticket->withnotifytiersatcreate = ($notifyTiers?1:0);
$formticket->withusercreate = 1;
$formticket->withref = 1;
$formticket->fk_user_create = $user->id;