forked from Wavyzz/dolibarr
Merge remote-tracking branch 'upstream/develop' into socialnetworks
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012-20113 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Christophe Battarel <christophe@altairis.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -49,7 +50,8 @@ $modules = array(
|
||||
'DETAILS' => 'FCKeditorForProductDetails',
|
||||
'USERSIGN' => 'FCKeditorForUserSignature',
|
||||
'MAILING' => 'FCKeditorForMailing',
|
||||
'MAIL' => 'FCKeditorForMail'
|
||||
'MAIL' => 'FCKeditorForMail',
|
||||
'TICKET' => 'FCKeditorForTicket'
|
||||
);
|
||||
// Conditions pour que l'option soit proposee
|
||||
$conditions = array(
|
||||
@@ -58,7 +60,8 @@ $conditions = array(
|
||||
'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->supplier_proposal->enabled) || ! empty($conf->fournisseur->enabled)),
|
||||
'USERSIGN' => 1,
|
||||
'MAILING' => ! empty($conf->mailing->enabled),
|
||||
'MAIL' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled))
|
||||
'MAIL' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)),
|
||||
'TICKET' => ! empty($conf->ticket->enabled)
|
||||
);
|
||||
// Picto
|
||||
$picto = array(
|
||||
@@ -67,7 +70,8 @@ $picto = array(
|
||||
'DETAILS' => 'product',
|
||||
'USERSIGN' => 'user',
|
||||
'MAILING' => 'email',
|
||||
'MAIL' => 'email'
|
||||
'MAIL' => 'email',
|
||||
'TICKET' => 'ticket'
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -150,3 +150,140 @@ function printBookmarksList($aDb, $aLangs)
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add area with bookmarks in top menu
|
||||
*
|
||||
* @param DoliDb $aDb Database handler
|
||||
* @param Translate $aLangs Object lang
|
||||
* @return string
|
||||
*/
|
||||
function printDropdownBookmarksList($aDb, $aLangs)
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$db = $aDb;
|
||||
$langs = $aLangs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||
if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;
|
||||
|
||||
$langs->load("bookmarks");
|
||||
|
||||
$url= $_SERVER["PHP_SELF"];
|
||||
|
||||
if (! empty($_SERVER["QUERY_STRING"]))
|
||||
{
|
||||
$url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
|
||||
}
|
||||
else
|
||||
{
|
||||
global $sortfield,$sortorder;
|
||||
$tmpurl='';
|
||||
// No urlencode, all param $url will be urlencoded later
|
||||
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
||||
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
||||
if (is_array($_POST))
|
||||
{
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
||||
}
|
||||
}
|
||||
$url.=($tmpurl?'?'.$tmpurl:'');
|
||||
}
|
||||
|
||||
$searchForm = '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||
$searchForm.= '<form id="top-menu-action-bookmark" name="actionbookmark" method="POST" action="" onsubmit="return false" >';
|
||||
$searchForm.= '<input name="bookmark" id="top-bookmark-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Bookmarks').'" autocomplete="off" >';
|
||||
$searchForm.= '</form>';
|
||||
|
||||
// Url to list bookmark
|
||||
$listbtn = '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.DOL_URL_ROOT.'/bookmarks/list.php" >';
|
||||
$listbtn.= '<span class="fa fa-list"></span> '.$langs->trans('Bookmarks').'</a>';
|
||||
|
||||
// Url to go on create new bookmark page
|
||||
$newbtn = '';
|
||||
if (! empty($user->rights->bookmark->creer))
|
||||
{
|
||||
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||
$newbtn.= '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.dol_escape_htmltag($urltoadd).'" >';
|
||||
$newbtn.= '<span class="fa fa-star-o"></span> '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
|
||||
}
|
||||
|
||||
|
||||
$bookmarkList='<div id="dropdown-bookmarks-list" >';
|
||||
// Menu with all bookmarks
|
||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
|
||||
{
|
||||
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
|
||||
$sql.= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
|
||||
$sql.= " AND entity IN (".getEntity('bookmarks').")";
|
||||
$sql.= " ORDER BY position";
|
||||
if ($resql = $db->query($sql) )
|
||||
{
|
||||
$i=0;
|
||||
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
|
||||
{
|
||||
$bookmarkList.='<a class="dropdown-item bookmark-item" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' href="'.dol_escape_htmltag($obj->url).'" >';
|
||||
$bookmarkList.= dol_escape_htmltag($obj->title);
|
||||
$bookmarkList.='</a>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$bookmarkList.='</div>';
|
||||
|
||||
$html= '';
|
||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) {
|
||||
$html.= '
|
||||
<!-- search input -->
|
||||
<div class="dropdown-header bookmark-header">
|
||||
' . $searchForm . '
|
||||
</div>
|
||||
';
|
||||
}
|
||||
|
||||
$html.= '
|
||||
<!-- Menu Body -->
|
||||
<div class="bookmark-body dropdown-body">
|
||||
'.$bookmarkList.'
|
||||
</div>
|
||||
';
|
||||
|
||||
$html.= '
|
||||
<!-- Menu Footer-->
|
||||
<div class="bookmark-footer">
|
||||
'.$newbtn.$listbtn.'
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
';
|
||||
|
||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) {
|
||||
$html .= '<script>
|
||||
$( document ).on("keyup", "#top-bookmark-search-input", function () {
|
||||
|
||||
var filter = $(this).val(), count = 0;
|
||||
$("#dropdown-bookmarks-list .bookmark-item").each(function () {
|
||||
|
||||
if ($(this).text().search(new RegExp(filter, "i")) < 0) {
|
||||
$(this).addClass("hidden-search-result");
|
||||
} else {
|
||||
$(this).removeClass("hidden-search-result");
|
||||
count++;
|
||||
}
|
||||
});
|
||||
$("#top-bookmark-search-filter-count").text(count);
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ class FormTicket
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$uselocalbrowser = true;
|
||||
$doleditor = new DolEditor('message', $msg, '100%', 230, $toolbarname, 'In', true, $uselocalbrowser);
|
||||
$doleditor = new DolEditor('message', $msg, '100%', 230, $toolbarname, 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@@ -781,6 +781,8 @@ class Translate
|
||||
if (preg_match('/^[a-z]+_[A-Z]+/i', $dir))
|
||||
{
|
||||
$this->load("languages");
|
||||
|
||||
if (! empty($conf->global->MAIN_LANGUAGES_ALLOWED) && ! in_array($dir, explode(',', $conf->global->MAIN_LANGUAGES_ALLOWED)) ) continue;
|
||||
|
||||
if ($usecode == 2)
|
||||
{
|
||||
|
||||
@@ -935,6 +935,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
|
||||
{
|
||||
$line1.=($line1?" ":"").$fromcompany->town;
|
||||
}
|
||||
// Country
|
||||
if ($fromcompany->country)
|
||||
{
|
||||
$line1.=($line1?", ":"").$fromcompany->country;
|
||||
}
|
||||
// Phone
|
||||
if ($fromcompany->phone)
|
||||
{
|
||||
|
||||
@@ -958,7 +958,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
$newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200);
|
||||
$newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201);
|
||||
$newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202);
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ModelList"), 1, $user->rights->ficheinter->lire, '', '', '', 203);
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->rights->ficheinter->lire, '', '', '', 203);
|
||||
$newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,8 +164,9 @@ if ($action == 'add') {
|
||||
$newinter->fk_projet=$object->fk_projet;
|
||||
$newinter->fk_project=$object->fk_projet;
|
||||
$newinter->fk_contrat=$object->fk_contrat;
|
||||
} else
|
||||
} else {
|
||||
$newinter->socid=GETPOST("socid");
|
||||
}
|
||||
|
||||
$newinter->entity=$object->entity;
|
||||
$newinter->duree=$object->duree;
|
||||
@@ -184,8 +185,9 @@ if ($action == 'add') {
|
||||
|
||||
if ($newfichinterid > 0) {
|
||||
// Now we add line of details
|
||||
foreach ($object->lines as $ficheinterligne)
|
||||
$newinter->addline($user, $newfichinterid, $ficheinterligne->desc, "", $ficheinterligne->duree, '');
|
||||
foreach ($object->lines as $line) {
|
||||
$newinter->addline($user, $newfichinterid, $line->desc, '', $line->duree, '');
|
||||
}
|
||||
|
||||
// on update le nombre d'inter crée à partir du modèle
|
||||
$object->updateNbGenDone();
|
||||
@@ -197,7 +199,7 @@ if ($action == 'add') {
|
||||
$action='';
|
||||
}
|
||||
} elseif ($action == 'delete' && $user->rights->ficheinter->supprimer) {
|
||||
// delete modele
|
||||
// delete modele
|
||||
$object->fetch($id);
|
||||
$object->delete();
|
||||
$id = 0 ;
|
||||
@@ -210,13 +212,10 @@ if ($action == 'add') {
|
||||
} elseif ($action == 'setdate_when' && $user->rights->ficheinter->creer) {
|
||||
// Set next date of execution
|
||||
$object->fetch($id);
|
||||
$date = dol_mktime(
|
||||
GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0,
|
||||
GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear')
|
||||
);
|
||||
$date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear'));
|
||||
if (!empty($date)) $object->setNextDate($date);
|
||||
} elseif ($action == 'setnb_gen_max' && $user->rights->ficheinter->creer) {
|
||||
// Set max period
|
||||
// Set max period
|
||||
$object->fetch($id);
|
||||
$object->setMaxPeriod(GETPOST('nb_gen_max', 'int'));
|
||||
}
|
||||
@@ -230,17 +229,16 @@ llxHeader('', $langs->trans("RepeatableInterventional"), 'ch-fichinter.html#s-fa
|
||||
|
||||
$form = new Form($db);
|
||||
$companystatic = new Societe($db);
|
||||
if (! empty($conf->contrat->enabled))
|
||||
if (! empty($conf->contrat->enabled)) {
|
||||
$contratstatic = new Contrat($db);
|
||||
if (! empty($conf->projet->enabled))
|
||||
}
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
$projectstatic = new Project($db);
|
||||
}
|
||||
|
||||
$now = dol_now();
|
||||
$tmparray=dol_getdate($now);
|
||||
$today = dol_mktime(
|
||||
23, 59, 59,
|
||||
$tmparray['mon'], $tmparray['mday'], $tmparray['year']
|
||||
); // Today is last second of current day
|
||||
$today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day
|
||||
|
||||
|
||||
|
||||
@@ -248,13 +246,13 @@ $today = dol_mktime(
|
||||
* Create mode
|
||||
*/
|
||||
if ($action == 'create') {
|
||||
print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'commercial');
|
||||
print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'fichinter');
|
||||
|
||||
$object = new Fichinter($db); // Source invoice
|
||||
//$object = new Managementfichinter($db); // Source invoice
|
||||
|
||||
if ($object->fetch($id, $ref) > 0) {
|
||||
print '<form action="fiche-rec.php" method="post">';
|
||||
print '<form action="card-rec.php" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="fichinterid" value="'.$object->id.'">';
|
||||
@@ -273,7 +271,7 @@ if ($action == 'create') {
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td><td>';
|
||||
print $form->select_company($object->thirdparty->id, 'socid', '', 0, 1);
|
||||
|
||||
// .$object->thirdparty->getNomUrl(1,'customer').
|
||||
//.$object->thirdparty->getNomUrl(1,'customer').
|
||||
print '</td><td>';
|
||||
print $langs->trans("Comment");
|
||||
print '</td></tr>';
|
||||
@@ -295,10 +293,7 @@ if ($action == 'create') {
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
|
||||
// Duration
|
||||
print '<tr><td>'.$langs->trans("TotalDuration").'</td>';
|
||||
print '<td colspan="3">'.convertSecondToTime(
|
||||
$object->duration, 'all',
|
||||
$conf->global->MAIN_DURATION_OF_WORKDAY
|
||||
).'</td>';
|
||||
print '<td colspan="3">'.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@@ -308,10 +303,7 @@ print '<td colspan="3">'.convertSecondToTime(
|
||||
print "<tr><td>".$langs->trans("Project")."</td><td>";
|
||||
$projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project;
|
||||
|
||||
$numprojet = $formproject->select_projects(
|
||||
$object->thirdparty->id, $projectid, 'projectid',
|
||||
0, 0, 1, 0, 0, 0, 0, '', 0, 0, ''
|
||||
);
|
||||
$numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->thirdparty->id;
|
||||
print '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?action=create';
|
||||
print '&socid='.$object->thirdparty->id.(!empty($id)?'&id='.$id:'').'">';
|
||||
@@ -342,26 +334,21 @@ $numprojet = $formproject->select_projects(
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
print $form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'));
|
||||
print "</td><td>";
|
||||
print "<input type='text' name='frequency' value='".GETPOST('frequency', 'int')."' size='4' /> ";
|
||||
print $form->selectarray(
|
||||
'unit_frequency',
|
||||
array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')),
|
||||
(GETPOST('unit_frequency')?GETPOST('unit_frequency'):'m')
|
||||
);
|
||||
print '<input type="text" name="frequency" value="'.GETPOST('frequency', 'int').'" size="4"> ';
|
||||
print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency')?GETPOST('unit_frequency'):'m'));
|
||||
print "</td></tr>";
|
||||
|
||||
// First date of execution for cron
|
||||
print "<tr><td>".$langs->trans('NextDateToExecution')."</td><td>";
|
||||
if ($date_next_execution != "")
|
||||
$date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')
|
||||
) : -1);
|
||||
if ($date_next_execution != "") {
|
||||
$date_next_execution = (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1);
|
||||
}
|
||||
print $form->selectDate($date_next_execution, '', 1, 1, '', "add", 1, 1);
|
||||
print "</td></tr>";
|
||||
|
||||
// Number max of generation
|
||||
print "<tr><td>".$langs->trans("MaxPeriodNumber")."</td><td>";
|
||||
print '<input type="text" name="nb_gen_max" value="'.GETPOST('nb_gen_max').'" size="5" />';
|
||||
print '<input type="text" name="nb_gen_max" value="'.GETPOST('nb_gen_max', 'int').'" size="5">';
|
||||
print "</td></tr>";
|
||||
|
||||
print "</table>";
|
||||
@@ -369,29 +356,31 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
print '<br>';
|
||||
|
||||
$title = $langs->trans("ProductsAndServices");
|
||||
if (empty($conf->service->enabled))
|
||||
if (empty($conf->service->enabled)) {
|
||||
$title = $langs->trans("Products");
|
||||
elseif (empty($conf->product->enabled))
|
||||
} elseif (empty($conf->product->enabled)) {
|
||||
$title = $langs->trans("Services");
|
||||
}
|
||||
|
||||
print load_fiche_titre($title, '', '');
|
||||
|
||||
/*
|
||||
* Invoice lines
|
||||
* Fichinter lines
|
||||
*/
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
print '<tr><td colspan="3">';
|
||||
|
||||
$sql = 'SELECT l.*';
|
||||
$sql = 'SELECT l.rowid, l.description, l.duree';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinterdet as l";
|
||||
$sql.= " WHERE l.fk_fichinter= ".$object->id;
|
||||
$sql.= " AND l.fk_product is null ";
|
||||
//$sql.= " AND l.fk_product is null ";
|
||||
$sql.= " ORDER BY l.rang";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0; $total = 0;
|
||||
$i = 0;
|
||||
$total = 0;
|
||||
|
||||
echo '<table class="noborder" width="100%">';
|
||||
if ($num) {
|
||||
@@ -413,15 +402,16 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
|
||||
print $text.' '.nl2br($objp->description);
|
||||
|
||||
// Qty
|
||||
// Duration
|
||||
print '<td class="center">'.convertSecondToTime($objp->duree).'</td>';
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
} else
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print '</td></tr>';
|
||||
@@ -436,8 +426,9 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
print '</div>';
|
||||
print "</form>\n";
|
||||
}
|
||||
else
|
||||
dol_print_error('', "Error, no invoice ".$object->id);
|
||||
else {
|
||||
dol_print_error('', "Error, no fichinter ".$object->id);
|
||||
}
|
||||
} elseif ($action == 'selsocforcreatefrommodel') {
|
||||
print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'commercial');
|
||||
dol_fiche_head('');
|
||||
@@ -492,32 +483,25 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
$morehtmlref.=img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(
|
||||
$object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1
|
||||
);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
$morehtmlref.= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.= '</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project(
|
||||
$_SERVER['PHP_SELF'].'?id='.$object->id,
|
||||
$object->socid, $object->fk_project,
|
||||
'none', 0, 0, 0, 1
|
||||
);
|
||||
$morehtmlref.= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'"';
|
||||
$morehtmlref.='title="'.$langs->trans('ShowProject').'">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
$morehtmlref.= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'"';
|
||||
$morehtmlref.= 'title="'.$langs->trans('ShowProject').'">';
|
||||
$morehtmlref.= $proj->ref;
|
||||
$morehtmlref.= '</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
$morehtmlref.= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -605,12 +589,8 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ";
|
||||
print $form->selectarray(
|
||||
'unit_frequency',
|
||||
array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')),
|
||||
($object->unit_frequency?$object->unit_frequency:'m')
|
||||
);
|
||||
print '<input type="text" name="frequency" value="'.$object->frequency.'" size="5"> ';
|
||||
print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency?$object->unit_frequency:'m'));
|
||||
print '</td>';
|
||||
print '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
@@ -625,19 +605,13 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
// Date when
|
||||
print '<tr><td>';
|
||||
if ( $user->rights->ficheinter->creer && ($action == 'date_when' || $object->frequency > 0)) {
|
||||
print $form->editfieldkey(
|
||||
$langs->trans("NextDateToExecution"), 'date_when', $object->date_when,
|
||||
$object, $user->rights->facture->creer, 'day'
|
||||
);
|
||||
print $form->editfieldkey($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day');
|
||||
} else {
|
||||
print $langs->trans("NextDateToExecution");
|
||||
}
|
||||
print '</td><td>';
|
||||
if ($action == 'date_when' || $object->frequency > 0) {
|
||||
print $form->editfieldval(
|
||||
$langs->trans("NextDateToExecution"), 'date_when', $object->date_when,
|
||||
$object, $user->rights->facture->creer, 'day'
|
||||
);
|
||||
print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@@ -645,19 +619,13 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
// Max period / Rest period
|
||||
print '<tr><td>';
|
||||
if ($user->rights->ficheinter->creer && ($action == 'nb_gen_max' || $object->frequency > 0)) {
|
||||
print $form->editfieldkey(
|
||||
$langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max,
|
||||
$object, $user->rights->facture->creer
|
||||
);
|
||||
print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer);
|
||||
} else
|
||||
print $langs->trans("MaxPeriodNumber");
|
||||
|
||||
print '</td><td>';
|
||||
if ($action == 'nb_gen_max' || $object->frequency > 0) {
|
||||
print $form->editfieldval(
|
||||
$langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max?$object->nb_gen_max:'',
|
||||
$object, $user->rights->facture->creer
|
||||
);
|
||||
print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max?$object->nb_gen_max:'', $object, $user->rights->facture->creer);
|
||||
}
|
||||
else
|
||||
print '';
|
||||
@@ -671,10 +639,7 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
if ($object->frequency > 0) {
|
||||
print '<br>';
|
||||
if (empty($conf->cron->enabled)) {
|
||||
$txtinfoadmin=$langs->trans(
|
||||
"EnableAndSetupModuleCron",
|
||||
$langs->transnoentitiesnoconv("Module2300Name")
|
||||
);
|
||||
$txtinfoadmin = $langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name"));
|
||||
print info_admin($txtinfoadmin);
|
||||
}
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
@@ -709,10 +674,11 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
*/
|
||||
|
||||
$title = $langs->trans("ProductsAndServices");
|
||||
if (empty($conf->service->enabled))
|
||||
if (empty($conf->service->enabled)) {
|
||||
$title = $langs->trans("Products");
|
||||
elseif (empty($conf->product->enabled))
|
||||
} elseif (empty($conf->product->enabled)) {
|
||||
$title = $langs->trans("Services");
|
||||
}
|
||||
|
||||
print load_fiche_titre($title);
|
||||
|
||||
@@ -850,8 +816,9 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
$companystatic->id=$objp->socid;
|
||||
$companystatic->name=$objp->name;
|
||||
print '<td>'.$companystatic->getNomUrl(1, 'customer').'</td>';
|
||||
} else
|
||||
} else {
|
||||
print '<td>'.$langs->trans("None").'</td>';
|
||||
}
|
||||
|
||||
if (! empty($conf->contrat->enabled)) {
|
||||
print '<td>';
|
||||
@@ -916,13 +883,15 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
} else
|
||||
print '<tr class="oddeven"><td colspan="6">'.$langs->trans("NoneF").'</td></tr>';
|
||||
} else {
|
||||
print '<tr class="oddeven"><td colspan="10">'.$langs->trans("NoneF").'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
} else
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
llxFooter();
|
||||
|
||||
@@ -1645,11 +1645,10 @@ elseif ($id > 0 || ! empty($ref))
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a></div>';
|
||||
}
|
||||
|
||||
// create intervention model
|
||||
if ($conf->global->MAIN_FEATURE_LEVEL >=2 && $object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) {
|
||||
// create intervention model
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >=2 && $object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) {
|
||||
print '<div class="inline-block divButAction">';
|
||||
// This feature is not yet implemented
|
||||
print '<a class="butAction" title="'.$langs->trans("not yet implemented").'" href="'.DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableIntervention").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableIntervention").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
814
htdocs/fichinter/class/fichinterrec.class.php
Normal file
814
htdocs/fichinter/class/fichinterrec.class.php
Normal file
@@ -0,0 +1,814 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016-2018 Charlie Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file fichinterrec/class/fichinter-rec.class.php
|
||||
* \ingroup facture
|
||||
* \brief Fichier de la classe des factures recurentes
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Classe de gestion des factures recurrentes/Modeles
|
||||
*/
|
||||
class FichinterRec extends Fichinter
|
||||
{
|
||||
public $element = 'fichinterrec';
|
||||
public $table_element = 'fichinter_rec';
|
||||
public $table_element_line = 'fichinter_rec';
|
||||
public $fk_element = 'fk_fichinter';
|
||||
public $picto = 'intervention';
|
||||
|
||||
public $title;
|
||||
public $number;
|
||||
public $date;
|
||||
public $amount;
|
||||
public $remise;
|
||||
public $tva;
|
||||
public $total;
|
||||
public $db_table;
|
||||
public $propalid;
|
||||
|
||||
public $date_last_gen;
|
||||
public $date_when;
|
||||
public $nb_gen_done;
|
||||
public $nb_gen_max;
|
||||
|
||||
public $rang;
|
||||
public $special_code;
|
||||
|
||||
public $usenewprice = 0;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
//status dans l'ordre de l'intervention
|
||||
$this->statuts[0]='Draft';
|
||||
$this->statuts[1]='Closed';
|
||||
|
||||
$this->statuts_short[0]='Draft';
|
||||
$this->statuts_short[1]='Closed';
|
||||
|
||||
$this->statuts_logo[0]='statut0';
|
||||
$this->statuts_logo[1]='statut1';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the label status
|
||||
*
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
public function getLibStatut($mode = 0)
|
||||
{
|
||||
return $this->LibStatut($this->statut, $mode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a predefined fichinter
|
||||
*
|
||||
* @param User $user User object
|
||||
* @param int $notrigger no trigger
|
||||
* @return int <0 if KO, id of fichinter if OK
|
||||
*/
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
|
||||
// Clean parameters
|
||||
$this->title = trim($this->title);
|
||||
$this->description = trim($this->description);
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load fichinter model
|
||||
$fichintsrc = new Fichinter($this->db);
|
||||
|
||||
$result = $fichintsrc->fetch($this->id_origin);
|
||||
$result = $fichintsrc->fetch_lines(1); // to get all lines
|
||||
|
||||
|
||||
if ($result > 0) {
|
||||
// On positionne en mode brouillon la facture
|
||||
$this->brouillon = 1;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."fichinter_rec (";
|
||||
$sql.= "titre";
|
||||
$sql.= ", fk_soc";
|
||||
$sql.= ", entity";
|
||||
$sql.= ", datec";
|
||||
$sql.= ", duree";
|
||||
$sql.= ", description";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", fk_contrat";
|
||||
$sql.= ", modelpdf";
|
||||
|
||||
$sql.= ", frequency";
|
||||
$sql.= ", unit_frequency";
|
||||
$sql.= ", date_when";
|
||||
$sql.= ", date_last_gen";
|
||||
$sql.= ", nb_gen_done";
|
||||
$sql.= ", nb_gen_max";
|
||||
// $sql.= ", auto_validate";
|
||||
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->db->escape($this->title)."'";
|
||||
$sql.= ", ".($this->socid >0 ? $this->socid : 'null');
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", ".(!empty($fichintsrc->duree)?$fichintsrc->duree:'0');
|
||||
$sql.= ", ".(!empty($this->description)?("'".$this->db->escape($this->description)."'"):"null");
|
||||
$sql.= ", ".(!empty($fichintsrc->note_private)?("'".$this->db->escape($fichintsrc->note_private)."'"):"null");
|
||||
$sql.= ", ".(!empty($fichintsrc->note_public)?("'".$this->db->escape($fichintsrc->note_public)."'"):"null");
|
||||
$sql.= ", '".$user->id."'";
|
||||
// si c'est la même société on conserve les liens vers le projet et le contrat
|
||||
if ($this->socid == $fichintsrc->socid) {
|
||||
$sql.= ", ".(! empty($fichintsrc->fk_project)?$fichintsrc->fk_project:"null");
|
||||
$sql.= ", ".(! empty($fichintsrc->fk_contrat)?$fichintsrc->fk_contrat:"null");
|
||||
} else {
|
||||
$sql.= ", null, null";
|
||||
}
|
||||
|
||||
$sql.= ", ".(! empty($fichintsrc->modelpdf)?"'".$this->db->escape($fichintsrc->modelpdf)."'":"''");
|
||||
|
||||
// récurrence
|
||||
$sql.= ", ".(! empty($this->frequency)?$this->frequency:"null");
|
||||
$sql.= ", '".$this->db->escape($this->unit_frequency)."'";
|
||||
$sql.= ", ".(!empty($this->date_when)?"'".$this->db->idate($this->date_when)."'":'null');
|
||||
$sql.= ", ".(!empty($this->date_last_gen)?"'".$this->db->idate($this->date_last_gen)."'":'null');
|
||||
$sql.= ", 0"; // we start à 0
|
||||
$sql.= ", ".$this->nb_gen_max;
|
||||
// $sql.= ", ".$this->auto_validate;
|
||||
$sql.= ")";
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
$num=count($fichintsrc->lines);
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
//$result=$fichintlignesrc->fetch($fichintsrc->lines[$i]->id);
|
||||
|
||||
//var_dump($fichintsrc->lines[$i]);
|
||||
$result_insert = $this->addline(
|
||||
$fichintsrc->lines[$i]->desc,
|
||||
$fichintsrc->lines[$i]->duration,
|
||||
$fichintsrc->lines[$i]->datei,
|
||||
$fichintsrc->lines[$i]->rang,
|
||||
$fichintsrc->lines[$i]->subprice,
|
||||
$fichintsrc->lines[$i]->qty,
|
||||
$fichintsrc->lines[$i]->tva_tx,
|
||||
$fichintsrc->lines[$i]->fk_product,
|
||||
$fichintsrc->lines[$i]->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
'',
|
||||
0,
|
||||
$fichintsrc->lines[$i]->product_type,
|
||||
$fichintsrc->lines[$i]->special_code,
|
||||
$fichintsrc->lines[$i]->label,
|
||||
$fichintsrc->lines[$i]->fk_unit
|
||||
);
|
||||
|
||||
if ($result_insert < 0)
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error)
|
||||
$this->db->rollback();
|
||||
else {
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
} else {
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Recupere l'objet facture et ses lignes de factures
|
||||
*
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref Reference of fichinter
|
||||
* @param string $ref_ext External reference of fichinter
|
||||
* @param int $ref_int Internal reference of other object
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
*/
|
||||
public function fetch($rowid = 0, $ref = '', $ref_ext = '', $ref_int = '')
|
||||
{
|
||||
$sql = 'SELECT f.titre, f.fk_soc';
|
||||
$sql.= ', f.datec, f.duree, f.fk_projet, f.fk_contrat, f.description';
|
||||
$sql.= ', f.note_private, f.note_public, f.fk_user_author';
|
||||
$sql.= ', f.frequency, f.unit_frequency, f.date_when, f.date_last_gen, f.nb_gen_done, f.nb_gen_max, f.auto_validate';
|
||||
$sql.= ', f.note_private, f.note_public, f.fk_user_author';
|
||||
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'fichinter_rec as f';
|
||||
if ($rowid >0 ) $sql.= ' WHERE f.rowid='.$rowid;
|
||||
elseif ($ref) $sql.= " WHERE f.titre='".$this->db->escape($ref)."'";
|
||||
|
||||
/* This field are not used for template fichinter
|
||||
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
|
||||
*/
|
||||
|
||||
dol_syslog(get_class($this)."::fetch rowid=".$rowid, LOG_DEBUG);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $rowid;
|
||||
$this->titre = $obj->titre;
|
||||
$this->ref = $obj->titre;
|
||||
$this->description = $obj->description;
|
||||
$this->datec = $obj->datec;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->statut = 0;
|
||||
$this->fk_project = $obj->fk_projet;
|
||||
$this->fk_contrat = $obj->fk_contrat;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->user_author = $obj->fk_user_author;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->rang = $obj->rang;
|
||||
$this->special_code = $obj->special_code;
|
||||
$this->frequency = $obj->frequency;
|
||||
$this->unit_frequency = $obj->unit_frequency;
|
||||
$this->date_when = $this->db->jdate($obj->date_when);
|
||||
$this->date_last_gen = $this->db->jdate($obj->date_last_gen);
|
||||
$this->nb_gen_done = $obj->nb_gen_done;
|
||||
$this->nb_gen_max = $obj->nb_gen_max;
|
||||
$this->auto_validate = $obj->auto_validate;
|
||||
|
||||
$this->brouillon = 1;
|
||||
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
$result=$this->fetch_lines();
|
||||
if ($result < 0) {
|
||||
$this->error=$this->db->error();
|
||||
return -3;
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
$this->error='Interventional with id '.$rowid.' not found sql='.$sql;
|
||||
dol_syslog(get_class($this).'::Fetch Error '.$this->error, LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Recupere les lignes de factures predefinies dans this->lines
|
||||
* @param int $sall sall
|
||||
*
|
||||
* @return int 1 if OK, < 0 if KO
|
||||
*/
|
||||
public function fetch_lines($sall = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, ';
|
||||
$sql.= ' l.price, l.qty, l.tva_tx, l.remise, l.remise_percent, l.subprice, l.duree, ';
|
||||
$sql.= ' l.total_ht, l.total_tva, l.total_ttc,';
|
||||
$sql.= ' l.rang, l.special_code,';
|
||||
$sql.= ' l.fk_unit, p.ref as product_ref, p.fk_product_type as fk_product_type,';
|
||||
$sql.= ' p.label as product_label, p.description as product_desc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet_rec as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||
$sql.= ' WHERE l.fk_fichinter = '.$this->id;
|
||||
|
||||
dol_syslog('FichInter-rec::fetch_lines', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$line = new FichinterLigne($this->db);
|
||||
|
||||
$line->rowid = $objp->rowid;
|
||||
$line->label = $objp->custom_label; // Label line
|
||||
$line->desc = $objp->description; // Description line
|
||||
$line->product_type = $objp->product_type; // Type of line
|
||||
$line->product_ref = $objp->product_ref; // Ref product
|
||||
$line->libelle = $objp->product_label; // deprecated
|
||||
$line->product_label = $objp->product_label; // Label product
|
||||
$line->product_desc = $objp->product_desc; // Description product
|
||||
$line->fk_product_type = $objp->fk_product_type; // Type of product
|
||||
$line->qty = $objp->qty;
|
||||
$line->duree = $objp->duree;
|
||||
$line->duration = $objp->duree;
|
||||
$line->datei = $objp->date;
|
||||
$line->subprice = $objp->subprice;
|
||||
$line->tva_tx = $objp->tva_tx;
|
||||
$line->remise_percent = $objp->remise_percent;
|
||||
$line->fk_remise_except = $objp->fk_remise_except;
|
||||
$line->fk_product = $objp->fk_product;
|
||||
$line->date_start = $objp->date_start;
|
||||
$line->date_end = $objp->date_end;
|
||||
$line->date_start = $objp->date_start;
|
||||
$line->date_end = $objp->date_end;
|
||||
$line->info_bits = $objp->info_bits;
|
||||
$line->total_ht = $objp->total_ht;
|
||||
$line->total_tva = $objp->total_tva;
|
||||
$line->total_ttc = $objp->total_ttc;
|
||||
$line->code_ventilation = $objp->fk_code_ventilation;
|
||||
$line->rang = $objp->rang;
|
||||
$line->special_code = $objp->special_code;
|
||||
$line->fk_unit = $objp->fk_unit;
|
||||
|
||||
// Ne plus utiliser
|
||||
$line->price = $objp->price;
|
||||
$line->remise = $objp->remise;
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
return 1;
|
||||
} else {
|
||||
$this->error=$this->db->error();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete template fichinter rec
|
||||
*
|
||||
* @param int $rowid Id of fichinter rec to delete. If empty, we delete current instance of fichinter rec
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @param int $idwarehouse Id warehouse to use for stock change.
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete($rowid = 0, $notrigger = 0, $idwarehouse = -1)
|
||||
{
|
||||
if (empty($rowid)) $rowid=$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG);
|
||||
|
||||
$error=0;
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet_rec WHERE fk_fichinter = ".$rowid;
|
||||
dol_syslog($sql);
|
||||
if ($this->db->query($sql)) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinter_rec WHERE rowid = ".$rowid;
|
||||
dol_syslog($sql);
|
||||
if (! $this->db->query($sql)) {
|
||||
$this->error=$this->db->lasterror();
|
||||
$error=-1;
|
||||
}
|
||||
} else {
|
||||
$this->error=$this->db->lasterror();
|
||||
$error=-2;
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a line to fichinter rec
|
||||
*
|
||||
* @param string $desc Description de la ligne
|
||||
* @param integer $duration Durée
|
||||
* @param string $datei Date
|
||||
* @param int $rang Position of line
|
||||
* @param double $pu_ht Prix unitaire HT (> 0 even for credit note)
|
||||
* @param double $qty Quantite
|
||||
* @param double $txtva Taux de tva force, sinon -1
|
||||
* @param int $fk_product Id du produit/service predefini
|
||||
* @param double $remise_percent Pourcentage de remise de la ligne
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param int $info_bits Bits de type de lignes
|
||||
* @param int $fk_remise_except Id remise
|
||||
* @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note)
|
||||
* @param int $type Type of line (0=product, 1=service)
|
||||
* @param int $special_code Special code
|
||||
* @param string $label Label of the line
|
||||
* @param string $fk_unit Unit
|
||||
* @return int <0 if KO, Id of line if OK
|
||||
*/
|
||||
public function addline($desc, $duration, $datei, $rang = -1, $pu_ht = 0, $qty = 0, $txtva = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $special_code = 0, $label = '', $fk_unit = null)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
if ($this->brouillon) {
|
||||
// Clean parameters
|
||||
$remise_percent = price2num($remise_percent);
|
||||
$qty = price2num($qty);
|
||||
if (! $qty) $qty=1;
|
||||
if (! $info_bits) $info_bits=0;
|
||||
$pu_ht = price2num($pu_ht);
|
||||
$pu_ttc = price2num($pu_ttc);
|
||||
$txtva = price2num($txtva);
|
||||
|
||||
if ($price_base_type=='HT') {
|
||||
$pu=$pu_ht;
|
||||
} else {
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type, $mysoc);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
|
||||
$product_type = $type;
|
||||
if ($fk_product) {
|
||||
$product = new Product($this->db);
|
||||
$result = $product->fetch($fk_product);
|
||||
$product_type = $product->type;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."fichinterdet_rec (";
|
||||
$sql.= "fk_fichinter";
|
||||
$sql.= ", label";
|
||||
$sql.= ", description";
|
||||
$sql.= ", date";
|
||||
$sql.= ", duree";
|
||||
//$sql.= ", price";
|
||||
//$sql.= ", qty";
|
||||
//$sql.= ", tva_tx";
|
||||
$sql.= ", fk_product";
|
||||
$sql.= ", product_type";
|
||||
$sql.= ", remise_percent";
|
||||
//$sql.= ", subprice";
|
||||
$sql.= ", remise";
|
||||
$sql.= ", total_ht";
|
||||
$sql.= ", total_tva";
|
||||
$sql.= ", total_ttc";
|
||||
$sql.= ", rang";
|
||||
//$sql.= ", special_code";
|
||||
$sql.= ", fk_unit";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= (int) $this->id;
|
||||
$sql.= ", ".(! empty($label)?"'".$this->db->escape($label)."'":"null");
|
||||
$sql.= ", ".(! empty($desc)?"'".$this->db->escape($desc)."'":"null");
|
||||
$sql.= ", ".(! empty($datei)?"'".$this->db->idate($datei)."'":"null");
|
||||
$sql.= ", ".$duration;
|
||||
//$sql.= ", ".price2num($pu_ht);
|
||||
//$sql.= ", ".(!empty($qty)? $qty :(!empty($duration)? $duration :"null"));
|
||||
//$sql.= ", ".price2num($txtva);
|
||||
$sql.= ", ".(! empty($fk_product)? $fk_product :"null");
|
||||
$sql.= ", ".$product_type;
|
||||
$sql.= ", ".(! empty($remise_percent)? $remise_percent:"null");
|
||||
//$sql.= ", '".price2num($pu_ht)."'";
|
||||
$sql.= ", null";
|
||||
$sql.= ", '".price2num($total_ht)."'";
|
||||
$sql.= ", '".price2num($total_tva)."'";
|
||||
$sql.= ", '".price2num($total_ttc)."'";
|
||||
$sql.= ", ".(int) $rang;
|
||||
//$sql.= ", ".$special_code;
|
||||
$sql.= ", ".(! empty($fk_unit) ? $fk_unit :"null");
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::addline", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
return 1;
|
||||
} else {
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Rend la fichinter automatique
|
||||
*
|
||||
* @param User $user User object
|
||||
* @param int $freq Freq
|
||||
* @param string $courant Courant
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
public function set_auto($user, $freq, $courant)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ($user->rights->fichinter->creer) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter_rec ";
|
||||
$sql .= " SET frequency='".$this->db->escape($freq)."'";
|
||||
$sql .= ", last_gen='".$this->db->escape($courant)."'";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
$this->frequency = $freq;
|
||||
$this->last_gen = $courant;
|
||||
return 0;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto Add picto into link
|
||||
* @param string $option Where point the link
|
||||
* @param int $max Maxlength of ref
|
||||
* @param int $short 1=Return just URL
|
||||
* @param string $moretitle Add more text to title tooltip
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowInterventionModel").': '.$this->ref;
|
||||
|
||||
$url = DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$this->id;
|
||||
|
||||
if ($short) return $url;
|
||||
|
||||
$picto='intervention';
|
||||
|
||||
$link = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) {
|
||||
$result.= $link.img_object($label, $picto, 'class="classfortooltip"').$linkend;
|
||||
}
|
||||
if ($withpicto && $withpicto != 2) {
|
||||
$result.=' ';
|
||||
}
|
||||
if ($withpicto != 2) {
|
||||
$result.=$link.$this->ref.$linkend;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @param string $option ''=Create a specimen fichinter with lines, 'nolines'=No lines
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen($option = '')
|
||||
{
|
||||
global $user, $langs, $conf;
|
||||
|
||||
$now=dol_now();
|
||||
$arraynow=dol_getdate($now);
|
||||
$nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
|
||||
|
||||
parent::initAsSpecimen($option);
|
||||
|
||||
$this->usenewprice = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array( 'fichinter_rec' );
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update frequency and unit
|
||||
*
|
||||
* @param int $frequency value of frequency
|
||||
* @param string $unit unit of frequency (d, m, y)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setFrequencyAndUnit($frequency, $unit)
|
||||
{
|
||||
if (! $this->table_element) {
|
||||
dol_syslog(get_class($this)."::setFrequencyAndUnit called with table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!empty($frequency) && empty($unit)) {
|
||||
dol_syslog(get_class($this)."::setFrequencyAndUnit called with frequency defined but unit not ", LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET frequency = '.($frequency?$this->db->escape($frequency):'null');
|
||||
if (!empty($unit)) {
|
||||
$sql.= ', unit_frequency = "'.$this->db->escape($unit).'"';
|
||||
}
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setFrequencyAndUnit", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
$this->frequency = $frequency;
|
||||
if (!empty($unit)) $this->unit_frequency = $unit;
|
||||
return 1;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the next date of execution
|
||||
*
|
||||
* @param datetime $date date of execution
|
||||
* @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setNextDate($date, $increment_nb_gen_done = 0)
|
||||
{
|
||||
if (! $this->table_element) {
|
||||
dol_syslog(get_class($this)."::setNextDate was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "null");
|
||||
if ($increment_nb_gen_done>0) $sql.= ', nb_gen_done = nb_gen_done + 1';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setNextDate", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
$this->date_when = $date;
|
||||
if ($increment_nb_gen_done>0) $this->nb_gen_done++;
|
||||
return 1;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the maximum period
|
||||
*
|
||||
* @param int $nb number of maximum period
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setMaxPeriod($nb)
|
||||
{
|
||||
if (! $this->table_element) {
|
||||
dol_syslog(get_class($this)."::setMaxPeriod was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (empty($nb)) $nb=0;
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET nb_gen_max = '.$nb;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setMaxPeriod", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
$this->nb_gen_max = $nb;
|
||||
return 1;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the auto validate fichinter
|
||||
*
|
||||
* @param int $validate 0 to create in draft, 1 to create and validate fichinter
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setAutoValidate($validate)
|
||||
{
|
||||
if (! $this->table_element) {
|
||||
dol_syslog(get_class($this)."::setAutoValidate called with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET auto_validate = '.$validate;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setAutoValidate", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
$this->auto_validate = $validate;
|
||||
return 1;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the Number of Generation Done
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function updateNbGenDone()
|
||||
{
|
||||
if (! $this->table_element) {
|
||||
dol_syslog(get_class($this)."::updateNbGenDone called with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET nb_gen_done = nb_gen_done + 1';
|
||||
$sql.= ' , date_last_gen = now()';
|
||||
// si on et arrivé à la fin des génération
|
||||
if ($this->nb_gen_max == $this->nb_gen_done+1)
|
||||
$sql.= ' , statut = 1';
|
||||
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setAutoValidate", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
$this->nb_gen_done = $this->nb_gen_done+1;
|
||||
$this->nb_gen_done = dol_now();
|
||||
return 1;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ if (! empty($conf->holiday->enabled))
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><th colspan="3">'.$langs->trans("Holidays").'</th></tr>';
|
||||
print "<tr ".$bc[0].">";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="3">';
|
||||
|
||||
$out='';
|
||||
@@ -197,8 +197,8 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
|
||||
|
||||
$i = 0;
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("BoxTitleLastLeaveRequests", min($max, $num)).'</th>';
|
||||
print '<th>'.$langs->trans("from").'</th>';
|
||||
@@ -244,7 +244,8 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
|
||||
{
|
||||
print '<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table></div><br>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
@@ -272,8 +273,8 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
|
||||
|
||||
$i = 0;
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).'</th>';
|
||||
print '<th class="right">'.$langs->trans("FeesKilometersOrAmout").'</th>';
|
||||
@@ -344,8 +345,8 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
|
||||
|
||||
$i = 0;
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).'</th>';
|
||||
print '<th class="right">'.$langs->trans("TotalTTC").'</th>';
|
||||
|
||||
@@ -247,3 +247,75 @@ ALTER TABLE llx_societe ADD COLUMN socialnetworks text DEFAULT NULL AFTER email;
|
||||
ALTER TABLE llx_socpeople ADD COLUMN socialnetworks text DEFAULT NULL AFTER email;
|
||||
ALTER TABLE llx_user ADD COLUMN socialnetworks text DEFAULT NULL AFTER personal_email;
|
||||
|
||||
create table llx_fichinter_rec
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
titre varchar(50) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
fk_soc integer DEFAULT NULL,
|
||||
datec datetime, -- date de creation
|
||||
fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche
|
||||
fk_user_author integer, -- createur
|
||||
fk_projet integer, -- projet auquel est associe la facture
|
||||
duree real, -- duree totale de l'intervention
|
||||
description text,
|
||||
modelpdf varchar(50),
|
||||
note_private text,
|
||||
note_public text,
|
||||
frequency integer, -- frequency (for example: 3 for every 3 month)
|
||||
unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ...
|
||||
date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date)
|
||||
date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice)
|
||||
nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented)
|
||||
nb_gen_max integer DEFAULT NULL, -- maximum number of generation
|
||||
auto_validate integer NULL DEFAULT NULL -- statut of the generated intervention
|
||||
|
||||
)ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_fichinter_rec ADD UNIQUE INDEX idx_fichinter_rec_uk_titre (titre, entity);
|
||||
ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_user_author (fk_user_author);
|
||||
ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_projet (fk_projet);
|
||||
ALTER TABLE llx_fichinter_rec ADD CONSTRAINT fk_fichinter_rec_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
|
||||
ALTER TABLE llx_fichinter_rec ADD CONSTRAINT fk_fichinter_rec_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
|
||||
|
||||
create table llx_fichinterdet_rec
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_fichinter integer NOT NULL,
|
||||
date datetime, -- date de la ligne d'intervention
|
||||
description text, -- description de la ligne d'intervention
|
||||
duree integer, -- duree de la ligne d'intervention
|
||||
rang integer DEFAULT 0, -- ordre affichage sur la fiche
|
||||
total_ht DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
subprice DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
fk_parent_line integer NULL DEFAULT NULL,
|
||||
fk_product integer NULL DEFAULT NULL,
|
||||
label varchar(255) NULL DEFAULT NULL,
|
||||
tva_tx DOUBLE(6, 3) NULL DEFAULT NULL,
|
||||
localtax1_tx DOUBLE(6, 3) NULL DEFAULT 0,
|
||||
localtax1_type VARCHAR(1) NULL DEFAULT NULL,
|
||||
localtax2_tx DOUBLE(6, 3) NULL DEFAULT 0,
|
||||
localtax2_type VARCHAR(1) NULL DEFAULT NULL,
|
||||
qty double NULL DEFAULT NULL,
|
||||
remise_percent double NULL DEFAULT 0,
|
||||
remise double NULL DEFAULT 0,
|
||||
fk_remise_except integer NULL DEFAULT NULL,
|
||||
price DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
total_tva DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
total_localtax1 DOUBLE(24, 8) NULL DEFAULT 0,
|
||||
total_localtax2 DOUBLE(24, 8) NULL DEFAULT 0,
|
||||
total_ttc DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
product_type INTEGER NULL DEFAULT 0,
|
||||
date_start datetime NULL DEFAULT NULL,
|
||||
date_end datetime NULL DEFAULT NULL,
|
||||
info_bits INTEGER NULL DEFAULT 0,
|
||||
buy_price_ht DOUBLE(24, 8) NULL DEFAULT 0,
|
||||
fk_product_fournisseur_price integer NULL DEFAULT NULL,
|
||||
fk_code_ventilation integer NOT NULL DEFAULT 0,
|
||||
fk_export_commpta integer NOT NULL DEFAULT 0,
|
||||
special_code integer UNSIGNED NULL DEFAULT 0,
|
||||
fk_unit integer NULL DEFAULT NULL,
|
||||
import_key varchar(14) NULL DEFAULT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
|
||||
@@ -1587,6 +1587,7 @@ FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines fo
|
||||
FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailing)
|
||||
FCKeditorForUserSignature=WYSIWIG creation/edition of user signature
|
||||
FCKeditorForMail=WYSIWIG creation/edition for all mail (except Tools->eMailing)
|
||||
FCKeditorForTicket=WYSIWIG creation/edition for tickets
|
||||
##### Stock #####
|
||||
StockSetup=Stock module setup
|
||||
IfYouUsePointOfSaleCheckModule=If you use the Point of Sale module (POS) provided by default or an external module, this setup may be ignored by your POS module. Most POS modules are designed by default to create an invoice immediately and decrease stock irrespective of the options here. So if you need or not to have a stock decrease when registering a sale from your POS, check also your POS module setup.
|
||||
|
||||
@@ -18,3 +18,4 @@ SetHereATitleForLink=Set a name for the bookmark
|
||||
UseAnExternalHttpLinkOrRelativeDolibarrLink=Use an external/absolute link (https://URL) or an internal/relative link (/DOLIBARR_ROOT/htdocs/...)
|
||||
ChooseIfANewWindowMustBeOpenedOnClickOnBookmark=Choose if the linked page should open in the current tab or a new tab
|
||||
BookmarksManagement=Bookmarks management
|
||||
BookmarksMenuShortCut=Ctrl + shift + m
|
||||
|
||||
@@ -1586,6 +1586,7 @@ FCKeditorForProductDetails=Création/édition WYSIWIG des lignes détails produi
|
||||
FCKeditorForMailing= Création/édition WYSIWIG des emailings (Outils->Emailings)
|
||||
FCKeditorForUserSignature=Création/édition WYSIWIG de la signature des utilisateurs
|
||||
FCKeditorForMail=Création/édition WYSIWIG tous les emails (sauf Outils->Emailings)
|
||||
FCKeditorForTicket=Création/édition WYSIWIG pour les tickets
|
||||
##### Stock #####
|
||||
StockSetup=Configuration du module Stock / Entrepôt
|
||||
IfYouUsePointOfSaleCheckModule=Si vous utilisez un module Point de Vente (module POS fourni par défaut ou un autre module externe), cette configuration peut être ignoré par votre module point de vente. La plupart de modules Point de Vente sont conçus pour créer immédiatement une facture et de réduire les stocks par défaut quelles que soient les options ici. Donc, si vous avez besoin ou non d'avoir une diminution du stock lors de l'enregistrement d'une vente dans votre Point de Vente, vérifiez également la configuration de votre module POS.
|
||||
|
||||
@@ -1602,6 +1602,10 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
|
||||
|
||||
print '<div class="login_block usedropdown">'."\n";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Add login user link
|
||||
$toprightmenu.='<div class="login_block_user">';
|
||||
|
||||
@@ -1609,6 +1613,17 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
|
||||
$mode=-1;
|
||||
$toprightmenu.='<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">';
|
||||
|
||||
if(!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)){
|
||||
// Add search dropdown
|
||||
$toprightmenu.= top_menu_search($user, $langs);
|
||||
}
|
||||
|
||||
if(!empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) {
|
||||
// Add bookmark dropdown
|
||||
$toprightmenu .= top_menu_bookmark($user, $langs);
|
||||
}
|
||||
|
||||
// add user dropdown
|
||||
$toprightmenu.= top_menu_user($user, $langs);
|
||||
|
||||
$toprightmenu.='</div></div>';
|
||||
@@ -1823,12 +1838,10 @@ function top_menu_user(User $user, Translate $langs)
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
|
||||
$btnUser = '<!-- div for user link -->
|
||||
<div id="topmenu-login-dropdown" class="userimg atoplogin dropdown user user-menu">
|
||||
<div id="topmenu-login-dropdown" class="userimg atoplogin dropdown user user-menu inline-block">
|
||||
<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="dropdown-toggle login-dropdown-a" data-toggle="dropdown">
|
||||
'.$userImage.'
|
||||
<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).'</span>
|
||||
<span class="fa fa-chevron-down login-dropdown-btn" id="dropdown-icon-down"></span>
|
||||
<span class="fa fa-chevron-up login-dropdown-btn hidden" id="dropdown-icon-up"></span>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
<!-- User image -->
|
||||
@@ -1869,16 +1882,12 @@ function top_menu_user(User $user, Translate $langs)
|
||||
if (!$(event.target).closest("#topmenu-login-dropdown").length) {
|
||||
// Hide the menus.
|
||||
$("#topmenu-login-dropdown").removeClass("open");
|
||||
$("#dropdown-icon-down").show(); // use show/hide instead toggle for avoid conflict
|
||||
$("#dropdown-icon-up").hide(); // use show/hide instead toggle for avoid conflict
|
||||
}
|
||||
});
|
||||
|
||||
$("#topmenu-login-dropdown .dropdown-toggle").on("click", function(event) {
|
||||
event.preventDefault();
|
||||
$("#topmenu-login-dropdown").toggleClass("open");
|
||||
$("#dropdown-icon-down").toggle();
|
||||
$("#dropdown-icon-up").toggle();
|
||||
});
|
||||
|
||||
$("#topmenuloginmoreinfo-btn").on("click", function() {
|
||||
@@ -1893,6 +1902,203 @@ function top_menu_user(User $user, Translate $langs)
|
||||
return $btnUser;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build the tooltip on top menu bookmark
|
||||
*
|
||||
* @param user $user User object
|
||||
* @param Translate $langs Language object
|
||||
* @return string HTML content
|
||||
*/
|
||||
function top_menu_bookmark(User $user, Translate $langs)
|
||||
{
|
||||
global $langs, $conf, $db, $hookmanager, $user;
|
||||
global $menumanager;
|
||||
$html = '';
|
||||
|
||||
|
||||
|
||||
// Define $bookmarks
|
||||
if (! empty($conf->bookmark->enabled) && $user->rights->bookmark->lire)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php';
|
||||
$langs->load("bookmarks");
|
||||
|
||||
$html.= '<!-- div for bookmark link -->
|
||||
<div id="topmenu-bookmark-dropdown" class="atoplogin dropdown inline-block">
|
||||
<a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('Bookmarks').' ('.$langs->trans('BookmarksMenuShortCut').')">
|
||||
<i class="fa fa-star" ></i>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
'.printDropdownBookmarksList($db, $langs).'
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
|
||||
|
||||
$html .= '
|
||||
<!-- Code to show/hide the user drop-down -->
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
$(document).on("click", function(event) {
|
||||
if (!$(event.target).closest("#topmenu-bookmark-dropdown").length) {
|
||||
// Hide the menus.
|
||||
$("#topmenu-bookmark-dropdown").removeClass("open");
|
||||
}
|
||||
});
|
||||
|
||||
$("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) {
|
||||
openBookMarkDropDown();
|
||||
});
|
||||
|
||||
// Key map shortcut
|
||||
$(document).keydown(function(e){
|
||||
if( e.which === 77 && e.ctrlKey && e.shiftKey ){
|
||||
console.log(\'control + shift + m : trigger open bookmark dropdown\');
|
||||
openBookMarkDropDown();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var openBookMarkDropDown = function() {
|
||||
event.preventDefault();
|
||||
$("#topmenu-bookmark-dropdown").toggleClass("open");
|
||||
$("#top-bookmark-search-input").focus();
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tooltip on top menu tsearch
|
||||
*
|
||||
* @param user $user User object
|
||||
* @param Translate $langs Language object
|
||||
* @return string HTML content
|
||||
*/
|
||||
function top_menu_search(User $user, Translate $langs)
|
||||
{
|
||||
global $langs, $conf, $db, $hookmanager, $user;
|
||||
global $menumanager;
|
||||
$html = '';
|
||||
|
||||
$usedbyinclude=1;
|
||||
$arrayresult=null;
|
||||
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; // This set $arrayresult
|
||||
|
||||
$defaultAction = '';
|
||||
$buttonList='<div class="dropdown-global-search-button-list" >';
|
||||
// Menu with all bookmarks
|
||||
foreach ($arrayresult as $keyItem => $item)
|
||||
{
|
||||
if(empty($defaultAction)){
|
||||
$defaultAction= $item['url'];
|
||||
}
|
||||
$buttonList.='<button class="dropdown-item global-search-item" data-target="'.dol_escape_htmltag($item['url']).'" >';
|
||||
$buttonList.= $item['text'];
|
||||
$buttonList.='</button>';
|
||||
}
|
||||
$buttonList.='</div>';
|
||||
|
||||
|
||||
|
||||
$searchInput = '<input name="sall" id="top-global-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Search').'" autocomplete="off" >';
|
||||
|
||||
|
||||
$dropDownHtml = '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||
$dropDownHtml.= '<form id="top-menu-action-bookmark" name="actionbookmark" method="POST" action="'.$defaultAction.'" >';
|
||||
|
||||
$dropDownHtml.= '
|
||||
<!-- search input -->
|
||||
<div class="dropdown-header search-dropdown-header">
|
||||
' . $searchInput . '
|
||||
</div>
|
||||
';
|
||||
|
||||
$dropDownHtml.= '
|
||||
<!-- Menu Body -->
|
||||
<div class="dropdown-body search-dropdown-body">
|
||||
'.$buttonList.'
|
||||
</div>
|
||||
';
|
||||
|
||||
$dropDownHtml.= '</form>';
|
||||
|
||||
|
||||
$html.= '<!-- div for Global Search -->
|
||||
<div id="topmenu-global-search-dropdown" class="atoplogin dropdown inline-block">
|
||||
<a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('Search').' ('.$langs->trans('SearchMenuShortCut').')">
|
||||
<i class="fa fa-search" ></i>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
'.$dropDownHtml.'
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
$html .= '
|
||||
<!-- Code to show/hide the user drop-down -->
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
|
||||
// prevent submiting form on press ENTER
|
||||
$("#top-global-search-input").keydown(function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
var inputs = $(this).parents("form").eq(0).find(":button");
|
||||
if (inputs[inputs.index(this) + 1] != null) {
|
||||
inputs[inputs.index(this) + 1].focus();
|
||||
}
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// submit form action
|
||||
$(".dropdown-global-search-button-list .global-search-item").on("click", function(event) {
|
||||
$("#top-menu-action-bookmark").attr("action", $(this).data("target"));
|
||||
$("#top-menu-action-bookmark").submit();
|
||||
});
|
||||
|
||||
// close drop down
|
||||
$(document).on("click", function(event) {
|
||||
if (!$(event.target).closest("#topmenu-global-search-dropdown").length) {
|
||||
// Hide the menus.
|
||||
$("#topmenu-global-search-dropdown").removeClass("open");
|
||||
}
|
||||
});
|
||||
|
||||
// Open drop down
|
||||
$("#topmenu-global-search-dropdown .dropdown-toggle").on("click", function(event) {
|
||||
openGlobalSearchDropDown();
|
||||
});
|
||||
|
||||
// Key map shortcut
|
||||
$(document).keydown(function(e){
|
||||
if( e.which === 70 && e.ctrlKey && e.shiftKey ){
|
||||
console.log(\'control + shift + f : trigger open global-search dropdown\');
|
||||
openGlobalSearchDropDown();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var openGlobalSearchDropDown = function() {
|
||||
event.preventDefault();
|
||||
$("#topmenu-global-search-dropdown").toggleClass("open");
|
||||
$("#top-global-search-input").focus();
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
';
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show left menu bar
|
||||
*
|
||||
@@ -1930,55 +2136,47 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
|
||||
|
||||
if (! is_object($form)) $form=new Form($db);
|
||||
$selected=-1;
|
||||
$usedbyinclude=1;
|
||||
$arrayresult=null;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; // This set $arrayresult
|
||||
if(empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) {
|
||||
$usedbyinclude = 1;
|
||||
$arrayresult = null;
|
||||
include DOL_DOCUMENT_ROOT . '/core/ajax/selectsearchbox.php'; // This set $arrayresult
|
||||
|
||||
if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM))
|
||||
{
|
||||
$searchform.=$form->selectArrayFilter('searchselectcombo', $arrayresult, $selected, '', 1, 0, (empty($conf->global->MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY)?1:0), 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_array($arrayresult))
|
||||
{
|
||||
foreach($arrayresult as $key => $val)
|
||||
{
|
||||
$searchform.=printSearchForm($val['url'], $val['url'], $val['label'], 'maxwidth125', 'sall', $val['shortcut'], 'searchleft'.$key, img_picto('', $val['img'], '', false, 1, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
|
||||
$searchform .= $form->selectArrayFilter('searchselectcombo', $arrayresult, $selected, '', 1, 0, (empty($conf->global->MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY) ? 1 : 0), 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1);
|
||||
} else {
|
||||
if (is_array($arrayresult)) {
|
||||
foreach ($arrayresult as $key => $val) {
|
||||
$searchform .= printSearchForm($val['url'], $val['url'], $val['label'], 'maxwidth125', 'sall', $val['shortcut'], 'searchleft' . $key, img_picto('', $val['img'], '', false, 1, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Execute hook printSearchForm
|
||||
$parameters=array('searchform'=>$searchform);
|
||||
$reshook=$hookmanager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook))
|
||||
{
|
||||
$searchform.=$hookmanager->resPrint;
|
||||
}
|
||||
else $searchform=$hookmanager->resPrint;
|
||||
// Execute hook printSearchForm
|
||||
$parameters = array('searchform' => $searchform);
|
||||
$reshook = $hookmanager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook)) {
|
||||
$searchform .= $hookmanager->resPrint;
|
||||
} else $searchform = $hookmanager->resPrint;
|
||||
|
||||
// Force special value for $searchform
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$urltosearch=DOL_URL_ROOT.'/core/search_page.php?showtitlebefore=1';
|
||||
$searchform='<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="'.$urltosearch.'" accesskey="s" alt="'.dol_escape_htmltag($langs->trans("ShowSearchFields")).'">'.$langs->trans("Search").'...</a></div></div>';
|
||||
}
|
||||
elseif ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_USE_OLD_SEARCH_FORM))
|
||||
{
|
||||
$searchform='<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="'.dol_escape_htmltag($langs->trans("ShowSearchFields")).'">'.$langs->trans("Search").'...</a></div><div id="divsearchforms2" style="display: none">'.$searchform.'</div>';
|
||||
$searchform.='<script>
|
||||
// Force special value for $searchform
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax)) {
|
||||
$urltosearch = DOL_URL_ROOT . '/core/search_page.php?showtitlebefore=1';
|
||||
$searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="' . $urltosearch . '" accesskey="s" alt="' . dol_escape_htmltag($langs->trans("ShowSearchFields")) . '">' . $langs->trans("Search") . '...</a></div></div>';
|
||||
} elseif ($conf->use_javascript_ajax && !empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
|
||||
$searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="' . dol_escape_htmltag($langs->trans("ShowSearchFields")) . '">' . $langs->trans("Search") . '...</a></div><div id="divsearchforms2" style="display: none">' . $searchform . '</div>';
|
||||
$searchform .= '<script>
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#divsearchforms1").click(function(){
|
||||
jQuery("#divsearchforms2").toggle();
|
||||
});
|
||||
});
|
||||
</script>' . "\n";
|
||||
$searchform.='</div>';
|
||||
}
|
||||
$searchform .= '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Define $bookmarks
|
||||
if (! empty($conf->bookmark->enabled) && $user->rights->bookmark->lire)
|
||||
if (! empty($conf->bookmark->enabled) && $user->rights->bookmark->lire && empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php';
|
||||
$langs->load("bookmarks");
|
||||
|
||||
@@ -356,7 +356,7 @@ if ($action == "updateprice")
|
||||
{
|
||||
foreach($invoice->lines as $line)
|
||||
{
|
||||
if ($line->id == $idline) { $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
|
||||
if ($line->id == $idline) { $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'TTC', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -253,25 +253,28 @@ function LoadProducts(position, issubcat) {
|
||||
|
||||
idata=0; //product data counter
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&category='+currentcat, function(data) {
|
||||
console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat);
|
||||
console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs");
|
||||
|
||||
while (ishow < maxproduct) {
|
||||
//console.log("ishow"+ishow+" idata="+idata);
|
||||
//console.log(data[idata]);
|
||||
console.log(data[idata]);
|
||||
if (typeof (data[idata]) == "undefined") {
|
||||
$("#prodivdesc"+ishow).hide();
|
||||
$("#prodesc"+ishow).text("");
|
||||
$("#proimg"+ishow).attr("title","");
|
||||
$("#proimg"+ishow).attr("src","genimg/empty.png");
|
||||
$("#prodiv"+ishow).data("rowid","");
|
||||
$("#prowatermark"+ishow).hide();
|
||||
ishow++; //Next product to show after print data product
|
||||
}
|
||||
else if ((data[idata]['status']) == "1") { // Only show products with status=1 (for sell)
|
||||
var titlestring = '<?php echo dol_escape_js($langs->transnoentities('Ref').': '); ?>'+data[idata]['ref'];
|
||||
$("#prodivdesc"+ishow).show();
|
||||
$("#prodesc"+ishow).text(data[parseInt(idata)]['label']);
|
||||
$("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']);
|
||||
$("#prodiv"+ishow).data("rowid",data[idata]['id']);
|
||||
$("#prodiv"+ishow).data("iscat",0);
|
||||
$("#proimg"+ishow).attr("title", titlestring);
|
||||
$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata]['id']);
|
||||
$("#prodiv"+ishow).data("rowid", data[idata]['id']);
|
||||
$("#prodiv"+ishow).data("iscat", 0);
|
||||
$("#prowatermark"+ishow).hide();
|
||||
ishow++; //Next product to show after print data product
|
||||
}
|
||||
@@ -425,11 +428,13 @@ function Search2() {
|
||||
$("#prodiv"+i).data("rowid","");
|
||||
continue;
|
||||
}
|
||||
$("#prodesc"+i).text(data[parseInt(i)]['label']);
|
||||
var titlestring = '<?php echo dol_escape_js($langs->transnoentities('Ref').': '); ?>'+data[i]['ref'];
|
||||
$("#prodesc"+i).text(data[i]['label']);
|
||||
$("#prodivdesc"+i).show();
|
||||
$("#proimg"+i).attr("src","genimg/?query=pro&id="+data[i]['rowid']);
|
||||
$("#prodiv"+i).data("rowid",data[i]['rowid']);
|
||||
$("#prodiv"+i).data("iscat",0);
|
||||
$("#proimg"+i).attr("title", titlestring);
|
||||
$("#proimg"+i).attr("src", "genimg/?query=pro&id="+data[i]['rowid']);
|
||||
$("#prodiv"+i).data("rowid", data[i]['rowid']);
|
||||
$("#prodiv"+i).data("iscat", 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -802,7 +807,7 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<img class="imgwrapper" height="100%" id="proimg'.$count.'" />';
|
||||
echo '<img class="imgwrapper" height="100%" title="" id="proimg'.$count.'">';
|
||||
}
|
||||
?>
|
||||
<?php if ($count!=($MAXPRODUCT-2) && $count!=($MAXPRODUCT-1)) { ?>
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
<?php
|
||||
if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
|
||||
/* <style type="text/css" > dont remove this line it's an ide hack */
|
||||
/*
|
||||
* Dropdown
|
||||
*/
|
||||
|
||||
.open>.dropdown-menu{ /*, #topmenu-login-dropdown:hover .dropdown-menu*/
|
||||
.open>.dropdown-menu{
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
box-shadow: none;
|
||||
border-color: #eee;
|
||||
}
|
||||
.dropdown-menu {
|
||||
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
@@ -21,7 +19,6 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
display: none;
|
||||
float: left;
|
||||
min-width: 160px;
|
||||
padding: 5px 0;
|
||||
margin: 2px 0 0;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
@@ -38,6 +35,34 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
|
||||
|
||||
|
||||
.dropdown-toggle{
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.dropdown-toggle::after {
|
||||
/* font part */
|
||||
font-family: "Font Awesome 5 Free";
|
||||
font-size: 0.7em;
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
text-rendering: auto;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-align:center;
|
||||
text-decoration:none;
|
||||
margin: auto 3px;
|
||||
display: inline-block;
|
||||
content: "\f078";
|
||||
|
||||
-webkit-transition: -webkit-transform .2s ease-in-out;
|
||||
-ms-transition: -ms-transform .2s ease-in-out;
|
||||
transition: transform .2s ease-in-out;
|
||||
}
|
||||
|
||||
.open>.dropdown-toggle::after {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
/*
|
||||
* MENU Dropdown
|
||||
*/
|
||||
@@ -75,12 +100,17 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
}
|
||||
|
||||
.side-nav-vert .user-menu .dropdown-menu > .user-header {
|
||||
height: 175px;
|
||||
min-height: 175px;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
#topmenu-global-search-dropdown .dropdown-menu{
|
||||
width: 300px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.dropdown-user-image {
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
@@ -98,6 +128,12 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
background: rgb(<?php echo $colorbackhmenu1 ?>);
|
||||
}
|
||||
|
||||
|
||||
|
||||
.dropdown-menu .dropdown-header{
|
||||
padding: 5px 10px 10px 10px;
|
||||
}
|
||||
|
||||
.dropdown-menu > .user-footer {
|
||||
background-color: #f9f9f9;
|
||||
padding: 10px;
|
||||
@@ -107,14 +143,43 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.dropdown-menu > .user-body {
|
||||
|
||||
.dropdown-menu > .bookmark-footer{
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
|
||||
.dropdown-menu > .user-body, .dropdown-body{
|
||||
padding: 15px;
|
||||
border-bottom: 1px solid #f4f4f4;
|
||||
border-top: 1px solid #dddddd;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
#topmenu-login-dropdown{
|
||||
.dropdown-menu > .bookmark-body, .dropdown-body{
|
||||
padding: 10px 0;
|
||||
overflow-y: auto;
|
||||
max-height: 60vh ; /* fallback for browsers without support for calc() */
|
||||
max-height: calc(90vh - 110px) ;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.dropdown-body::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
.dropdown-body::-webkit-scrollbar-thumb {
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0;
|
||||
background: rgb(<?php echo $colorbackhmenu1 ?>);
|
||||
}
|
||||
.dropdown-body::-webkit-scrollbar-track {
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
|
||||
#topmenu-login-dropdown, #topmenu-bookmark-dropdown, #topmenu-global-search-dropdown {
|
||||
padding: 0 5px 0 5px;
|
||||
}
|
||||
#topmenu-login-dropdown a:hover{
|
||||
@@ -166,3 +231,89 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
background-color: #f4f4f4;
|
||||
border-color: #ddd;
|
||||
}
|
||||
|
||||
.dropdown-menu a.top-menu-dropdown-link {
|
||||
color: rgb(<?php print $colortextlink; ?>) !important;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
display: block;
|
||||
margin: 5px 0px;
|
||||
}
|
||||
|
||||
.dropdown-item {
|
||||
display: block !important;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: .25rem 1.5rem .25rem 1rem;
|
||||
clear: both;
|
||||
font-weight: 400;
|
||||
color: #212529 !important;
|
||||
text-align: inherit;
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.dropdown-item::before {
|
||||
/* font part */
|
||||
font-family: "Font Awesome 5 Free";
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
text-rendering: auto;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-align:center;
|
||||
text-decoration:none;
|
||||
margin-right: 5px;
|
||||
display: inline-block;
|
||||
content: "\f0da";
|
||||
color: rgba(0,0,0,0.3);
|
||||
}
|
||||
|
||||
|
||||
.dropdown-item.active, .dropdown-item:hover, .dropdown-item:focus {
|
||||
color: #<?php echo $colortextbackhmenu; ?> !important;
|
||||
text-decoration: none;
|
||||
background: rgb(<?php echo $colorbackhmenu1 ?>);
|
||||
}
|
||||
|
||||
/*
|
||||
* SEARCH
|
||||
*/
|
||||
|
||||
.dropdown-search-input {
|
||||
width: 100%;
|
||||
padding: 10px 35px 10px 20px;
|
||||
|
||||
background-color: transparent;
|
||||
font-size: 14px;
|
||||
line-height: 16px;
|
||||
box-sizing: border-box;
|
||||
|
||||
|
||||
color: #575756;
|
||||
background-color: transparent;
|
||||
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 16px 16px;
|
||||
background-position: 95% center;
|
||||
border-radius: 50px;
|
||||
border: 1px solid #c4c4c2 !important;
|
||||
transition: all 250ms ease-in-out;
|
||||
backface-visibility: hidden;
|
||||
transform-style: preserve-3d;
|
||||
|
||||
}
|
||||
|
||||
.dropdown-search-input::placeholder {
|
||||
color: color(#575756 a(0.8));
|
||||
letter-spacing: 1.5px;
|
||||
}
|
||||
|
||||
.hidden-search-result{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,11 @@ $heightmenu=48; /* height of top menu, part with image */
|
||||
$heightmenu2=49; /* height of top menu, part with login */
|
||||
$disableimages = 0;
|
||||
$maxwidthloginblock = 180;
|
||||
if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu=0; }
|
||||
if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu=0; }
|
||||
|
||||
|
||||
if(!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)){ $maxwidthloginblock = $maxwidthloginblock + 55; }
|
||||
if(! empty($conf->bookmark->enabled) && !empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
|
||||
|
||||
|
||||
print '/*'."\n";
|
||||
|
||||
@@ -177,7 +177,7 @@ class ActionsTicket
|
||||
*/
|
||||
public function viewTicketOriginalMessage($user, $action, $object)
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
print '<!-- initial message of ticket -->'."\n";
|
||||
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
|
||||
@@ -208,7 +208,7 @@ class ActionsTicket
|
||||
$msg = GETPOST('message_initial', 'alpha') ? GETPOST('message_initial', 'alpha') : $object->message;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$uselocalbrowser = true;
|
||||
$doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser);
|
||||
$doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET);
|
||||
$doleditor->Create();
|
||||
} else {
|
||||
// Deal with format differences (text / HTML)
|
||||
|
||||
@@ -56,9 +56,34 @@ print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . "
|
||||
dol_syslog($script_file . " launched with arg " . join(',', $argv));
|
||||
|
||||
// List of fields to get from LDAP
|
||||
$required_fields = array($conf->global->LDAP_KEY_MEMBERS,$conf->global->LDAP_FIELD_FULLNAME,$conf->global->LDAP_FIELD_LOGIN,$conf->global->LDAP_FIELD_LOGIN_SAMBA,$conf->global->LDAP_FIELD_PASSWORD,$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,$conf->global->LDAP_FIELD_NAME,$conf->global->LDAP_FIELD_FIRSTNAME,$conf->global->LDAP_FIELD_MAIL,$conf->global->LDAP_FIELD_PHONE,$conf->global->LDAP_FIELD_PHONE_PERSO,$conf->global->LDAP_FIELD_MOBILE,$conf->global->LDAP_FIELD_FAX,$conf->global->LDAP_FIELD_ADDRESS,$conf->global->LDAP_FIELD_ZIP,$conf->global->LDAP_FIELD_TOWN,$conf->global->LDAP_FIELD_COUNTRY,$conf->global->LDAP_FIELD_DESCRIPTION,$conf->global->LDAP_FIELD_BIRTHDATE,$conf->global->LDAP_FIELD_MEMBER_STATUS,$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION,
|
||||
$required_fields = array(
|
||||
$conf->global->LDAP_KEY_MEMBERS,
|
||||
$conf->global->LDAP_FIELD_FULLNAME,
|
||||
$conf->global->LDAP_FIELD_LOGIN,
|
||||
$conf->global->LDAP_FIELD_LOGIN_SAMBA,
|
||||
$conf->global->LDAP_FIELD_PASSWORD,
|
||||
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
|
||||
$conf->global->LDAP_FIELD_NAME,
|
||||
$conf->global->LDAP_FIELD_FIRSTNAME,
|
||||
$conf->global->LDAP_FIELD_MAIL,
|
||||
$conf->global->LDAP_FIELD_PHONE,
|
||||
$conf->global->LDAP_FIELD_PHONE_PERSO,
|
||||
$conf->global->LDAP_FIELD_MOBILE,
|
||||
$conf->global->LDAP_FIELD_FAX,
|
||||
$conf->global->LDAP_FIELD_ADDRESS,
|
||||
$conf->global->LDAP_FIELD_ZIP,
|
||||
$conf->global->LDAP_FIELD_TOWN,
|
||||
$conf->global->LDAP_FIELD_COUNTRY,
|
||||
$conf->global->LDAP_FIELD_DESCRIPTION,
|
||||
$conf->global->LDAP_FIELD_BIRTHDATE,
|
||||
$conf->global->LDAP_FIELD_MEMBER_STATUS,
|
||||
$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION,
|
||||
// Subscriptions
|
||||
$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE,$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT,$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE,$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT);
|
||||
$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE,
|
||||
$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT,
|
||||
$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE,
|
||||
$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT
|
||||
);
|
||||
|
||||
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
|
||||
$required_fields = array_unique(array_values(array_filter($required_fields, "dolValidElement")));
|
||||
|
||||
Reference in New Issue
Block a user