commit
0c20b6b2d6
@ -86,13 +86,14 @@ class Members extends DolibarrApi
|
|||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
* @param int $page Page number
|
* @param int $page Page number
|
||||||
* @param string $typeid ID of the type of member
|
* @param string $typeid ID of the type of member
|
||||||
|
* @param int $category Use this param to filter list by category
|
||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma.
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma.
|
||||||
* Example: "(t.ref:like:'SO-%') and ((t.date_creation:<:'20160101') or (t.nature:is:NULL))"
|
* Example: "(t.ref:like:'SO-%') and ((t.date_creation:<:'20160101') or (t.nature:is:NULL))"
|
||||||
* @return array Array of member objects
|
* @return array Array of member objects
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '')
|
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $category = 0, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
@ -104,11 +105,19 @@ class Members extends DolibarrApi
|
|||||||
|
|
||||||
$sql = "SELECT t.rowid";
|
$sql = "SELECT t.rowid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as t";
|
||||||
|
if ($category > 0) {
|
||||||
|
$sql .= ", ".MAIN_DB_PREFIX."categorie_member as c";
|
||||||
|
}
|
||||||
$sql .= ' WHERE t.entity IN ('.getEntity('adherent').')';
|
$sql .= ' WHERE t.entity IN ('.getEntity('adherent').')';
|
||||||
if (!empty($typeid))
|
if (!empty($typeid))
|
||||||
{
|
{
|
||||||
$sql .= ' AND t.fk_adherent_type='.$typeid;
|
$sql .= ' AND t.fk_adherent_type='.$typeid;
|
||||||
}
|
}
|
||||||
|
// Select members of given category
|
||||||
|
if ($category > 0) {
|
||||||
|
$sql .= " AND c.fk_categorie = ".$db->escape($category);
|
||||||
|
$sql .= " AND c.fk_member = t.rowid ";
|
||||||
|
}
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -32,7 +32,7 @@ $langs->loadLangs(array("admin", "ticket"));
|
|||||||
|
|
||||||
// Access control
|
// Access control
|
||||||
if (!$user->admin) {
|
if (!$user->admin) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parameters
|
// Parameters
|
||||||
@ -49,117 +49,117 @@ $error = 0;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'updateMask') {
|
if ($action == 'updateMask') {
|
||||||
$maskconstticket = GETPOST('maskconstticket', 'alpha');
|
$maskconstticket = GETPOST('maskconstticket', 'alpha');
|
||||||
$maskticket = GETPOST('maskticket', 'alpha');
|
$maskticket = GETPOST('maskticket', 'alpha');
|
||||||
|
|
||||||
if ($maskconstticket) {
|
if ($maskconstticket) {
|
||||||
$res = dolibarr_set_const($db, $maskconstticket, $maskticket, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, $maskconstticket, $maskticket, 'chaine', 0, '', $conf->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$res > 0) {
|
if (!$res > 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'setmod') {
|
} elseif ($action == 'setmod') {
|
||||||
// TODO Verifier si module numerotation choisi peut etre active
|
// TODO Verifier si module numerotation choisi peut etre active
|
||||||
// par appel methode canBeActivated
|
// par appel methode canBeActivated
|
||||||
|
|
||||||
dolibarr_set_const($db, "TICKET_ADDON", $value, 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "TICKET_ADDON", $value, 'chaine', 0, '', $conf->entity);
|
||||||
} elseif ($action == 'setvar') {
|
} elseif ($action == 'setvar') {
|
||||||
include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
|
include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
|
||||||
|
|
||||||
$notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha');
|
$notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha');
|
||||||
if (!empty($notification_email)) {
|
if (!empty($notification_email)) {
|
||||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity);
|
||||||
} else {
|
} else {
|
||||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity);
|
||||||
}
|
}
|
||||||
if (!$res > 0) {
|
if (!$res > 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// altairis : differentiate notification email FROM and TO
|
// altairis : differentiate notification email FROM and TO
|
||||||
$notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha');
|
$notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha');
|
||||||
if (!empty($notification_email_to)) {
|
if (!empty($notification_email_to)) {
|
||||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity);
|
||||||
} else {
|
} else {
|
||||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity);
|
||||||
}
|
}
|
||||||
if (!$res > 0) {
|
if (!$res > 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'restricthtml');
|
$mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'restricthtml');
|
||||||
if (!empty($mail_intro)) {
|
if (!empty($mail_intro)) {
|
||||||
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
|
||||||
} else {
|
} else {
|
||||||
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity);
|
||||||
}
|
}
|
||||||
if (!$res > 0) {
|
if (!$res > 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'restricthtml');
|
$mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'restricthtml');
|
||||||
if (!empty($mail_signature)) {
|
if (!empty($mail_signature)) {
|
||||||
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity);
|
||||||
} else {
|
} else {
|
||||||
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity);
|
||||||
}
|
}
|
||||||
if (!$res > 0) {
|
if (!$res > 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setvarother') {
|
if ($action == 'setvarother') {
|
||||||
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
|
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
|
||||||
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
|
||||||
if (!$res > 0) {
|
if (!$res > 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha');
|
$param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha');
|
||||||
$res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
|
||||||
if (!$res > 0) {
|
if (!$res > 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||||
{
|
{
|
||||||
$param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
|
$param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
|
||||||
$res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
|
||||||
if (!$res > 0) {
|
if (!$res > 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||||
{
|
{
|
||||||
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
|
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
|
||||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
|
||||||
if (!$res > 0) {
|
if (!$res > 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
|
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
|
||||||
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
|
||||||
if (!$res > 0) {
|
if (!$res > 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
|
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
|
||||||
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
|
||||||
if (!$res > 0) {
|
if (!$res > 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ dol_fiche_end();
|
|||||||
* Projects Numbering model
|
* Projects Numbering model
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("TicketNumberingModules"));
|
print load_fiche_titre($langs->trans("TicketNumberingModules"), '', '');
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
@ -210,82 +210,82 @@ print "</tr>\n";
|
|||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
foreach ($dirmodels as $reldir) {
|
foreach ($dirmodels as $reldir) {
|
||||||
$dir = dol_buildpath($reldir."core/modules/ticket");
|
$dir = dol_buildpath($reldir."core/modules/ticket");
|
||||||
|
|
||||||
if (is_dir($dir)) {
|
if (is_dir($dir)) {
|
||||||
$handle = opendir($dir);
|
$handle = opendir($dir);
|
||||||
if (is_resource($handle)) {
|
if (is_resource($handle)) {
|
||||||
while (($file = readdir($handle)) !== false) {
|
while (($file = readdir($handle)) !== false) {
|
||||||
if (preg_match('/^(mod_.*)\.php$/i', $file, $reg)) {
|
if (preg_match('/^(mod_.*)\.php$/i', $file, $reg)) {
|
||||||
$file = $reg[1];
|
$file = $reg[1];
|
||||||
$classname = substr($file, 4);
|
$classname = substr($file, 4);
|
||||||
|
|
||||||
include_once $dir.'/'.$file.'.php';
|
include_once $dir.'/'.$file.'.php';
|
||||||
|
|
||||||
$module = new $file;
|
$module = new $file;
|
||||||
|
|
||||||
// Show modules according to features level
|
// Show modules according to features level
|
||||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
|
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($module->isEnabled()) {
|
if ($module->isEnabled()) {
|
||||||
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
|
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
|
||||||
print $module->info();
|
print $module->info();
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Show example of numbering model
|
// Show example of numbering model
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$tmp = $module->getExample();
|
$tmp = $module->getExample();
|
||||||
if (preg_match('/^Error/', $tmp)) {
|
if (preg_match('/^Error/', $tmp)) {
|
||||||
print '<div class="error">'.$langs->trans($tmp).'</div>';
|
print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||||
} elseif ($tmp == 'NotConfigured') {
|
} elseif ($tmp == 'NotConfigured') {
|
||||||
print $langs->trans($tmp);
|
print $langs->trans($tmp);
|
||||||
} else {
|
} else {
|
||||||
print $tmp;
|
print $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
if ($conf->global->TICKET_ADDON == 'mod_'.$classname) {
|
if ($conf->global->TICKET_ADDON == 'mod_'.$classname) {
|
||||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||||
} else {
|
} else {
|
||||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value=mod_'.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value=mod_'.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$ticket = new Ticket($db);
|
$ticket = new Ticket($db);
|
||||||
$ticket->initAsSpecimen();
|
$ticket->initAsSpecimen();
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
$htmltooltip = '';
|
$htmltooltip = '';
|
||||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$nextval = $module->getNextValue($mysoc, $ticket);
|
$nextval = $module->getNextValue($mysoc, $ticket);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||||
if ($nextval) {
|
if ($nextval) {
|
||||||
$htmltooltip .= $nextval.'<br>';
|
$htmltooltip .= $nextval.'<br>';
|
||||||
} else {
|
} else {
|
||||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -293,12 +293,12 @@ print '</div>';
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
if (!$conf->use_javascript_ajax) {
|
if (!$conf->use_javascript_ajax) {
|
||||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="setvarother">';
|
print '<input type="hidden" name="action" value="setvarother">';
|
||||||
}
|
}
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("TicketParams"));
|
print load_fiche_titre($langs->trans("Other"), '', '');
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -307,86 +307,14 @@ print '<td></td>';
|
|||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Activate email notifications
|
|
||||||
/*
|
|
||||||
print '<tr class="pair"><td>' . $langs->trans("TicketsDisableEmail") . '</td>';
|
|
||||||
print '<td class="left">';
|
|
||||||
if ($conf->use_javascript_ajax) {
|
|
||||||
print ajax_constantonoff('TICKET_DISABLE_ALL_MAILS');
|
|
||||||
} else {
|
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
|
||||||
print $form->selectarray("TICKET_DISABLE_ALL_MAILS", $arrval, $conf->global->TICKET_DISABLE_ALL_MAILS);
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="center">';
|
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Activate log by email
|
|
||||||
print '<tr class="pair"><td>' . $langs->trans("TicketsLogEnableEmail") . '</td>';
|
|
||||||
print '<td class="left">';
|
|
||||||
if ($conf->use_javascript_ajax) {
|
|
||||||
print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL');
|
|
||||||
} else {
|
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
|
||||||
print $form->selectarray("TICKET_ACTIVATE_LOG_BY_EMAIL", $arrval, $conf->global->TICKET_ACTIVATE_LOG_BY_EMAIL);
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="center">';
|
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help');
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Also send to main email address
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|
||||||
{
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress").'</td>';
|
|
||||||
print '<td class="left">';
|
|
||||||
if ($conf->use_javascript_ajax) {
|
|
||||||
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
|
|
||||||
} else {
|
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
|
||||||
print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="center">';
|
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Limiter la vue des tickets à ceux assignés à l'utilisateur
|
|
||||||
/*
|
|
||||||
print '<tr class="pair"><td>' . $langs->trans("TicketsLimitViewAssignedOnly") . '</td>';
|
|
||||||
print '<td class="left">';
|
|
||||||
if ($conf->use_javascript_ajax) {
|
|
||||||
print ajax_constantonoff('TICKET_LIMIT_VIEW_ASSIGNED_ONLY');
|
|
||||||
} else {
|
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
|
||||||
print $form->selectarray("TICKET_LIMIT_VIEW_ASSIGNED_ONLY", $arrval, $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY);
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="center">';
|
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsLimitViewAssignedOnlyHelp"), 1, 'help');
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*if (!$conf->use_javascript_ajax) {
|
|
||||||
print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
|
|
||||||
print '</tr>';
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Auto assign ticket at user who created it
|
// Auto assign ticket at user who created it
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoAssignTicket").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoAssignTicket").'</td>';
|
||||||
print '<td class="left">';
|
print '<td class="left">';
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
|
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
|
print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
@ -397,11 +325,11 @@ print '</tr>';
|
|||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
|
|
||||||
if (!$conf->use_javascript_ajax) {
|
if (!$conf->use_javascript_ajax) {
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Admin var of module
|
// Admin var of module
|
||||||
print load_fiche_titre($langs->trans("Notification"));
|
print load_fiche_titre($langs->trans("Notification"), '', '');
|
||||||
|
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
@ -414,27 +342,11 @@ print '<td colspan="3">'.$langs->trans("Email").'</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td colspan="3"><div class="info">'.$langs->trans("TicketCkEditorEmailNotActivated").'</div></td>';
|
print '<td colspan="3"><div class="info">'.$langs->trans("TicketCkEditorEmailNotActivated").'</div></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activate log by email
|
|
||||||
/*print '<tr class="pair"><td>' . $langs->trans("TicketsLogEnableEmail") . '</td>';
|
|
||||||
print '<td class="left">';
|
|
||||||
if ($conf->use_javascript_ajax) {
|
|
||||||
print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL');
|
|
||||||
} else {
|
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
|
||||||
print $form->selectarray("TICKET_ACTIVATE_LOG_BY_EMAIL", $arrval, $conf->global->TICKET_ACTIVATE_LOG_BY_EMAIL);
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="center">';
|
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help');
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
// @todo Use module notification instead...
|
// @todo Use module notification instead...
|
||||||
|
|
||||||
// Email d'envoi des notifications
|
// Email d'envoi des notifications
|
||||||
@ -446,18 +358,36 @@ print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"),
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Email de réception des notifications
|
// Email for notification of TICKET_CREATE
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationTo").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationTo").' ('.$langs->trans("Creation").')</td>';
|
||||||
print '<td class="left">';
|
print '<td class="left">';
|
||||||
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : $conf->global->TICKET_NOTIFICATION_EMAIL_FROM).'" size="20" ></td>';
|
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : '').'"></td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
|
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Also send to TICKET_NOTIFICATION_EMAIL_TO for responses (not only creation)
|
||||||
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress").'</td>';
|
||||||
|
print '<td class="left">';
|
||||||
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
|
||||||
|
} else {
|
||||||
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
|
print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Texte d'introduction
|
// Texte d'introduction
|
||||||
$mail_intro = $conf->global->TICKET_MESSAGE_MAIL_INTRO ? $conf->global->TICKET_MESSAGE_MAIL_INTRO : $langs->trans('TicketMessageMailIntroText');
|
$mail_intro = $conf->global->TICKET_MESSAGE_MAIL_INTRO ? $conf->global->TICKET_MESSAGE_MAIL_INTRO : $langs->trans('TicketMessageMailIntroText');
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketMessageMailIntroLabelAdmin").'</label>';
|
print '<tr class="oddeven"><td>'.$langs->trans("TicketMessageMailIntroLabelAdmin").' ('.$langs->trans("Responses").')';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
|
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
|
||||||
|
|||||||
@ -57,12 +57,13 @@ class BankAccounts extends DolibarrApi
|
|||||||
* @param string $sortorder Sort order
|
* @param string $sortorder Sort order
|
||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
* @param int $page Page number
|
* @param int $page Page number
|
||||||
|
* @param int $category Use this param to filter list by category
|
||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')"
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')"
|
||||||
* @return array List of account objects
|
* @return array List of account objects
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
|
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $category = 0, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
$list = array();
|
$list = array();
|
||||||
|
|
||||||
@ -71,7 +72,14 @@ class BankAccounts extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank_account as t";
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank_account as t";
|
||||||
|
if ($category > 0) {
|
||||||
|
$sql .= ", ".MAIN_DB_PREFIX."categorie_account as c";
|
||||||
|
}
|
||||||
$sql .= ' WHERE t.entity IN ('.getEntity('bank_account').')';
|
$sql .= ' WHERE t.entity IN ('.getEntity('bank_account').')';
|
||||||
|
// Select accounts of given category
|
||||||
|
if ($category > 0) {
|
||||||
|
$sql .= " AND c.fk_categorie = ".$db->escape($category)." AND c.fk_account = t.rowid ";
|
||||||
|
}
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -75,6 +75,8 @@ if ($action == 'add' && !empty($permissiontoadd))
|
|||||||
$value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
|
$value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
|
||||||
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
|
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
|
||||||
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
|
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
|
||||||
|
} elseif ($object->fields[$key]['type'] == 'boolean') {
|
||||||
|
$value = (GETPOST($key) == 'on' ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
$value = GETPOST($key, 'alphanohtml');
|
$value = GETPOST($key, 'alphanohtml');
|
||||||
}
|
}
|
||||||
@ -156,6 +158,8 @@ if ($action == 'update' && !empty($permissiontoadd))
|
|||||||
}
|
}
|
||||||
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
|
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
|
||||||
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
|
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
|
||||||
|
} elseif ($object->fields[$key]['type'] == 'boolean') {
|
||||||
|
$value = (GETPOST($key) == 'on' ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
$value = GETPOST($key, 'alpha');
|
$value = GETPOST($key, 'alpha');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -386,6 +387,12 @@ abstract class CommonDocGenerator
|
|||||||
$sumcreditnote = $object->getSumCreditNotesUsed();
|
$sumcreditnote = $object->getSumCreditNotesUsed();
|
||||||
$already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
|
$already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
|
||||||
$remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote;
|
$remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote;
|
||||||
|
|
||||||
|
if ($object->fk_account > 0) {
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php';
|
||||||
|
$bank_account = new Account($this->db);
|
||||||
|
$bank_account->fetch($object->fk_account);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$date = ($object->element == 'contrat' ? $object->date_contrat : $object->date);
|
$date = ($object->element == 'contrat' ? $object->date_contrat : $object->date);
|
||||||
@ -414,6 +421,9 @@ abstract class CommonDocGenerator
|
|||||||
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
|
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
|
||||||
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)),
|
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)),
|
||||||
|
|
||||||
|
$array_key.'_bank_iban'=>$bank_account->iban,
|
||||||
|
$array_key.'_bank_bic'=>$bank_account->bic,
|
||||||
|
|
||||||
$array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
|
$array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
|
||||||
$array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)),
|
$array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)),
|
||||||
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
||||||
|
|||||||
@ -30,9 +30,9 @@
|
|||||||
class FormProjets
|
class FormProjets
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var DoliDB Database handler.
|
* @var DoliDB Database handler.
|
||||||
*/
|
*/
|
||||||
public $db;
|
public $db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Error code (or message)
|
* @var string Error code (or message)
|
||||||
@ -50,7 +50,7 @@ class FormProjets
|
|||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Output a combo list with projects qualified for a third party / user
|
* Output a combo list with projects qualified for a third party / user
|
||||||
*
|
*
|
||||||
@ -71,9 +71,9 @@ class FormProjets
|
|||||||
* @param int $htmlid Html id to use instead of htmlname
|
* @param int $htmlid Html id to use instead of htmlname
|
||||||
* @return string Return html content
|
* @return string Return html content
|
||||||
*/
|
*/
|
||||||
public function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '')
|
public function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs, $conf, $form;
|
global $langs, $conf, $form;
|
||||||
|
|
||||||
$out = '';
|
$out = '';
|
||||||
@ -90,13 +90,13 @@ class FormProjets
|
|||||||
$selected_input_value = $project->ref;
|
$selected_input_value = $project->ref;
|
||||||
}
|
}
|
||||||
$urloption = 'socid='.$socid.'&htmlname='.$htmlname.'&discardclosed='.$discard_closed;
|
$urloption = 'socid='.$socid.'&htmlname='.$htmlname.'&discardclosed='.$discard_closed;
|
||||||
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array(
|
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array(
|
||||||
// 'update' => array(
|
// 'update' => array(
|
||||||
// 'projectid' => 'id'
|
// 'projectid' => 'id'
|
||||||
// )
|
// )
|
||||||
));
|
));
|
||||||
|
|
||||||
$out .= '<input type="text" class="minwidth200'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
|
$out .= '<input type="text" class="minwidth200'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -113,13 +113,13 @@ class FormProjets
|
|||||||
|
|
||||||
if (empty($nooutput))
|
if (empty($nooutput))
|
||||||
{
|
{
|
||||||
print $out;
|
print $out;
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
else return $out;
|
else return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Returns an array with projects qualified for a third party
|
* Returns an array with projects qualified for a third party
|
||||||
*
|
*
|
||||||
@ -130,8 +130,8 @@ class FormProjets
|
|||||||
* @param int $option_only Return only html options lines without the select tag
|
* @param int $option_only Return only html options lines without the select tag
|
||||||
* @param int $show_empty Add an empty line
|
* @param int $show_empty Add an empty line
|
||||||
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
|
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
|
||||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||||
* @param int $disabled Disabled
|
* @param int $disabled Disabled
|
||||||
* @param int $mode 0 for HTML mode and 1 for array return (to be used by json_encode for example)
|
* @param int $mode 0 for HTML mode and 1 for array return (to be used by json_encode for example)
|
||||||
* @param string $filterkey Key to filter
|
* @param string $filterkey Key to filter
|
||||||
* @param int $nooutput No print output. Return it only.
|
* @param int $nooutput No print output. Return it only.
|
||||||
@ -140,9 +140,9 @@ class FormProjets
|
|||||||
* @param string $morecss More CSS
|
* @param string $morecss More CSS
|
||||||
* @return int Nb of project if OK, <0 if KO
|
* @return int Nb of project if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function select_projects_list($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $htmlid = '', $morecss = 'maxwidth500')
|
public function select_projects_list($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $htmlid = '', $morecss = 'maxwidth500')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $user, $conf, $langs;
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
@ -170,11 +170,11 @@ class FormProjets
|
|||||||
if ($socid == 0) $sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
if ($socid == 0) $sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
||||||
if ($socid > 0)
|
if ($socid > 0)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql .= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
if (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql .= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
||||||
elseif ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
|
elseif ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
|
||||||
{
|
{
|
||||||
$sql .= " AND (p.fk_soc IN (".$socid.", ".$conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") OR p.fk_soc IS NULL)";
|
$sql .= " AND (p.fk_soc IN (".$socid.", ".$conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") OR p.fk_soc IS NULL)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($filterkey)) $sql .= natural_search(array('p.title', 'p.ref'), $filterkey);
|
if (!empty($filterkey)) $sql .= natural_search(array('p.title', 'p.ref'), $filterkey);
|
||||||
$sql .= " ORDER BY p.ref ASC";
|
$sql .= " ORDER BY p.ref ASC";
|
||||||
@ -186,9 +186,9 @@ class FormProjets
|
|||||||
if (!empty($conf->use_javascript_ajax))
|
if (!empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||||
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
|
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
|
||||||
$out .= $comboenhancement;
|
$out .= $comboenhancement;
|
||||||
$morecss .= ' minwidth100';
|
$morecss .= ' minwidth100';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($option_only)) {
|
if (empty($option_only)) {
|
||||||
@ -223,8 +223,8 @@ class FormProjets
|
|||||||
$labeltoshow .= ', '.dol_trunc($obj->title, $maxlength);
|
$labeltoshow .= ', '.dol_trunc($obj->title, $maxlength);
|
||||||
if ($obj->name)
|
if ($obj->name)
|
||||||
{
|
{
|
||||||
$labeltoshow .= ' - '.$obj->name;
|
$labeltoshow .= ' - '.$obj->name;
|
||||||
if ($obj->name_alias) $labeltoshow .= ' ('.$obj->name_alias.')';
|
if ($obj->name_alias) $labeltoshow .= ' ('.$obj->name_alias.')';
|
||||||
}
|
}
|
||||||
|
|
||||||
$disabled = 0;
|
$disabled = 0;
|
||||||
@ -287,8 +287,8 @@ class FormProjets
|
|||||||
if (empty($option_only)) $out .= '</select>';
|
if (empty($option_only)) $out .= '</select>';
|
||||||
if (empty($nooutput))
|
if (empty($nooutput))
|
||||||
{
|
{
|
||||||
print $out;
|
print $out;
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
else return $out;
|
else return $out;
|
||||||
} else {
|
} else {
|
||||||
@ -312,15 +312,15 @@ class FormProjets
|
|||||||
* @param int $option_only Return only html options lines without the select tag
|
* @param int $option_only Return only html options lines without the select tag
|
||||||
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
|
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
|
||||||
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
|
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
|
||||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||||
* @param int $disabled Disabled
|
* @param int $disabled Disabled
|
||||||
* @param string $morecss More css added to the select component
|
* @param string $morecss More css added to the select component
|
||||||
* @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids.
|
* @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids.
|
||||||
* @param string $showproject 'all' = Show project info, ''=Hide project info
|
* @param string $showproject 'all' = Show project info, ''=Hide project info
|
||||||
* @param User $usertofilter User object to use for filtering
|
* @param User $usertofilter User object to use for filtering
|
||||||
* @return int Nbr of project if OK, <0 if KO
|
* @return int Nbr of tasks if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
|
public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
|
||||||
{
|
{
|
||||||
global $user, $conf, $langs;
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
@ -365,9 +365,9 @@ class FormProjets
|
|||||||
if (!empty($conf->use_javascript_ajax))
|
if (!empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||||
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||||
$out .= $comboenhancement;
|
$out .= $comboenhancement;
|
||||||
$morecss = 'minwidth200imp maxwidth500';
|
$morecss = 'minwidth200imp maxwidth500';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($option_only)) {
|
if (empty($option_only)) {
|
||||||
@ -481,7 +481,7 @@ class FormProjets
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Build a HTML select list of element of same thirdparty to suggest to link them to project
|
* Build a HTML select list of element of same thirdparty to suggest to link them to project
|
||||||
*
|
*
|
||||||
@ -494,7 +494,7 @@ class FormProjets
|
|||||||
*/
|
*/
|
||||||
public function select_element($table_element, $socid = 0, $morecss = '', $limitonstatus = -2, $projectkey = "fk_projet")
|
public function select_element($table_element, $socid = 0, $morecss = '', $limitonstatus = -2, $projectkey = "fk_projet")
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done)
|
if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done)
|
||||||
@ -518,7 +518,7 @@ class FormProjets
|
|||||||
break;
|
break;
|
||||||
case "commande_fourn":
|
case "commande_fourn":
|
||||||
case "commande_fournisseur":
|
case "commande_fournisseur":
|
||||||
$sql = "SELECT t.rowid, t.ref, t.ref_supplier";
|
$sql = "SELECT t.rowid, t.ref, t.ref_supplier";
|
||||||
break;
|
break;
|
||||||
case "facture_rec":
|
case "facture_rec":
|
||||||
$sql = "SELECT t.rowid, t.titre as ref";
|
$sql = "SELECT t.rowid, t.titre as ref";
|
||||||
@ -535,10 +535,10 @@ class FormProjets
|
|||||||
break;*/
|
break;*/
|
||||||
return '';
|
return '';
|
||||||
case "commande":
|
case "commande":
|
||||||
case "contrat":
|
case "contrat":
|
||||||
case "fichinter":
|
case "fichinter":
|
||||||
$sql = "SELECT t.rowid, t.ref";
|
$sql = "SELECT t.rowid, t.ref";
|
||||||
break;
|
break;
|
||||||
case 'stock_mouvement':
|
case 'stock_mouvement':
|
||||||
$sql = 'SELECT t.rowid, t.label as ref';
|
$sql = 'SELECT t.rowid, t.label as ref';
|
||||||
$projectkey = 'fk_origin';
|
$projectkey = 'fk_origin';
|
||||||
@ -560,8 +560,8 @@ class FormProjets
|
|||||||
$sql .= " WHERE ".$projectkey." is null";
|
$sql .= " WHERE ".$projectkey." is null";
|
||||||
if (!empty($socid) && $linkedtothirdparty)
|
if (!empty($socid) && $linkedtothirdparty)
|
||||||
{
|
{
|
||||||
if (is_numeric($socid)) $sql .= " AND t.fk_soc=".$socid;
|
if (is_numeric($socid)) $sql .= " AND t.fk_soc=".$socid;
|
||||||
else $sql .= " AND t.fk_soc IN (".$socid.")";
|
else $sql .= " AND t.fk_soc IN (".$socid.")";
|
||||||
}
|
}
|
||||||
if (!in_array($table_element, array('expensereport_det', 'stock_mouvement'))) $sql .= ' AND t.entity IN ('.getEntity('project').')';
|
if (!in_array($table_element, array('expensereport_det', 'stock_mouvement'))) $sql .= ' AND t.entity IN ('.getEntity('project').')';
|
||||||
if ($linkedtothirdparty) $sql .= " AND s.rowid = t.fk_soc";
|
if ($linkedtothirdparty) $sql .= " AND s.rowid = t.fk_soc";
|
||||||
@ -640,15 +640,15 @@ class FormProjets
|
|||||||
{
|
{
|
||||||
$sellist = '<select class="flat oppstatus'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
|
$sellist = '<select class="flat oppstatus'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||||
if ($showempty) {
|
if ($showempty) {
|
||||||
// Without  , strange move of screen when switching value
|
// Without  , strange move of screen when switching value
|
||||||
$sellist .= '<option value="-1"> </option>';
|
$sellist .= '<option value="-1"> </option>';
|
||||||
}
|
}
|
||||||
if ($showallnone) {
|
if ($showallnone) {
|
||||||
$sellist .= '<option value="all"'.($preselected == 'all' ? ' selected="selected"' : '').'>-- '.$langs->trans("OnlyOpportunitiesShort").' --</option>';
|
$sellist .= '<option value="all"'.($preselected == 'all' ? ' selected="selected"' : '').'>-- '.$langs->trans("OnlyOpportunitiesShort").' --</option>';
|
||||||
$sellist .= '<option value="openedopp"'.($preselected == 'openedopp' ? ' selected="selected"' : '').'>-- '.$langs->trans("OpenedOpportunitiesShort").' --</option>';
|
$sellist .= '<option value="openedopp"'.($preselected == 'openedopp' ? ' selected="selected"' : '').'>-- '.$langs->trans("OpenedOpportunitiesShort").' --</option>';
|
||||||
$sellist .= '<option value="notopenedopp"'.($preselected == 'notopenedopp' ? ' selected="selected"' : '').'>-- '.$langs->trans("NotOpenedOpportunitiesShort").' --</option>';
|
$sellist .= '<option value="notopenedopp"'.($preselected == 'notopenedopp' ? ' selected="selected"' : '').'>-- '.$langs->trans("NotOpenedOpportunitiesShort").' --</option>';
|
||||||
$sellist .= '<option value="none"'.($preselected == 'none' ? ' selected="selected"' : '').'>-- '.$langs->trans("NotAnOpportunityShort").' --</option>';
|
$sellist .= '<option value="none"'.($preselected == 'none' ? ' selected="selected"' : '').'>-- '.$langs->trans("NotAnOpportunityShort").' --</option>';
|
||||||
}
|
}
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -23,8 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Define size of logo small and mini
|
// Define size of logo small and mini
|
||||||
$maxwidthsmall = 270; $maxheightsmall = 150;
|
$maxwidthsmall = 350; $maxheightsmall = 200; // Near 16/9eme
|
||||||
$maxwidthmini = 128; $maxheightmini = 72;
|
$maxwidthmini = 128; $maxheightmini = 72; // 16/9eme
|
||||||
$quality = 80;
|
$quality = 80;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,83 +34,83 @@
|
|||||||
*/
|
*/
|
||||||
function build_calfile($format, $title, $desc, $events_array, $outputfile)
|
function build_calfile($format, $title, $desc, $events_array, $outputfile)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
dol_syslog("xcal.lib.php::build_calfile Build cal file ".$outputfile." to format ".$format);
|
dol_syslog("xcal.lib.php::build_calfile Build cal file ".$outputfile." to format ".$format);
|
||||||
|
|
||||||
if (empty($outputfile))
|
if (empty($outputfile))
|
||||||
{
|
{
|
||||||
// -1 = error
|
// -1 = error
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: A cal file is an UTF8 encoded file
|
// Note: A cal file is an UTF8 encoded file
|
||||||
$calfileh = fopen($outputfile, "w");
|
$calfileh = fopen($outputfile, "w");
|
||||||
|
|
||||||
if ($calfileh)
|
if ($calfileh)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
|
include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$encoding = "";
|
$encoding = "";
|
||||||
|
|
||||||
if ($format === "vcal")
|
if ($format === "vcal")
|
||||||
{
|
{
|
||||||
$encoding = "ENCODING=QUOTED-PRINTABLE:";
|
$encoding = "ENCODING=QUOTED-PRINTABLE:";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print header
|
// Print header
|
||||||
fwrite($calfileh, "BEGIN:VCALENDAR\n");
|
fwrite($calfileh, "BEGIN:VCALENDAR\n");
|
||||||
|
|
||||||
// version is always "2.0"
|
// version is always "2.0"
|
||||||
fwrite($calfileh, "VERSION:2.0\n");
|
fwrite($calfileh, "VERSION:2.0\n");
|
||||||
|
|
||||||
fwrite($calfileh, "METHOD:PUBLISH\n");
|
fwrite($calfileh, "METHOD:PUBLISH\n");
|
||||||
fwrite($calfileh, "PRODID:-//DOLIBARR ".DOL_VERSION."\n");
|
fwrite($calfileh, "PRODID:-//DOLIBARR ".DOL_VERSION."\n");
|
||||||
fwrite($calfileh, "CALSCALE:GREGORIAN\n");
|
fwrite($calfileh, "CALSCALE:GREGORIAN\n");
|
||||||
fwrite($calfileh, "X-WR-CALNAME:".$encoding.format_cal($format, $title)."\n");
|
fwrite($calfileh, "X-WR-CALNAME:".$encoding.format_cal($format, $title)."\n");
|
||||||
fwrite($calfileh, "X-WR-CALDESC:".$encoding.format_cal($format, $desc)."\n");
|
fwrite($calfileh, "X-WR-CALDESC:".$encoding.format_cal($format, $desc)."\n");
|
||||||
//fwrite($calfileh,"X-WR-TIMEZONE:Europe/Paris\n");
|
//fwrite($calfileh,"X-WR-TIMEZONE:Europe/Paris\n");
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_AGENDA_EXPORT_CACHE) && $conf->global->MAIN_AGENDA_EXPORT_CACHE > 60)
|
if (!empty($conf->global->MAIN_AGENDA_EXPORT_CACHE) && $conf->global->MAIN_AGENDA_EXPORT_CACHE > 60)
|
||||||
{
|
{
|
||||||
$hh = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "hour");
|
$hh = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "hour");
|
||||||
$mm = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "min");
|
$mm = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "min");
|
||||||
$ss = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "sec");
|
$ss = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "sec");
|
||||||
|
|
||||||
fwrite($calfileh, "X-PUBLISHED-TTL: P".$hh."H".$mm."M".$ss."S\n");
|
fwrite($calfileh, "X-PUBLISHED-TTL: P".$hh."H".$mm."M".$ss."S\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($events_array as $key => $event)
|
foreach ($events_array as $key => $event)
|
||||||
{
|
{
|
||||||
// See http://fr.wikipedia.org/wiki/ICalendar for format
|
// See http://fr.wikipedia.org/wiki/ICalendar for format
|
||||||
// See http://www.ietf.org/rfc/rfc2445.txt for RFC
|
// See http://www.ietf.org/rfc/rfc2445.txt for RFC
|
||||||
|
|
||||||
// TODO: avoid use extra event array, use objects direct thahtwas created before
|
// TODO: avoid use extra event array, use objects direct thahtwas created before
|
||||||
|
|
||||||
$uid = $event["uid"];
|
$uid = $event["uid"];
|
||||||
$type = $event["type"];
|
$type = $event["type"];
|
||||||
$startdate = $event["startdate"];
|
$startdate = $event["startdate"];
|
||||||
$duration = $event["duration"];
|
$duration = $event["duration"];
|
||||||
$enddate = $event["enddate"];
|
$enddate = $event["enddate"];
|
||||||
$summary = $event["summary"];
|
$summary = $event["summary"];
|
||||||
$category = $event["category"];
|
$category = $event["category"];
|
||||||
$priority = $event["priority"];
|
$priority = $event["priority"];
|
||||||
$fulldayevent = $event["fulldayevent"];
|
$fulldayevent = $event["fulldayevent"];
|
||||||
$location = $event["location"];
|
$location = $event["location"];
|
||||||
$email = $event["email"];
|
$email = $event["email"];
|
||||||
$url = $event["url"];
|
$url = $event["url"];
|
||||||
$transparency = $event["transparency"];
|
$transparency = $event["transparency"];
|
||||||
$description = dol_string_nohtmltag(preg_replace("/<br[\s\/]?>/i", "\n", $event["desc"]), 0);
|
$description = dol_string_nohtmltag(preg_replace("/<br[\s\/]?>/i", "\n", $event["desc"]), 0);
|
||||||
$created = $event["created"];
|
$created = $event["created"];
|
||||||
$modified = $event["modified"];
|
$modified = $event["modified"];
|
||||||
$assignedUsers = $event["assignedUsers"];
|
$assignedUsers = $event["assignedUsers"];
|
||||||
|
|
||||||
// Format
|
// Format
|
||||||
$summary = format_cal($format, $summary);
|
$summary = format_cal($format, $summary);
|
||||||
$description = format_cal($format, $description);
|
$description = format_cal($format, $description);
|
||||||
$category = format_cal($format, $category);
|
$category = format_cal($format, $category);
|
||||||
$location = format_cal($format, $location);
|
$location = format_cal($format, $location);
|
||||||
|
|
||||||
// Output the vCard/iCal VEVENT object
|
// Output the vCard/iCal VEVENT object
|
||||||
/*
|
/*
|
||||||
@ -147,180 +147,180 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
|
|||||||
END:VEVENT
|
END:VEVENT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($type === "event")
|
if ($type === "event")
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "BEGIN:VEVENT\n");
|
fwrite($calfileh, "BEGIN:VEVENT\n");
|
||||||
fwrite($calfileh, "UID:".$uid."\n");
|
fwrite($calfileh, "UID:".$uid."\n");
|
||||||
|
|
||||||
if (!empty($email))
|
if (!empty($email))
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "ORGANIZER:MAILTO:".$email."\n");
|
fwrite($calfileh, "ORGANIZER:MAILTO:".$email."\n");
|
||||||
fwrite($calfileh, "CONTACT:MAILTO:".$email."\n");
|
fwrite($calfileh, "CONTACT:MAILTO:".$email."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($url))
|
if (!empty($url))
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "URL:".$url."\n");
|
fwrite($calfileh, "URL:".$url."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($assignedUsers))
|
if (is_array($assignedUsers))
|
||||||
{
|
{
|
||||||
foreach ($assignedUsers as $assignedUser)
|
foreach ($assignedUsers as $assignedUser)
|
||||||
{
|
{
|
||||||
if ($assignedUser->email === $email)
|
if ($assignedUser->email === $email)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite($calfileh, "ATTENDEE;RSVP=TRUE:mailto:".$assignedUser->email."\n");
|
fwrite($calfileh, "ATTENDEE;RSVP=TRUE:mailto:".$assignedUser->email."\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($created)
|
if ($created)
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n");
|
fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($modified)
|
if ($modified)
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n");
|
fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n");
|
fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n");
|
||||||
fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n");
|
fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n");
|
||||||
|
|
||||||
if (!empty($location))
|
if (!empty($location))
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "LOCATION:".$encoding.$location."\n");
|
fwrite($calfileh, "LOCATION:".$encoding.$location."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fulldayevent)
|
if ($fulldayevent)
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "X-FUNAMBOL-ALLDAY:1\n");
|
fwrite($calfileh, "X-FUNAMBOL-ALLDAY:1\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// see https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/0f262da6-c5fd-459e-9f18-145eba86b5d2
|
// see https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/0f262da6-c5fd-459e-9f18-145eba86b5d2
|
||||||
if ($fulldayevent)
|
if ($fulldayevent)
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "X-MICROSOFT-CDO-ALLDAYEVENT:TRUE\n");
|
fwrite($calfileh, "X-MICROSOFT-CDO-ALLDAYEVENT:TRUE\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Date must be GMT dates
|
// Date must be GMT dates
|
||||||
// Current date
|
// Current date
|
||||||
fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", true)."\n");
|
fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", true)."\n");
|
||||||
|
|
||||||
// Start date
|
// Start date
|
||||||
$prefix = "";
|
$prefix = "";
|
||||||
$startdatef = dol_print_date($startdate, "dayhourxcard", true);
|
$startdatef = dol_print_date($startdate, "dayhourxcard", true);
|
||||||
|
|
||||||
if ($fulldayevent)
|
if ($fulldayevent)
|
||||||
{
|
{
|
||||||
// Local time
|
// Local time
|
||||||
$prefix = ";VALUE=DATE";
|
$prefix = ";VALUE=DATE";
|
||||||
$startdatef = dol_print_date($startdate, "dayxcard", false);
|
$startdatef = dol_print_date($startdate, "dayxcard", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n");
|
fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n");
|
||||||
|
|
||||||
// End date
|
// End date
|
||||||
if ($fulldayevent)
|
if ($fulldayevent)
|
||||||
{
|
{
|
||||||
if (empty($enddate))
|
if (empty($enddate))
|
||||||
{
|
{
|
||||||
$enddate = dol_time_plus_duree($startdate, 1, "d");
|
$enddate = dol_time_plus_duree($startdate, 1, "d");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (empty($enddate))
|
if (empty($enddate))
|
||||||
{
|
{
|
||||||
$enddate = $startdate + $duration;
|
$enddate = $startdate + $duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$prefix = "";
|
$prefix = "";
|
||||||
$enddatef = dol_print_date($enddate, "dayhourxcard", true);
|
$enddatef = dol_print_date($enddate, "dayhourxcard", true);
|
||||||
|
|
||||||
if ($fulldayevent)
|
if ($fulldayevent)
|
||||||
{
|
{
|
||||||
$prefix = ";VALUE=DATE";
|
$prefix = ";VALUE=DATE";
|
||||||
$enddatef = dol_print_date($enddate + 1, "dayxcard", false);
|
$enddatef = dol_print_date($enddate + 1, "dayxcard", false);
|
||||||
|
|
||||||
// Local time
|
// Local time
|
||||||
//$enddatef .= dol_print_date($enddate+1,"dayhourxcard",false);
|
//$enddatef .= dol_print_date($enddate+1,"dayhourxcard",false);
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n");
|
fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n");
|
||||||
fwrite($calfileh, "STATUS:CONFIRMED"."\n");
|
fwrite($calfileh, "STATUS:CONFIRMED"."\n");
|
||||||
|
|
||||||
if (!empty($transparency))
|
if (!empty($transparency))
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "TRANSP:".$transparency."\n");
|
fwrite($calfileh, "TRANSP:".$transparency."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($category))
|
if (!empty($category))
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "CATEGORIES:".$encoding.$category."\n");
|
fwrite($calfileh, "CATEGORIES:".$encoding.$category."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite($calfileh, "END:VEVENT\n");
|
fwrite($calfileh, "END:VEVENT\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output the vCard/iCal VJOURNAL object
|
// Output the vCard/iCal VJOURNAL object
|
||||||
if ($type === "journal")
|
if ($type === "journal")
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "BEGIN:VJOURNAL\n");
|
fwrite($calfileh, "BEGIN:VJOURNAL\n");
|
||||||
fwrite($calfileh, "UID:".$uid."\n");
|
fwrite($calfileh, "UID:".$uid."\n");
|
||||||
|
|
||||||
if (!empty($email))
|
if (!empty($email))
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "ORGANIZER:MAILTO:".$email."\n");
|
fwrite($calfileh, "ORGANIZER:MAILTO:".$email."\n");
|
||||||
fwrite($calfileh, "CONTACT:MAILTO:".$email."\n");
|
fwrite($calfileh, "CONTACT:MAILTO:".$email."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($url))
|
if (!empty($url))
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "URL:".$url."\n");
|
fwrite($calfileh, "URL:".$url."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($created)
|
if ($created)
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n");
|
fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($modified)
|
if ($modified)
|
||||||
{
|
{
|
||||||
fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n");
|
fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n");
|
fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n");
|
||||||
fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n");
|
fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n");
|
||||||
fwrite($calfileh, "STATUS:CONFIRMED"."\n");
|
fwrite($calfileh, "STATUS:CONFIRMED"."\n");
|
||||||
fwrite($calfileh, "CATEGORIES:".$category."\n");
|
fwrite($calfileh, "CATEGORIES:".$category."\n");
|
||||||
fwrite($calfileh, "LOCATION:".$location."\n");
|
fwrite($calfileh, "LOCATION:".$location."\n");
|
||||||
fwrite($calfileh, "TRANSP:OPAQUE\n");
|
fwrite($calfileh, "TRANSP:OPAQUE\n");
|
||||||
fwrite($calfileh, "CLASS:CONFIDENTIAL\n");
|
fwrite($calfileh, "CLASS:CONFIDENTIAL\n");
|
||||||
fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", true)."\n");
|
fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", true)."\n");
|
||||||
|
|
||||||
fwrite($calfileh, "END:VJOURNAL\n");
|
fwrite($calfileh, "END:VJOURNAL\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Footer
|
// Footer
|
||||||
fwrite($calfileh, "END:VCALENDAR");
|
fwrite($calfileh, "END:VCALENDAR");
|
||||||
|
|
||||||
fclose($calfileh);
|
fclose($calfileh);
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_UMASK))
|
if (!empty($conf->global->MAIN_UMASK))
|
||||||
{
|
{
|
||||||
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
|
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("xcal.lib.php::build_calfile Failed to open file ".$outputfile." for writing");
|
dol_syslog("xcal.lib.php::build_calfile Failed to open file ".$outputfile." for writing");
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -333,38 +333,38 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
|
|||||||
* @param array $events_array Array of events ("uid","startdate","summary","url","desc","author","category") or Array of WebsitePage
|
* @param array $events_array Array of events ("uid","startdate","summary","url","desc","author","category") or Array of WebsitePage
|
||||||
* @param string $outputfile Output file
|
* @param string $outputfile Output file
|
||||||
* @param string $filter (optional) Filter
|
* @param string $filter (optional) Filter
|
||||||
* @param string $url Url
|
* @param string $url Url (If empty, forge URL for agenda RSS export)
|
||||||
* @return int < 0 if ko, Nb of events in file if ok
|
* @return int < 0 if ko, Nb of events in file if ok
|
||||||
*/
|
*/
|
||||||
function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '')
|
function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '')
|
||||||
{
|
{
|
||||||
global $user, $conf, $langs;
|
global $user, $conf, $langs;
|
||||||
global $dolibarr_main_url_root;
|
global $dolibarr_main_url_root;
|
||||||
|
|
||||||
dol_syslog("xcal.lib.php::build_rssfile Build rss file ".$outputfile." to format ".$format);
|
dol_syslog("xcal.lib.php::build_rssfile Build rss file ".$outputfile." to format ".$format);
|
||||||
|
|
||||||
if (empty($outputfile))
|
if (empty($outputfile))
|
||||||
{
|
{
|
||||||
// -1 = error
|
// -1 = error
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fichier = fopen($outputfile, "w");
|
$fichier = fopen($outputfile, "w");
|
||||||
|
|
||||||
if ($fichier)
|
if ($fichier)
|
||||||
{
|
{
|
||||||
$date = date("r");
|
$date = date("r");
|
||||||
|
|
||||||
// Print header
|
// Print header
|
||||||
fwrite($fichier, '<?xml version="1.0" encoding="'.$langs->charset_output.'"?>');
|
fwrite($fichier, '<?xml version="1.0" encoding="'.$langs->charset_output.'"?>');
|
||||||
fwrite($fichier, "\n");
|
fwrite($fichier, "\n");
|
||||||
|
|
||||||
fwrite($fichier, '<rss version="2.0">');
|
fwrite($fichier, '<rss version="2.0">');
|
||||||
fwrite($fichier, "\n");
|
fwrite($fichier, "\n");
|
||||||
|
|
||||||
fwrite($fichier, "<channel>\n<title>".$title."</title>\n");
|
fwrite($fichier, "<channel>\n<title>".$title."</title>\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
fwrite($fichier, "<description><![CDATA[".$desc.".]]></description>"."\n".
|
fwrite($fichier, "<description><![CDATA[".$desc.".]]></description>"."\n".
|
||||||
// "<language>fr</language>"."\n".
|
// "<language>fr</language>"."\n".
|
||||||
"<copyright>Dolibarr</copyright>"."\n".
|
"<copyright>Dolibarr</copyright>"."\n".
|
||||||
@ -372,90 +372,91 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt
|
|||||||
"<generator>Dolibarr</generator>"."\n");
|
"<generator>Dolibarr</generator>"."\n");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
// Define $urlwithroot
|
// Define $urlwithroot
|
||||||
$urlwithouturlroot = preg_replace("/".preg_quote(DOL_URL_ROOT, "/")."$/i", "", trim($dolibarr_main_url_root));
|
$urlwithouturlroot = preg_replace("/".preg_quote(DOL_URL_ROOT, "/")."$/i", "", trim($dolibarr_main_url_root));
|
||||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||||
|
|
||||||
$url = $urlwithroot."/public/agenda/agendaexport.php?format=rss&exportkey=".urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY);
|
$url = $urlwithroot."/public/agenda/agendaexport.php?format=rss&exportkey=".urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite($fichier, "<link><![CDATA[".$url."]]></link>"."\n");
|
fwrite($fichier, "<link><![CDATA[".$url."]]></link>"."\n");
|
||||||
|
|
||||||
foreach ($events_array as $key => $event)
|
foreach ($events_array as $key => $event)
|
||||||
{
|
{
|
||||||
$eventqualified = true;
|
$eventqualified = true;
|
||||||
|
|
||||||
if ($filter)
|
if ($filter)
|
||||||
{
|
{
|
||||||
// TODO Add a filter
|
// TODO Add a filter
|
||||||
|
|
||||||
$eventqualified = false;
|
$eventqualified = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($eventqualified)
|
if ($eventqualified)
|
||||||
{
|
{
|
||||||
if (is_object($event) && get_class($event) == 'WebsitePage') {
|
if (is_object($event) && get_class($event) == 'WebsitePage') {
|
||||||
// Convert object into an array
|
// Convert object into an array
|
||||||
$tmpevent = array();
|
$tmpevent = array();
|
||||||
$tmpevent['uid'] = $event->id;
|
$tmpevent['uid'] = $event->id;
|
||||||
$tmpevent['startdate'] = $event->date_creation;
|
$tmpevent['startdate'] = $event->date_creation;
|
||||||
$tmpevent['summary'] = $event->title;
|
$tmpevent['summary'] = $event->title;
|
||||||
$tmpevent['url'] = $event->urlpage.'.php';
|
$tmpevent['url'] = $event->fullpageurl ? $event->fullpageurl : $event->pageurl.'.php';
|
||||||
$tmpevent['author'] = $event->author_alias ? $event->author_alias : 'unknown';
|
$tmpevent['author'] = $event->author_alias ? $event->author_alias : 'unknown';
|
||||||
//$tmpevent['category'] = '';
|
//$tmpevent['category'] = '';
|
||||||
|
$tmpevent['desc'] = $event->description;
|
||||||
|
|
||||||
$event = $tmpevent;
|
$event = $tmpevent;
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = $event["uid"];
|
$uid = $event["uid"];
|
||||||
$startdate = $event["startdate"];
|
$startdate = $event["startdate"];
|
||||||
$summary = $event["summary"];
|
$summary = $event["summary"];
|
||||||
$url = $event["url"];
|
$url = $event["url"];
|
||||||
$author = $event["author"];
|
$author = $event["author"];
|
||||||
$category = $event["category"];
|
$category = $event["category"];
|
||||||
|
|
||||||
/* No place inside a RSS
|
/* No place inside a RSS
|
||||||
$priority = $event["priority"];
|
$priority = $event["priority"];
|
||||||
$fulldayevent = $event["fulldayevent"];
|
$fulldayevent = $event["fulldayevent"];
|
||||||
$location = $event["location"];
|
$location = $event["location"];
|
||||||
$email = $event["email"];
|
$email = $event["email"];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$description = dol_string_nohtmltag(preg_replace("/<br[\s\/]?>/i", "\n", $event["desc"]), 0);
|
$description = dol_string_nohtmltag(preg_replace("/<br[\s\/]?>/i", "\n", $event["desc"]), 0);
|
||||||
|
|
||||||
fwrite($fichier, "<item>\n");
|
fwrite($fichier, "<item>\n");
|
||||||
fwrite($fichier, "<title><![CDATA[".$summary."]]></title>\n");
|
fwrite($fichier, "<title><![CDATA[".$summary."]]></title>\n");
|
||||||
fwrite($fichier, "<link><![CDATA[".$url."]]></link>\n");
|
fwrite($fichier, "<link><![CDATA[".$url."]]></link>\n");
|
||||||
fwrite($fichier, "<author><![CDATA[".$author."]]></author>\n");
|
fwrite($fichier, "<author><![CDATA[".$author."]]></author>\n");
|
||||||
fwrite($fichier, "<category><![CDATA[".$category."]]></category>\n");
|
fwrite($fichier, "<category><![CDATA[".$category."]]></category>\n");
|
||||||
fwrite($fichier, "<description><![CDATA[");
|
fwrite($fichier, "<description><![CDATA[");
|
||||||
|
|
||||||
if ($description)
|
if ($description)
|
||||||
fwrite($fichier, $description);
|
fwrite($fichier, $description);
|
||||||
// else
|
// else
|
||||||
// fwrite($fichier, "NoDesc");
|
// fwrite($fichier, "NoDesc");
|
||||||
|
|
||||||
fwrite($fichier, "]]></description>\n");
|
fwrite($fichier, "]]></description>\n");
|
||||||
fwrite($fichier, "<pubDate>".date("r", $startdate)."</pubDate>\n");
|
fwrite($fichier, "<pubDate>".date("r", $startdate)."</pubDate>\n");
|
||||||
fwrite($fichier, "<guid isPermaLink=\"true\"><![CDATA[".$uid."]]></guid>\n");
|
fwrite($fichier, "<guid isPermaLink=\"true\"><![CDATA[".$uid."]]></guid>\n");
|
||||||
fwrite($fichier, "<source><![CDATA[Dolibarr]]></source>\n");
|
fwrite($fichier, "<source><![CDATA[Dolibarr]]></source>\n");
|
||||||
fwrite($fichier, "</item>\n");
|
fwrite($fichier, "</item>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite($fichier, "</channel>");
|
fwrite($fichier, "</channel>");
|
||||||
fwrite($fichier, "\n");
|
fwrite($fichier, "\n");
|
||||||
fwrite($fichier, "</rss>");
|
fwrite($fichier, "</rss>");
|
||||||
|
|
||||||
fclose($fichier);
|
fclose($fichier);
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_UMASK))
|
if (!empty($conf->global->MAIN_UMASK))
|
||||||
{
|
{
|
||||||
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
|
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -467,27 +468,27 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt
|
|||||||
*/
|
*/
|
||||||
function format_cal($format, $string)
|
function format_cal($format, $string)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$newstring = $string;
|
$newstring = $string;
|
||||||
|
|
||||||
if ($format === "vcal")
|
if ($format === "vcal")
|
||||||
{
|
{
|
||||||
$newstring = quotedPrintEncode($newstring);
|
$newstring = quotedPrintEncode($newstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($format === "ical")
|
if ($format === "ical")
|
||||||
{
|
{
|
||||||
// Replace new lines chars by "\n"
|
// Replace new lines chars by "\n"
|
||||||
$newstring = preg_replace("/"."\r\n"."/i", "\\n", $newstring);
|
$newstring = preg_replace("/"."\r\n"."/i", "\\n", $newstring);
|
||||||
$newstring = preg_replace("/"."\n\r"."/i", "\\n", $newstring);
|
$newstring = preg_replace("/"."\n\r"."/i", "\\n", $newstring);
|
||||||
$newstring = preg_replace("/"."\n"."/i", "\\n", $newstring);
|
$newstring = preg_replace("/"."\n"."/i", "\\n", $newstring);
|
||||||
|
|
||||||
// Must not exceed 75 char. Cut with "\r\n"+Space
|
// Must not exceed 75 char. Cut with "\r\n"+Space
|
||||||
$newstring = calEncode($newstring);
|
$newstring = calEncode($newstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $newstring;
|
return $newstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -499,56 +500,56 @@ function format_cal($format, $string)
|
|||||||
*/
|
*/
|
||||||
function calEncode($line)
|
function calEncode($line)
|
||||||
{
|
{
|
||||||
$out = "";
|
$out = "";
|
||||||
$newpara = "";
|
$newpara = "";
|
||||||
|
|
||||||
// If mb_ functions exists, it"s better to use them
|
// If mb_ functions exists, it"s better to use them
|
||||||
if (function_exists("mb_strlen"))
|
if (function_exists("mb_strlen"))
|
||||||
{
|
{
|
||||||
$strlength = mb_strlen($line, "UTF-8");
|
$strlength = mb_strlen($line, "UTF-8");
|
||||||
|
|
||||||
for ($j = 0; $j < $strlength; $j++)
|
for ($j = 0; $j < $strlength; $j++)
|
||||||
{
|
{
|
||||||
// Take char at position $j
|
// Take char at position $j
|
||||||
$char = mb_substr($line, $j, 1, "UTF-8");
|
$char = mb_substr($line, $j, 1, "UTF-8");
|
||||||
|
|
||||||
if ((mb_strlen($newpara, "UTF-8") + mb_strlen($char, "UTF-8")) >= 75)
|
if ((mb_strlen($newpara, "UTF-8") + mb_strlen($char, "UTF-8")) >= 75)
|
||||||
{
|
{
|
||||||
// CRLF + Space for cal
|
// CRLF + Space for cal
|
||||||
$out .= $newpara."\r\n ";
|
$out .= $newpara."\r\n ";
|
||||||
|
|
||||||
$newpara = "";
|
$newpara = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$newpara .= $char;
|
$newpara .= $char;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= $newpara;
|
$out .= $newpara;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$strlength = dol_strlen($line);
|
$strlength = dol_strlen($line);
|
||||||
|
|
||||||
for ($j = 0; $j < $strlength; $j++)
|
for ($j = 0; $j < $strlength; $j++)
|
||||||
{
|
{
|
||||||
// Take char at position $j
|
// Take char at position $j
|
||||||
$char = substr($line, $j, 1);
|
$char = substr($line, $j, 1);
|
||||||
|
|
||||||
if ((dol_strlen($newpara) + dol_strlen($char)) >= 75)
|
if ((dol_strlen($newpara) + dol_strlen($char)) >= 75)
|
||||||
{
|
{
|
||||||
// CRLF + Space for cal
|
// CRLF + Space for cal
|
||||||
$out .= $newpara."\r\n ";
|
$out .= $newpara."\r\n ";
|
||||||
|
|
||||||
$newpara = "";
|
$newpara = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$newpara .= $char;
|
$newpara .= $char;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= $newpara;
|
$out .= $newpara;
|
||||||
}
|
}
|
||||||
|
|
||||||
return trim($out);
|
return trim($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -561,45 +562,45 @@ function calEncode($line)
|
|||||||
*/
|
*/
|
||||||
function quotedPrintEncode($str, $forcal = 0)
|
function quotedPrintEncode($str, $forcal = 0)
|
||||||
{
|
{
|
||||||
$lines = preg_split("/\r\n/", $str);
|
$lines = preg_split("/\r\n/", $str);
|
||||||
$out = "";
|
$out = "";
|
||||||
|
|
||||||
foreach ($lines as $line)
|
foreach ($lines as $line)
|
||||||
{
|
{
|
||||||
$newpara = "";
|
$newpara = "";
|
||||||
|
|
||||||
// Do not use dol_strlen here, we need number of bytes
|
// Do not use dol_strlen here, we need number of bytes
|
||||||
$strlength = strlen($line);
|
$strlength = strlen($line);
|
||||||
|
|
||||||
for ($j = 0; $j < $strlength; $j++)
|
for ($j = 0; $j < $strlength; $j++)
|
||||||
{
|
{
|
||||||
$char = substr($line, $j, 1);
|
$char = substr($line, $j, 1);
|
||||||
$ascii = ord($char);
|
$ascii = ord($char);
|
||||||
|
|
||||||
if ($ascii < 32 || $ascii === 61 || $ascii > 126)
|
if ($ascii < 32 || $ascii === 61 || $ascii > 126)
|
||||||
{
|
{
|
||||||
$char = "=".strtoupper(sprintf("%02X", $ascii));
|
$char = "=".strtoupper(sprintf("%02X", $ascii));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not use dol_strlen here, we need number of bytes
|
// Do not use dol_strlen here, we need number of bytes
|
||||||
if ((strlen($newpara) + strlen($char)) >= 76)
|
if ((strlen($newpara) + strlen($char)) >= 76)
|
||||||
{
|
{
|
||||||
// New line with carray-return (CR) and line-feed (LF)
|
// New line with carray-return (CR) and line-feed (LF)
|
||||||
$out .= $newpara."="."\r\n";
|
$out .= $newpara."="."\r\n";
|
||||||
|
|
||||||
// extra space for cal
|
// extra space for cal
|
||||||
if ($forcal)
|
if ($forcal)
|
||||||
$out .= " ";
|
$out .= " ";
|
||||||
|
|
||||||
$newpara = "";
|
$newpara = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$newpara .= $char;
|
$newpara .= $char;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= $newpara;
|
$out .= $newpara;
|
||||||
}
|
}
|
||||||
return trim($out);
|
return trim($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -610,5 +611,5 @@ function quotedPrintEncode($str, $forcal = 0)
|
|||||||
*/
|
*/
|
||||||
function quotedPrintDecode($str)
|
function quotedPrintDecode($str)
|
||||||
{
|
{
|
||||||
return trim(quoted_printable_decode(preg_replace("/=\r?\n/", "", $str)));
|
return trim(quoted_printable_decode(preg_replace("/=\r?\n/", "", $str)));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -364,14 +364,14 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
// If a certificate is found
|
// If a certificate is found
|
||||||
if ($cert) {
|
if ($cert) {
|
||||||
$info = array(
|
$info = array(
|
||||||
'Name' => $this->emetteur->name,
|
'Name' => $this->emetteur->name,
|
||||||
'Location' => getCountry($this->emetteur->country_code, 0),
|
'Location' => getCountry($this->emetteur->country_code, 0),
|
||||||
'Reason' => 'INVOICE',
|
'Reason' => 'INVOICE',
|
||||||
'ContactInfo' => $this->emetteur->email
|
'ContactInfo' => $this->emetteur->email
|
||||||
);
|
);
|
||||||
$pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info);
|
$pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||||
|
|
||||||
// Set $this->atleastonediscount if you have at least one discount
|
// Set $this->atleastonediscount if you have at least one discount
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -128,14 +128,14 @@ class modSociete extends DolibarrModules
|
|||||||
$r++;
|
$r++;
|
||||||
$this->boxes[$r][1] = "box_prospect.php";
|
$this->boxes[$r][1] = "box_prospect.php";
|
||||||
$r++;
|
$r++;
|
||||||
$this->boxes[$r][1] = "box_contacts.php";
|
$this->boxes[$r][1] = "box_contacts.php";
|
||||||
$r++;
|
$r++;
|
||||||
$this->boxes[$r][1] = "box_activity.php";
|
$this->boxes[$r][1] = "box_activity.php";
|
||||||
$this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)';
|
$this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)';
|
||||||
$r++;
|
$r++;
|
||||||
$this->boxes[$r][1] = "box_goodcustomers.php";
|
$this->boxes[$r][1] = "box_goodcustomers.php";
|
||||||
$this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)';
|
$this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)';
|
||||||
$r++;
|
$r++;
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->rights = array();
|
$this->rights = array();
|
||||||
$this->rights_class = 'societe';
|
$this->rights_class = 'societe';
|
||||||
@ -148,7 +148,7 @@ class modSociete extends DolibarrModules
|
|||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
$this->rights[$r][4] = 'lire';
|
$this->rights[$r][4] = 'lire';
|
||||||
|
|
||||||
/*$r++;
|
/*$r++;
|
||||||
$this->rights[$r][0] = 241;
|
$this->rights[$r][0] = 241;
|
||||||
$this->rights[$r][1] = 'Read thirdparties customers';
|
$this->rights[$r][1] = 'Read thirdparties customers';
|
||||||
$this->rights[$r][2] = 'r';
|
$this->rights[$r][2] = 'r';
|
||||||
@ -172,7 +172,7 @@ class modSociete extends DolibarrModules
|
|||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
$this->rights[$r][4] = 'creer';
|
$this->rights[$r][4] = 'creer';
|
||||||
|
|
||||||
/* $r++;
|
/* $r++;
|
||||||
$this->rights[$r][0] = 251;
|
$this->rights[$r][0] = 251;
|
||||||
$this->rights[$r][1] = 'Create thirdparties customers';
|
$this->rights[$r][1] = 'Create thirdparties customers';
|
||||||
$this->rights[$r][2] = 'r';
|
$this->rights[$r][2] = 'r';
|
||||||
@ -274,8 +274,8 @@ class modSociete extends DolibarrModules
|
|||||||
// Add multicompany field
|
// Add multicompany field
|
||||||
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED))
|
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED))
|
||||||
{
|
{
|
||||||
$nbofallowedentities = count(explode(',', getEntity('societe'))); // If project are shared, nb will be > 1
|
$nbofallowedentities = count(explode(',', getEntity('societe'))); // If project are shared, nb will be > 1
|
||||||
if (!empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r] += array('s.entity'=>'Entity');
|
if (!empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r] += array('s.entity'=>'Entity');
|
||||||
}
|
}
|
||||||
$keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra';
|
$keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||||
@ -304,7 +304,7 @@ class modSociete extends DolibarrModules
|
|||||||
$this->export_examplevalues_array[$r] = array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)', 's.fournisseur'=>'0 (not a supplier) or 1 (supplier)');
|
$this->export_examplevalues_array[$r] = array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)', 's.fournisseur'=>'0 (not a supplier) or 1 (supplier)');
|
||||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id';
|
||||||
@ -338,38 +338,38 @@ class modSociete extends DolibarrModules
|
|||||||
's.rowid'=>"IdCompany", 's.nom'=>"CompanyName", 's.status'=>"Status", 's.code_client'=>"CustomerCode", 's.code_fournisseur'=>"SupplierCode",
|
's.rowid'=>"IdCompany", 's.nom'=>"CompanyName", 's.status'=>"Status", 's.code_client'=>"CustomerCode", 's.code_fournisseur'=>"SupplierCode",
|
||||||
's.code_compta'=>"AccountancyCode", 's.code_compta_fournisseur'=>"SupplierAccountancyCode",
|
's.code_compta'=>"AccountancyCode", 's.code_compta_fournisseur'=>"SupplierAccountancyCode",
|
||||||
's.client'=>'Customer', 's.fournisseur'=>'Supplier',
|
's.client'=>'Customer', 's.fournisseur'=>'Supplier',
|
||||||
's.address'=>'Address', 's.zip'=>"Zip", 's.town'=>"Town", 's.phone'=>'Phone', 's.email'=>"Email",
|
's.address'=>'Address', 's.zip'=>"Zip", 's.town'=>"Town", 's.phone'=>'Phone', 's.email'=>"Email",
|
||||||
't.libelle'=>"ThirdPartyType"
|
't.libelle'=>"ThirdPartyType"
|
||||||
);
|
);
|
||||||
$this->export_examplevalues_array[$r] = array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)', 's.fournisseur'=>'0 (not a supplier) or 1 (supplier)');
|
$this->export_examplevalues_array[$r] = array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)', 's.fournisseur'=>'0 (not a supplier) or 1 (supplier)');
|
||||||
$this->export_TypeFields_array[$r] = array(
|
$this->export_TypeFields_array[$r] = array(
|
||||||
'c.civility'=>"List:c_civility:label:code", 'c.lastname'=>'Text', 'c.firstname'=>'Text', 'c.poste'=>'Text', 'c.datec'=>"Date", 'c.priv'=>"Boolean",
|
'c.civility'=>"List:c_civility:label:code", 'c.lastname'=>'Text', 'c.firstname'=>'Text', 'c.poste'=>'Text', 'c.datec'=>"Date", 'c.priv'=>"Boolean",
|
||||||
'c.address'=>"Text", 'c.zip'=>"Text", 'c.town'=>"Text", 'd.nom'=>'Text', 'co.label'=>"List:c_country:label:rowid", 'co.code'=>"Text", 'c.phone'=>"Text",
|
'c.address'=>"Text", 'c.zip'=>"Text", 'c.town'=>"Text", 'd.nom'=>'Text', 'co.label'=>"List:c_country:label:rowid", 'co.code'=>"Text", 'c.phone'=>"Text",
|
||||||
'c.fax'=>"Text", 'c.email'=>"Text",
|
'c.fax'=>"Text", 'c.email'=>"Text",
|
||||||
'c.statut'=>"Status",
|
'c.statut'=>"Status",
|
||||||
's.rowid'=>"List:societe:nom::thirdparty", 's.nom'=>"Text", 's.status'=>"Status", 's.code_client'=>"Text", 's.code_fournisseur'=>"Text",
|
's.rowid'=>"List:societe:nom::thirdparty", 's.nom'=>"Text", 's.status'=>"Status", 's.code_client'=>"Text", 's.code_fournisseur'=>"Text",
|
||||||
's.code_compta'=>"Text", 's.code_compta_fournisseur'=>"Text",
|
's.code_compta'=>"Text", 's.code_compta_fournisseur'=>"Text",
|
||||||
's.client'=>"Text", 's.fournisseur'=>"Text",
|
's.client'=>"Text", 's.fournisseur'=>"Text",
|
||||||
's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 's.phone'=>"Text", 's.email'=>"Text",
|
's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 's.phone'=>"Text", 's.email'=>"Text",
|
||||||
't.libelle'=>"Text"
|
't.libelle'=>"Text"
|
||||||
);
|
);
|
||||||
$this->export_entities_array[$r] = array(
|
$this->export_entities_array[$r] = array(
|
||||||
's.rowid'=>"company", 's.nom'=>"company", 's.status'=>'company', 's.code_client'=>"company", 's.code_fournisseur'=>"company",
|
's.rowid'=>"company", 's.nom'=>"company", 's.status'=>'company', 's.code_client'=>"company", 's.code_fournisseur'=>"company",
|
||||||
's.code_compta'=>"company", 's.code_compta_fournisseur'=>"company",
|
's.code_compta'=>"company", 's.code_compta_fournisseur'=>"company",
|
||||||
's.client'=>"company", 's.fournisseur'=>"company",
|
's.client'=>"company", 's.fournisseur'=>"company",
|
||||||
's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 's.phone'=>"company", 's.email'=>"company",
|
's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 's.phone'=>"company", 's.email'=>"company",
|
||||||
't.libelle'=>"company"
|
't.libelle'=>"company"
|
||||||
); // We define here only fields that use another picto
|
); // We define here only fields that use another picto
|
||||||
if (empty($conf->fournisseur->enabled))
|
if (empty($conf->fournisseur->enabled))
|
||||||
{
|
{
|
||||||
unset($this->export_fields_array[$r]['s.code_fournisseur']);
|
unset($this->export_fields_array[$r]['s.code_fournisseur']);
|
||||||
unset($this->export_entities_array[$r]['s.code_fournisseur']);
|
unset($this->export_entities_array[$r]['s.code_fournisseur']);
|
||||||
}
|
}
|
||||||
$keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra';
|
$keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||||
$keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extrasoc';
|
$keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extrasoc';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'socpeople as c';
|
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'socpeople as c';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON c.fk_soc = s.rowid';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON c.fk_soc = s.rowid';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extrasoc ON s.rowid = extrasoc.fk_object';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extrasoc ON s.rowid = extrasoc.fk_object';
|
||||||
@ -377,7 +377,7 @@ class modSociete extends DolibarrModules
|
|||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON c.fk_departement = d.rowid';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON c.fk_departement = d.rowid';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id';
|
||||||
$this->export_sql_end[$r] .= ' WHERE c.entity IN ('.getEntity('socpeople').')';
|
$this->export_sql_end[$r] .= ' WHERE c.entity IN ('.getEntity('socpeople').')';
|
||||||
if (is_object($user) && empty($user->rights->societe->client->voir)) {
|
if (is_object($user) && empty($user->rights->societe->client->voir)) {
|
||||||
$this->export_sql_end[$r] .= ' AND (sc.fk_user = '.$user->id.' ';
|
$this->export_sql_end[$r] .= ' AND (sc.fk_user = '.$user->id.' ';
|
||||||
@ -389,337 +389,338 @@ class modSociete extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Imports
|
// Imports
|
||||||
//--------
|
//--------
|
||||||
$r = 0;
|
$r = 0;
|
||||||
|
|
||||||
// Import list of third parties and attributes
|
// Import list of third parties and attributes
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||||
$this->import_label[$r] = 'ImportDataset_company_1';
|
$this->import_label[$r] = 'ImportDataset_company_1';
|
||||||
$this->import_icon[$r] = 'company';
|
$this->import_icon[$r] = 'company';
|
||||||
$this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon
|
$this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon
|
||||||
$this->import_tables_array[$r] = array(
|
$this->import_tables_array[$r] = array(
|
||||||
's' => MAIN_DB_PREFIX.'societe',
|
's' => MAIN_DB_PREFIX.'societe',
|
||||||
'extra' => MAIN_DB_PREFIX.'societe_extrafields'
|
'extra' => MAIN_DB_PREFIX.'societe_extrafields'
|
||||||
); // List of tables to insert into (insert done in same order)
|
); // List of tables to insert into (insert done in same order)
|
||||||
$this->import_fields_array[$r] = array(//field order as per structure of table llx_societe
|
$this->import_fields_array[$r] = array(//field order as per structure of table llx_societe
|
||||||
's.nom' => "Name*",
|
's.nom' => "Name*",
|
||||||
's.name_alias' => "AliasNameShort",
|
's.name_alias' => "AliasNameShort",
|
||||||
's.status' => "Status",
|
's.status' => "Status",
|
||||||
's.code_client' => "CustomerCode",
|
's.code_client' => "CustomerCode",
|
||||||
's.code_fournisseur' => "SupplierCode",
|
's.code_fournisseur' => "SupplierCode",
|
||||||
's.code_compta' => "CustomerAccountancyCode",
|
's.code_compta' => "CustomerAccountancyCode",
|
||||||
's.code_compta_fournisseur' => "SupplierAccountancyCode",
|
's.code_compta_fournisseur' => "SupplierAccountancyCode",
|
||||||
's.address' => "Address",
|
's.address' => "Address",
|
||||||
's.zip' => "Zip",
|
's.zip' => "Zip",
|
||||||
's.town' => "Town",
|
's.town' => "Town",
|
||||||
's.fk_departement' => "StateCode",
|
's.fk_departement' => "StateCode",
|
||||||
's.fk_pays' => "CountryCode",
|
's.fk_pays' => "CountryCode",
|
||||||
's.phone' => "Phone",
|
's.phone' => "Phone",
|
||||||
's.fax' => "Fax",
|
's.fax' => "Fax",
|
||||||
's.url' => "Url",
|
's.url' => "Url",
|
||||||
's.email' => "Email",
|
's.email' => "Email",
|
||||||
's.skype' => "Skype",
|
's.skype' => "Skype",
|
||||||
's.fk_effectif' => "Staff",
|
's.fk_effectif' => "Staff",
|
||||||
's.fk_typent' => "ThirdPartyType",
|
's.fk_typent' => "ThirdPartyType",
|
||||||
"s.fk_forme_juridique" => "JuridicalStatus",
|
"s.fk_forme_juridique" => "JuridicalStatus",
|
||||||
's.siren' => "ProfId1",
|
's.siren' => "ProfId1",
|
||||||
's.siret' => "ProfId2",
|
's.siret' => "ProfId2",
|
||||||
's.ape' => "ProfId3",
|
's.ape' => "ProfId3",
|
||||||
's.idprof4' => "ProfId4",
|
's.idprof4' => "ProfId4",
|
||||||
's.idprof5' => "ProfId5",
|
's.idprof5' => "ProfId5",
|
||||||
's.idprof6' => "ProfId6",
|
's.idprof6' => "ProfId6",
|
||||||
's.tva_intra' => "VATIntraShort",
|
's.tva_intra' => "VATIntraShort",
|
||||||
's.capital' => "Capital",
|
's.capital' => "Capital",
|
||||||
's.fk_stcomm' => 'ProspectStatus',
|
's.fk_stcomm' => 'ProspectStatus',
|
||||||
's.note_private' => "NotePrivate",
|
's.note_private' => "NotePrivate",
|
||||||
's.note_public' => "NotePublic",
|
's.note_public' => "NotePublic",
|
||||||
's.client' => "Customer*",
|
's.client' => "Customer*",
|
||||||
's.fournisseur' => "Supplier*",
|
's.fournisseur' => "Supplier*",
|
||||||
's.fk_prospectlevel' => 'ProspectLevel',
|
's.fk_prospectlevel' => 'ProspectLevel',
|
||||||
's.mode_reglement' => 'PaymentTypeCustomer',
|
's.mode_reglement' => 'PaymentTypeCustomer',
|
||||||
's.cond_reglement' => "PaymentTermsCustomer",
|
's.cond_reglement' => "PaymentTermsCustomer",
|
||||||
's.mode_reglement_supplier' => 'PaymentTypeSupplier',
|
's.mode_reglement_supplier' => 'PaymentTypeSupplier',
|
||||||
's.cond_reglement_supplier' => "PaymentTermsSupplier",
|
's.cond_reglement_supplier' => "PaymentTermsSupplier",
|
||||||
's.tva_assuj' => 'VATIsUsed',
|
's.tva_assuj' => 'VATIsUsed',
|
||||||
's.barcode' => 'BarCode',
|
's.barcode' => 'BarCode',
|
||||||
's.default_lang' => 'DefaultLanguage',
|
's.default_lang' => 'DefaultLanguage',
|
||||||
's.canvas' => "Canvas",
|
's.canvas' => "Canvas",
|
||||||
's.datec' => "DateCreation",
|
's.datec' => "DateCreation",
|
||||||
's.fk_multicurrency' => 'MulticurrencyUsed',
|
's.fk_multicurrency' => 'MulticurrencyUsed',
|
||||||
's.multicurrency_code' => 'MulticurrencyCurrency'
|
's.multicurrency_code' => 'MulticurrencyCurrency'
|
||||||
);
|
);
|
||||||
// Add extra fields
|
if (! empty($conf->global->PRODUIT_MULTIPRICES)) $this->import_fields_array[$r]['s.price_level']='PriceLevel';
|
||||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
// Add extra fields
|
||||||
$resql = $this->db->query($sql);
|
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
||||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
$resql = $this->db->query($sql);
|
||||||
{
|
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||||
while ($obj = $this->db->fetch_object($resql)) {
|
{
|
||||||
$fieldname = 'extra.'.$obj->name;
|
while ($obj = $this->db->fetch_object($resql)) {
|
||||||
$fieldlabel = ucfirst($obj->label);
|
$fieldname = 'extra.'.$obj->name;
|
||||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
$fieldlabel = ucfirst($obj->label);
|
||||||
}
|
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||||
}
|
}
|
||||||
// End add extra fields
|
}
|
||||||
$this->import_fieldshidden_array[$r] = array(
|
// End add extra fields
|
||||||
's.fk_user_creat' => 'user->id',
|
$this->import_fieldshidden_array[$r] = array(
|
||||||
'extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'societe'
|
's.fk_user_creat' => 'user->id',
|
||||||
); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
'extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'societe'
|
||||||
$this->import_convertvalue_array[$r] = array(//field order as per structure of table llx_societe
|
); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||||
's.code_client' => array('rule' => 'getcustomercodeifauto'),
|
$this->import_convertvalue_array[$r] = array(//field order as per structure of table llx_societe
|
||||||
's.code_fournisseur' => array('rule' => 'getsuppliercodeifauto'),
|
's.code_client' => array('rule' => 'getcustomercodeifauto'),
|
||||||
's.code_compta' => array('rule' => 'getcustomeraccountancycodeifauto'),
|
's.code_fournisseur' => array('rule' => 'getsuppliercodeifauto'),
|
||||||
's.code_compta_fournisseur' => array('rule' => 'getsupplieraccountancycodeifauto'),
|
's.code_compta' => array('rule' => 'getcustomeraccountancycodeifauto'),
|
||||||
's.fk_departement' => array(
|
's.code_compta_fournisseur' => array('rule' => 'getsupplieraccountancycodeifauto'),
|
||||||
'rule' => 'fetchidfromcodeid',
|
's.fk_departement' => array(
|
||||||
'classfile' => '/core/class/cstate.class.php',
|
'rule' => 'fetchidfromcodeid',
|
||||||
'class' => 'Cstate',
|
'classfile' => '/core/class/cstate.class.php',
|
||||||
'method' => 'fetch',
|
'class' => 'Cstate',
|
||||||
'dict' => 'DictionaryState'
|
'method' => 'fetch',
|
||||||
),
|
'dict' => 'DictionaryState'
|
||||||
's.fk_pays' => array(
|
),
|
||||||
'rule' => 'fetchidfromcodeid',
|
's.fk_pays' => array(
|
||||||
'classfile' => '/core/class/ccountry.class.php',
|
'rule' => 'fetchidfromcodeid',
|
||||||
'class' => 'Ccountry',
|
'classfile' => '/core/class/ccountry.class.php',
|
||||||
'method' => 'fetch',
|
'class' => 'Ccountry',
|
||||||
'dict' => 'DictionaryCountry'
|
'method' => 'fetch',
|
||||||
),
|
'dict' => 'DictionaryCountry'
|
||||||
's.fk_typent' => array(
|
),
|
||||||
'rule' => 'fetchidfromcodeorlabel',
|
's.fk_typent' => array(
|
||||||
'classfile' => '/core/class/ctypent.class.php',
|
'rule' => 'fetchidfromcodeorlabel',
|
||||||
'class' => 'Ctypent',
|
'classfile' => '/core/class/ctypent.class.php',
|
||||||
'method' => 'fetch',
|
'class' => 'Ctypent',
|
||||||
'dict' => 'DictionaryCompanyType'
|
'method' => 'fetch',
|
||||||
),
|
'dict' => 'DictionaryCompanyType'
|
||||||
's.capital' => array('rule' => 'numeric'),
|
),
|
||||||
's.fk_stcomm' => array('rule' => 'zeroifnull'),
|
's.capital' => array('rule' => 'numeric'),
|
||||||
);
|
's.fk_stcomm' => array('rule' => 'zeroifnull'),
|
||||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
);
|
||||||
$this->import_regex_array[$r] = array(//field order as per structure of table llx_societe
|
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||||
's.status' => '^[0|1]',
|
$this->import_regex_array[$r] = array(//field order as per structure of table llx_societe
|
||||||
's.fk_typent' => 'id@'.MAIN_DB_PREFIX.'c_typent',
|
's.status' => '^[0|1]',
|
||||||
's.client' => '^[0|1|2|3]',
|
's.fk_typent' => 'id@'.MAIN_DB_PREFIX.'c_typent',
|
||||||
's.fournisseur' => '^[0|1]',
|
's.client' => '^[0|1|2|3]',
|
||||||
's.mode_reglement' => 'id@'.MAIN_DB_PREFIX.'c_paiement',
|
's.fournisseur' => '^[0|1]',
|
||||||
's.cond_reglement' => 'rowid@'.MAIN_DB_PREFIX.'c_payment_term',
|
's.mode_reglement' => 'id@'.MAIN_DB_PREFIX.'c_paiement',
|
||||||
's.mode_reglement_supplier' => 'id@'.MAIN_DB_PREFIX.'c_paiement',
|
's.cond_reglement' => 'rowid@'.MAIN_DB_PREFIX.'c_payment_term',
|
||||||
's.cond_reglement_supplier' => 'rowid@'.MAIN_DB_PREFIX.'c_payment_term',
|
's.mode_reglement_supplier' => 'id@'.MAIN_DB_PREFIX.'c_paiement',
|
||||||
's.tva_assuj' => '^[0|1]',
|
's.cond_reglement_supplier' => 'rowid@'.MAIN_DB_PREFIX.'c_payment_term',
|
||||||
's.fk_multicurrency' => '^[0|1]',
|
's.tva_assuj' => '^[0|1]',
|
||||||
's.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$',
|
's.fk_multicurrency' => '^[0|1]',
|
||||||
's.multicurrency_code' => 'code_iso@'.MAIN_DB_PREFIX.'c_currencies'
|
's.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$',
|
||||||
);
|
's.multicurrency_code' => 'code_iso@'.MAIN_DB_PREFIX.'c_currencies'
|
||||||
|
);
|
||||||
|
|
||||||
$this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_societe
|
$this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_societe
|
||||||
's.nom' => "TPBigCompany",
|
's.nom' => "TPBigCompany",
|
||||||
's.name_alias' => "Alias for TPBigCompany",
|
's.name_alias' => "Alias for TPBigCompany",
|
||||||
's.status' => "0 (closed) / 1 (active)",
|
's.status' => "0 (closed) / 1 (active)",
|
||||||
's.code_client' => 'eg. CU01-0001 / empty / "auto"',
|
's.code_client' => 'eg. CU01-0001 / empty / "auto"',
|
||||||
's.code_fournisseur' => 'eg. SU01-0001 / empty / "auto"',
|
's.code_fournisseur' => 'eg. SU01-0001 / empty / "auto"',
|
||||||
's.code_compta' => "Code or empty to be auto-created",
|
's.code_compta' => "Code or empty to be auto-created",
|
||||||
's.code_compta_fournisseur' => "Code or empty to be auto-created",
|
's.code_compta_fournisseur' => "Code or empty to be auto-created",
|
||||||
's.address' => "61 Jump Street",
|
's.address' => "61 Jump Street",
|
||||||
's.zip' => "123456",
|
's.zip' => "123456",
|
||||||
's.town' => "Bigtown",
|
's.town' => "Bigtown",
|
||||||
's.fk_departement' => 'matches field "code_departement" in table "'.MAIN_DB_PREFIX.'c_departements"',
|
's.fk_departement' => 'matches field "code_departement" in table "'.MAIN_DB_PREFIX.'c_departements"',
|
||||||
's.fk_pays' => 'US/FR/DE etc. matches field "code" in table "'.MAIN_DB_PREFIX.'c_country"',
|
's.fk_pays' => 'US/FR/DE etc. matches field "code" in table "'.MAIN_DB_PREFIX.'c_country"',
|
||||||
's.phone' => "eg: +34123456789",
|
's.phone' => "eg: +34123456789",
|
||||||
's.fax' => "eg. +34987654321",
|
's.fax' => "eg. +34987654321",
|
||||||
's.url' => "e.g. https://www.mybigcompany.com",
|
's.url' => "e.g. https://www.mybigcompany.com",
|
||||||
's.email' => "e.g. test@mybigcompany.com",
|
's.email' => "e.g. test@mybigcompany.com",
|
||||||
's.skype' => "Skype name",
|
's.skype' => "Skype name",
|
||||||
's.fk_effectif' => "1/2/3/5: represents one of the five ranges of employees",
|
's.fk_effectif' => "1/2/3/5: represents one of the five ranges of employees",
|
||||||
's.fk_typent' => 'matches field "id" (1-9 etc.) OR "code" (TE_SMALL etc.) in table "'.MAIN_DB_PREFIX.'c_typent"',
|
's.fk_typent' => 'matches field "id" (1-9 etc.) OR "code" (TE_SMALL etc.) in table "'.MAIN_DB_PREFIX.'c_typent"',
|
||||||
's.fk_forme_juridique' => '1/2/3 etc...matches field "code" in table "'.MAIN_DB_PREFIX.'c_forme_juridique"',
|
's.fk_forme_juridique' => '1/2/3 etc...matches field "code" in table "'.MAIN_DB_PREFIX.'c_forme_juridique"',
|
||||||
's.siret' => "",
|
's.siret' => "",
|
||||||
's.siren' => "",
|
's.siren' => "",
|
||||||
's.ape' => "",
|
's.ape' => "",
|
||||||
's.idprof4' => "",
|
's.idprof4' => "",
|
||||||
's.idprof5' => "",
|
's.idprof5' => "",
|
||||||
's.idprof6' => "",
|
's.idprof6' => "",
|
||||||
's.tva_intra' => 'VAT number e.g."FR0123456789"',
|
's.tva_intra' => 'VAT number e.g."FR0123456789"',
|
||||||
's.capital' => "10000",
|
's.capital' => "10000",
|
||||||
's.fk_stcomm' => '-1/0/1/2 etc... matches field "id" in table "'.MAIN_DB_PREFIX.'c_stcomm"',
|
's.fk_stcomm' => '-1/0/1/2 etc... matches field "id" in table "'.MAIN_DB_PREFIX.'c_stcomm"',
|
||||||
's.note_private' => "Example of a PRIVATE note.",
|
's.note_private' => "Example of a PRIVATE note.",
|
||||||
's.note_public' => "Example of a PUBLIC note.",
|
's.note_public' => "Example of a PUBLIC note.",
|
||||||
's.client' => '0 (no customer no prospect) / 1 (customer) / 2 (prospect)/ 3 (customer and prospect)',
|
's.client' => '0 (no customer no prospect) / 1 (customer) / 2 (prospect)/ 3 (customer and prospect)',
|
||||||
's.fournisseur' => '0 (not supplier) / 1 (supplier)',
|
's.fournisseur' => '0 (not supplier) / 1 (supplier)',
|
||||||
's.fk_prospectlevel' => 'eg. "PL_MEDIUM" matches field "code" in table "'.MAIN_DB_PREFIX.'c_prospectlevel"',
|
's.fk_prospectlevel' => 'eg. "PL_MEDIUM" matches field "code" in table "'.MAIN_DB_PREFIX.'c_prospectlevel"',
|
||||||
's.mode_reglement' => '1/2/3...matches field "id" in table "'.MAIN_DB_PREFIX.'c_paiement"',
|
's.mode_reglement' => '1/2/3...matches field "id" in table "'.MAIN_DB_PREFIX.'c_paiement"',
|
||||||
's.cond_reglement' => '1/2/3...matches field "rowid" in table "'.MAIN_DB_PREFIX.'c_payment_term"',
|
's.cond_reglement' => '1/2/3...matches field "rowid" in table "'.MAIN_DB_PREFIX.'c_payment_term"',
|
||||||
's.mode_reglement_supplier' => '1/2/3...matches field "id" in table "'.MAIN_DB_PREFIX.'c_paiement"',
|
's.mode_reglement_supplier' => '1/2/3...matches field "id" in table "'.MAIN_DB_PREFIX.'c_paiement"',
|
||||||
's.cond_reglement_supplier' => '1/2/3...matches field "rowid" in table "'.MAIN_DB_PREFIX.'c_payment_term"',
|
's.cond_reglement_supplier' => '1/2/3...matches field "rowid" in table "'.MAIN_DB_PREFIX.'c_payment_term"',
|
||||||
's.tva_assuj' => '0 (VAT not used) / 1 (VAT used)',
|
's.tva_assuj' => '0 (VAT not used) / 1 (VAT used)',
|
||||||
's.barcode' => '123456789',
|
's.barcode' => '123456789',
|
||||||
's.default_lang' => 'en_US / es_ES etc...matches a language directory in htdocs/langs/',
|
's.default_lang' => 'en_US / es_ES etc...matches a language directory in htdocs/langs/',
|
||||||
's.canvas' => "empty / a custom canvas form layout url e.g. mycanvas@mymodule",
|
's.canvas' => "empty / a custom canvas form layout url e.g. mycanvas@mymodule",
|
||||||
's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'),
|
's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'),
|
||||||
's.fk_multicurrency' => '0 (use system default currency) / 1 (use local currency)',
|
's.fk_multicurrency' => '0 (use system default currency) / 1 (use local currency)',
|
||||||
's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"'
|
's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"'
|
||||||
);
|
);
|
||||||
$this->import_updatekeys_array[$r] = array(
|
$this->import_updatekeys_array[$r] = array(
|
||||||
's.nom' => 'Name',
|
's.nom' => 'Name',
|
||||||
's.code_client' => 'CustomerCode',
|
's.code_client' => 'CustomerCode',
|
||||||
's.code_fournisseur' => 'SupplierCode',
|
's.code_fournisseur' => 'SupplierCode',
|
||||||
's.code_compta' => 'CustomerAccountancyCode',
|
's.code_compta' => 'CustomerAccountancyCode',
|
||||||
's.code_compta_fournisseur' => 'SupplierAccountancyCode'
|
's.code_compta_fournisseur' => 'SupplierAccountancyCode'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Import list of contacts/additional addresses and attributes
|
// Import list of contacts/additional addresses and attributes
|
||||||
$r++;
|
$r++;
|
||||||
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||||
$this->import_label[$r] = 'ImportDataset_company_2';
|
$this->import_label[$r] = 'ImportDataset_company_2';
|
||||||
$this->import_icon[$r] = 'contact';
|
$this->import_icon[$r] = 'contact';
|
||||||
$this->import_entities_array[$r] = array('s.fk_soc' => 'company'); // We define here only fields that use a different icon than the one defined in import_icon
|
$this->import_entities_array[$r] = array('s.fk_soc' => 'company'); // We define here only fields that use a different icon than the one defined in import_icon
|
||||||
$this->import_tables_array[$r] = array(
|
$this->import_tables_array[$r] = array(
|
||||||
's' => MAIN_DB_PREFIX.'socpeople',
|
's' => MAIN_DB_PREFIX.'socpeople',
|
||||||
'extra' => MAIN_DB_PREFIX.'socpeople_extrafields'
|
'extra' => MAIN_DB_PREFIX.'socpeople_extrafields'
|
||||||
); // List of tables to insert into (insert done in same order)
|
); // List of tables to insert into (insert done in same order)
|
||||||
$this->import_fields_array[$r] = array(//field order as per structure of table llx_socpeople
|
$this->import_fields_array[$r] = array(//field order as per structure of table llx_socpeople
|
||||||
's.datec' => "DateCreation",
|
's.datec' => "DateCreation",
|
||||||
's.fk_soc' => 'ThirdPartyName',
|
's.fk_soc' => 'ThirdPartyName',
|
||||||
's.civility' => 'UserTitle',
|
's.civility' => 'UserTitle',
|
||||||
's.lastname' => "Lastname*",
|
's.lastname' => "Lastname*",
|
||||||
's.firstname' => "Firstname",
|
's.firstname' => "Firstname",
|
||||||
's.address' => "Address",
|
's.address' => "Address",
|
||||||
's.zip' => "Zip",
|
's.zip' => "Zip",
|
||||||
's.town' => "Town",
|
's.town' => "Town",
|
||||||
's.fk_departement' => "StateCode",
|
's.fk_departement' => "StateCode",
|
||||||
's.fk_pays' => "CountryCode",
|
's.fk_pays' => "CountryCode",
|
||||||
's.birthday' => "BirthdayDate",
|
's.birthday' => "BirthdayDate",
|
||||||
's.poste' => "Role",
|
's.poste' => "Role",
|
||||||
's.phone' => "Phone",
|
's.phone' => "Phone",
|
||||||
's.phone_perso' => "PhonePerso",
|
's.phone_perso' => "PhonePerso",
|
||||||
's.phone_mobile' => "PhoneMobile",
|
's.phone_mobile' => "PhoneMobile",
|
||||||
's.fax' => "Fax",
|
's.fax' => "Fax",
|
||||||
's.email' => "Email",
|
's.email' => "Email",
|
||||||
's.skype' => "Skype",
|
's.skype' => "Skype",
|
||||||
's.note_private' => "NotePrivate",
|
's.note_private' => "NotePrivate",
|
||||||
's.note_public' => "NotePublic"
|
's.note_public' => "NotePublic"
|
||||||
);
|
);
|
||||||
// Add extra fields
|
// Add extra fields
|
||||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
|
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) // This can fail when class is used on an old database (during a migration for example)
|
if ($resql) // This can fail when class is used on an old database (during a migration for example)
|
||||||
{
|
{
|
||||||
while ($obj = $this->db->fetch_object($resql)) {
|
while ($obj = $this->db->fetch_object($resql)) {
|
||||||
$fieldname = 'extra.'.$obj->name;
|
$fieldname = 'extra.'.$obj->name;
|
||||||
$fieldlabel = ucfirst($obj->label);
|
$fieldlabel = ucfirst($obj->label);
|
||||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// End add extra fields
|
// End add extra fields
|
||||||
$this->import_fieldshidden_array[$r] = array(
|
$this->import_fieldshidden_array[$r] = array(
|
||||||
's.fk_user_creat' => 'user->id',
|
's.fk_user_creat' => 'user->id',
|
||||||
'extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'socpeople'
|
'extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'socpeople'
|
||||||
); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||||
$this->import_convertvalue_array[$r] = array(
|
$this->import_convertvalue_array[$r] = array(
|
||||||
's.fk_soc' => array(
|
's.fk_soc' => array(
|
||||||
'rule' => 'fetchidfromref',
|
'rule' => 'fetchidfromref',
|
||||||
'file' => '/societe/class/societe.class.php',
|
'file' => '/societe/class/societe.class.php',
|
||||||
'class' => 'Societe',
|
'class' => 'Societe',
|
||||||
'method' => 'fetch',
|
'method' => 'fetch',
|
||||||
'element' => 'ThirdParty'
|
'element' => 'ThirdParty'
|
||||||
),
|
),
|
||||||
's.fk_departement' => array(
|
's.fk_departement' => array(
|
||||||
'rule' => 'fetchidfromcodeid',
|
'rule' => 'fetchidfromcodeid',
|
||||||
'classfile' => '/core/class/cstate.class.php',
|
'classfile' => '/core/class/cstate.class.php',
|
||||||
'class' => 'Cstate',
|
'class' => 'Cstate',
|
||||||
'method' => 'fetch',
|
'method' => 'fetch',
|
||||||
'dict' => 'DictionaryState'
|
'dict' => 'DictionaryState'
|
||||||
),
|
),
|
||||||
's.fk_pays' => array(
|
's.fk_pays' => array(
|
||||||
'rule' => 'fetchidfromcodeid',
|
'rule' => 'fetchidfromcodeid',
|
||||||
'classfile' => '/core/class/ccountry.class.php',
|
'classfile' => '/core/class/ccountry.class.php',
|
||||||
'class' => 'Ccountry',
|
'class' => 'Ccountry',
|
||||||
'method' => 'fetch',
|
'method' => 'fetch',
|
||||||
'dict' => 'DictionaryCountry'
|
'dict' => 'DictionaryCountry'
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||||
$this->import_regex_array[$r] = array(
|
$this->import_regex_array[$r] = array(
|
||||||
's.birthday' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
|
's.birthday' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
|
||||||
's.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'
|
's.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'
|
||||||
);
|
);
|
||||||
$this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_socpeople
|
$this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_socpeople
|
||||||
's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'),
|
's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'),
|
||||||
's.fk_soc' => 'Third Party name eg. TPBigCompany',
|
's.fk_soc' => 'Third Party name eg. TPBigCompany',
|
||||||
's.civility' => 'Title of civility eg: MR...matches field "code" in table "'.MAIN_DB_PREFIX.'c_civility"',
|
's.civility' => 'Title of civility eg: MR...matches field "code" in table "'.MAIN_DB_PREFIX.'c_civility"',
|
||||||
's.lastname' => "lastname or label",
|
's.lastname' => "lastname or label",
|
||||||
's.firstname' => 'John',
|
's.firstname' => 'John',
|
||||||
's.address' => '61 Jump street',
|
's.address' => '61 Jump street',
|
||||||
's.zip' => '75000',
|
's.zip' => '75000',
|
||||||
's.town' => 'Bigtown',
|
's.town' => 'Bigtown',
|
||||||
's.fk_departement' => 'matches field "code_departement" in table "'.MAIN_DB_PREFIX.'c_departements"',
|
's.fk_departement' => 'matches field "code_departement" in table "'.MAIN_DB_PREFIX.'c_departements"',
|
||||||
's.fk_pays' => 'US/FR/DE etc. matches field "code" in table "'.MAIN_DB_PREFIX.'c_country"',
|
's.fk_pays' => 'US/FR/DE etc. matches field "code" in table "'.MAIN_DB_PREFIX.'c_country"',
|
||||||
's.birthday' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'),
|
's.birthday' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'),
|
||||||
's.poste' => "Director",
|
's.poste' => "Director",
|
||||||
's.phone' => "5551122",
|
's.phone' => "5551122",
|
||||||
's.phone_perso' => "5551133",
|
's.phone_perso' => "5551133",
|
||||||
's.phone_mobile' => "5551144",
|
's.phone_mobile' => "5551144",
|
||||||
's.fax' => "5551155",
|
's.fax' => "5551155",
|
||||||
's.email' => "johnsmith@email.com",
|
's.email' => "johnsmith@email.com",
|
||||||
's.skype' => "skype username",
|
's.skype' => "skype username",
|
||||||
's.note_private' => "My private note",
|
's.note_private' => "My private note",
|
||||||
's.note_public' => "My public note"
|
's.note_public' => "My public note"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Import Bank Accounts
|
// Import Bank Accounts
|
||||||
$r++;
|
$r++;
|
||||||
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||||
$this->import_label[$r] = "ImportDataset_company_3"; // Translation key
|
$this->import_label[$r] = "ImportDataset_company_3"; // Translation key
|
||||||
$this->import_icon[$r] = 'company';
|
$this->import_icon[$r] = 'company';
|
||||||
$this->import_entities_array[$r] = array(); // We define here only fields that use a different icon to the one defined in import_icon
|
$this->import_entities_array[$r] = array(); // We define here only fields that use a different icon to the one defined in import_icon
|
||||||
$this->import_tables_array[$r] = array('sr' => MAIN_DB_PREFIX.'societe_rib');
|
$this->import_tables_array[$r] = array('sr' => MAIN_DB_PREFIX.'societe_rib');
|
||||||
$this->import_fields_array[$r] = array(//field order as per structure of table llx_societe_rib
|
$this->import_fields_array[$r] = array(//field order as per structure of table llx_societe_rib
|
||||||
'sr.label' => "Label*",
|
'sr.label' => "Label*",
|
||||||
'sr.fk_soc' => "ThirdPartyName*",
|
'sr.fk_soc' => "ThirdPartyName*",
|
||||||
'sr.datec' => "DateCreation*",
|
'sr.datec' => "DateCreation*",
|
||||||
'sr.bank' => "Bank",
|
'sr.bank' => "Bank",
|
||||||
'sr.code_banque' => "BankCode",
|
'sr.code_banque' => "BankCode",
|
||||||
'sr.code_guichet' => "DeskCode",
|
'sr.code_guichet' => "DeskCode",
|
||||||
'sr.number' => "BankAccountNumber*",
|
'sr.number' => "BankAccountNumber*",
|
||||||
'sr.cle_rib' => "BankAccountNumberKey",
|
'sr.cle_rib' => "BankAccountNumberKey",
|
||||||
'sr.bic' => "BIC",
|
'sr.bic' => "BIC",
|
||||||
'sr.iban_prefix' => "IBAN",
|
'sr.iban_prefix' => "IBAN",
|
||||||
'sr.domiciliation' => "BankAccountDomiciliation",
|
'sr.domiciliation' => "BankAccountDomiciliation",
|
||||||
'sr.proprio' => "BankAccountOwner",
|
'sr.proprio' => "BankAccountOwner",
|
||||||
'sr.owner_address' => "BankAccountOwnerAddress",
|
'sr.owner_address' => "BankAccountOwnerAddress",
|
||||||
'sr.default_rib' => 'Default',
|
'sr.default_rib' => 'Default',
|
||||||
'sr.rum' => 'RUM',
|
'sr.rum' => 'RUM',
|
||||||
'sr.type' => "Type ban is defaut",
|
'sr.type' => "Type ban is defaut",
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->import_convertvalue_array[$r] = array(
|
$this->import_convertvalue_array[$r] = array(
|
||||||
'sr.fk_soc' => array(
|
'sr.fk_soc' => array(
|
||||||
'rule' => 'fetchidfromref',
|
'rule' => 'fetchidfromref',
|
||||||
'classfile' => '/societe/class/societe.class.php',
|
'classfile' => '/societe/class/societe.class.php',
|
||||||
'class' => 'Societe',
|
'class' => 'Societe',
|
||||||
'method' => 'fetch',
|
'method' => 'fetch',
|
||||||
'element' => 'ThirdParty'
|
'element' => 'ThirdParty'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_societe_rib
|
$this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_societe_rib
|
||||||
'sr.label' => 'eg. "account1"',
|
'sr.label' => 'eg. "account1"',
|
||||||
'sr.fk_soc' => 'eg. "TPBigCompany"',
|
'sr.fk_soc' => 'eg. "TPBigCompany"',
|
||||||
'sr.datec' => 'date used for creating direct debit UMR formatted as '.dol_print_date(dol_now(),
|
'sr.datec' => 'date used for creating direct debit UMR formatted as '.dol_print_date(dol_now(),
|
||||||
'%Y-%m-%d'),
|
'%Y-%m-%d'),
|
||||||
'sr.bank' => 'bank name eg: "ING-Direct"',
|
'sr.bank' => 'bank name eg: "ING-Direct"',
|
||||||
'sr.code_banque' => 'account sort code (GB)/Routing number (US) eg. "8456"',
|
'sr.code_banque' => 'account sort code (GB)/Routing number (US) eg. "8456"',
|
||||||
'sr.code_guichet' => "bank code for office/branch",
|
'sr.code_guichet' => "bank code for office/branch",
|
||||||
'sr.number' => 'account number eg. "3333333333"',
|
'sr.number' => 'account number eg. "3333333333"',
|
||||||
'sr.cle_rib' => 'account checksum/control digits (if used) eg. "22"',
|
'sr.cle_rib' => 'account checksum/control digits (if used) eg. "22"',
|
||||||
'sr.bic' => 'bank identifier eg. "USHINGMMXXX"',
|
'sr.bic' => 'bank identifier eg. "USHINGMMXXX"',
|
||||||
'sr.iban_prefix' => 'complete account IBAN eg. "GB78CPBK08925068637123"',
|
'sr.iban_prefix' => 'complete account IBAN eg. "GB78CPBK08925068637123"',
|
||||||
'sr.domiciliation' => 'bank branch address eg. "PARIS"',
|
'sr.domiciliation' => 'bank branch address eg. "PARIS"',
|
||||||
'sr.proprio' => 'name on the bank account',
|
'sr.proprio' => 'name on the bank account',
|
||||||
'sr.owner_address' => 'address of account holder',
|
'sr.owner_address' => 'address of account holder',
|
||||||
'sr.default_rib' => '1 (default account) / 0 (not default)',
|
'sr.default_rib' => '1 (default account) / 0 (not default)',
|
||||||
'sr.rum' => 'RUM code',
|
'sr.rum' => 'RUM code',
|
||||||
'sr.type' => 'ban',
|
'sr.type' => 'ban',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Import Company Sales representatives
|
// Import Company Sales representatives
|
||||||
$r++;
|
$r++;
|
||||||
@ -738,16 +739,16 @@ class modSociete extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
public function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
// We disable this to prevent pb of modules not correctly disabled
|
// We disable this to prevent pb of modules not correctly disabled
|
||||||
|
|||||||
@ -74,7 +74,7 @@ if ($permission)
|
|||||||
print '<div class="div-table-responsive-no-min">'."\n";
|
print '<div class="div-table-responsive-no-min">'."\n";
|
||||||
print '<div class="tagtable tableforcontact centpercent noborder nobordertop allwidth">'."\n";
|
print '<div class="tagtable tableforcontact centpercent noborder nobordertop allwidth">'."\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<form class="tagtr liste_titre">
|
<form class="tagtr liste_titre">
|
||||||
<div class="tagtd liste_titre"><?php echo $langs->trans("NatureOfContact"); ?></div>
|
<div class="tagtd liste_titre"><?php echo $langs->trans("NatureOfContact"); ?></div>
|
||||||
<div class="tagtd liste_titre"><?php echo $langs->trans("ThirdParty"); ?></div>
|
<div class="tagtd liste_titre"><?php echo $langs->trans("ThirdParty"); ?></div>
|
||||||
@ -88,8 +88,8 @@ if ($permission)
|
|||||||
|
|
||||||
if (empty($hideaddcontactforuser))
|
if (empty($hideaddcontactforuser))
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<form class="tagtr impair" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
|
<form class="tagtr impair nohover" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
|
||||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
|
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
|
||||||
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
|
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
|
||||||
<input type="hidden" name="action" value="addcontact" />
|
<input type="hidden" name="action" value="addcontact" />
|
||||||
@ -113,9 +113,9 @@ if ($permission)
|
|||||||
|
|
||||||
if (empty($hideaddcontactforthirdparty))
|
if (empty($hideaddcontactforthirdparty))
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form class="tagtr pair" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
|
<form class="tagtr pair nohover" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
|
||||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
|
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
|
||||||
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
|
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
|
||||||
<input type="hidden" name="action" value="addcontact" />
|
<input type="hidden" name="action" value="addcontact" />
|
||||||
@ -128,7 +128,7 @@ if ($permission)
|
|||||||
// add company icon before select list
|
// add company icon before select list
|
||||||
if ($selectedCompany)
|
if ($selectedCompany)
|
||||||
{
|
{
|
||||||
echo img_object('', 'company', 'class="hideonsmartphone"');
|
echo img_object('', 'company', 'class="hideonsmartphone"');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
|
<?php $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
|
||||||
@ -326,9 +326,9 @@ print "</form>";
|
|||||||
|
|
||||||
print "<!-- TEMPLATE CONTACTS HOOK BEGIN HERE -->\n";
|
print "<!-- TEMPLATE CONTACTS HOOK BEGIN HERE -->\n";
|
||||||
if (is_object($hookmanager)) {
|
if (is_object($hookmanager)) {
|
||||||
$hookmanager->initHooks(array('contacttpl'));
|
$hookmanager->initHooks(array('contacttpl'));
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('formContactTpl', $parameters, $object, $action);
|
$reshook = $hookmanager->executeHooks('formContactTpl', $parameters, $object, $action);
|
||||||
}
|
}
|
||||||
print "<!-- END PHP TEMPLATE CONTACTS -->\n";
|
print "<!-- END PHP TEMPLATE CONTACTS -->\n";
|
||||||
|
|
||||||
|
|||||||
@ -30,170 +30,168 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
|||||||
*/
|
*/
|
||||||
class InterfaceTicketEmail extends DolibarrTriggers
|
class InterfaceTicketEmail extends DolibarrTriggers
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var DoliDB Database handler.
|
* @var DoliDB Database handler.
|
||||||
*/
|
*/
|
||||||
public $db;
|
public $db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
public function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||||
$this->family = "ticket";
|
$this->family = "ticket";
|
||||||
$this->description = "Triggers of the module ticket to send notifications to internal users and to third-parties";
|
$this->description = "Triggers of the module ticket to send notifications to internal users and to third-parties";
|
||||||
$this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version
|
$this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version
|
||||||
$this->picto = 'ticket';
|
$this->picto = 'ticket';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return name of trigger file
|
* Return name of trigger file
|
||||||
*
|
*
|
||||||
* @return string Name of trigger file
|
* @return string Name of trigger file
|
||||||
*/
|
*/
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return description of trigger file
|
* Return description of trigger file
|
||||||
*
|
*
|
||||||
* @return string Description of trigger file
|
* @return string Description of trigger file
|
||||||
*/
|
*/
|
||||||
public function getDesc()
|
public function getDesc()
|
||||||
{
|
{
|
||||||
return $this->description;
|
return $this->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return version of trigger file
|
* Return version of trigger file
|
||||||
*
|
*
|
||||||
* @return string Version of trigger file
|
* @return string Version of trigger file
|
||||||
*/
|
*/
|
||||||
public function getVersion()
|
public function getVersion()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
|
|
||||||
if ($this->version == 'development') {
|
if ($this->version == 'development') {
|
||||||
return $langs->trans("Development");
|
return $langs->trans("Development");
|
||||||
} elseif ($this->version == 'experimental') {
|
} elseif ($this->version == 'experimental') {
|
||||||
return $langs->trans("Experimental");
|
return $langs->trans("Experimental");
|
||||||
} elseif ($this->version == 'dolibarr') {
|
} elseif ($this->version == 'dolibarr') {
|
||||||
return DOL_VERSION;
|
return DOL_VERSION;
|
||||||
} elseif ($this->version) {
|
} elseif ($this->version) {
|
||||||
return $this->version;
|
return $this->version;
|
||||||
} else {
|
} else {
|
||||||
return $langs->trans("Unknown");
|
return $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when a Dolibarrr business event is done.
|
* Function called when a Dolibarrr business event is done.
|
||||||
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers
|
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers
|
||||||
*
|
*
|
||||||
* @param string $action Event action code
|
* @param string $action Event action code
|
||||||
* @param Object $object Object
|
* @param Object $object Object
|
||||||
* @param User $user Object user
|
* @param User $user Object user
|
||||||
* @param Translate $langs Object langs
|
* @param Translate $langs Object langs
|
||||||
* @param conf $conf Object conf
|
* @param conf $conf Object conf
|
||||||
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
|
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
|
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
|
|
||||||
if (empty($conf->ticket->enabled)) return 0; // Module not active, we do nothing
|
if (empty($conf->ticket->enabled)) return 0; // Module not active, we do nothing
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'TICKET_ASSIGNED':
|
case 'TICKET_ASSIGNED':
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
|
||||||
if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id)
|
if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id)
|
||||||
{
|
{
|
||||||
$userstat = new User($this->db);
|
$userstat = new User($this->db);
|
||||||
$res = $userstat->fetch($object->fk_user_assign);
|
$res = $userstat->fetch($object->fk_user_assign);
|
||||||
if ($res > 0)
|
if ($res > 0)
|
||||||
{
|
{
|
||||||
// Send email to notification email
|
// Send email to notification email
|
||||||
|
|
||||||
if (empty($conf->global->TICKET_DISABLE_ALL_MAILS))
|
if (empty($conf->global->TICKET_DISABLE_ALL_MAILS))
|
||||||
{
|
{
|
||||||
// Init to avoid errors
|
// Init to avoid errors
|
||||||
$filepath = array();
|
$filepath = array();
|
||||||
$filename = array();
|
$filename = array();
|
||||||
$mimetype = array();
|
$mimetype = array();
|
||||||
|
|
||||||
// Send email to assigned user
|
// Send email to assigned user
|
||||||
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketAssignedToYou');
|
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketAssignedToYou');
|
||||||
$message = '<p>'.$langs->transnoentities('TicketAssignedEmailBody', $object->track_id, dolGetFirstLastname($user->firstname, $user->lastname))."</p>";
|
$message = '<p>'.$langs->transnoentities('TicketAssignedEmailBody', $object->track_id, dolGetFirstLastname($user->firstname, $user->lastname))."</p>";
|
||||||
$message .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
|
$message .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
|
||||||
$message .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
|
$message .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
|
||||||
$message .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
|
$message .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
|
||||||
$message .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
|
$message .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (is_array($object->array_options) && count($object->array_options) > 0) {
|
if (is_array($object->array_options) && count($object->array_options) > 0) {
|
||||||
foreach ($object->array_options as $key => $value) {
|
foreach ($object->array_options as $key => $value) {
|
||||||
$message .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
|
$message .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message .= '</ul>';
|
$message .= '</ul>';
|
||||||
$message .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
|
$message .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
|
||||||
$message .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
|
$message .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
|
||||||
|
|
||||||
$sendto = $userstat->email;
|
$sendto = $userstat->email;
|
||||||
$from = dolGetFirstLastname($user->firstname, $user->lastname).'<'.$user->email.'>';
|
$from = dolGetFirstLastname($user->firstname, $user->lastname).'<'.$user->email.'>';
|
||||||
|
|
||||||
$message = dol_nl2br($message);
|
$message = dol_nl2br($message);
|
||||||
|
|
||||||
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
||||||
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
||||||
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
|
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
|
||||||
}
|
}
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, '', '', 0, -1);
|
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, '', '', 0, -1);
|
||||||
if ($mailfile->error) {
|
if ($mailfile->error) {
|
||||||
setEventMessages($mailfile->error, $mailfile->errors, 'errors');
|
setEventMessages($mailfile->error, $mailfile->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
$result = $mailfile->sendfile();
|
$result = $mailfile->sendfile();
|
||||||
}
|
}
|
||||||
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
||||||
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
|
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ok = 1;
|
$ok = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error = $userstat->error;
|
$this->error = $userstat->error;
|
||||||
$this->errors = $userstat->errors;
|
$this->errors = $userstat->errors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'TICKET_CREATE':
|
case 'TICKET_CREATE':
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
|
||||||
$langs->load('ticket');
|
$langs->load('ticket');
|
||||||
|
|
||||||
$object->fetch('', $object->track_id); // Should be useless
|
$object->fetch('', $object->track_id); // Should be useless
|
||||||
|
|
||||||
|
|
||||||
// Send email to notification email
|
// Send email to notification email
|
||||||
|
$sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||||
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail']))
|
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail']))
|
||||||
{
|
{
|
||||||
$sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
if ($sendto)
|
||||||
|
|
||||||
if ($sendto)
|
|
||||||
{
|
{
|
||||||
// Init to avoid errors
|
// Init to avoid errors
|
||||||
$filepath = array();
|
$filepath = array();
|
||||||
@ -201,146 +199,146 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
|||||||
$mimetype = array();
|
$mimetype = array();
|
||||||
|
|
||||||
/* Send email to admin */
|
/* Send email to admin */
|
||||||
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin');
|
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin');
|
||||||
$message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n";
|
$message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n";
|
||||||
$message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
|
$message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
|
||||||
$message_admin .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
|
$message_admin .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
|
||||||
$message_admin .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
|
$message_admin .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
|
||||||
$message_admin .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
|
$message_admin .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
|
||||||
$message_admin .= '<li>'.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'</li>';
|
$message_admin .= '<li>'.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'</li>';
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (is_array($object->array_options) && count($object->array_options) > 0) {
|
if (is_array($object->array_options) && count($object->array_options) > 0) {
|
||||||
foreach ($object->array_options as $key => $value) {
|
foreach ($object->array_options as $key => $value) {
|
||||||
$message_admin .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
|
$message_admin .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$message_admin .= '</ul>';
|
$message_admin .= '</ul>';
|
||||||
|
|
||||||
if ($object->fk_soc > 0) {
|
if ($object->fk_soc > 0) {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$message_admin .= '<p>'.$langs->trans('Company').' : '.$object->thirdparty->name.'</p>';
|
$message_admin .= '<p>'.$langs->trans('Company').' : '.$object->thirdparty->name.'</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$message_admin .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
|
$message_admin .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
|
||||||
$message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
|
$message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
|
||||||
|
|
||||||
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
||||||
$replyto = $from;
|
$replyto = $from;
|
||||||
|
|
||||||
$message_admin = dol_nl2br($message_admin);
|
$message_admin = dol_nl2br($message_admin);
|
||||||
|
|
||||||
$trackid = 'tic'.$object->id;
|
$trackid = 'tic'.$object->id;
|
||||||
|
|
||||||
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
||||||
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
||||||
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
|
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
|
||||||
}
|
}
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
$mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
|
$mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
|
||||||
if ($mailfile->error) {
|
if ($mailfile->error) {
|
||||||
dol_syslog($mailfile->error, LOG_DEBUG);
|
dol_syslog($mailfile->error, LOG_DEBUG);
|
||||||
} else {
|
} else {
|
||||||
$result = $mailfile->sendfile();
|
$result = $mailfile->sendfile();
|
||||||
}
|
}
|
||||||
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
||||||
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
|
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send email to customer
|
// Send email to customer
|
||||||
|
|
||||||
if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create)
|
if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create)
|
||||||
{
|
{
|
||||||
$sendto = '';
|
$sendto = '';
|
||||||
if (empty($user->socid) && empty($user->email)) {
|
if (empty($user->socid) && empty($user->email)) {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$sendto = $object->thirdparty->email;
|
$sendto = $object->thirdparty->email;
|
||||||
} else {
|
} else {
|
||||||
$sendto = $user->email;
|
$sendto = $user->email;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sendto) {
|
if ($sendto) {
|
||||||
// Init to avoid errors
|
// Init to avoid errors
|
||||||
$filepath = array();
|
$filepath = array();
|
||||||
$filename = array();
|
$filename = array();
|
||||||
$mimetype = array();
|
$mimetype = array();
|
||||||
|
|
||||||
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectCustomer');
|
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectCustomer');
|
||||||
$message_customer = $langs->transnoentities('TicketNewEmailBodyCustomer', $object->track_id)."\n\n";
|
$message_customer = $langs->transnoentities('TicketNewEmailBodyCustomer', $object->track_id)."\n\n";
|
||||||
$message_customer .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
|
$message_customer .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
|
||||||
$message_customer .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
|
$message_customer .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
|
||||||
$message_customer .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
|
$message_customer .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
|
||||||
$message_customer .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
|
$message_customer .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
foreach ($this->attributes[$object->table_element]['label'] as $key => $value)
|
foreach ($this->attributes[$object->table_element]['label'] as $key => $value)
|
||||||
{
|
{
|
||||||
$enabled = 1;
|
$enabled = 1;
|
||||||
if ($enabled && isset($this->attributes[$object->table_element]['list'][$key]))
|
if ($enabled && isset($this->attributes[$object->table_element]['list'][$key]))
|
||||||
{
|
{
|
||||||
$enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1);
|
$enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1);
|
||||||
}
|
}
|
||||||
$perms = 1;
|
$perms = 1;
|
||||||
if ($perms && isset($this->attributes[$object->table_element]['perms'][$key]))
|
if ($perms && isset($this->attributes[$object->table_element]['perms'][$key]))
|
||||||
{
|
{
|
||||||
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1);
|
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$qualified = true;
|
$qualified = true;
|
||||||
if (empty($enabled)) $qualified = false;
|
if (empty($enabled)) $qualified = false;
|
||||||
if (empty($perms)) $qualified = false;
|
if (empty($perms)) $qualified = false;
|
||||||
|
|
||||||
if ($qualified) $message_customer .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
|
if ($qualified) $message_customer .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$message_customer .= '</ul>';
|
$message_customer .= '</ul>';
|
||||||
$message_customer .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
|
$message_customer .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
|
||||||
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
|
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
|
||||||
$message_customer .= '<p>'.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
|
$message_customer .= '<p>'.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
|
||||||
$message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
|
$message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
|
||||||
|
|
||||||
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
||||||
$replyto = $from;
|
$replyto = $from;
|
||||||
|
|
||||||
$message_customer = dol_nl2br($message_customer);
|
$message_customer = dol_nl2br($message_customer);
|
||||||
|
|
||||||
$trackid = 'tic'.$object->id;
|
$trackid = 'tic'.$object->id;
|
||||||
|
|
||||||
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
||||||
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
||||||
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
|
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
|
||||||
}
|
}
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
$mailfile = new CMailFile($subject, $sendto, $from, $message_customer, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid);
|
$mailfile = new CMailFile($subject, $sendto, $from, $message_customer, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid);
|
||||||
if ($mailfile->error) {
|
if ($mailfile->error) {
|
||||||
dol_syslog($mailfile->error, LOG_DEBUG);
|
dol_syslog($mailfile->error, LOG_DEBUG);
|
||||||
} else {
|
} else {
|
||||||
$result = $mailfile->sendfile();
|
$result = $mailfile->sendfile();
|
||||||
}
|
}
|
||||||
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
||||||
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
|
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ok = 1;
|
$ok = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'TICKET_DELETE':
|
case 'TICKET_DELETE':
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'TICKET_MODIFY':
|
case 'TICKET_MODIFY':
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'TICKET_CLOSE':
|
case 'TICKET_CLOSE':
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $ok;
|
return $ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2553,7 +2553,7 @@ elseif ($id || $ref)
|
|||||||
|
|
||||||
// This is just to generate a delivery receipt
|
// This is just to generate a delivery receipt
|
||||||
//var_dump($object->linkedObjectsIds['delivery']);
|
//var_dump($object->linkedObjectsIds['delivery']);
|
||||||
if ($conf->livraison_bon->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->livraison->creer && count($object->linkedObjectsIds['delivery']) == 0)
|
if ($conf->livraison_bon->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery']))
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create_delivery">'.$langs->trans("CreateDeliveryOrder").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create_delivery">'.$langs->trans("CreateDeliveryOrder").'</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ GraphInBarsAreLimitedToNMeasures=Grapics are limited to %s measures in 'Bars' mo
|
|||||||
OnlyOneFieldForXAxisIsPossible=Only 1 field is currently possible as X-Axis. Only the first selected field has been selected.
|
OnlyOneFieldForXAxisIsPossible=Only 1 field is currently possible as X-Axis. Only the first selected field has been selected.
|
||||||
AtLeastOneMeasureIsRequired=At least 1 field for measure is required
|
AtLeastOneMeasureIsRequired=At least 1 field for measure is required
|
||||||
AtLeastOneXAxisIsRequired=At least 1 field for X-Axis is required
|
AtLeastOneXAxisIsRequired=At least 1 field for X-Axis is required
|
||||||
|
LatestBlogPosts=Latest Blog Posts
|
||||||
Notify_ORDER_VALIDATE=Sales order validated
|
Notify_ORDER_VALIDATE=Sales order validated
|
||||||
Notify_ORDER_SENTBYMAIL=Sales order sent by mail
|
Notify_ORDER_SENTBYMAIL=Sales order sent by mail
|
||||||
Notify_ORDER_SUPPLIER_SENTBYMAIL=Purchase order sent by email
|
Notify_ORDER_SUPPLIER_SENTBYMAIL=Purchase order sent by email
|
||||||
|
|||||||
@ -186,7 +186,7 @@ PlannedWorkload=Planned workload
|
|||||||
PlannedWorkloadShort=Workload
|
PlannedWorkloadShort=Workload
|
||||||
ProjectReferers=Related items
|
ProjectReferers=Related items
|
||||||
ProjectMustBeValidatedFirst=Project must be validated first
|
ProjectMustBeValidatedFirst=Project must be validated first
|
||||||
FirstAddRessourceToAllocateTime=Assign a user resource to task to allocate time
|
FirstAddRessourceToAllocateTime=Assign a user resource as contact of project to allocate time
|
||||||
InputPerDay=Input per day
|
InputPerDay=Input per day
|
||||||
InputPerWeek=Input per week
|
InputPerWeek=Input per week
|
||||||
InputPerMonth=Input per month
|
InputPerMonth=Input per month
|
||||||
|
|||||||
@ -113,3 +113,5 @@ CantDisableYourself=You can't disable your own user record
|
|||||||
ForceUserExpenseValidator=Force expense report validator
|
ForceUserExpenseValidator=Force expense report validator
|
||||||
ForceUserHolidayValidator=Force leave request validator
|
ForceUserHolidayValidator=Force leave request validator
|
||||||
ValidatorIsSupervisorByDefault=By default, the validator is the supervisor of the user. Keep empty to keep this behaviour.
|
ValidatorIsSupervisorByDefault=By default, the validator is the supervisor of the user. Keep empty to keep this behaviour.
|
||||||
|
UserPersonalEmail=Personal email
|
||||||
|
UserPersonalMobile=Personal mobile phone
|
||||||
|
|||||||
@ -70,8 +70,8 @@ if ($cancel) $action ='';
|
|||||||
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
var_dump(GETPOST("max_prod", 'int'));
|
$maxprod = GETPOST("max_prod", 'int');
|
||||||
for ($i=0; $i < GETPOST("max_prod", 'int'); $i++)
|
for ($i=0; $i < $maxprod; $i++)
|
||||||
{
|
{
|
||||||
$qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS');
|
$qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS');
|
||||||
if ($qty > 0)
|
if ($qty > 0)
|
||||||
|
|||||||
@ -87,12 +87,13 @@ class Warehouses extends DolibarrApi
|
|||||||
* @param string $sortorder Sort order
|
* @param string $sortorder Sort order
|
||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
* @param int $page Page number
|
* @param int $page Page number
|
||||||
|
* @param int $category Use this param to filter list by category
|
||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'WH-%') and (t.date_creation:<:'20160101')"
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'WH-%') and (t.date_creation:<:'20160101')"
|
||||||
* @return array Array of warehouse objects
|
* @return array Array of warehouse objects
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
|
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $category = 0, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
@ -104,7 +105,15 @@ class Warehouses extends DolibarrApi
|
|||||||
|
|
||||||
$sql = "SELECT t.rowid";
|
$sql = "SELECT t.rowid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as t";
|
||||||
|
if ($category > 0) {
|
||||||
|
$sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c";
|
||||||
|
}
|
||||||
$sql .= ' WHERE t.entity IN ('.getEntity('stock').')';
|
$sql .= ' WHERE t.entity IN ('.getEntity('stock').')';
|
||||||
|
// Select warehouses of given category
|
||||||
|
if ($category > 0) {
|
||||||
|
$sql .= " AND c.fk_categorie = ".$db->escape($category);
|
||||||
|
$sql .= " AND c.fk_warehouse = t.rowid ";
|
||||||
|
}
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -95,10 +95,11 @@ class Projects extends DolibarrApi
|
|||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
* @param int $page Page number
|
* @param int $page Page number
|
||||||
* @param string $thirdparty_ids Thirdparty ids to filter projects of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
|
* @param string $thirdparty_ids Thirdparty ids to filter projects of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
|
||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
* @param int $category Use this param to filter list by category
|
||||||
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||||
* @return array Array of project objects
|
* @return array Array of project objects
|
||||||
*/
|
*/
|
||||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
|
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $category = 0, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
@ -114,7 +115,9 @@ class Projects extends DolibarrApi
|
|||||||
$sql = "SELECT t.rowid";
|
$sql = "SELECT t.rowid";
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."projet as t";
|
||||||
|
if ($category > 0) {
|
||||||
|
$sql .= ", ".MAIN_DB_PREFIX."categorie_project as c";
|
||||||
|
}
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
|
|
||||||
$sql .= ' WHERE t.entity IN ('.getEntity('project').')';
|
$sql .= ' WHERE t.entity IN ('.getEntity('project').')';
|
||||||
@ -126,6 +129,10 @@ class Projects extends DolibarrApi
|
|||||||
{
|
{
|
||||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||||
}
|
}
|
||||||
|
// Select projects of given category
|
||||||
|
if ($category > 0) {
|
||||||
|
$sql .= " AND c.fk_categorie = ".$db->escape($category)." AND c.fk_project = t.rowid ";
|
||||||
|
}
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -131,6 +131,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
|
|||||||
|
|
||||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -141,27 +142,27 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
// Selection of new fields
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_user_id = "";
|
$search_user_id = "";
|
||||||
$search_taskref = '';
|
$search_taskref = '';
|
||||||
$search_tasklabel = '';
|
$search_tasklabel = '';
|
||||||
$search_dtstartday = '';
|
$search_dtstartday = '';
|
||||||
$search_dtstartmonth = '';
|
$search_dtstartmonth = '';
|
||||||
$search_dtstartyear = '';
|
$search_dtstartyear = '';
|
||||||
$search_dtendday = '';
|
$search_dtendday = '';
|
||||||
$search_dtendmonth = '';
|
$search_dtendmonth = '';
|
||||||
$search_dtendyear = '';
|
$search_dtendyear = '';
|
||||||
$search_planedworkload = '';
|
$search_planedworkload = '';
|
||||||
$search_timespend = '';
|
$search_timespend = '';
|
||||||
$search_progresscalc = '';
|
$search_progresscalc = '';
|
||||||
$search_progressdeclare = '';
|
$search_progressdeclare = '';
|
||||||
$toselect = '';
|
$toselect = '';
|
||||||
$search_array_options = array();
|
$search_array_options = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
@ -216,8 +217,8 @@ if ($action == 'createtask' && $user->rights->projet->creer)
|
|||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// If we use user timezone, we must change also view/list to use user timezone everywhere
|
// If we use user timezone, we must change also view/list to use user timezone everywhere
|
||||||
//$date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user');
|
//$date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user');
|
||||||
//$date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user');
|
//$date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user');
|
||||||
$date_start = dol_mktime($_POST['dateohour'], $_POST['dateomin'], 0, $_POST['dateomonth'], $_POST['dateoday'], $_POST['dateoyear']);
|
$date_start = dol_mktime($_POST['dateohour'], $_POST['dateomin'], 0, $_POST['dateomonth'], $_POST['dateoday'], $_POST['dateoyear']);
|
||||||
$date_end = dol_mktime($_POST['dateehour'], $_POST['dateemin'], 0, $_POST['dateemonth'], $_POST['dateeday'], $_POST['dateeyear']);
|
$date_end = dol_mktime($_POST['dateehour'], $_POST['dateemin'], 0, $_POST['dateemonth'], $_POST['dateeday'], $_POST['dateeyear']);
|
||||||
@ -230,7 +231,7 @@ if ($action == 'createtask' && $user->rights->projet->creer)
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($label))
|
if (empty($label))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
@ -358,7 +359,7 @@ if ($id > 0 || !empty($ref))
|
|||||||
$head = project_prepare_head($object);
|
$head = project_prepare_head($object);
|
||||||
dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project'));
|
dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project'));
|
||||||
|
|
||||||
$param = 'id='.$object->id;
|
$param = '&id='.$object->id;
|
||||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||||
if ($search_user_id) $param .= '&search_user_id='.urlencode($search_user_id);
|
if ($search_user_id) $param .= '&search_user_id='.urlencode($search_user_id);
|
||||||
if ($search_taskref) $param .= '&search_taskref='.urlencode($search_taskref);
|
if ($search_taskref) $param .= '&search_taskref='.urlencode($search_taskref);
|
||||||
@ -378,116 +379,116 @@ if ($id > 0 || !empty($ref))
|
|||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
|
|
||||||
// Project card
|
// Project card
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
$morehtmlref = '<div class="refidno">';
|
$morehtmlref = '<div class="refidno">';
|
||||||
// Title
|
// Title
|
||||||
$morehtmlref .= $object->title;
|
$morehtmlref .= $object->title;
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
if ($object->thirdparty->id > 0)
|
if ($object->thirdparty->id > 0)
|
||||||
{
|
{
|
||||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
|
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
|
||||||
}
|
}
|
||||||
$morehtmlref .= '</div>';
|
$morehtmlref .= '</div>';
|
||||||
|
|
||||||
// Define a complementary filter for search of next/prev ref.
|
// Define a complementary filter for search of next/prev ref.
|
||||||
if (!$user->rights->projet->all->lire)
|
if (!$user->rights->projet->all->lire)
|
||||||
{
|
{
|
||||||
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
|
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
|
||||||
$object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
|
$object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
// Usage
|
// Usage
|
||||||
print '<tr><td class="tdtop">';
|
print '<tr><td class="tdtop">';
|
||||||
print $langs->trans("Usage");
|
print $langs->trans("Usage");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||||
{
|
{
|
||||||
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
|
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
|
||||||
$htmltext = $langs->trans("ProjectFollowOpportunity");
|
$htmltext = $langs->trans("ProjectFollowOpportunity");
|
||||||
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
|
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||||
{
|
{
|
||||||
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
|
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
|
||||||
$htmltext = $langs->trans("ProjectFollowTasks");
|
$htmltext = $langs->trans("ProjectFollowTasks");
|
||||||
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
|
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
|
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
|
||||||
{
|
{
|
||||||
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
|
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
|
||||||
$htmltext = $langs->trans("ProjectBillTimeDescription");
|
$htmltext = $langs->trans("ProjectBillTimeDescription");
|
||||||
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
|
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Visibility
|
// Visibility
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
|
||||||
if ($object->public) print $langs->trans('SharedProject');
|
if ($object->public) print $langs->trans('SharedProject');
|
||||||
else print $langs->trans('PrivateProject');
|
else print $langs->trans('PrivateProject');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date start - end
|
// Date start - end
|
||||||
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
|
||||||
$start = dol_print_date($object->date_start, 'day');
|
$start = dol_print_date($object->date_start, 'day');
|
||||||
print ($start ? $start : '?');
|
print ($start ? $start : '?');
|
||||||
$end = dol_print_date($object->date_end, 'day');
|
$end = dol_print_date($object->date_end, 'day');
|
||||||
print ' - ';
|
print ' - ';
|
||||||
print ($end ? $end : '?');
|
print ($end ? $end : '?');
|
||||||
if ($object->hasDelay()) print img_warning("Late");
|
if ($object->hasDelay()) print img_warning("Late");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Budget
|
// Budget
|
||||||
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
|
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
|
||||||
if (strcmp($object->budget_amount, '')) print price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency);
|
if (strcmp($object->budget_amount, '')) print price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$cols = 2;
|
$cols = 2;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="fichehalfright">';
|
print '<div class="fichehalfright">';
|
||||||
print '<div class="ficheaddleft">';
|
print '<div class="ficheaddleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
print nl2br($object->description);
|
print nl2br($object->description);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Categories
|
// Categories
|
||||||
if ($conf->categorie->enabled) {
|
if ($conf->categorie->enabled) {
|
||||||
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
|
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
|
||||||
print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
|
print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="clearboth"></div>';
|
print '<div class="clearboth"></div>';
|
||||||
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
@ -593,9 +594,9 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
|||||||
// Other options
|
// Other options
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $taskstatic, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $taskstatic, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
if (empty($reshook) && !empty($extrafields->attributes[$taskstatic->table_element]['label']))
|
if (empty($reshook) && !empty($extrafields->attributes[$taskstatic->table_element]['label']))
|
||||||
{
|
{
|
||||||
print $taskstatic->showOptionals($extrafields, 'edit'); // Do not use $object here that is object of project but use $taskstatic
|
print $taskstatic->showOptionals($extrafields, 'edit'); // Do not use $object here that is object of project but use $taskstatic
|
||||||
}
|
}
|
||||||
@ -624,17 +625,17 @@ elseif ($id > 0 || !empty($ref))
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Link to create task
|
// Link to create task
|
||||||
$linktocreatetaskParam = array();
|
$linktocreatetaskParam = array();
|
||||||
$linktocreatetaskUserRight = false;
|
$linktocreatetaskUserRight = false;
|
||||||
if ($user->rights->projet->all->creer || $user->rights->projet->creer) {
|
if ($user->rights->projet->all->creer || $user->rights->projet->creer) {
|
||||||
if ($object->public || $userWrite > 0) {
|
if ($object->public || $userWrite > 0) {
|
||||||
$linktocreatetaskUserRight = true;
|
$linktocreatetaskUserRight = true;
|
||||||
} else {
|
} else {
|
||||||
$linktocreatetaskParam['attr']['title'] = $langs->trans("NotOwnerOfProject");
|
$linktocreatetaskParam['attr']['title'] = $langs->trans("NotOwnerOfProject");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam);
|
$linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam);
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
@ -643,7 +644,7 @@ elseif ($id > 0 || !empty($ref))
|
|||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
$title = $langs->trans("ListOfTasks");
|
$title = $langs->trans("ListOfTasks");
|
||||||
@ -686,7 +687,7 @@ elseif ($id > 0 || !empty($ref))
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table id="tablelines" class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
|
print '<table id="tablelines" class="tagtable nobottom liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
|
||||||
|
|
||||||
// Fields title search
|
// Fields title search
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
@ -749,8 +750,8 @@ elseif ($id > 0 || !empty($ref))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// progress resume not searchable
|
// progress resume not searchable
|
||||||
print '<td class="liste_titre right"></td>';
|
print '<td class="liste_titre right"></td>';
|
||||||
|
|
||||||
if ($object->usage_bill_time)
|
if ($object->usage_bill_time)
|
||||||
{
|
{
|
||||||
@ -807,14 +808,14 @@ elseif ($id > 0 || !empty($ref))
|
|||||||
|
|
||||||
if (count($tasksarray) > 0)
|
if (count($tasksarray) > 0)
|
||||||
{
|
{
|
||||||
// Show all lines in taskarray (recursive function to go down on tree)
|
// Show all lines in taskarray (recursive function to go down on tree)
|
||||||
$j = 0; $level = 0;
|
$j = 0; $level = 0;
|
||||||
$nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields);
|
$nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$colspan = 10;
|
$colspan = 10;
|
||||||
if ($object->usage_bill_time) $colspan += 2;
|
if ($object->usage_bill_time) $colspan += 2;
|
||||||
print '<tr class="oddeven nobottom"><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoTasks").'</span></td></tr>';
|
print '<tr class="oddeven nobottom"><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoTasks").'</span></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -374,7 +374,7 @@ if ($id > 0 || !empty($ref))
|
|||||||
if ($action != 'editline' && $user->rights->projet->creer)
|
if ($action != 'editline' && $user->rights->projet->creer)
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Nature").'</td>';
|
print '<td>'.$langs->trans("NatureOfContact").'</td>';
|
||||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
||||||
print '<td>'.$langs->trans("Users").'</td>';
|
print '<td>'.$langs->trans("Users").'</td>';
|
||||||
print '<td>'.$langs->trans("ContactType").'</td>';
|
print '<td>'.$langs->trans("ContactType").'</td>';
|
||||||
@ -389,7 +389,7 @@ if ($id > 0 || !empty($ref))
|
|||||||
if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
||||||
|
|
||||||
// Ligne ajout pour contact interne
|
// Ligne ajout pour contact interne
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven nohover">';
|
||||||
|
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
print img_object('', 'user').' '.$langs->trans("Users");
|
print img_object('', 'user').' '.$langs->trans("Users");
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2006-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||||
@ -53,6 +53,7 @@ $projectid = GETPOST('projectid', 'int');
|
|||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$withproject = GETPOST('withproject', 'int');
|
$withproject = GETPOST('withproject', 'int');
|
||||||
$project_ref = GETPOST('project_ref', 'alpha');
|
$project_ref = GETPOST('project_ref', 'alpha');
|
||||||
|
$tab = GETPOST('tab', 'aZ09');
|
||||||
|
|
||||||
$search_day = GETPOST('search_day', 'int');
|
$search_day = GETPOST('search_day', 'int');
|
||||||
$search_month = GETPOST('search_month', 'int');
|
$search_month = GETPOST('search_month', 'int');
|
||||||
@ -620,8 +621,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
|||||||
if ($withproject)
|
if ($withproject)
|
||||||
{
|
{
|
||||||
// Tabs for project
|
// Tabs for project
|
||||||
if (empty($id)) $tab = 'timespent';
|
if (empty($id) || $tab == 'timespent') $tab = 'timespent';
|
||||||
else $tab = 'tasks';
|
else $tab = 'tasks';
|
||||||
|
|
||||||
$head = project_prepare_head($projectstatic);
|
$head = project_prepare_head($projectstatic);
|
||||||
dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'));
|
dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'));
|
||||||
|
|
||||||
@ -958,6 +960,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
|||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';
|
print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';
|
||||||
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
||||||
|
print '<input type="hidden" name="tab" value="'.$tab.'">';
|
||||||
|
|
||||||
if ($massaction == 'generateinvoice')
|
if ($massaction == 'generateinvoice')
|
||||||
{
|
{
|
||||||
@ -1139,7 +1142,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
|||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven nohover">';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<td class="maxwidthonsmartphone">';
|
print '<td class="maxwidthonsmartphone">';
|
||||||
@ -1149,28 +1152,31 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Task
|
// Task
|
||||||
|
$nboftasks = 0;
|
||||||
if (empty($id))
|
if (empty($id))
|
||||||
{
|
{
|
||||||
print '<td class="maxwidthonsmartphone">';
|
print '<td class="maxwidthonsmartphone">';
|
||||||
$formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, '');
|
$nboftasks = $formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Contributor
|
// Contributor
|
||||||
print '<td class="maxwidthonsmartphone nowraponall">';
|
print '<td class="maxwidthonsmartphone nowraponall">';
|
||||||
print img_object('', 'user', 'class="hideonsmartphone"');
|
|
||||||
$contactsofproject = $projectstatic->getListContactId('internal');
|
$contactsofproject = $projectstatic->getListContactId('internal');
|
||||||
if (count($contactsofproject) > 0)
|
if (count($contactsofproject) > 0)
|
||||||
{
|
{
|
||||||
|
print img_object('', 'user', 'class="hideonsmartphone"');
|
||||||
if (in_array($user->id, $contactsofproject)) $userid = $user->id;
|
if (in_array($user->id, $contactsofproject)) $userid = $user->id;
|
||||||
else $userid = $contactsofproject[0];
|
else $userid = $contactsofproject[0];
|
||||||
|
|
||||||
if ($projectstatic->public) $contactsofproject = array();
|
if ($projectstatic->public) $contactsofproject = array();
|
||||||
print $form->select_dolusers((GETPOST('userid', 'int') ?GETPOST('userid', 'int') : $userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'maxwidth200');
|
print $form->select_dolusers((GETPOST('userid', 'int') ? GETPOST('userid', 'int') : $userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'maxwidth200');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime');
|
if ($nboftasks) {
|
||||||
|
print img_error($langs->trans('FirstAddRessourceToAllocateTime')).' '.$langs->trans('FirstAddRessourceToAllocateTime');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -1202,8 +1208,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print '<input type="submit" name="save" class="button buttongen marginleftonly marginbottomonly" value="'.$langs->trans("Add").'">';
|
print '<input type="submit" name="save" class="button buttongen marginleftonly margintoponlyshort marginbottomonlyshort" value="'.$langs->trans("Add").'">';
|
||||||
print '<input type="submit" name="cancel" class="button buttongen marginleftonly" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" name="cancel" class="button buttongen marginleftonly margintoponlyshort marginbottomonlyshort" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -1504,9 +1510,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
|||||||
if (($action == 'editline' || $action == 'splitline') && $_GET['lineid'] == $task_time->rowid)
|
if (($action == 'editline' || $action == 'splitline') && $_GET['lineid'] == $task_time->rowid)
|
||||||
{
|
{
|
||||||
print '<input type="hidden" name="lineid" value="'.$_GET['lineid'].'">';
|
print '<input type="hidden" name="lineid" value="'.$_GET['lineid'].'">';
|
||||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort" name="save" value="'.$langs->trans("Save").'">';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
|
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort" name="cancel" value="'.$langs->trans('Cancel').'">';
|
||||||
}
|
}
|
||||||
elseif ($user->rights->projet->lire || $user->rights->projet->all->creer) // Read project and enter time consumed on assigned tasks
|
elseif ($user->rights->projet->lire || $user->rights->projet->all->creer) // Read project and enter time consumed on assigned tasks
|
||||||
{
|
{
|
||||||
@ -1515,19 +1521,19 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
|||||||
if ($conf->MAIN_FEATURES_LEVEL >= 2)
|
if ($conf->MAIN_FEATURES_LEVEL >= 2)
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=splitline&lineid='.$task_time->rowid.$param.'">';
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=splitline&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
|
||||||
print img_split();
|
print img_split();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=editline&lineid='.$task_time->rowid.$param.'">';
|
print '<a class="reposition editfielda" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=editline&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
|
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=deleteline&lineid='.$task_time->rowid.$param.'">';
|
print '<a class="reposition paddingleft" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=deleteline&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
|
||||||
print img_delete();
|
print img_delete('default', 'class="pictodelete paddingleft"');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
|
|
||||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
@ -1544,6 +1550,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
|||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
// Add line to split
|
// Add line to split
|
||||||
|
|
||||||
if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid)
|
if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid)
|
||||||
|
|||||||
@ -61,270 +61,268 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
|||||||
|
|
||||||
// Add file in email form
|
// Add file in email form
|
||||||
if (GETPOST('addfile', 'alpha') && !GETPOST('add', 'alpha')) {
|
if (GETPOST('addfile', 'alpha') && !GETPOST('add', 'alpha')) {
|
||||||
////$res = $object->fetch('','',GETPOST('track_id'));
|
////$res = $object->fetch('','',GETPOST('track_id'));
|
||||||
////if($res > 0)
|
////if($res > 0)
|
||||||
////{
|
////{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
// Set tmp directory TODO Use a dedicated directory for temp mails files
|
// Set tmp directory TODO Use a dedicated directory for temp mails files
|
||||||
$vardir = $conf->ticket->dir_output;
|
$vardir = $conf->ticket->dir_output;
|
||||||
$upload_dir_tmp = $vardir.'/temp/'.session_id();
|
$upload_dir_tmp = $vardir.'/temp/'.session_id();
|
||||||
if (!dol_is_dir($upload_dir_tmp)) {
|
if (!dol_is_dir($upload_dir_tmp)) {
|
||||||
dol_mkdir($upload_dir_tmp);
|
dol_mkdir($upload_dir_tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, '', 0);
|
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, '', 0);
|
||||||
$action = 'create_ticket';
|
$action = 'create_ticket';
|
||||||
////}
|
////}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove file
|
// Remove file
|
||||||
if (GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha')) {
|
if (GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha')) {
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
// Set tmp directory
|
// Set tmp directory
|
||||||
$vardir = $conf->ticket->dir_output.'/';
|
$vardir = $conf->ticket->dir_output.'/';
|
||||||
$upload_dir_tmp = $vardir.'/temp/'.session_id();
|
$upload_dir_tmp = $vardir.'/temp/'.session_id();
|
||||||
|
|
||||||
// TODO Delete only files that was uploaded from email form
|
// TODO Delete only files that was uploaded from email form
|
||||||
dol_remove_file_process($_POST['removedfile'], 0, 0);
|
dol_remove_file_process($_POST['removedfile'], 0, 0);
|
||||||
$action = 'create_ticket';
|
$action = 'create_ticket';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
|
if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$origin_email = GETPOST('email', 'alpha');
|
$origin_email = GETPOST('email', 'alpha');
|
||||||
if (empty($origin_email)) {
|
if (empty($origin_email)) {
|
||||||
$error++;
|
$error++;
|
||||||
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email")));
|
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email")));
|
||||||
$action = '';
|
$action = '';
|
||||||
} else {
|
} else {
|
||||||
// Search company saved with email
|
// Search company saved with email
|
||||||
$searched_companies = $object->searchSocidByEmail($origin_email, '0');
|
$searched_companies = $object->searchSocidByEmail($origin_email, '0');
|
||||||
|
|
||||||
// Chercher un contact existant avec cette adresse email
|
// Chercher un contact existant avec cette adresse email
|
||||||
// Le premier contact trouvé est utilisé pour déterminer le contact suivi
|
// Le premier contact trouvé est utilisé pour déterminer le contact suivi
|
||||||
$contacts = $object->searchContactByEmail($origin_email);
|
$contacts = $object->searchContactByEmail($origin_email);
|
||||||
|
|
||||||
// Option to require email exists to create ticket
|
// Option to require email exists to create ticket
|
||||||
if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && !$contacts[0]->socid) {
|
if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && !$contacts[0]->socid) {
|
||||||
$error++;
|
$error++;
|
||||||
array_push($object->errors, $langs->trans("ErrorEmailMustExistToCreateTicket"));
|
array_push($object->errors, $langs->trans("ErrorEmailMustExistToCreateTicket"));
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GETPOST("subject", "none")) {
|
if (!GETPOST("subject", "none")) {
|
||||||
$error++;
|
$error++;
|
||||||
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")));
|
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")));
|
||||||
$action = '';
|
$action = '';
|
||||||
} elseif (!GETPOST("message", "none")) {
|
} elseif (!GETPOST("message", "none")) {
|
||||||
$error++;
|
$error++;
|
||||||
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("message")));
|
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("message")));
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check email address
|
// Check email address
|
||||||
if (!isValidEmail($origin_email)) {
|
if (!isValidEmail($origin_email)) {
|
||||||
$error++;
|
$error++;
|
||||||
array_push($object->errors, $langs->trans("ErrorBadEmailAddress", $langs->transnoentities("email")));
|
array_push($object->errors, $langs->trans("ErrorBadEmailAddress", $langs->transnoentities("email")));
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$object->db->begin();
|
$object->db->begin();
|
||||||
|
|
||||||
$object->track_id = generate_random_id(16);
|
$object->track_id = generate_random_id(16);
|
||||||
|
|
||||||
$object->subject = GETPOST("subject", "none");
|
$object->subject = GETPOST("subject", "none");
|
||||||
$object->message = GETPOST("message", "none");
|
$object->message = GETPOST("message", "none");
|
||||||
$object->origin_email = $origin_email;
|
$object->origin_email = $origin_email;
|
||||||
|
|
||||||
$object->type_code = GETPOST("type_code", 'aZ09');
|
$object->type_code = GETPOST("type_code", 'aZ09');
|
||||||
$object->category_code = GETPOST("category_code", 'aZ09');
|
$object->category_code = GETPOST("category_code", 'aZ09');
|
||||||
$object->severity_code = GETPOST("severity_code", 'aZ09');
|
$object->severity_code = GETPOST("severity_code", 'aZ09');
|
||||||
if (is_array($searched_companies)) {
|
if (is_array($searched_companies)) {
|
||||||
$object->fk_soc = $searched_companies[0]->id;
|
$object->fk_soc = $searched_companies[0]->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($contacts) and count($contacts) > 0) {
|
if (is_array($contacts) and count($contacts) > 0) {
|
||||||
$object->fk_soc = $contacts[0]->socid;
|
$object->fk_soc = $contacts[0]->socid;
|
||||||
$usertoassign = $contacts[0]->id;
|
$usertoassign = $contacts[0]->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||||
|
|
||||||
// Generate new ref
|
// Generate new ref
|
||||||
$object->ref = $object->getDefaultRef();
|
$object->ref = $object->getDefaultRef();
|
||||||
if (!is_object($user)) {
|
if (!is_object($user)) {
|
||||||
$user = new User($db);
|
$user = new User($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$object->context['disableticketemail'] = 1; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later
|
$object->context['disableticketemail'] = 1; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later
|
||||||
|
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
if ($id <= 0) {
|
if ($id <= 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$errors = ($object->error ? array($object->error) : $object->errors);
|
$errors = ($object->error ? array($object->error) : $object->errors);
|
||||||
array_push($object->errors, $object->error ? array($object->error) : $object->errors);
|
array_push($object->errors, $object->error ? array($object->error) : $object->errors);
|
||||||
$action = 'create_ticket';
|
$action = 'create_ticket';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && $id > 0) {
|
if (!$error && $id > 0) {
|
||||||
if ($usertoassign > 0) {
|
if ($usertoassign > 0) {
|
||||||
$object->add_contact($usertoassign, "SUPPORTCLI", 'external', 0);
|
$object->add_contact($usertoassign, "SUPPORTCLI", 'external', 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$object->db->commit();
|
$object->db->commit();
|
||||||
$action = "infos_success";
|
$action = "infos_success";
|
||||||
} else {
|
} else {
|
||||||
$object->db->rollback();
|
$object->db->rollback();
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action = 'create_ticket';
|
$action = 'create_ticket';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$res = $object->fetch($id);
|
$res = $object->fetch($id);
|
||||||
if ($res) {
|
if ($res) {
|
||||||
// Create form object
|
// Create form object
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
$formmail = new FormMail($db);
|
$formmail = new FormMail($db);
|
||||||
|
|
||||||
// Init to avoid errors
|
// Init to avoid errors
|
||||||
$filepath = array();
|
$filepath = array();
|
||||||
$filename = array();
|
$filename = array();
|
||||||
$mimetype = array();
|
$mimetype = array();
|
||||||
|
|
||||||
$attachedfiles = $formmail->get_attached_files();
|
$attachedfiles = $formmail->get_attached_files();
|
||||||
$filepath = $attachedfiles['paths'];
|
$filepath = $attachedfiles['paths'];
|
||||||
$filename = $attachedfiles['names'];
|
$filename = $attachedfiles['names'];
|
||||||
$mimetype = $attachedfiles['mimes'];
|
$mimetype = $attachedfiles['mimes'];
|
||||||
|
|
||||||
// Send email to customer
|
// Send email to customer
|
||||||
|
|
||||||
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref, $object->track_id);
|
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref, $object->track_id);
|
||||||
$message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n";
|
$message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n";
|
||||||
$message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n";
|
$message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n";
|
||||||
|
|
||||||
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
|
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
|
||||||
$infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', '<a href="'.$url_public_ticket.'">'.$object->track_id.'</a>')."\n";
|
$infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', '<a href="'.$url_public_ticket.'">'.$object->track_id.'</a>')."\n";
|
||||||
$infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl')."\n\n";
|
$infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl')."\n\n";
|
||||||
|
|
||||||
$message .= dol_nl2br($infos_new_ticket);
|
$message .= dol_nl2br($infos_new_ticket);
|
||||||
$message .= $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->transnoentities('TicketMessageMailSignatureText');
|
$message .= $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->transnoentities('TicketMessageMailSignatureText');
|
||||||
|
|
||||||
$sendto = GETPOST('email', 'alpha');
|
$sendto = GETPOST('email', 'alpha');
|
||||||
|
|
||||||
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
||||||
$replyto = $from;
|
$replyto = $from;
|
||||||
$sendtocc = '';
|
$sendtocc = '';
|
||||||
$deliveryreceipt = 0;
|
$deliveryreceipt = 0;
|
||||||
|
|
||||||
$message = dol_nl2br($message);
|
$message = dol_nl2br($message);
|
||||||
|
|
||||||
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
||||||
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
||||||
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
|
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
|
||||||
}
|
}
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
|
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
|
||||||
if ($mailfile->error || $mailfile->errors) {
|
if ($mailfile->error || $mailfile->errors) {
|
||||||
setEventMessages($mailfile->error, $mailfile->errors, 'errors');
|
setEventMessages($mailfile->error, $mailfile->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
$result = $mailfile->sendfile();
|
$result = $mailfile->sendfile();
|
||||||
}
|
}
|
||||||
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
||||||
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
|
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send email to TICKET_NOTIFICATION_EMAIL_TO
|
||||||
|
$sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||||
|
if ($sendto)
|
||||||
|
{
|
||||||
|
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref, $object->track_id);
|
||||||
|
$message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n";
|
||||||
|
$message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
|
||||||
|
$message_admin .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
|
||||||
|
$message_admin .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
|
||||||
|
$message_admin .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
|
||||||
|
$message_admin .= '<li>'.$langs->trans('From').' : '.$object->origin_email.'</li>';
|
||||||
|
|
||||||
// Send email to TICKET_NOTIFICATION_EMAIL_TO
|
if (is_array($extrafields->attributes[$object->table_element]['label']))
|
||||||
|
{
|
||||||
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
|
{
|
||||||
|
$enabled = 1;
|
||||||
|
if ($qualified && isset($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
|
{
|
||||||
|
$enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1);
|
||||||
|
}
|
||||||
|
$perms = 1;
|
||||||
|
if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key]))
|
||||||
|
{
|
||||||
|
$perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1);
|
||||||
|
}
|
||||||
|
|
||||||
$sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
$qualified = true;
|
||||||
|
if (empty($enabled) || $enabled == 2) $qualified = false;
|
||||||
|
if (empty($perms)) $qualified = false;
|
||||||
|
if ($qualified) $message_admin .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($sendto)
|
$message_admin .= '</ul>';
|
||||||
{
|
$message_admin .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
|
||||||
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref, $object->track_id);
|
$message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
|
||||||
$message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n";
|
|
||||||
$message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
|
|
||||||
$message_admin .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
|
|
||||||
$message_admin .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
|
|
||||||
$message_admin .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
|
|
||||||
$message_admin .= '<li>'.$langs->trans('From').' : '.$object->origin_email.'</li>';
|
|
||||||
|
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']))
|
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
||||||
{
|
$replyto = $from;
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
|
||||||
{
|
|
||||||
$enabled = 1;
|
|
||||||
if ($qualified && isset($extrafields->attributes[$object->table_element]['list'][$key]))
|
|
||||||
{
|
|
||||||
$enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1);
|
|
||||||
}
|
|
||||||
$perms = 1;
|
|
||||||
if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key]))
|
|
||||||
{
|
|
||||||
$perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$qualified = true;
|
$message_admin = dol_nl2br($message_admin);
|
||||||
if (empty($enabled) || $enabled == 2) $qualified = false;
|
|
||||||
if (empty($perms)) $qualified = false;
|
|
||||||
if ($qualified) $message_admin .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$message_admin .= '</ul>';
|
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
||||||
$message_admin .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
|
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
||||||
$message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
|
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
|
||||||
|
}
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
|
$mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
|
||||||
|
if ($mailfile->error || $mailfile->errors) {
|
||||||
|
setEventMessages($mailfile->error, $mailfile->errors, 'errors');
|
||||||
|
} else {
|
||||||
|
$result = $mailfile->sendfile();
|
||||||
|
}
|
||||||
|
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
||||||
|
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
// Copy files into ticket directory
|
||||||
$replyto = $from;
|
$destdir = $conf->ticket->dir_output.'/'.$object->ref;
|
||||||
|
if (!dol_is_dir($destdir)) {
|
||||||
|
dol_mkdir($destdir);
|
||||||
|
}
|
||||||
|
foreach ($filename as $i => $val) {
|
||||||
|
dol_move($filepath[$i], $destdir.'/'.$filename[$i], 0, 1);
|
||||||
|
$formmail->remove_attached_files($i);
|
||||||
|
}
|
||||||
|
|
||||||
$message_admin = dol_nl2br($message_admin);
|
//setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs');
|
||||||
|
|
||||||
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
// Make a redirect to avoid to have ticket submitted twice if we make back
|
||||||
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
setEventMessages($langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '<strong>'.$object->track_id.'</strong>', '<strong>'.$object->ref.'</strong>'), null, 'warnings');
|
||||||
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
|
setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings');
|
||||||
}
|
header("Location: index.php");
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
|
||||||
$mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
|
|
||||||
if ($mailfile->error || $mailfile->errors) {
|
|
||||||
setEventMessages($mailfile->error, $mailfile->errors, 'errors');
|
|
||||||
} else {
|
|
||||||
$result = $mailfile->sendfile();
|
|
||||||
}
|
|
||||||
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
|
||||||
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy files into ticket directory
|
|
||||||
$destdir = $conf->ticket->dir_output.'/'.$object->ref;
|
|
||||||
if (!dol_is_dir($destdir)) {
|
|
||||||
dol_mkdir($destdir);
|
|
||||||
}
|
|
||||||
foreach ($filename as $i => $val) {
|
|
||||||
dol_move($filepath[$i], $destdir.'/'.$filename[$i], 0, 1);
|
|
||||||
$formmail->remove_attached_files($i);
|
|
||||||
}
|
|
||||||
|
|
||||||
//setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs');
|
|
||||||
|
|
||||||
// Make a redirect to avoid to have ticket submitted twice if we make back
|
|
||||||
setEventMessages($langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '<strong>'.$object->track_id.'</strong>', '<strong>'.$object->ref.'</strong>'), null, 'warnings');
|
|
||||||
setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings');
|
|
||||||
header("Location: index.php");
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -338,9 +336,9 @@ $formticket = new FormTicket($db);
|
|||||||
|
|
||||||
if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)
|
if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)
|
||||||
{
|
{
|
||||||
print '<div class="error">'.$langs->trans('TicketPublicInterfaceForbidden').'</div>';
|
print '<div class="error">'.$langs->trans('TicketPublicInterfaceForbidden').'</div>';
|
||||||
$db->close();
|
$db->close();
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$arrayofjs = array();
|
$arrayofjs = array();
|
||||||
@ -349,34 +347,34 @@ $arrayofcss = array('/opensurvey/css/style.css', '/ticket/css/styles.css.php');
|
|||||||
llxHeaderTicket($langs->trans("CreateTicket"), "", 0, 0, $arrayofjs, $arrayofcss);
|
llxHeaderTicket($langs->trans("CreateTicket"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||||
|
|
||||||
|
|
||||||
print '<div style="width:60%; margin: 0 auto;" class="ticketpublicarea">';
|
print '<div class="ticketpublicarea">';
|
||||||
|
|
||||||
if ($action != "infos_success") {
|
if ($action != "infos_success") {
|
||||||
$formticket->withfromsocid = isset($socid) ? $socid : $user->socid;
|
$formticket->withfromsocid = isset($socid) ? $socid : $user->socid;
|
||||||
$formticket->withtitletopic = 1;
|
$formticket->withtitletopic = 1;
|
||||||
$formticket->withcompany = 0;
|
$formticket->withcompany = 0;
|
||||||
$formticket->withusercreate = 1;
|
$formticket->withusercreate = 1;
|
||||||
$formticket->fk_user_create = 0;
|
$formticket->fk_user_create = 0;
|
||||||
$formticket->withemail = 1;
|
$formticket->withemail = 1;
|
||||||
$formticket->ispublic = 1;
|
$formticket->ispublic = 1;
|
||||||
$formticket->withfile = 2;
|
$formticket->withfile = 2;
|
||||||
$formticket->action = 'create_ticket';
|
$formticket->action = 'create_ticket';
|
||||||
|
|
||||||
$formticket->param = array('returnurl' => $_SERVER['PHP_SELF'].($conf->entity > 1 ? '?entity='.$conf->entity : ''));
|
$formticket->param = array('returnurl' => $_SERVER['PHP_SELF'].($conf->entity > 1 ? '?entity='.$conf->entity : ''));
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('NewTicket'), '', '', 0, 0, 'marginleftonly');
|
print load_fiche_titre($langs->trans('NewTicket'), '', '', 0, 0, 'marginleftonly');
|
||||||
|
|
||||||
if (empty($conf->global->TICKET_NOTIFICATION_EMAIL_FROM)) {
|
if (empty($conf->global->TICKET_NOTIFICATION_EMAIL_FROM)) {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
print '<div class="error">';
|
print '<div class="error">';
|
||||||
print $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketEmailNotificationFrom")).'<br>';
|
print $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketEmailNotificationFrom")).'<br>';
|
||||||
print $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentities("Ticket"));
|
print $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentities("Ticket"));
|
||||||
print '<div>';
|
print '<div>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<div class="info marginleftonly marginrightonly">'.$langs->trans('TicketPublicInfoCreateTicket').'</div>';
|
print '<div class="info marginleftonly marginrightonly">'.$langs->trans('TicketPublicInfoCreateTicket').'</div>';
|
||||||
$formticket->showForm();
|
$formticket->showForm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -67,12 +67,12 @@ $arrayofcss = array('/ticket/css/styles.css.php');
|
|||||||
|
|
||||||
llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
|
llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||||
|
|
||||||
print '<div style="margin: 0 auto; width:60%" class="ticketpublicarea">';
|
print '<div class="ticketpublicarea">';
|
||||||
print '<p style="text-align: center">'.($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")).'</p>';
|
print '<p style="text-align: center">'.($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")).'</p>';
|
||||||
print '<div class="ticketform">';
|
print '<div class="ticketform">';
|
||||||
print '<a href="create_ticket.php" class=""><div class="index_create orange bigrounded">'.dol_escape_htmltag($langs->trans("CreateTicket")).'</div></a>';
|
print '<a href="create_ticket.php" class="butAction marginbottomonly"><div class="index_create bigrounded"><span class="fa fa-plus-circle valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("CreateTicket")).'</div></a>';
|
||||||
print '<a href="list.php" class=""><div class="index_display blue bigrounded">'.dol_escape_htmltag($langs->trans("ShowListTicketWithTrackId")).'</div></a>';
|
print '<a href="list.php" class="butAction marginbottomonly"><div class="index_display bigrounded"><span class="fa fa-list-alt valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("ViewMyTicketList")).'</div></a>';
|
||||||
print '<a href="view.php" class=""><div class="index_display blue bigrounded">'.dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")).'</div></a>';
|
print '<a href="view.php" class="butAction marginbottomonly"><div class="index_display bigrounded">'.img_picto('', 'ticket').'<br>'.dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")).'</div></a>';
|
||||||
print '<div style="clear:both;"></div>';
|
print '<div style="clear:both;"></div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -170,7 +170,7 @@ $arrayofcss = array('/ticket/css/styles.css.php');
|
|||||||
llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
|
llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||||
|
|
||||||
|
|
||||||
print '<div style="margin: 0 auto; width:60%" class="ticketpublicarea">';
|
print '<div class="ticketpublicarealist">';
|
||||||
|
|
||||||
if ($action == "view_ticketlist")
|
if ($action == "view_ticketlist")
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,15 +23,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('NOCSRFCHECK')) {
|
if (!defined('NOCSRFCHECK')) {
|
||||||
define('NOCSRFCHECK', '1');
|
define('NOCSRFCHECK', '1');
|
||||||
}
|
}
|
||||||
// Do not check anti CSRF attack test
|
// Do not check anti CSRF attack test
|
||||||
if (!defined('NOREQUIREMENU')) {
|
if (!defined('NOREQUIREMENU')) {
|
||||||
define('NOREQUIREMENU', '1');
|
define('NOREQUIREMENU', '1');
|
||||||
}
|
}
|
||||||
// If there is no need to load and show top and left menu
|
// If there is no need to load and show top and left menu
|
||||||
if (!defined("NOLOGIN")) {
|
if (!defined("NOLOGIN")) {
|
||||||
define("NOLOGIN", '1');
|
define("NOLOGIN", '1');
|
||||||
}
|
}
|
||||||
// If this page is public (can be called outside logged session)
|
// If this page is public (can be called outside logged session)
|
||||||
|
|
||||||
@ -54,10 +54,10 @@ $action = GETPOST('action', 'aZ09');
|
|||||||
$email = GETPOST('email', 'alpha');
|
$email = GETPOST('email', 'alpha');
|
||||||
|
|
||||||
if (GETPOST('btn_view_ticket')) {
|
if (GETPOST('btn_view_ticket')) {
|
||||||
unset($_SESSION['email_customer']);
|
unset($_SESSION['email_customer']);
|
||||||
}
|
}
|
||||||
if (isset($_SESSION['email_customer'])) {
|
if (isset($_SESSION['email_customer'])) {
|
||||||
$email = $_SESSION['email_customer'];
|
$email = $_SESSION['email_customer'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = new ActionsTicket($db);
|
$object = new ActionsTicket($db);
|
||||||
@ -78,121 +78,121 @@ if ($cancel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close" || $action == "add_message") {
|
if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close" || $action == "add_message") {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$display_ticket = false;
|
$display_ticket = false;
|
||||||
if (!strlen($track_id)) {
|
if (!strlen($track_id)) {
|
||||||
$error++;
|
$error++;
|
||||||
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketTrackId")));
|
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketTrackId")));
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
if (!strlen($email)) {
|
if (!strlen($email)) {
|
||||||
$error++;
|
$error++;
|
||||||
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email")));
|
array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email")));
|
||||||
$action = '';
|
$action = '';
|
||||||
} else {
|
} else {
|
||||||
if (!isValidEmail($email)) {
|
if (!isValidEmail($email)) {
|
||||||
$error++;
|
$error++;
|
||||||
array_push($object->errors, $langs->trans("ErrorEmailInvalid"));
|
array_push($object->errors, $langs->trans("ErrorEmailInvalid"));
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$ret = $object->fetch('', '', $track_id);
|
$ret = $object->fetch('', '', $track_id);
|
||||||
if ($ret && $object->dao->id > 0) {
|
if ($ret && $object->dao->id > 0) {
|
||||||
// Check if emails provided is the one of author
|
// Check if emails provided is the one of author
|
||||||
$emailofticket = CMailFile::getValidAddress($object->dao->origin_email, 2);
|
$emailofticket = CMailFile::getValidAddress($object->dao->origin_email, 2);
|
||||||
if ($emailofticket == $email)
|
if ($emailofticket == $email)
|
||||||
{
|
{
|
||||||
$display_ticket = true;
|
$display_ticket = true;
|
||||||
$_SESSION['email_customer'] = $email;
|
$_SESSION['email_customer'] = $email;
|
||||||
}
|
}
|
||||||
// Check if emails provided is inside list of contacts
|
// Check if emails provided is inside list of contacts
|
||||||
else {
|
else {
|
||||||
$contacts = $object->dao->liste_contact(-1, 'external');
|
$contacts = $object->dao->liste_contact(-1, 'external');
|
||||||
foreach ($contacts as $contact) {
|
foreach ($contacts as $contact) {
|
||||||
if ($contact['email'] == $email) {
|
if ($contact['email'] == $email) {
|
||||||
$display_ticket = true;
|
$display_ticket = true;
|
||||||
$_SESSION['email_customer'] = $email;
|
$_SESSION['email_customer'] = $email;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
$display_ticket = false;
|
$display_ticket = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check email of thirdparty of ticket
|
// Check email of thirdparty of ticket
|
||||||
if ($object->dao->fk_soc > 0 || $object->dao->socid > 0) {
|
if ($object->dao->fk_soc > 0 || $object->dao->socid > 0) {
|
||||||
$object->dao->fetch_thirdparty();
|
$object->dao->fetch_thirdparty();
|
||||||
if ($email == $object->dao->thirdparty->email) {
|
if ($email == $object->dao->thirdparty->email) {
|
||||||
$display_ticket = true;
|
$display_ticket = true;
|
||||||
$_SESSION['email_customer'] = $email;
|
$_SESSION['email_customer'] = $email;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check if email is email of creator
|
// Check if email is email of creator
|
||||||
if ($object->dao->fk_user_create > 0)
|
if ($object->dao->fk_user_create > 0)
|
||||||
{
|
{
|
||||||
$tmpuser = new User($db);
|
$tmpuser = new User($db);
|
||||||
$tmpuser->fetch($object->dao->fk_user_create);
|
$tmpuser->fetch($object->dao->fk_user_create);
|
||||||
if ($email == $tmpuser->email) {
|
if ($email == $tmpuser->email) {
|
||||||
$display_ticket = true;
|
$display_ticket = true;
|
||||||
$_SESSION['email_customer'] = $email;
|
$_SESSION['email_customer'] = $email;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check if email is email of creator
|
// Check if email is email of creator
|
||||||
if ($object->dao->fk_user_assign > 0 && $object->dao->fk_user_assign != $object->dao->fk_user_create)
|
if ($object->dao->fk_user_assign > 0 && $object->dao->fk_user_assign != $object->dao->fk_user_create)
|
||||||
{
|
{
|
||||||
$tmpuser = new User($db);
|
$tmpuser = new User($db);
|
||||||
$tmpuser->fetch($object->dao->fk_user_assign);
|
$tmpuser->fetch($object->dao->fk_user_assign);
|
||||||
if ($email == $tmpuser->email) {
|
if ($email == $tmpuser->email) {
|
||||||
$display_ticket = true;
|
$display_ticket = true;
|
||||||
$_SESSION['email_customer'] = $email;
|
$_SESSION['email_customer'] = $email;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$error++;
|
$error++;
|
||||||
array_push($object->errors, $langs->trans("ErrorTicketNotFound", $track_id));
|
array_push($object->errors, $langs->trans("ErrorTicketNotFound", $track_id));
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && $action == 'confirm_public_close' && $display_ticket)
|
if (!$error && $action == 'confirm_public_close' && $display_ticket)
|
||||||
{
|
{
|
||||||
if ($object->dao->close($user)) {
|
if ($object->dao->close($user)) {
|
||||||
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
|
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
|
||||||
|
|
||||||
$url = 'view.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha');
|
$url = 'view.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha');
|
||||||
header("Location: ".$url);
|
header("Location: ".$url);
|
||||||
} else {
|
} else {
|
||||||
$action = '';
|
$action = '';
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message'))
|
if (!$error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message'))
|
||||||
{
|
{
|
||||||
// TODO Add message...
|
// TODO Add message...
|
||||||
$ret = $object->dao->newMessage($user, $action, 0);
|
$ret = $object->dao->newMessage($user, $action, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$action = 'view_ticket';
|
$action = 'view_ticket';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error || $errors) {
|
if ($error || $errors) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
if ($action == "add_message")
|
if ($action == "add_message")
|
||||||
{
|
{
|
||||||
$action = 'presend';
|
$action = 'presend';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//var_dump($action);
|
//var_dump($action);
|
||||||
//$object->doActions($action);
|
//$object->doActions($action);
|
||||||
@ -224,181 +224,181 @@ $arrayofcss = array('/ticket/css/styles.css.php');
|
|||||||
|
|
||||||
llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
|
llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||||
|
|
||||||
print '<div style="margin: 0 auto;" class="ticketpublicarea">';
|
print '<div class="ticketpublicarea">';
|
||||||
|
|
||||||
if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close") {
|
if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close") {
|
||||||
if ($display_ticket)
|
if ($display_ticket)
|
||||||
{
|
{
|
||||||
// Confirmation close
|
// Confirmation close
|
||||||
if ($action == 'close') {
|
if ($action == 'close') {
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?track_id=".$track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1);
|
print $form->formconfirm($_SERVER["PHP_SELF"]."?track_id=".$track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<div id="form_view_ticket" class="margintoponly">';
|
print '<div id="form_view_ticket" class="margintoponly">';
|
||||||
|
|
||||||
print '<table class="ticketpublictable centpercent tableforfield">';
|
print '<table class="ticketpublictable centpercent tableforfield">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
||||||
print $object->dao->ref;
|
print $object->dao->ref;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Tracking ID
|
// Tracking ID
|
||||||
print '<tr><td>'.$langs->trans("TicketTrackId").'</td><td>';
|
print '<tr><td>'.$langs->trans("TicketTrackId").'</td><td>';
|
||||||
print $object->dao->track_id;
|
print $object->dao->track_id;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Subject
|
// Subject
|
||||||
print '<tr><td>'.$langs->trans("Subject").'</td><td>';
|
print '<tr><td>'.$langs->trans("Subject").'</td><td>';
|
||||||
print $object->dao->subject;
|
print $object->dao->subject;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||||
print $object->dao->getLibStatut(2);
|
print $object->dao->getLibStatut(2);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
||||||
print $object->dao->type_label;
|
print $object->dao->type_label;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Category
|
// Category
|
||||||
print '<tr><td>'.$langs->trans("Category").'</td><td>';
|
print '<tr><td>'.$langs->trans("Category").'</td><td>';
|
||||||
print $object->dao->category_label;
|
print $object->dao->category_label;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Severity
|
// Severity
|
||||||
print '<tr><td>'.$langs->trans("Severity").'</td><td>';
|
print '<tr><td>'.$langs->trans("Severity").'</td><td>';
|
||||||
print $object->dao->severity_label;
|
print $object->dao->severity_label;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Creation date
|
// Creation date
|
||||||
print '<tr><td>'.$langs->trans("DateCreation").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateCreation").'</td><td>';
|
||||||
print dol_print_date($object->dao->datec, 'dayhour');
|
print dol_print_date($object->dao->datec, 'dayhour');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Author
|
// Author
|
||||||
print '<tr><td>'.$langs->trans("Author").'</td><td>';
|
print '<tr><td>'.$langs->trans("Author").'</td><td>';
|
||||||
if ($object->dao->fk_user_create > 0) {
|
if ($object->dao->fk_user_create > 0) {
|
||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
$fuser = new User($db);
|
$fuser = new User($db);
|
||||||
$fuser->fetch($object->dao->fk_user_create);
|
$fuser->fetch($object->dao->fk_user_create);
|
||||||
print $fuser->getFullName($langs);
|
print $fuser->getFullName($langs);
|
||||||
} else {
|
} else {
|
||||||
print dol_escape_htmltag($object->dao->origin_email);
|
print dol_escape_htmltag($object->dao->origin_email);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Read date
|
// Read date
|
||||||
if (!empty($object->dao->date_read)) {
|
if (!empty($object->dao->date_read)) {
|
||||||
print '<tr><td>'.$langs->trans("TicketReadOn").'</td><td>';
|
print '<tr><td>'.$langs->trans("TicketReadOn").'</td><td>';
|
||||||
print dol_print_date($object->dao->date_read, 'dayhour');
|
print dol_print_date($object->dao->date_read, 'dayhour');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close date
|
// Close date
|
||||||
if (!empty($object->dao->date_close)) {
|
if (!empty($object->dao->date_close)) {
|
||||||
print '<tr><td>'.$langs->trans("TicketCloseOn").'</td><td>';
|
print '<tr><td>'.$langs->trans("TicketCloseOn").'</td><td>';
|
||||||
print dol_print_date($object->dao->date_close, 'dayhour');
|
print dol_print_date($object->dao->date_close, 'dayhour');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// User assigned
|
// User assigned
|
||||||
print '<tr><td>'.$langs->trans("AssignedTo").'</td><td>';
|
print '<tr><td>'.$langs->trans("AssignedTo").'</td><td>';
|
||||||
if ($object->dao->fk_user_assign > 0) {
|
if ($object->dao->fk_user_assign > 0) {
|
||||||
$fuser = new User($db);
|
$fuser = new User($db);
|
||||||
$fuser->fetch($object->dao->fk_user_assign);
|
$fuser->fetch($object->dao->fk_user_assign);
|
||||||
print $fuser->getFullName($langs, 1);
|
print $fuser->getFullName($langs, 1);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Progression
|
// Progression
|
||||||
print '<tr><td>'.$langs->trans("Progression").'</td><td>';
|
print '<tr><td>'.$langs->trans("Progression").'</td><td>';
|
||||||
print ($object->dao->progress > 0 ? $object->dao->progress : '0').'%';
|
print ($object->dao->progress > 0 ? $object->dao->progress : '0').'%';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div style="clear: both; margin-top: 1.5em;"></div>';
|
print '<div style="clear: both; margin-top: 1.5em;"></div>';
|
||||||
|
|
||||||
if ($action == 'presend') {
|
if ($action == 'presend') {
|
||||||
print load_fiche_titre($langs->trans('TicketAddMessage'), '', 'messages@ticket');
|
print load_fiche_titre($langs->trans('TicketAddMessage'), '', 'messages@ticket');
|
||||||
|
|
||||||
$formticket = new FormTicket($db);
|
$formticket = new FormTicket($db);
|
||||||
|
|
||||||
$formticket->action = "add_message";
|
$formticket->action = "add_message";
|
||||||
$formticket->track_id = $object->dao->track_id;
|
$formticket->track_id = $object->dao->track_id;
|
||||||
$formticket->id = $object->dao->id;
|
$formticket->id = $object->dao->id;
|
||||||
|
|
||||||
$formticket->param = array('track_id' => $object->dao->track_id, 'fk_user_create' => '-1', 'returnurl' => DOL_URL_ROOT.'/public/ticket/view.php');
|
$formticket->param = array('track_id' => $object->dao->track_id, 'fk_user_create' => '-1', 'returnurl' => DOL_URL_ROOT.'/public/ticket/view.php');
|
||||||
|
|
||||||
$formticket->withfile = 2;
|
$formticket->withfile = 2;
|
||||||
$formticket->withcancel = 1;
|
$formticket->withcancel = 1;
|
||||||
|
|
||||||
$formticket->showMessageForm('100%');
|
$formticket->showMessageForm('100%');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action != 'presend') {
|
if ($action != 'presend') {
|
||||||
print '<form method="post" id="form_view_ticket_list" name="form_view_ticket_list" enctype="multipart/form-data" action="'.DOL_URL_ROOT.'/public/ticket/list.php">';
|
print '<form method="post" id="form_view_ticket_list" name="form_view_ticket_list" enctype="multipart/form-data" action="'.DOL_URL_ROOT.'/public/ticket/list.php">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="view_ticketlist">';
|
print '<input type="hidden" name="action" value="view_ticketlist">';
|
||||||
print '<input type="hidden" name="track_id" value="'.$object->dao->track_id.'">';
|
print '<input type="hidden" name="track_id" value="'.$object->dao->track_id.'">';
|
||||||
print '<input type="hidden" name="email" value="'.$_SESSION['email_customer'].'">';
|
print '<input type="hidden" name="email" value="'.$_SESSION['email_customer'].'">';
|
||||||
//print '<input type="hidden" name="search_fk_status" value="non_closed">';
|
//print '<input type="hidden" name="search_fk_status" value="non_closed">';
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
// List ticket
|
// List ticket
|
||||||
print '<div class="inline-block divButAction"><a class="left" style="padding-right: 50px" href="javascript:$(\'#form_view_ticket_list\').submit();">'.$langs->trans('ViewMyTicketList').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="left" style="padding-right: 50px" href="javascript:$(\'#form_view_ticket_list\').submit();">'.$langs->trans('ViewMyTicketList').'</a></div>';
|
||||||
|
|
||||||
if ($object->dao->fk_statut < Ticket::STATUS_CLOSED) {
|
if ($object->dao->fk_statut < Ticket::STATUS_CLOSED) {
|
||||||
// New message
|
// New message
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=presend&mode=init&track_id='.$object->dao->track_id.'">'.$langs->trans('AddMessage').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=presend&mode=init&track_id='.$object->dao->track_id.'">'.$langs->trans('AddMessage').'</a></div>';
|
||||||
|
|
||||||
// Close ticket
|
// Close ticket
|
||||||
if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) {
|
if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=close&track_id='.$object->dao->track_id.'">'.$langs->trans('CloseTicket').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=close&track_id='.$object->dao->track_id.'">'.$langs->trans('CloseTicket').'</a></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message list
|
// Message list
|
||||||
print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'messages@ticket');
|
print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'messages@ticket');
|
||||||
$object->viewTicketMessages(false, true, $object->dao);
|
$object->viewTicketMessages(false, true, $object->dao);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<div class="error">Not Allowed<br><a href="'.$_SERVER['PHP_SELF'].'?track_id='.$object->dao->track_id.'">'.$langs->trans('Back').'</a></div>';
|
print '<div class="error">Not Allowed<br><a href="'.$_SERVER['PHP_SELF'].'?track_id='.$object->dao->track_id.'">'.$langs->trans('Back').'</a></div>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<div class="center opacitymedium margintoponly marginbottomonly">'.$langs->trans("TicketPublicMsgViewLogIn").'</div>';
|
print '<div class="center opacitymedium margintoponly marginbottomonly">'.$langs->trans("TicketPublicMsgViewLogIn").'</div>';
|
||||||
|
|
||||||
print '<div id="form_view_ticket">';
|
print '<div id="form_view_ticket">';
|
||||||
print '<form method="post" name="form_view_ticket" enctype="multipart/form-data" action="'.$_SERVER['PHP_SELF'].'">';
|
print '<form method="post" name="form_view_ticket" enctype="multipart/form-data" action="'.$_SERVER['PHP_SELF'].'">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="view_ticket">';
|
print '<input type="hidden" name="action" value="view_ticket">';
|
||||||
|
|
||||||
print '<p><label for="track_id" style="display: inline-block; width: 30%; "><span class="fieldrequired">'.$langs->trans("TicketTrackId").'</span></label>';
|
print '<p><label for="track_id" style="display: inline-block; width: 30%; "><span class="fieldrequired">'.$langs->trans("TicketTrackId").'</span></label>';
|
||||||
print '<input size="30" id="track_id" name="track_id" value="'.(GETPOST('track_id', 'alpha') ? GETPOST('track_id', 'alpha') : '').'" />';
|
print '<input size="30" id="track_id" name="track_id" value="'.(GETPOST('track_id', 'alpha') ? GETPOST('track_id', 'alpha') : '').'" />';
|
||||||
print '</p>';
|
print '</p>';
|
||||||
|
|
||||||
print '<p><label for="email" style="display: inline-block; width: 30%; "><span class="fieldrequired">'.$langs->trans('Email').'</span></label>';
|
print '<p><label for="email" style="display: inline-block; width: 30%; "><span class="fieldrequired">'.$langs->trans('Email').'</span></label>';
|
||||||
print '<input size="30" id="email" name="email" value="'.(GETPOST('email', 'alpha') ? GETPOST('email', 'alpha') : $_SESSION['customer_email']).'" />';
|
print '<input size="30" id="email" name="email" value="'.(GETPOST('email', 'alpha') ? GETPOST('email', 'alpha') : $_SESSION['customer_email']).'" />';
|
||||||
print '</p>';
|
print '</p>';
|
||||||
|
|
||||||
print '<p style="text-align: center; margin-top: 1.5em;">';
|
print '<p style="text-align: center; margin-top: 1.5em;">';
|
||||||
print '<input class="button" type="submit" name="btn_view_ticket" value="'.$langs->trans('ViewTicket').'" />';
|
print '<input class="button" type="submit" name="btn_view_ticket" value="'.$langs->trans('ViewTicket').'" />';
|
||||||
print "</p>\n";
|
print "</p>\n";
|
||||||
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|||||||
@ -212,6 +212,8 @@ class Reception extends CommonObject
|
|||||||
$this->brouillon = 1;
|
$this->brouillon = 1;
|
||||||
$this->tracking_number = dol_sanitizeFileName($this->tracking_number);
|
$this->tracking_number = dol_sanitizeFileName($this->tracking_number);
|
||||||
if (empty($this->fk_project)) $this->fk_project = 0;
|
if (empty($this->fk_project)) $this->fk_project = 0;
|
||||||
|
if (empty($this->weight_units)) $this->weight_units = 0;
|
||||||
|
if (empty($this->size_units)) $this->size_units = 0;
|
||||||
|
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
||||||
|
|||||||
@ -108,13 +108,14 @@ class Contacts extends DolibarrApi
|
|||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
* @param int $page Page number
|
* @param int $page Page number
|
||||||
* @param string $thirdparty_ids Thirdparty ids to filter contacts of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
|
* @param string $thirdparty_ids Thirdparty ids to filter contacts of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
|
||||||
|
* @param int $category Use this param to filter list by category
|
||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||||
* @param int $includecount Count and return also number of elements the contact is used as a link for
|
* @param int $includecount Count and return also number of elements the contact is used as a link for
|
||||||
* @return array Array of contact objects
|
* @return array Array of contact objects
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $includecount = 0)
|
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $category = 0, $sqlfilters = '', $includecount = 0)
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
@ -135,6 +136,9 @@ class Contacts extends DolibarrApi
|
|||||||
|
|
||||||
$sql = "SELECT t.rowid";
|
$sql = "SELECT t.rowid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t";
|
||||||
|
if ($category > 0) {
|
||||||
|
$sql .= ", ".MAIN_DB_PREFIX."categorie_contact as c";
|
||||||
|
}
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as te ON te.fk_object = t.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as te ON te.fk_object = t.rowid";
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||||
// We need this table joined to the select in order to filter by sale
|
// We need this table joined to the select in order to filter by sale
|
||||||
@ -153,6 +157,13 @@ class Contacts extends DolibarrApi
|
|||||||
{
|
{
|
||||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Select contacts of given category
|
||||||
|
if ($category > 0) {
|
||||||
|
$sql .= " AND c.fk_categorie = ".$db->escape($category);
|
||||||
|
$sql .= " AND c.fk_socpeople = t.rowid ";
|
||||||
|
}
|
||||||
|
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -107,10 +107,11 @@ class Thirdparties extends DolibarrApi
|
|||||||
* Set to 2 to show only prospects
|
* Set to 2 to show only prospects
|
||||||
* Set to 3 to show only those are not customer neither prospect
|
* Set to 3 to show only those are not customer neither prospect
|
||||||
* Set to 4 to show only suppliers
|
* Set to 4 to show only suppliers
|
||||||
|
* @param int $category Use this param to filter list by category
|
||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.nom:like:'TheCompany%') and (t.date_creation:<:'20160101')"
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.nom:like:'TheCompany%') and (t.date_creation:<:'20160101')"
|
||||||
* @return array Array of thirdparty objects
|
* @return array Array of thirdparty objects
|
||||||
*/
|
*/
|
||||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $sqlfilters = '')
|
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
@ -126,15 +127,27 @@ class Thirdparties extends DolibarrApi
|
|||||||
$sql = "SELECT t.rowid";
|
$sql = "SELECT t.rowid";
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as t";
|
||||||
|
if ($category > 0) {
|
||||||
|
if ($mode != 4) $sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c";
|
||||||
|
if (!in_array($mode, array(1,2,3))) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc";
|
||||||
|
}
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||||
$sql .= " WHERE t.fk_stcomm = st.id";
|
$sql .= " WHERE t.entity IN ('.getEntity('societe').')";
|
||||||
|
$sql .= " AND t.fk_stcomm = st.id";
|
||||||
|
|
||||||
if ($mode == 1) $sql .= " AND t.client IN (1, 3)";
|
if ($mode == 1) $sql .= " AND t.client IN (1, 3)";
|
||||||
if ($mode == 2) $sql .= " AND t.client IN (2, 3)";
|
if ($mode == 2) $sql .= " AND t.client IN (2, 3)";
|
||||||
if ($mode == 3) $sql .= " AND t.client IN (0)";
|
if ($mode == 3) $sql .= " AND t.client IN (0)";
|
||||||
if ($mode == 4) $sql .= " AND t.fournisseur IN (1)";
|
if ($mode == 4) $sql .= " AND t.fournisseur IN (1)";
|
||||||
$sql .= ' AND t.entity IN ('.getEntity('societe').')';
|
|
||||||
|
// Select thirdparties of given category
|
||||||
|
if ($category > 0) {
|
||||||
|
if (!empty($mode) && $mode != 4) { $sql .= " AND c.fk_categorie = ".$db->escape($category)." AND c.fk_soc = t.rowid"; }
|
||||||
|
elseif (!empty($mode) && $mode == 4) { $sql .= " AND cc.fk_categorie = ".$db->escape($category)." AND cc.fk_soc = t.rowid"; }
|
||||||
|
else { $sql .= " AND ((c.fk_categorie = ".$db->escape($category)." AND c.fk_soc = t.rowid) OR (cc.fk_categorie = ".$db->escape($category)." AND cc.fk_soc = t.rowid))"; }
|
||||||
|
}
|
||||||
|
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc";
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc";
|
||||||
//if ($email != NULL) $sql.= " AND s.email = \"".$email."\"";
|
//if ($email != NULL) $sql.= " AND s.email = \"".$email."\"";
|
||||||
if ($socids) $sql .= " AND t.rowid IN (".$socids.")";
|
if ($socids) $sql .= " AND t.rowid IN (".$socids.")";
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
||||||
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
* Copyright (C) 2019-2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -965,7 +965,7 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
elseif ($rescode == -5)
|
elseif ($rescode == -5)
|
||||||
{
|
{
|
||||||
$this->errors[] = 'ErrorprefixRequired';
|
$this->errors[] = 'ErrorPrefixRequired';
|
||||||
}
|
}
|
||||||
$result = -3;
|
$result = -3;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,7 +58,7 @@ span.butAction, span.butActionDelete {
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em !important;
|
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em;
|
||||||
padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
|
padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
|
||||||
font-family: <?php print $fontlist ?>;
|
font-family: <?php print $fontlist ?>;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|||||||
@ -296,6 +296,7 @@ input.buttonpaymentstripe {
|
|||||||
a.buttonticket {
|
a.buttonticket {
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
|
/* height: 40px; */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Used by timesheets */
|
/* Used by timesheets */
|
||||||
@ -797,9 +798,15 @@ select.flat.selectlimit {
|
|||||||
.margintoponly {
|
.margintoponly {
|
||||||
margin-top: 10px !important;
|
margin-top: 10px !important;
|
||||||
}
|
}
|
||||||
|
.margintoponlyshort {
|
||||||
|
margin-top: 3px !important;
|
||||||
|
}
|
||||||
.marginbottomonly {
|
.marginbottomonly {
|
||||||
margin-bottom: 10px !important;
|
margin-bottom: 10px !important;
|
||||||
}
|
}
|
||||||
|
.marginbottomonlyshort {
|
||||||
|
margin-bottom: 3px !important;
|
||||||
|
}
|
||||||
.nomargintop {
|
.nomargintop {
|
||||||
margin-top: 0 !important;
|
margin-top: 0 !important;
|
||||||
}
|
}
|
||||||
@ -5817,7 +5824,8 @@ div.tabsElem a.tab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ticketpublicarea {
|
.ticketpublicarea {
|
||||||
width: 70%;
|
margin-left: 15%;
|
||||||
|
margin-right: 15%;
|
||||||
}
|
}
|
||||||
.publicnewticketform {
|
.publicnewticketform {
|
||||||
/* margin-top: 25px !important; */
|
/* margin-top: 25px !important; */
|
||||||
@ -5833,7 +5841,8 @@ div.tabsElem a.tab {
|
|||||||
padding-left: 5px; padding-right: 5px;
|
padding-left: 5px; padding-right: 5px;
|
||||||
}
|
}
|
||||||
.ticketpublicarea {
|
.ticketpublicarea {
|
||||||
width: 100% !important;
|
margin-left: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5808,7 +5808,8 @@ border-top-right-radius: 6px;
|
|||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|
||||||
.ticketpublicarea {
|
.ticketpublicarea {
|
||||||
width: 70%;
|
margin-left: 15%;
|
||||||
|
margin-right: 15%;
|
||||||
}
|
}
|
||||||
.publicnewticketform {
|
.publicnewticketform {
|
||||||
/* margin-top: 25px !important; */
|
/* margin-top: 25px !important; */
|
||||||
@ -5824,7 +5825,8 @@ border-top-right-radius: 6px;
|
|||||||
padding-left: 5px; padding-right: 5px;
|
padding-left: 5px; padding-right: 5px;
|
||||||
}
|
}
|
||||||
.ticketpublicarea {
|
.ticketpublicarea {
|
||||||
width: 100%;
|
margin-left: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -35,406 +35,406 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
|||||||
*/
|
*/
|
||||||
class ActionsTicket
|
class ActionsTicket
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var DoliDB Database handler.
|
* @var DoliDB Database handler.
|
||||||
*/
|
*/
|
||||||
public $db;
|
public $db;
|
||||||
|
|
||||||
public $dao;
|
public $dao;
|
||||||
|
|
||||||
public $mesg;
|
public $mesg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Error code (or message)
|
* @var string Error code (or message)
|
||||||
*/
|
*/
|
||||||
public $error;
|
public $error;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[] Error codes (or messages)
|
* @var string[] Error codes (or messages)
|
||||||
*/
|
*/
|
||||||
public $errors = array();
|
public $errors = array();
|
||||||
|
|
||||||
//! Numero de l'erreur
|
//! Numero de l'erreur
|
||||||
public $errno = 0;
|
public $errno = 0;
|
||||||
|
|
||||||
public $template_dir;
|
public $template_dir;
|
||||||
public $template;
|
public $template;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string ticket action label
|
* @var string ticket action label
|
||||||
*/
|
*/
|
||||||
public $label;
|
public $label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string description
|
* @var string description
|
||||||
*/
|
*/
|
||||||
public $description;
|
public $description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID
|
||||||
*/
|
*/
|
||||||
public $fk_statut;
|
public $fk_statut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Thirdparty ID
|
* @var int Thirdparty ID
|
||||||
*/
|
*/
|
||||||
public $fk_soc;
|
public $fk_soc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
public function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiation of DAO class
|
* Instantiation of DAO class
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function getInstanceDao()
|
public function getInstanceDao()
|
||||||
{
|
{
|
||||||
if (!is_object($this->dao)) {
|
if (!is_object($this->dao)) {
|
||||||
$this->dao = new Ticket($this->db);
|
$this->dao = new Ticket($this->db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch object
|
* Fetch object
|
||||||
*
|
*
|
||||||
* @param int $id ID of ticket
|
* @param int $id ID of ticket
|
||||||
* @param string $ref Reference of ticket
|
* @param string $ref Reference of ticket
|
||||||
* @param string $track_id Track ID of ticket (for public area)
|
* @param string $track_id Track ID of ticket (for public area)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function fetch($id = 0, $ref = '', $track_id = '')
|
public function fetch($id = 0, $ref = '', $track_id = '')
|
||||||
{
|
{
|
||||||
$this->getInstanceDao();
|
$this->getInstanceDao();
|
||||||
return $this->dao->fetch($id, $ref, $track_id);
|
return $this->dao->fetch($id, $ref, $track_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print statut
|
* Print statut
|
||||||
*
|
*
|
||||||
* @param int $mode Display mode
|
* @param int $mode Display mode
|
||||||
* @return string Label of status
|
* @return string Label of status
|
||||||
*/
|
*/
|
||||||
public function getLibStatut($mode = 0)
|
public function getLibStatut($mode = 0)
|
||||||
{
|
{
|
||||||
$this->getInstanceDao();
|
$this->getInstanceDao();
|
||||||
$this->dao->fk_statut = $this->fk_statut;
|
$this->dao->fk_statut = $this->fk_statut;
|
||||||
return $this->dao->getLibStatut($mode);
|
return $this->dao->getLibStatut($mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ticket info
|
* Get ticket info
|
||||||
*
|
*
|
||||||
* @param int $id Object id
|
* @param int $id Object id
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function getInfo($id)
|
public function getInfo($id)
|
||||||
{
|
{
|
||||||
$this->getInstanceDao();
|
$this->getInstanceDao();
|
||||||
$this->dao->fetch($id, '', $track_id);
|
$this->dao->fetch($id, '', $track_id);
|
||||||
|
|
||||||
$this->label = $this->dao->label;
|
$this->label = $this->dao->label;
|
||||||
$this->description = $this->dao->description;
|
$this->description = $this->dao->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get action title
|
* Get action title
|
||||||
*
|
*
|
||||||
* @param string $action Type of action
|
* @param string $action Type of action
|
||||||
* @return string Title of action
|
* @return string Title of action
|
||||||
*/
|
*/
|
||||||
public function getTitle($action = '')
|
public function getTitle($action = '')
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
if ($action == 'create') {
|
if ($action == 'create') {
|
||||||
return $langs->trans("CreateTicket");
|
return $langs->trans("CreateTicket");
|
||||||
} elseif ($action == 'edit') {
|
} elseif ($action == 'edit') {
|
||||||
return $langs->trans("EditTicket");
|
return $langs->trans("EditTicket");
|
||||||
} elseif ($action == 'view') {
|
} elseif ($action == 'view') {
|
||||||
return $langs->trans("TicketCard");
|
return $langs->trans("TicketCard");
|
||||||
} elseif ($action == 'add_message') {
|
} elseif ($action == 'add_message') {
|
||||||
return $langs->trans("AddMessage");
|
return $langs->trans("AddMessage");
|
||||||
} else {
|
} else {
|
||||||
return $langs->trans("TicketsManagement");
|
return $langs->trans("TicketsManagement");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show ticket original message
|
* Show ticket original message
|
||||||
*
|
*
|
||||||
* @param User $user User wich display
|
* @param User $user User wich display
|
||||||
* @param string $action Action mode
|
* @param string $action Action mode
|
||||||
* @param Ticket $object Object ticket
|
* @param Ticket $object Object ticket
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function viewTicketOriginalMessage($user, $action, $object)
|
public function viewTicketOriginalMessage($user, $action, $object)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
print '<!-- initial message of ticket -->'."\n";
|
print '<!-- initial message of ticket -->'."\n";
|
||||||
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
|
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
|
||||||
// MESSAGE
|
// MESSAGE
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="track_id" value="'.$object->track_id.'">';
|
print '<input type="hidden" name="track_id" value="'.$object->track_id.'">';
|
||||||
print '<input type="hidden" name="action" value="set_message">';
|
print '<input type="hidden" name="action" value="set_message">';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initial message
|
// Initial message
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||||
print '<table class="noborder centpercent margintable">';
|
print '<table class="noborder centpercent margintable">';
|
||||||
print '<tr class="liste_titre"><td class="nowrap titlefield">';
|
print '<tr class="liste_titre"><td class="nowrap titlefield">';
|
||||||
print $langs->trans("InitialMessage");
|
print $langs->trans("InitialMessage");
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($user->rights->ticket->manage) {
|
if ($user->rights->ticket->manage) {
|
||||||
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=edit_message_init&track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a>';
|
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=edit_message_init&track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
|
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
|
||||||
// MESSAGE
|
// MESSAGE
|
||||||
$msg = GETPOST('message_initial', 'alpha') ? GETPOST('message_initial', 'alpha') : $object->message;
|
$msg = GETPOST('message_initial', 'alpha') ? GETPOST('message_initial', 'alpha') : $object->message;
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$uselocalbrowser = true;
|
$uselocalbrowser = true;
|
||||||
$doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET, ROWS_4, '95%');
|
$doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET, ROWS_4, '95%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
} else {
|
} else {
|
||||||
// Deal with format differences (text / HTML)
|
// Deal with format differences (text / HTML)
|
||||||
if (dol_textishtml($object->message)) {
|
if (dol_textishtml($object->message)) {
|
||||||
print $object->message;
|
print $object->message;
|
||||||
} else {
|
} else {
|
||||||
print dol_nl2br($object->message);
|
print dol_nl2br($object->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//print '<div>' . $object->message . '</div>';
|
//print '<div>' . $object->message . '</div>';
|
||||||
}
|
}
|
||||||
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
|
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||||
print ' <input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
|
print ' <input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
|
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
|
||||||
// MESSAGE
|
// MESSAGE
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View html list of message for ticket
|
* View html list of message for ticket
|
||||||
*
|
*
|
||||||
* @param boolean $show_private Show private messages
|
* @param boolean $show_private Show private messages
|
||||||
* @param boolean $show_user Show user who make action
|
* @param boolean $show_user Show user who make action
|
||||||
* @param Ticket $object Object ticket
|
* @param Ticket $object Object ticket
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function viewTicketMessages($show_private, $show_user, $object)
|
public function viewTicketMessages($show_private, $show_user, $object)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
// Load logs in cache
|
// Load logs in cache
|
||||||
$ret = $this->dao->loadCacheMsgsTicket();
|
$ret = $this->dao->loadCacheMsgsTicket();
|
||||||
if ($ret < 0) dol_print_error($this->dao->db);
|
if ($ret < 0) dol_print_error($this->dao->db);
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
$this->viewTicketOriginalMessage($user, $action, $object);
|
$this->viewTicketOriginalMessage($user, $action, $object);
|
||||||
|
|
||||||
if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0)
|
if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0)
|
||||||
{
|
{
|
||||||
print '<table class="border" style="width:100%;">';
|
print '<table class="border" style="width:100%;">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $langs->trans('TicketMessagesList');
|
print $langs->trans('TicketMessagesList');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($show_user) {
|
if ($show_user) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $langs->trans('User');
|
print $langs->trans('User');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->dao->cache_msgs_ticket as $id => $arraymsgs) {
|
foreach ($this->dao->cache_msgs_ticket as $id => $arraymsgs) {
|
||||||
if (!$arraymsgs['private']
|
if (!$arraymsgs['private']
|
||||||
|| ($arraymsgs['private'] == "1" && $show_private)
|
|| ($arraymsgs['private'] == "1" && $show_private)
|
||||||
) {
|
) {
|
||||||
//print '<tr>';
|
//print '<tr>';
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td><strong>';
|
print '<td><strong>';
|
||||||
print dol_print_date($arraymsgs['datec'], 'dayhour');
|
print dol_print_date($arraymsgs['datec'], 'dayhour');
|
||||||
print '<strong></td>';
|
print '<strong></td>';
|
||||||
if ($show_user) {
|
if ($show_user) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($arraymsgs['fk_user_author'] > 0) {
|
if ($arraymsgs['fk_user_author'] > 0) {
|
||||||
$userstat = new User($this->db);
|
$userstat = new User($this->db);
|
||||||
$res = $userstat->fetch($arraymsgs['fk_user_author']);
|
$res = $userstat->fetch($arraymsgs['fk_user_author']);
|
||||||
if ($res) {
|
if ($res) {
|
||||||
print $userstat->getNomUrl(0);
|
print $userstat->getNomUrl(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print $langs->trans('Customer');
|
print $langs->trans('Customer');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print $arraymsgs['message'];
|
print $arraymsgs['message'];
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
} else {
|
} else {
|
||||||
print '<div class="info">'.$langs->trans('NoMsgForThisTicket').'</div>';
|
print '<div class="info">'.$langs->trans('NoMsgForThisTicket').'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View list of message for ticket with timeline display
|
* View list of message for ticket with timeline display
|
||||||
*
|
*
|
||||||
* @param boolean $show_private Show private messages
|
* @param boolean $show_private Show private messages
|
||||||
* @param boolean $show_user Show user who make action
|
* @param boolean $show_user Show user who make action
|
||||||
* @param Ticket $object Object ticket
|
* @param Ticket $object Object ticket
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function viewTicketTimelineMessages($show_private, $show_user, Ticket $object)
|
public function viewTicketTimelineMessages($show_private, $show_user, Ticket $object)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
// Load logs in cache
|
// Load logs in cache
|
||||||
$ret = $object->loadCacheMsgsTicket();
|
$ret = $object->loadCacheMsgsTicket();
|
||||||
$action = GETPOST('action');
|
$action = GETPOST('action');
|
||||||
|
|
||||||
if (is_array($object->cache_msgs_ticket) && count($object->cache_msgs_ticket) > 0) {
|
if (is_array($object->cache_msgs_ticket) && count($object->cache_msgs_ticket) > 0) {
|
||||||
print '<section id="cd-timeline">';
|
print '<section id="cd-timeline">';
|
||||||
|
|
||||||
foreach ($object->cache_msgs_ticket as $id => $arraymsgs) {
|
foreach ($object->cache_msgs_ticket as $id => $arraymsgs) {
|
||||||
if (!$arraymsgs['private']
|
if (!$arraymsgs['private']
|
||||||
|| ($arraymsgs['private'] == "1" && $show_private)
|
|| ($arraymsgs['private'] == "1" && $show_private)
|
||||||
) {
|
) {
|
||||||
print '<div class="cd-timeline-block">';
|
print '<div class="cd-timeline-block">';
|
||||||
print '<div class="cd-timeline-img">';
|
print '<div class="cd-timeline-img">';
|
||||||
print '<img src="img/messages.png" alt="">';
|
print '<img src="img/messages.png" alt="">';
|
||||||
print '</div> <!-- cd-timeline-img -->';
|
print '</div> <!-- cd-timeline-img -->';
|
||||||
|
|
||||||
print '<div class="cd-timeline-content">';
|
print '<div class="cd-timeline-content">';
|
||||||
print $arraymsgs['message'];
|
print $arraymsgs['message'];
|
||||||
|
|
||||||
print '<span class="cd-date">';
|
print '<span class="cd-date">';
|
||||||
print dol_print_date($arraymsgs['datec'], 'dayhour');
|
print dol_print_date($arraymsgs['datec'], 'dayhour');
|
||||||
|
|
||||||
if ($show_user) {
|
if ($show_user) {
|
||||||
if ($arraymsgs['fk_user_action'] > 0) {
|
if ($arraymsgs['fk_user_action'] > 0) {
|
||||||
$userstat = new User($this->db);
|
$userstat = new User($this->db);
|
||||||
$res = $userstat->fetch($arraymsgs['fk_user_action']);
|
$res = $userstat->fetch($arraymsgs['fk_user_action']);
|
||||||
if ($res) {
|
if ($res) {
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print $userstat->getNomUrl(1);
|
print $userstat->getNomUrl(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print $langs->trans('Customer');
|
print $langs->trans('Customer');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</span>';
|
print '</span>';
|
||||||
print '</div> <!-- cd-timeline-content -->';
|
print '</div> <!-- cd-timeline-content -->';
|
||||||
print '</div> <!-- cd-timeline-block -->';
|
print '</div> <!-- cd-timeline-block -->';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</section>';
|
print '</section>';
|
||||||
} else {
|
} else {
|
||||||
print '<div class="info">'.$langs->trans('NoMsgForThisTicket').'</div>';
|
print '<div class="info">'.$langs->trans('NoMsgForThisTicket').'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print html navbar with link to set ticket status
|
* Print html navbar with link to set ticket status
|
||||||
*
|
*
|
||||||
* @param Ticket $object Ticket sup
|
* @param Ticket $object Ticket sup
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function viewStatusActions(Ticket $object)
|
public function viewStatusActions(Ticket $object)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min margintoponly">';
|
||||||
print '<div class="tagtable centpercent">';
|
print '<div class="tagtable centpercent">';
|
||||||
print '<div class="tagtr liste_titre">';
|
print '<div class="tagtr">';
|
||||||
// Exclude status which requires specific method
|
// Exclude status which requires specific method
|
||||||
$exclude_status = array(Ticket::STATUS_CLOSED, Ticket::STATUS_CANCELED);
|
$exclude_status = array(Ticket::STATUS_CLOSED, Ticket::STATUS_CANCELED);
|
||||||
// Exclude actual status
|
// Exclude actual status
|
||||||
$exclude_status = array_merge($exclude_status, array(intval($object->fk_statut)));
|
$exclude_status = array_merge($exclude_status, array(intval($object->fk_statut)));
|
||||||
|
|
||||||
// Sort results to be similar to status object list
|
// Sort results to be similar to status object list
|
||||||
//sort($exclude_status);
|
//sort($exclude_status);
|
||||||
|
|
||||||
foreach ($object->statuts_short as $status => $status_label) {
|
foreach ($object->statuts_short as $status => $status_label) {
|
||||||
if (!in_array($status, $exclude_status)) {
|
if (!in_array($status, $exclude_status)) {
|
||||||
print '<div class="tagtd center">';
|
print '<div class="tagtd center">';
|
||||||
|
|
||||||
if ($status == 1)
|
if ($status == 1)
|
||||||
{
|
{
|
||||||
$urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=mark_ticket_read'; // To set as read, we use a dedicated action
|
$urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=mark_ticket_read'; // To set as read, we use a dedicated action
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=set_status&new_status='.$status;
|
$urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=set_status&new_status='.$status;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<a class="button buttonticket" href="'.$urlforbutton.'">';
|
print '<a class="butAction buttonticket" href="'.$urlforbutton.'">';
|
||||||
print img_picto($langs->trans($object->statuts_short[$status]), 'statut'.$status.'.png@ticket').' '.$langs->trans($object->statuts_short[$status]);
|
print img_picto($langs->trans($object->statuts_short[$status]), 'statut'.$status.'.png@ticket').' '.$langs->trans($object->statuts_short[$status]);
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</div></div></div><br>';
|
print '</div></div></div><br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook to add email element template
|
* Hook to add email element template
|
||||||
*
|
*
|
||||||
* @param array $parameters Parameters
|
* @param array $parameters Parameters
|
||||||
* @param Ticket $object Object for action
|
* @param Ticket $object Object for action
|
||||||
* @param string $action Action string
|
* @param string $action Action string
|
||||||
* @param HookManager $hookmanager Hookmanager object
|
* @param HookManager $hookmanager Hookmanager object
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function emailElementlist($parameters, &$object, &$action, $hookmanager)
|
public function emailElementlist($parameters, &$object, &$action, $hookmanager)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if (in_array('admin', explode(':', $parameters['context']))) {
|
if (in_array('admin', explode(':', $parameters['context']))) {
|
||||||
$this->results = array('ticket_send' => $langs->trans('MailToSendTicketMessage'));
|
$this->results = array('ticket_send' => $langs->trans('MailToSendTicketMessage'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
return 0; // or return 1 to replace standard code
|
return 0; // or return 1 to replace standard code
|
||||||
} else {
|
} else {
|
||||||
$this->errors[] = 'Error message';
|
$this->errors[] = 'Error message';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -74,56 +74,13 @@ div.ticketform {
|
|||||||
div.ticketform .index_create, .index_display {
|
div.ticketform .index_create, .index_display {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 58px;
|
height: 45px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.ticketform .orange {
|
|
||||||
color: #fef4e9;
|
|
||||||
border: solid 1px #da7c0c;
|
|
||||||
background: #f78d1d;
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20));
|
|
||||||
background: -moz-linear-gradient(top, #faa51a, #f47a20);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20');
|
|
||||||
}
|
|
||||||
div.ticketform .orange:active {
|
|
||||||
color: #fcd3a5;
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#f47a20), to(#faa51a));
|
|
||||||
background: -moz-linear-gradient(top, #f47a20, #faa51a);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f47a20', endColorstr='#faa51a');
|
|
||||||
}
|
|
||||||
|
|
||||||
div.ticketform .orange:hover {
|
|
||||||
background: #f47c20;
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015));
|
|
||||||
background: -moz-linear-gradient(top, #f88e11, #f06015);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015');
|
|
||||||
}
|
|
||||||
|
|
||||||
div.ticketform .blue {
|
|
||||||
color: #d9eef7;
|
|
||||||
border: solid 1px #0076a3;
|
|
||||||
background: #0095cd;
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5));
|
|
||||||
background: -moz-linear-gradient(top, #00adee, #0078a5);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5');
|
|
||||||
}
|
|
||||||
div.ticketform .blue:active {
|
|
||||||
color: #80bed6;
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#0078a5), to(#00adee));
|
|
||||||
background: -moz-linear-gradient(top, #0078a5, #00adee);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0078a5', endColorstr='#00adee');
|
|
||||||
}
|
|
||||||
div.ticketform .blue:hover {
|
|
||||||
background: #007ead;
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#0095cc), to(#00678e));
|
|
||||||
background: -moz-linear-gradient(top, #0095cc, #00678e);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0095cc', endColorstr='#00678e');
|
|
||||||
}
|
|
||||||
|
|
||||||
#form_create_ticket, #form_view_ticket
|
#form_create_ticket, #form_view_ticket
|
||||||
{
|
{
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
|||||||
@ -145,6 +145,22 @@ if ($action == 'update' && !$cancel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update personal email
|
||||||
|
if ($action == 'setpersonal_email')
|
||||||
|
{
|
||||||
|
$object->personal_email = GETPOST('personal_email');
|
||||||
|
$result = $object->update($user);
|
||||||
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
// update personal mobile
|
||||||
|
if ($action == 'setpersonal_mobile')
|
||||||
|
{
|
||||||
|
$object->personal_mobile = GETPOST('personal_mobile');
|
||||||
|
$result = $object->update($user);
|
||||||
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -197,6 +213,22 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
|
|||||||
print '<td>'.$object->login.'</td>';
|
print '<td>'.$object->login.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr class="nowrap">';
|
||||||
|
print '<td>';
|
||||||
|
print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer);
|
||||||
|
print '</td><td>';
|
||||||
|
print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer, 'email', ($object->personal_email != '' ? dol_print_email($object->personal_email) : ''));
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr class="nowrap">';
|
||||||
|
print '<td>';
|
||||||
|
print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer);
|
||||||
|
print '</td><td>';
|
||||||
|
print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer, 'string', ($object->personal_mobile != '' ? dol_print_phone($object->personal_mobile) : ''));
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
|
/* Copyright (C) 2030 Thibault FOUCART <support@ptibogxiv.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -62,10 +63,11 @@ class Users extends DolibarrApi
|
|||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
* @param int $page Page number
|
* @param int $page Page number
|
||||||
* @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i}
|
* @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i}
|
||||||
|
* @param int $category Use this param to filter list by category
|
||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||||
* @return array Array of User objects
|
* @return array Array of User objects
|
||||||
*/
|
*/
|
||||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '')
|
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $category = 0, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
@ -80,8 +82,18 @@ class Users extends DolibarrApi
|
|||||||
|
|
||||||
$sql = "SELECT t.rowid";
|
$sql = "SELECT t.rowid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."user as t";
|
||||||
|
if ($category > 0) {
|
||||||
|
$sql .= ", ".MAIN_DB_PREFIX."categorie_user as c";
|
||||||
|
}
|
||||||
$sql .= ' WHERE t.entity IN ('.getEntity('user').')';
|
$sql .= ' WHERE t.entity IN ('.getEntity('user').')';
|
||||||
if ($user_ids) $sql .= " AND t.rowid IN (".$user_ids.")";
|
if ($user_ids) $sql .= " AND t.rowid IN (".$user_ids.")";
|
||||||
|
|
||||||
|
// Select products of given category
|
||||||
|
if ($category > 0) {
|
||||||
|
$sql .= " AND c.fk_categorie = ".$db->escape($category);
|
||||||
|
$sql .= " AND c.fk_user = t.rowid ";
|
||||||
|
}
|
||||||
|
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -936,7 +936,7 @@ if ($action == 'addcontainer')
|
|||||||
} else {
|
} else {
|
||||||
$filetpl = $pathofwebsite.'/page'.$pageid.'.tpl.php';
|
$filetpl = $pathofwebsite.'/page'.$pageid.'.tpl.php';
|
||||||
|
|
||||||
// Generate the index.php page to be the home page
|
// Generate the index.php page (to be the home page) and wrapper.php file
|
||||||
$result = dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper);
|
$result = dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper);
|
||||||
|
|
||||||
if ($result <= 0) setEventMessages('Failed to write file '.$fileindex, null, 'errors');
|
if ($result <= 0) setEventMessages('Failed to write file '.$fileindex, null, 'errors');
|
||||||
|
|||||||
@ -76,10 +76,10 @@ $original_file = str_replace("../", "/", $original_file);
|
|||||||
// Cache or not
|
// Cache or not
|
||||||
if (GETPOST("cache", 'none') || image_format_supported($original_file) >= 0)
|
if (GETPOST("cache", 'none') || image_format_supported($original_file) >= 0)
|
||||||
{
|
{
|
||||||
// Important: Following code is to avoid page request by browser and PHP CPU at
|
// Important: Following code is to avoid page request by browser and PHP CPU at
|
||||||
// each Dolibarr page access.
|
// each Dolibarr page access.
|
||||||
header('Cache-Control: max-age=3600, public, must-revalidate');
|
header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||||
header('Pragma: cache'); // This is to avoid having Pragma: no-cache
|
header('Pragma: cache'); // This is to avoid having Pragma: no-cache
|
||||||
}
|
}
|
||||||
|
|
||||||
$refname = basename(dirname($original_file)."/");
|
$refname = basename(dirname($original_file)."/");
|
||||||
@ -99,102 +99,107 @@ if ($rss) {
|
|||||||
|
|
||||||
$website->fetch('', $websitekey);
|
$website->fetch('', $websitekey);
|
||||||
|
|
||||||
$MAXNEWS = 20;
|
$MAXNEWS = 20;
|
||||||
$arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters);
|
$arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters);
|
||||||
$eventarray = $arrayofblogs;
|
$eventarray = array();
|
||||||
|
foreach ($arrayofblogs as $blog) {
|
||||||
|
$blog->fullpageurl = $website->virtualhost.'/'.$blog->pageurl.'.php';
|
||||||
|
$eventarray[] = $blog;
|
||||||
|
}
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT."/core/lib/xcal.lib.php";
|
require_once DOL_DOCUMENT_ROOT."/core/lib/xcal.lib.php";
|
||||||
require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
|
require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
|
||||||
require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
|
require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
|
||||||
|
|
||||||
dol_syslog("build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG);
|
dol_syslog("build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG);
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (!$filename)
|
if (!$filename)
|
||||||
{
|
{
|
||||||
$extension = 'rss';
|
$extension = 'rss';
|
||||||
$filename = $format.'.'.$extension;
|
$filename = $format.'.'.$extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create dir and define output file (definitive and temporary)
|
// Create dir and define output file (definitive and temporary)
|
||||||
$result = dol_mkdir($dir_temp);
|
$result = dol_mkdir($dir_temp);
|
||||||
$outputfile = $dir_temp.'/'.$filename;
|
$outputfile = $dir_temp.'/'.$filename;
|
||||||
|
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
$buildfile = true;
|
$buildfile = true;
|
||||||
|
|
||||||
if ($cachedelay)
|
if ($cachedelay)
|
||||||
{
|
{
|
||||||
$nowgmt = dol_now();
|
$nowgmt = dol_now();
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay))
|
if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay))
|
||||||
{
|
{
|
||||||
dol_syslog("build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled");
|
dol_syslog("build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled");
|
||||||
$buildfile = false;
|
$buildfile = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($buildfile)
|
if ($buildfile)
|
||||||
{
|
{
|
||||||
$title = $desc = $langs->transnoentities('LastBlogPosts');
|
$langs->load("other");
|
||||||
|
$title = $desc = $langs->transnoentities('LatestBlogPosts');
|
||||||
|
|
||||||
// Create temp file
|
// Create temp file
|
||||||
$outputfiletmp = tempnam($dir_temp, 'tmp'); // Temporary file (allow call of function by different threads
|
$outputfiletmp = tempnam($dir_temp, 'tmp'); // Temporary file (allow call of function by different threads
|
||||||
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
|
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
// Write file
|
// Write file
|
||||||
$result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp);
|
$result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1');
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
if (dol_move($outputfiletmp, $outputfile, 0, 1)) $result = 1;
|
if (dol_move($outputfiletmp, $outputfile, 0, 1)) $result = 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile;
|
$error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile;
|
||||||
dol_syslog("build_exportfile ".$error, LOG_ERR);
|
dol_syslog("build_exportfile ".$error, LOG_ERR);
|
||||||
dol_delete_file($outputfiletmp, 0, 1);
|
dol_delete_file($outputfiletmp, 0, 1);
|
||||||
print $error;
|
print $error;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR);
|
dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR);
|
||||||
dol_delete_file($outputfiletmp, 0, 1);
|
dol_delete_file($outputfiletmp, 0, 1);
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
print $langs->trans("ErrorFailToCreateFile", $outputfile);
|
print $langs->trans("ErrorFailToCreateFile", $outputfile);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
$attachment = false;
|
$attachment = false;
|
||||||
if (isset($_GET["attachment"])) $attachment = $_GET["attachment"];
|
if (isset($_GET["attachment"])) $attachment = $_GET["attachment"];
|
||||||
//$attachment = false;
|
//$attachment = false;
|
||||||
$contenttype = 'application/rss+xml';
|
$contenttype = 'application/rss+xml';
|
||||||
if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"];
|
if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"];
|
||||||
//$contenttype='text/plain';
|
//$contenttype='text/plain';
|
||||||
$outputencoding = 'UTF-8';
|
$outputencoding = 'UTF-8';
|
||||||
|
|
||||||
if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : ''));
|
if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : ''));
|
||||||
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
|
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||||
|
|
||||||
// Ajout directives pour resoudre bug IE
|
// Ajout directives pour resoudre bug IE
|
||||||
//header('Cache-Control: Public, must-revalidate');
|
//header('Cache-Control: Public, must-revalidate');
|
||||||
//header('Pragma: public');
|
//header('Pragma: public');
|
||||||
if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate');
|
if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate');
|
||||||
else header('Cache-Control: private, must-revalidate');
|
else header('Cache-Control: private, must-revalidate');
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$outputfile = $dir_temp.'/'.$filename;
|
$outputfile = $dir_temp.'/'.$filename;
|
||||||
$result = readfile($outputfile);
|
$result = readfile($outputfile);
|
||||||
if (!$result) print 'File '.$outputfile.' was empty.';
|
if (!$result) print 'File '.$outputfile.' was empty.';
|
||||||
|
|
||||||
// header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename));
|
// header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Get logos
|
// Get logos
|
||||||
elseif ($modulepart == "mycompany" && preg_match('/^\/?logos\//', $original_file))
|
elseif ($modulepart == "mycompany" && preg_match('/^\/?logos\//', $original_file))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user