Changement du fonctionnement des bons d'interventions
This commit is contained in:
parent
ed451f3b28
commit
1d4b3c4798
@ -59,13 +59,13 @@ if ($_POST["action"] == 'add_action')
|
||||
if ($_POST["apmin"] == -1) $_POST["apmin"]='0';
|
||||
if ($_POST["adhour"] == -1) $_POST["adhour"]='0';
|
||||
if ($_POST["admin"] == -1) $_POST["admin"]='0';
|
||||
$datep=@mktime($_POST["aphour"],
|
||||
$datep=dolibarr_mktime($_POST["aphour"],
|
||||
$_POST["apmin"],
|
||||
0,
|
||||
$_POST["apmonth"],
|
||||
$_POST["apday"],
|
||||
$_POST["apyear"]);
|
||||
$datea=@mktime($_POST["adhour"],
|
||||
$datea=dolibarr_mktime($_POST["adhour"],
|
||||
$_POST["admin"],
|
||||
0,
|
||||
$_POST["admonth"],
|
||||
@ -240,13 +240,13 @@ if ($_POST["action"] == 'update')
|
||||
$action = new Actioncomm($db);
|
||||
$action->fetch($_POST["id"]);
|
||||
|
||||
$action->datep = @mktime($_POST["aphour"],
|
||||
$action->datep = dolibarr_mktime($_POST["aphour"],
|
||||
$_POST["apmin"],
|
||||
0,
|
||||
$_POST["apmonth"],
|
||||
$_POST["apday"],
|
||||
$_POST["apyear"]);
|
||||
$action->date = @mktime($_POST["adhour"],
|
||||
$action->date = dolibarr_mktime($_POST["adhour"],
|
||||
$_POST["admin"],
|
||||
0,
|
||||
$_POST["admonth"],
|
||||
|
||||
258
htdocs/fichinter/apercu.php
Normal file
258
htdocs/fichinter/apercu.php
Normal file
@ -0,0 +1,258 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/fichinter/apercu.php
|
||||
\ingroup fichinter
|
||||
\brief Page de l'onglet aperçu d'une fiche d'intervention
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/fichinter.lib.php");
|
||||
|
||||
$user->getrights('ficheinter');
|
||||
|
||||
if (!$user->rights->ficheinter->lire)
|
||||
accessforbidden();
|
||||
|
||||
$langs->load('interventions');
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/fichinter/fichinter.class.php');
|
||||
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/project.class.php");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
llxHeader();
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Mode fiche */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
|
||||
if ($_GET["id"] > 0) {
|
||||
$fichinter = new Fichinter($db);
|
||||
|
||||
if ( $fichinter->fetch($_GET["id"], $user->societe_id) > 0)
|
||||
{
|
||||
$soc = new Societe($db, $fichinter->socid);
|
||||
$soc->fetch($fichinter->socid);
|
||||
|
||||
|
||||
$head = fichinter_prepare_head($fichinter);
|
||||
dolibarr_fiche_head($head, 'preview', $langs->trans("InterventionCard"));
|
||||
|
||||
|
||||
/*
|
||||
* Fiche intervention
|
||||
*/
|
||||
$sql = 'SELECT s.nom, s.rowid, fi.fk_projet, fi.ref, fi.description, fi.fk_statut, '.$db->pdate('fi.datei').' as di,';
|
||||
$sql.= ' fi.fk_user_author, fi.fk_user_valid, fi.datec, fi.date_valid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'fichinter as fi';
|
||||
$sql.= ' WHERE fi.fk_soc = s.rowid';
|
||||
$sql.= ' AND fi.rowid = '.$fichinter->id;
|
||||
if ($socid) $sql .= ' AND s.rowid = '.$socid;
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($db->num_rows($result))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($obj->rowid);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans("Ref")."</td>";
|
||||
print '<td colspan="2">'.$fichinter->ref.'</td>';
|
||||
print "</tr>";
|
||||
|
||||
$nbrow=6;
|
||||
print '<td rowspan="'.$nbrow.'" valign="top">';
|
||||
|
||||
/*
|
||||
* Documents
|
||||
*/
|
||||
$fichinterref = sanitize_string($fichinter->ref);
|
||||
$dir_output = $conf->fichinter->dir_output . "/";
|
||||
$filepath = $dir_output . $fichinterref . "/";
|
||||
$file = $filepath . $fichinterref . ".pdf";
|
||||
$filedetail = $filepath . $fichinterref . "-detail.pdf";
|
||||
$relativepath = "${fichinterref}/${fichinterref}.pdf";
|
||||
$relativepathdetail = "${fichinterref}/${fichinterref}-detail.pdf";
|
||||
|
||||
// Chemin vers png aperçus
|
||||
$relativepathimage = "${fichinterref}/${fichinterref}.pdf.png";
|
||||
$fileimage = $file.".png"; // Si PDF d'1 page
|
||||
$fileimagebis = $file.".png.0"; // Si PDF de plus d'1 page
|
||||
|
||||
$var=true;
|
||||
|
||||
// Si fichier PDF existe
|
||||
if (file_exists($file))
|
||||
{
|
||||
$encfile = urlencode($file);
|
||||
print_titre($langs->trans("Documents"));
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr $bc[$var]><td>".$langs->trans("Order")." PDF</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=commande&file='.urlencode($relativepath).'">'.$commande->ref.'.pdf</a></td>';
|
||||
print '<td align="right">'.filesize($file). ' bytes</td>';
|
||||
print '<td align="right">'.dolibarr_print_date(filemtime($file),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Si fichier detail PDF existe
|
||||
if (file_exists($filedetail)) { // commande détaillée supplémentaire
|
||||
print "<tr $bc[$var]><td>Commande détaillée</td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=commande&file='.urlencode($relativepathdetail).'">'.$commande->ref.'-detail.pdf</a></td>';
|
||||
print '<td align="right">'.filesize($filedetail). ' bytes</td>';
|
||||
print '<td align="right">'.dolibarr_print_date(filemtime($filedetail),'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
// Conversion du PDF en image png si fichier png non existant
|
||||
if (! file_exists($fileimage) && ! file_exists($fileimagebis))
|
||||
{
|
||||
if (function_exists("imagick_readimage"))
|
||||
{
|
||||
$handle = imagick_readimage( $file ) ;
|
||||
if ( imagick_iserror( $handle ) )
|
||||
{
|
||||
$reason = imagick_failedreason( $handle ) ;
|
||||
$description = imagick_faileddescription( $handle ) ;
|
||||
|
||||
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
|
||||
}
|
||||
imagick_convert( $handle, "PNG" ) ;
|
||||
if ( imagick_iserror( $handle ) )
|
||||
{
|
||||
$reason = imagick_failedreason( $handle ) ;
|
||||
$description = imagick_faileddescription( $handle ) ;
|
||||
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
|
||||
}
|
||||
imagick_writeimages( $handle, $file .".png");
|
||||
} else {
|
||||
$langs->load("other");
|
||||
print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print "</td></tr>";
|
||||
|
||||
|
||||
// Client
|
||||
print "<tr><td>".$langs->trans("Customer")."</td>";
|
||||
print '<td colspan="2">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id.'">'.$societe->nom.'</a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||
print "<td colspan=\"2\">".$commande->getLibStatut(4)."</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
// Date
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print "<td colspan=\"2\">".dolibarr_print_date($commande->date,"daytext")."</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
// ligne 6
|
||||
// partie Gauche
|
||||
print '<tr><td height="10" nowrap>'.$langs->trans('GlobalDiscount').'</td>';
|
||||
print '<td colspan="2">'.$commande->remise_percent.'%</td>';
|
||||
print '</tr>';
|
||||
|
||||
// ligne 7
|
||||
// partie Gauche
|
||||
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td align="right" colspan="1"><b>'.price($commande->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
} else {
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
} else {
|
||||
// Commande non trouvée
|
||||
print $langs->trans("ErrorPropalNotFound",$_GET["id"]);
|
||||
}
|
||||
}
|
||||
|
||||
// Si fichier png PDF d'1 page trouvé
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercucommande&file='.urlencode($relativepathimage).'">';
|
||||
}
|
||||
// Si fichier png PDF de plus d'1 page trouvé
|
||||
elseif (file_exists($fileimagebis))
|
||||
{
|
||||
$multiple = $relativepathimage . ".";
|
||||
|
||||
for ($i = 0; $i < 20; $i++)
|
||||
{
|
||||
$preview = $multiple.$i;
|
||||
|
||||
if (file_exists($dir_output.$preview))
|
||||
{
|
||||
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercucommande&file='.urlencode($preview).'"><p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent
|
||||
print '<div class="tabsAction">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.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
|
||||
@ -62,7 +63,7 @@ if ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add' && ! $_REQUE
|
||||
return;
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'valid')
|
||||
if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
$fichinter->id = $_GET["id"];
|
||||
@ -73,7 +74,7 @@ if ($_GET["action"] == 'valid')
|
||||
if ($_POST["action"] == 'add')
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
|
||||
|
||||
$fichinter->date = $db->idate(dolibarr_mktime(12, 1 , 1, $_POST["pmonth"], $_POST["pday"], $_POST["pyear"]));
|
||||
$fichinter->socid = $_POST["socid"];
|
||||
$fichinter->duree = $_POST["duree"];
|
||||
@ -81,11 +82,14 @@ if ($_POST["action"] == 'add')
|
||||
$fichinter->author = $user->id;
|
||||
$fichinter->description = $_POST["description"];
|
||||
$fichinter->ref = $_POST["ref"];
|
||||
$fichinter->modelpdf = $_POST["model"];
|
||||
|
||||
$result = $fichinter->create();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$_GET["id"]=$result; // Force raffraichissement sur fiche venant d'etre créée
|
||||
$fichinterid=$result;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -99,7 +103,6 @@ if ($_POST["action"] == 'update')
|
||||
|
||||
$fichinter->date = $db->idate(mktime(12, 1 , 1, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]));
|
||||
$fichinter->socid = $_POST["socid"];
|
||||
$fichinter->duree = $_POST["duree"];
|
||||
$fichinter->projet_id = $_POST["projetidp"];
|
||||
$fichinter->author = $user->id;
|
||||
$fichinter->description = $_POST["description"];
|
||||
@ -127,6 +130,170 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Classer dans un projet
|
||||
*/
|
||||
if ($_POST['action'] == 'classin')
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
$fichinter->fetch($_GET['id']);
|
||||
$fichinter->set_project($user, $_POST['projetidp']);
|
||||
}
|
||||
|
||||
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
||||
{
|
||||
if ($user->rights->ficheinter->supprimer)
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
$fichinter->fetch($_GET['id']);
|
||||
$fichinter->delete($user);
|
||||
}
|
||||
Header('Location: index.php?leftmenu=ficheinter');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'setdate_delivery')
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
$fichinter->fetch($_GET['id']);
|
||||
$result=$fichinter->set_date_delivery($user,dolibarr_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']));
|
||||
if ($result < 0) dolibarr_print_error($db,$fichinter->error);
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'setdescription')
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
$fichinter->fetch($_GET['id']);
|
||||
$result=$fichinter->set_description($user,$_POST['description']);
|
||||
if ($result < 0) dolibarr_print_error($db,$fichinter->error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ajout d'une ligne d'intervention
|
||||
*/
|
||||
if ($_POST['action'] == "addligne" && $user->rights->ficheinter->creer)
|
||||
{
|
||||
if ($_POST['np_desc'] && ($_POST['durationhour'] || $_POST['durationmin']))
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
$ret=$fichinter->fetch($_POST['fichinterid']);
|
||||
|
||||
$desc=$_POST['np_desc'];
|
||||
$date_intervention = $db->idate(mktime(12, 1 , 1, $_POST["dimonth"], $_POST["diday"], $_POST["diyear"]));
|
||||
$duration = ConvertTime2Seconds($_POST['durationhour'],$_POST['durationmin']);
|
||||
|
||||
$fichinter->addline(
|
||||
$_POST['fichinterid'],
|
||||
$desc,
|
||||
$date_intervention,
|
||||
$duration
|
||||
);
|
||||
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
fichinter_pdf_create($db, $fichinter->id, $fichinter->modelpdf, $outputlangs);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Mise à jour d'une ligne d'intervention
|
||||
*/
|
||||
if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_POST["save"] == $langs->trans("Save"))
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
if (! $fichinter->fetch($_POST['fichinterid']) > 0) dolibarr_print_error($db);
|
||||
|
||||
$desc=$_POST['desc'];
|
||||
$date_intervention = $db->idate(mktime(12, 1 , 1, $_POST["dimonth"], $_POST["diday"], $_POST["diyear"]));
|
||||
$duration = ConvertTime2Seconds($_POST['durationhour'],$_POST['durationmin']);
|
||||
|
||||
$result = $fichinter->updateline($_POST['ligne'],
|
||||
$desc,
|
||||
$date_intervention,
|
||||
$duration
|
||||
);
|
||||
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
fichinter_pdf_create($db, $fichinter->id, $fichinter->modelpdf, $outputlangs);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Supprime une ligne d'intervention SANS confirmation
|
||||
*/
|
||||
if ($_GET['action'] == 'deleteline' && $user->rights->ficheinter->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
$fichinter->fetch($_GET['id']);
|
||||
$result=$fichinter->delete_line($_GET['ligne']);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
fichinter_pdf_create($db, $fichinter->id, $fichinter->modelpdf, $outputlangs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Supprime une ligne d'intervention AVEC confirmation
|
||||
*/
|
||||
if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||
{
|
||||
if ($user->rights->ficheinter->creer)
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
$fichinter->fetch($_GET['id']);
|
||||
$result=$fichinter->delete_line($_GET['ligne']);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
fichinter_pdf_create($db, $fichinter->id, $fichinter->modelpdf, $outputlangs);
|
||||
}
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']);
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Ordonnancement des lignes
|
||||
*/
|
||||
|
||||
if ($_GET['action'] == 'up' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
$fichinter->fetch($_GET['id']);
|
||||
$fichinter->line_up($_GET['rowid']);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
fichinter_pdf_create($db, $fichinter->id, $fichinter->modelpdf, $outputlangs);
|
||||
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
|
||||
}
|
||||
|
||||
if ($_GET['action'] == 'down' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$fichinter = new Fichinter($db);
|
||||
$fichinter->fetch($_GET['id']);
|
||||
$fichinter->line_down($_GET['rowid']);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
fichinter_pdf_create($db, $fichinter->id, $fichinter->modelpdf, $outputlangs);
|
||||
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -158,7 +325,7 @@ if ($_GET["action"] == 'create')
|
||||
}
|
||||
|
||||
$ficheinter = new Fichinter($db);
|
||||
$result=$ficheinter->fetch($_GET["id"]);
|
||||
$result=$ficheinter->fetch($fichinterid);
|
||||
|
||||
$obj = $conf->global->FICHEINTER_ADDON;
|
||||
$file = $obj.".php";
|
||||
@ -180,7 +347,7 @@ if ($_GET["action"] == 'create')
|
||||
else
|
||||
{
|
||||
print "<tr><td>".$langs->trans("Company")."</td><td>";
|
||||
$html->select_societes('','socid','');
|
||||
$html->select_societes('','socid','',1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
@ -193,9 +360,7 @@ if ($_GET["action"] == 'create')
|
||||
print "<tr><td>".$langs->trans("Ref")."</td>";
|
||||
print "<td><input name=\"ref\" value=\"$numpr\"></td></tr>\n";
|
||||
|
||||
print "<tr><td>".$langs->trans("Duration")." (".$langs->trans("days").")</td><td><input name=\"duree\"></td></tr>\n";
|
||||
|
||||
if ($conf->projet->enabled)
|
||||
if ($conf->projet->enabled && $_GET["socid"])
|
||||
{
|
||||
// Projet associe
|
||||
$langs->load("project");
|
||||
@ -223,6 +388,15 @@ if ($_GET["action"] == 'create')
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Model
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DefaultModel").'</td>';
|
||||
print '<td colspan="2">';
|
||||
$model=new ModelePDFFicheinter();
|
||||
$liste=$model->liste_modeles($db);
|
||||
$html->select_array('model',$liste,$conf->global->FICHINTER_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
|
||||
print "<td>";
|
||||
@ -248,109 +422,20 @@ if ($_GET["action"] == 'create')
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
elseif ($_GET["action"] == 'edit' && $_GET["id"] > 0)
|
||||
{
|
||||
/*
|
||||
*
|
||||
* Mode update
|
||||
* Mise a jour de la fiche d'intervention
|
||||
*
|
||||
*/
|
||||
$fichinter = new Fichinter($db);
|
||||
$fichinter->fetch($_GET["id"]);
|
||||
$fichinter->fetch_client();
|
||||
|
||||
$head = fichinter_prepare_head($fichinter);
|
||||
|
||||
dolibarr_fiche_head($head, 'card', $langs->trans("EditIntervention"));
|
||||
|
||||
|
||||
print "<form name='update' action=\"fiche.php\" method=\"post\">";
|
||||
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
|
||||
print "<input type=\"hidden\" name=\"id\" value=\"".$_GET["id"]."\">";
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td>'.$fichinter->ref.'</td></tr>';
|
||||
|
||||
// Tiers
|
||||
print "<tr><td>".$langs->trans("Company")."</td><td>".$fichinter->client->getNomUrl(1)."</td></tr>";
|
||||
|
||||
// Date
|
||||
print "<tr><td>".$langs->trans("Date")."</td><td>";
|
||||
$html->select_date($fichinter->date,'','','','','update');
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("Duration")." (".$langs->trans("days").')</td><td><input name="duree" value="'.$fichinter->duree.'"></td></tr>';
|
||||
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$societe=new Societe($db);
|
||||
$societe->fetch($fichinter->societe_id);
|
||||
$numprojet = $societe->has_projects();
|
||||
|
||||
// Projet associé
|
||||
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>';
|
||||
|
||||
if (!$numprojet)
|
||||
{
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
print '<tr><td width="130">'.$langs->trans("NoProject").'</td>';
|
||||
|
||||
$user->getrights("projet");
|
||||
|
||||
if ($user->rights->projet->creer)
|
||||
{
|
||||
print '<td><a href='.DOL_URL_ROOT.'/projet/fiche.php?socid='.$fichinter->societe_id.'&action=create>'.$langs->trans("Add").'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->select_projects($fichinter->societe_id,$fichinter->projet_id,"projetidp");
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
|
||||
print '<td>';
|
||||
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_SOCIETE)
|
||||
{
|
||||
// Editeur wysiwyg
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('description',$fichinter->description,280,'dolibarr_notes','In',true);
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="description" wrap="soft" cols="70" rows="12">'.$fichinter->description.'</textarea>';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td colspan="2" align="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</td></tr>';
|
||||
print "</table>\n";
|
||||
print '</form>';
|
||||
print '</div>';
|
||||
}
|
||||
elseif ($_GET["id"] > 0)
|
||||
{
|
||||
/*
|
||||
* Affichage en mode visu
|
||||
*/
|
||||
|
||||
$html = new Form($db);
|
||||
$fichinter = new Fichinter($db);
|
||||
$result=$fichinter->fetch($_GET["id"]);
|
||||
if (! $result > 0)
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
exit;
|
||||
}
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
exit;
|
||||
}
|
||||
$fichinter->fetch_client();
|
||||
|
||||
if ($mesg) print $mesg."<br>";
|
||||
@ -359,6 +444,32 @@ elseif ($_GET["id"] > 0)
|
||||
|
||||
dolibarr_fiche_head($head, 'card', $langs->trans("InterventionCard"));
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de la fiche d'intervention
|
||||
*/
|
||||
if ($_GET['action'] == 'delete')
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la validation de la fiche d'intervention
|
||||
*/
|
||||
if ($_GET['action'] == 'validate')
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression d'une ligne d'intervention
|
||||
*/
|
||||
if ($_GET['action'] == 'ask_deleteline' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -369,32 +480,334 @@ elseif ($_GET["id"] > 0)
|
||||
print "<tr><td>".$langs->trans("Company")."</td><td>".$fichinter->client->getNomUrl(1)."</td></tr>";
|
||||
|
||||
// Date
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dolibarr_print_date($fichinter->date,"daytext").'</td></tr>';
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Date');
|
||||
print '</td>';
|
||||
if ($_GET['action'] != 'editdate_delivery' && $fichinter->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_delivery&id='.$fichinter->id.'">'.img_edit($langs->trans('SetDateCreate'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET['action'] == 'editdate_delivery')
|
||||
{
|
||||
print '<form name="editdate_delivery" action="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="setdate_delivery">';
|
||||
$html->select_date($fichinter->date,'liv_','','','',"editdate_delivery");
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print dolibarr_print_date($fichinter->date,'%a %d %B %Y');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Durée
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td>'.$fichinter->duree.'</td></tr>';
|
||||
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$fichinter->fetch_projet();
|
||||
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$fichinter->projet->id.'" title="'.$langs->trans('ShowProject').'">';
|
||||
print $fichinter->projet->title;
|
||||
print '</a>';
|
||||
// Projet
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load("projects");
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Project').'</td>';
|
||||
$societe=new Societe($db);
|
||||
$societe->fetch($fichinter->socid);
|
||||
$numprojet = $societe->has_projects();
|
||||
if (! $numprojet)
|
||||
{
|
||||
print '</td></tr></table>';
|
||||
print '<td>';
|
||||
print $langs->trans("NoProject").' ';
|
||||
if ($fichinter->brouillon) print '<a href=../projet/fiche.php?socid='.$societe->id.'&action=create>'.$langs->trans('AddProject').'</a>';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($fichinter->statut == 0 && $user->rights->ficheinter->creer)
|
||||
{
|
||||
if ($_GET['action'] != 'classer' && $fichinter->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=classer&id='.$fichinter->id.'">'.img_edit($langs->trans('SetProject')).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET['action'] == 'classer')
|
||||
{
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->projetidp, 'projetidp');
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->projetidp, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($fichinter->projetidp))
|
||||
{
|
||||
print '</td></tr></table>';
|
||||
print '<td colspan="3">';
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($fichinter->projetidp);
|
||||
print '<a href="../projet/fiche.php?id='.$fichinter->projetidp.'" title="'.$langs->trans('ShowProject').'">';
|
||||
print $proj->title;
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
print '</td></tr></table>';
|
||||
print '<td colspan="3"> </td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Durée
|
||||
print '<tr><td>'.$langs->trans("TotalDuration").'</td><td>'.$fichinter->duree.'</td></tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Description');
|
||||
print '</td>';
|
||||
if ($_GET['action'] != 'editdescription' && $fichinter->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdescription&id='.$fichinter->id.'">'.img_edit($langs->trans('SetDescription'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET['action'] == 'editdescription')
|
||||
{
|
||||
print '<form name="editdescription" action="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="setdescription">';
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_SOCIETE)
|
||||
{
|
||||
// Editeur wysiwyg
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('description',$fichinter->description,280,'dolibarr_notes','In',true);
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="description" wrap="soft" cols="70" rows="12">'.$fichinter->description.'</textarea>';
|
||||
}
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print nl2br($fichinter->description);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$fichinter->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
|
||||
print '<td>';
|
||||
print nl2br($fichinter->description);
|
||||
print '</td></tr>';
|
||||
print "</table><br>";
|
||||
|
||||
/*
|
||||
* Lignes d'intervention
|
||||
*/
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
$sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang';
|
||||
$sql.= ', '.$db->pdate('ft.date').' as date_intervention';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft';
|
||||
$sql.= ' WHERE ft.fk_fichinter = '.$fichinterid;
|
||||
$sql.= ' ORDER BY ft.rang ASC, ft.rowid';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
if ($num)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Description').'</td>';
|
||||
print '<td>'.$langs->trans('Date').'</td>';
|
||||
print '<td>'.$langs->trans('Duration').'</td>';
|
||||
print '<td width="48" colspan="3"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
// Ligne en mode visu
|
||||
if ($_GET['action'] != 'editline' || $_GET['ligne'] != $objp->rowid)
|
||||
{
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
print nl2br($objp->description);
|
||||
|
||||
print '<td width="150">'.dolibarr_print_date($objp->date_intervention,'%a %d %B %Y').'</td>';
|
||||
print '<td width="150">'.ConvertSecondToTime($objp->duree).'</td>';
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
|
||||
// Icone d'edition et suppression
|
||||
if ($fichinter->statut == 0 && $user->rights->ficheinter->creer)
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=editline&ligne='.$objp->rowid.'#'.$objp->rowid.'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
if ($conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||
{
|
||||
if ($conf->use_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$objp->rowid.'&action=confirm_deleteline&confirm=yes';
|
||||
print '<a href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeleteInterventionLine').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'deleteline'.$i.'\')">';
|
||||
print img_delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=ask_deleteline&ligne='.$objp->rowid.'">';
|
||||
print img_delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=deleteline&ligne='.$objp->rowid.'">';
|
||||
print img_delete();
|
||||
}
|
||||
print '</a></td>';
|
||||
if ($num > 1)
|
||||
{
|
||||
print '<td align="center">';
|
||||
if ($i > 0)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=up&rowid='.$objp->rowid.'">';
|
||||
print img_up();
|
||||
print '</a>';
|
||||
}
|
||||
if ($i < $num-1)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=down&rowid='.$objp->rowid.'">';
|
||||
print img_down();
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="3"> </td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Ligne en mode update
|
||||
if ($fichinter->statut == 0 && $_GET["action"] == 'editline' && $user->rights->ficheinter->creer && $_GET["ligne"] == $objp->rowid)
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'#'.$objp->rowid.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="updateligne">';
|
||||
print '<input type="hidden" name="fichinterid" value="'.$fichinter->id.'">';
|
||||
print '<input type="hidden" name="ligne" value="'.$_GET["ligne"].'">';
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
// éditeur wysiwyg
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('desc',$objp->description,164,'dolibarr_details');
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="desc" cols="70" class="flat" rows="'.ROWS_2.'">'.$objp->description.'</textarea>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Date d'intervention
|
||||
print '<td>';
|
||||
$html->select_date($objp->date_intervention,'di',0,0,0,"date_intervention");
|
||||
print '</td>';
|
||||
|
||||
// Durée
|
||||
print '<td>';
|
||||
$html->select_duree('duration',$objp->duree);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center" colspan="5" valign="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print '<br /><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
print '</tr>' . "\n";
|
||||
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ajouter une ligne
|
||||
*/
|
||||
if ($fichinter->statut == 0 && $user->rights->ficheinter->creer && $_GET["action"] <> 'editline')
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>';
|
||||
print '<a name="add"></a>'; // ancre
|
||||
print $langs->trans('Description').'</td>';
|
||||
print '<td>'.$langs->trans('Date').'</td>';
|
||||
print '<td>'.$langs->trans('Duration').'</td>';
|
||||
|
||||
print '<td colspan="4"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Ajout ligne d'intervention
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'#add" method="post">';
|
||||
print '<input type="hidden" name="fichinterid" value="'.$fichinter->id.'">';
|
||||
print '<input type="hidden" name="action" value="addligne">';
|
||||
|
||||
$var=true;
|
||||
|
||||
print '<tr '.$bc[$var].">\n";
|
||||
print '<td>';
|
||||
// éditeur wysiwyg
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS_PERSO)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('np_desc','',100,'dolibarr_details');
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea class="flat" cols="70" name="np_desc" rows="'.ROWS_2.'"></textarea>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Date d'intervention
|
||||
print '<td>';
|
||||
$html->select_date(time(),'di',0,0,0,"date_intervention");
|
||||
print '</td>';
|
||||
|
||||
// Durée
|
||||
print '<td>';
|
||||
$html->select_duree('duration');
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'" name="addligne"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print "\n";
|
||||
|
||||
|
||||
/**
|
||||
@ -405,17 +818,39 @@ elseif ($_GET["id"] > 0)
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
|
||||
if ($fichinter->statut == 0)
|
||||
// Validate
|
||||
if ($fichinter->statut == 0 && $user->rights->ficheinter->creer)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$_GET["id"].'&action=edit">'.$langs->trans("Edit").'</a>';
|
||||
print '<a class="butAction" ';
|
||||
if ($conf->use_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=confirm_validate&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmValidateIntervention').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')"';
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="fiche.php?id='.$_GET["id"].'&action=validate"';
|
||||
}
|
||||
print '>'.$langs->trans("Valid").'</a>';
|
||||
}
|
||||
|
||||
if ($fichinter->statut == 0)
|
||||
|
||||
// Delete
|
||||
if ($fichinter->statut == 0 && $user->rights->ficheinter->supprimer)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$_GET["id"].'&action=valid">'.$langs->trans("Valid").'</a>';
|
||||
print '<a class="butActionDelete" ';
|
||||
if ($conf->use_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=confirm_delete&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans("ConfirmDeleteIntervention").'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')"';
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=delete"';
|
||||
}
|
||||
print '>'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
@ -425,8 +860,8 @@ elseif ($_GET["id"] > 0)
|
||||
$filename=sanitize_string($fichinter->ref);
|
||||
$filedir=$conf->fichinter->dir_output . "/".$fichinter->ref;
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$fichinter->id;
|
||||
$genallowed=$user->rights->fichinter->creer;
|
||||
$delallowed=$user->rights->fichinter->supprimer;
|
||||
$genallowed=$user->rights->ficheinter->creer;
|
||||
$delallowed=$user->rights->ficheinter->supprimer;
|
||||
$genallowed=1;
|
||||
$delallowed=0;
|
||||
|
||||
|
||||
@ -46,11 +46,13 @@ class Fichinter extends CommonObject
|
||||
var $author;
|
||||
var $ref;
|
||||
var $date;
|
||||
var $date_delivery;
|
||||
var $duree;
|
||||
var $description;
|
||||
var $note_private;
|
||||
var $note_public;
|
||||
var $projet_id;
|
||||
var $modelpdf;
|
||||
|
||||
|
||||
/**
|
||||
@ -92,33 +94,34 @@ class Fichinter extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."fichinter (fk_soc, datei, datec, ref, fk_user_author, description, duree";
|
||||
if ($this->projet_id) {
|
||||
$sql .= ",fk_projet";
|
||||
}
|
||||
$sql .= ") ";
|
||||
$sql .= " VALUES ($this->socid, $this->date, now(), '$this->ref', $this->author, '".addslashes($this->description)."', $this->duree";
|
||||
if ($this->projet_id) {
|
||||
$sql .= ", ".$this->projet_id;
|
||||
}
|
||||
$sql .= ")";
|
||||
$sqlok = 0;
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."fichinter (fk_soc, datei, datec, ref, fk_user_author, description, model_pdf";
|
||||
if ($this->projet_id) {
|
||||
$sql .= ", fk_projet";
|
||||
}
|
||||
$sql .= ") ";
|
||||
$sql .= " VALUES (".$this->socid.", ".$this->date.", now(), '".$this->ref."', ".$this->author;
|
||||
$sql .= ", '".addslashes($this->description)."', '".$this->modelpdf."'";
|
||||
if ($this->projet_id) {
|
||||
$sql .= ", ".$this->projet_id;
|
||||
}
|
||||
$sql .= ")";
|
||||
$sqlok = 0;
|
||||
|
||||
dolibarr_syslog("Fichinter::create sql=".$sql);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Fichinter::create ".$this->error);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
dolibarr_syslog("Fichinter::create sql=".$sql);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Fichinter::create ".$this->error);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -160,8 +163,8 @@ class Fichinter extends CommonObject
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = "SELECT ref, description, fk_soc, fk_statut, duree";
|
||||
$sql.= ", ".$this->db->pdate(datei)." as di, fk_projet, note_public, note_private";
|
||||
$sql = "SELECT ref, description, fk_soc, fk_statut";
|
||||
$sql.= ", ".$this->db->pdate(datei)." as di, fk_projet, note_public, note_private, model_pdf";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter";
|
||||
$sql.= " WHERE rowid=".$rowid;
|
||||
|
||||
@ -176,14 +179,16 @@ class Fichinter extends CommonObject
|
||||
|
||||
$this->id = $rowid;
|
||||
$this->date = $obj->di;
|
||||
$this->duree = $obj->duree;
|
||||
$this->ref = $obj->ref;
|
||||
$this->description = $obj->description;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->projet_id = $obj->fk_projet;
|
||||
$this->projetidp = $obj->fk_projet;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
|
||||
if ($this->statut == 0) $this->brouillon = 1;
|
||||
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
@ -429,5 +434,537 @@ class Fichinter extends CommonObject
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Classe la fiche d'intervention dans un projet
|
||||
* \param project_id Id du projet dans lequel classer la facture
|
||||
*/
|
||||
function set_project($user, $project_id)
|
||||
{
|
||||
if ($user->rights->ficheinter->creer)
|
||||
{
|
||||
//verif que le projet et la société concordent
|
||||
$sql = 'SELECT p.rowid, p.title FROM '.MAIN_DB_PREFIX.'projet as p WHERE p.fk_soc ='.$this->socid.' AND p.rowid='.$project_id;
|
||||
$sqlres = $this->db->query($sql);
|
||||
if ($sqlres)
|
||||
{
|
||||
$numprojet = $this->db->num_rows($sqlres);
|
||||
if ($numprojet > 0)
|
||||
{
|
||||
$this->projetidp=$project_id;
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'fichinter SET fk_projet = '.$project_id;
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;';
|
||||
$this->db->query($sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
dolibarr_syslog("Fichinter.class::set_project Erreur SQL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Efface fiche intervention
|
||||
* \param user Objet du user qui efface
|
||||
*/
|
||||
function delete($user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE fk_fichinter = ".$this->id;
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinter WHERE rowid = ".$this->id;
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
|
||||
// On efface le répertoire du pdf
|
||||
$fichinterref = sanitize_string($this->ref);
|
||||
if ($conf->fichinter->dir_output)
|
||||
{
|
||||
$dir = $conf->fichinter->dir_output . "/" . $fichinterref ;
|
||||
$file = $conf->fichinter->dir_output . "/" . $fichinterref . "/" . $fichinterref . ".pdf";
|
||||
if (file_exists($file))
|
||||
{
|
||||
fichinter_delete_preview($this->db, $this->id, $this->ref);
|
||||
|
||||
if (!dol_delete_file($file))
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (file_exists($dir))
|
||||
{
|
||||
if (!dol_delete_dir($dir))
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dolibarr_syslog("Suppression de la fiche intervention $this->id par $user->fullname ($user->id)");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Définit une date de livraison du bon d'intervention
|
||||
* \param user Objet utilisateur qui modifie
|
||||
* \param date_creation date de livraison
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function set_date_delivery($user, $date_delivery)
|
||||
{
|
||||
if ($user->rights->ficheinter->creer)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
|
||||
$sql.= " SET datei = ".$this->db->idate($date_delivery);
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->date_delivery = $date_delivery;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Fichinter.class::set_date_delivery Erreur SQL");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Définit le label de l'intervention
|
||||
* \param user Objet utilisateur qui modifie
|
||||
* \param description description
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function set_description($user, $description)
|
||||
{
|
||||
if ($user->rights->ficheinter->creer)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
|
||||
$sql.= " SET description = '".addslashes($description)."'";
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->description = $description;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Fichinter.class::set_description Erreur SQL");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Ajout d'une ligne d'intervention, en base
|
||||
* \param fichinterid Id de la fiche d'intervention
|
||||
* \param desc Description de la ligne
|
||||
* \param date_intervention Date de l'intervention
|
||||
* \param duration Durée de l'intervention
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function addline($fichinterid, $desc, $date_intervention, $duration)
|
||||
{
|
||||
dolibarr_syslog("Fichinter::Addline $fichinterid, $desc, $date_intervention, $duration");
|
||||
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Insertion ligne
|
||||
$ligne=new FichinterLigne($this->db);
|
||||
|
||||
$ligne->fk_fichinter = $fichinterid;
|
||||
$ligne->desc = $desc;
|
||||
$ligne->datei = $date_intervention;
|
||||
$ligne->duration = $duration;
|
||||
|
||||
$result=$ligne->insert();
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Error sql=$sql, error=".$this->error);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Mise à jour d'une ligne d'intervention
|
||||
* \param fichinterid Id de la ligne
|
||||
* \param desc Description
|
||||
* \param date Date d'intervention
|
||||
* \param duration Durée de l'intervention
|
||||
* \return int 0 en cas de succès
|
||||
*/
|
||||
function updateline($fichinterid, $desc, $date_intervention, $duration)
|
||||
{
|
||||
dolibarr_syslog("Fichinter::UpdateLine $fichinterid, $desc, $date_intervention, $duration");
|
||||
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinterdet ";
|
||||
$sql.= " SET description='".addslashes($desc)."'";
|
||||
$sql.= " , date=".$date_intervention;
|
||||
$sql.= " , duree=".$duration;
|
||||
$sql.= " WHERE rowid = '".$fichinterid."';";
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result > 0)
|
||||
{
|
||||
//Todo: mise à jour du total de la durée
|
||||
//$this->update_price();
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("Fichinter.class::UpdateLine Erreur sql=$sql, error=".$this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Fichinter.class::UpdateLigne Erreur -2 Fiche intervention en mode incompatible pour cette action");
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Supprime une ligne d'intervention
|
||||
* \param idligne Id de la ligne detail à supprimer
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function delete_line($idligne)
|
||||
{
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$idligne;
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
//Todo : faire un update du total de la durée
|
||||
//$this->update_price();
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Stocke un numéro de rang pour toutes les lignes de
|
||||
* detail d'une fiche d'intervention qui n'en ont pas.
|
||||
*/
|
||||
function line_order()
|
||||
{
|
||||
$sql = 'SELECT count(rowid) FROM '.MAIN_DB_PREFIX.'fichinterdet';
|
||||
$sql .= ' WHERE fk_fichinter='.$this->id;
|
||||
$sql .= ' AND rang = 0';
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$nl = $row[0];
|
||||
}
|
||||
if ($nl > 0)
|
||||
{
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'fichinterdet';
|
||||
$sql .= ' WHERE fk_fichinter='.$this->id;
|
||||
$sql .= ' ORDER BY rang ASC, rowid ASC';
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$li[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
for ($i = 0 ; $i < sizeof($li) ; $i++)
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'fichinterdet SET rang = '.($i+1);
|
||||
$sql .= ' WHERE rowid = '.$li[$i];
|
||||
if (!$this->db->query($sql) )
|
||||
{
|
||||
dolibarr_syslog($this->db->error());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function line_up($rowid)
|
||||
{
|
||||
$this->line_order();
|
||||
|
||||
/* Lecture du rang de la ligne */
|
||||
$sql = 'SELECT rang FROM '.MAIN_DB_PREFIX.'fichinterdet';
|
||||
$sql .= ' WHERE rowid ='.$rowid;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$rang = $row[0];
|
||||
}
|
||||
|
||||
if ($rang > 1 )
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'fichinterdet SET rang = '.$rang ;
|
||||
$sql .= ' WHERE fk_fichinter = '.$this->id;
|
||||
$sql .= ' AND rang = '.($rang - 1);
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'fichinterdet SET rang = '.($rang - 1);
|
||||
$sql .= ' WHERE rowid = '.$rowid;
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function line_down($rowid)
|
||||
{
|
||||
$this->line_order();
|
||||
|
||||
/* Lecture du rang de la ligne */
|
||||
$sql = 'SELECT rang FROM '.MAIN_DB_PREFIX.'fichinterdet';
|
||||
$sql .= ' WHERE rowid ='.$rowid;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$rang = $row[0];
|
||||
}
|
||||
|
||||
/* Lecture du rang max de la propale */
|
||||
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.'fichinterdet';
|
||||
$sql .= ' WHERE fk_fichinter ='.$this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$max = $row[0];
|
||||
}
|
||||
|
||||
if ($rang < $max )
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'fichinterdet SET rang = '.$rang;
|
||||
$sql .= ' WHERE fk_fichinter = '.$this->id;
|
||||
$sql .= ' AND rang = '.($rang+1);
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'fichinterdet SET rang = '.($rang+1);
|
||||
$sql .= ' WHERE rowid = '.$rowid;
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\class FichinterLigne
|
||||
\brief Classe permettant la gestion des lignes d'intervention
|
||||
*/
|
||||
|
||||
class FichinterLigne
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
// From llx_fichinterdet
|
||||
var $rowid;
|
||||
var $fk_fichinter;
|
||||
var $desc; // Description ligne
|
||||
var $datei; // Date intervention
|
||||
var $duration; // Durée de l'intervention
|
||||
var $rang = 0;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur d'objets ligne d'intervention
|
||||
* \param DB handler d'accès base de donnée
|
||||
*/
|
||||
function FichinterLigne($DB)
|
||||
{
|
||||
$this->db= $DB;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Recupére l'objet ligne d'intervention
|
||||
* \param rowid id de la ligne
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = 'SELECT ft.rowid, ft.fk_fichinter, ft.description, ft.duree, ft.rang';
|
||||
$sql.= ', '.$db->pdate('ft.date').' as date_intervention';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pd';
|
||||
$sql.= ' WHERE ft.rowid = '.$rowid;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$this->rowid = $objp->rowid;
|
||||
$this->fk_fichinter = $objp->fk_fichinter;
|
||||
$this->datei = $objp->date_intervention;
|
||||
$this->desc = $objp->description;
|
||||
$this->duration = $objp->duree;
|
||||
$this->rang = $objp->rang;
|
||||
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Insère l'objet ligne d'intervention en base
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function insert()
|
||||
{
|
||||
dolibarr_syslog("FichinterLigne.class::insert rang=".$this->rang);
|
||||
$this->db->begin();
|
||||
|
||||
$rangToUse=$this->rang;
|
||||
if ($rangToUse == -1)
|
||||
{
|
||||
// Récupère rang max de la ligne d'intervention dans $rangmax
|
||||
$sql = 'SELECT max(rang) as max FROM '.MAIN_DB_PREFIX.'fichinterdet';
|
||||
$sql.= ' WHERE fk_fichinter ='.$this->fk_fichinter;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$rangToUse = $obj->max + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Insertion dans base de la ligne
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'fichinterdet';
|
||||
$sql.= ' (fk_fichinter, description, date, duree, rang)';
|
||||
$sql.= " VALUES (".$this->fk_fichinter.",";
|
||||
$sql.= " '".addslashes($this->desc)."',";
|
||||
$sql.= " ".$this->datei.",";
|
||||
$sql.= " ".$this->duration.",";
|
||||
$sql.= ' '.$rangToUse;
|
||||
$sql.= ')';
|
||||
|
||||
dolibarr_syslog("fichinterLigne.class::insert sql=$sql");
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->rang=$rangToUse;
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." sql=".$sql;
|
||||
dolibarr_syslog("FichinterLigne::insert Error ".$this->error);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Mise a jour de l'objet ligne d'intervention en base
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function update()
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Mise a jour ligne en base
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinterdet SET";
|
||||
$sql.= " description='".addslashes($this->desc)."'";
|
||||
$sql.= ",date=".$this->datei;
|
||||
$sql.= ",duree=".$this->duration;
|
||||
$sql.= ",rang='".$this->rang."'";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dolibarr_syslog("FichinterLigne::update sql=$sql");
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("FichinterLigne::update Error ".$this->error);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@ -2763,24 +2763,35 @@ class Form
|
||||
|
||||
/**
|
||||
\brief Fonction servant a afficher une durée dans une liste déroulante
|
||||
\param prefix prefix
|
||||
\param prefix prefix
|
||||
\param iSecond Nombre de secondes
|
||||
*/
|
||||
function select_duree($prefix)
|
||||
function select_duree($prefix,$iSecond='')
|
||||
{
|
||||
if ($iSecond)
|
||||
{
|
||||
$hourSelected = ConvertSecondToTime($iSecond,'hour');
|
||||
$minSelected = ConvertSecondToTime($iSecond,'min');
|
||||
}
|
||||
print '<select class="flat" name="'.$prefix.'hour">';
|
||||
print "<option value=\"0\">0</option>";
|
||||
for ($hour = 1 ; $hour < 24 ; $hour++)
|
||||
{
|
||||
print "<option value=\"$hour\"";
|
||||
if ($hour == 1) print " selected=\"true\"";
|
||||
print ">$hour</option>";
|
||||
print '<option value="'.$hour.'"';
|
||||
if ((!$hourSelected && $hour == 1) || ($hourSelected == $hour))
|
||||
{
|
||||
print " selected=\"true\"";
|
||||
}
|
||||
print ">".$hour."</option>";
|
||||
}
|
||||
print "</select>";
|
||||
print "H ";
|
||||
print '<select class="flat" name="'.$prefix.'min">';
|
||||
for ($min = 0 ; $min < 55 ; $min=$min+5)
|
||||
for ($min = 0 ; $min <= 55 ; $min=$min+5)
|
||||
{
|
||||
print "<option value=\"$min\">$min</option>";
|
||||
print '<option value="'.$min.'"';
|
||||
if ($minSelected == $min) print ' selected="true"';
|
||||
print '>'.$min.'</option>';
|
||||
}
|
||||
print "</select>";
|
||||
print "M ";
|
||||
|
||||
@ -341,7 +341,7 @@ class MenuLeft {
|
||||
{
|
||||
$langs->load("interventions");
|
||||
$newmenu->add(DOL_URL_ROOT."/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire);
|
||||
if ($leftmenu=="ficheinter") $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer);
|
||||
if ($leftmenu=="ficheinter") $newmenu->add_submenu(DOL_URL_ROOT."/fichinter/fiche.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer);
|
||||
if ($leftmenu=="ficheinter") $newmenu->add_submenu(DOL_URL_ROOT."/fichinter/index.php?leftmenu=ficheinter", $langs->trans("List"), 1 ,$user->rights->ficheinter->lire);
|
||||
}
|
||||
|
||||
|
||||
@ -195,4 +195,54 @@ function fichinter_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Supprime l'image de prévisualitation, pour le cas de régénération de propal
|
||||
\param db objet base de donnée
|
||||
\param propalid id de la propal à effacer
|
||||
\param propalref référence de la propal si besoin
|
||||
*/
|
||||
function fichinter_delete_preview($db, $fichinterid, $fichinterref='')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
if (!$fichinterref)
|
||||
{
|
||||
$fichinter = new Fichinter($db,"",$fichinterid);
|
||||
$fichinter->fetch($fichinterid);
|
||||
$fichinterref = $fichinter->ref;
|
||||
}
|
||||
|
||||
if ($conf->fichinter->dir_output)
|
||||
{
|
||||
$fichinterref = sanitize_string($fichinterref);
|
||||
$dir = $conf->fichinter->dir_output . "/" . $fichinterref ;
|
||||
$file = $dir . "/" . $fichinterref . ".pdf.png";
|
||||
$multiple = $file . ".";
|
||||
|
||||
if ( file_exists( $file ) && is_writable( $file ) )
|
||||
{
|
||||
if ( ! unlink($file) )
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ($i = 0; $i < 20; $i++)
|
||||
{
|
||||
$preview = $multiple.$i;
|
||||
if ( file_exists( $preview ) && is_writable( $preview ) )
|
||||
{
|
||||
if ( ! unlink($preview) )
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFailedToOpenFile",$preview);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -227,7 +227,7 @@ function propale_delete_preview($db, $propalid, $propalref='')
|
||||
|
||||
if ($conf->propal->dir_output)
|
||||
{
|
||||
$propref = sanitize_string($propalref);
|
||||
$propalref = sanitize_string($propalref);
|
||||
$dir = $conf->propal->dir_output . "/" . $propalref ;
|
||||
$file = $dir . "/" . $propalref . ".pdf.png";
|
||||
$multiple = $file . ".";
|
||||
|
||||
@ -11,6 +11,12 @@ AllInterventions=All interventions
|
||||
CreateDaftIntervention=Create draft
|
||||
CustomerDoesNotHavePrefix=Customer does not have a prefix
|
||||
InterventionContact=Intervention contact
|
||||
DeleteIntervention=Delete intervention
|
||||
ValidateIntervention=Validate intervention
|
||||
DeleteInterventionLine=Delete intervention line
|
||||
ConfirmDeleteIntervention=Are you sure you want to delete this intervention ?
|
||||
ConfirmValidateIntervention=Are you sure you want to validate this intervention ?
|
||||
ConfirmDeleteInterventionLine=Are you sure you want to delete this intervention line ?
|
||||
##### Types de contacts #####
|
||||
TypeContact_fichinter_internal_INTERREPFOLL=Representative following-up intervention
|
||||
TypeContact_fichinter_internal_INTERVENING=Intervening
|
||||
|
||||
@ -249,6 +249,7 @@ ChartNotGenerated=Chart not generated
|
||||
GeneratedOn=Build on %s
|
||||
Generate=Generate
|
||||
Duration=Duration
|
||||
TotalDuration=Total duration
|
||||
Summary=Summary
|
||||
MyBookmarks=My bookmarks
|
||||
OtherInformationsBoxes=Other information boxes
|
||||
|
||||
@ -11,6 +11,12 @@ AllInterventions=Toutes les interventions
|
||||
CreateDaftIntervention=Créer brouillon
|
||||
CustomerDoesNotHavePrefix=Le client n'a pas de préfixe de défini
|
||||
InterventionContact=Contact intervention
|
||||
DeleteIntervention=Supprimer intervention
|
||||
ValidateIntervention=Valider intervention
|
||||
DeleteInterventionLine=Supprimer ligne d'intervention
|
||||
ConfirmDeleteIntervention=Êtes-vous sûr de vouloir effacer cette intervention ?
|
||||
ConfirmValidateIntervention=Êtes-vous sûr de vouloir valider cette intervention ?
|
||||
ConfirmDeleteInterventionLine=Êtes-vous sûr de vouloir effacer cette ligne ?
|
||||
##### Types de contacts #####
|
||||
TypeContact_fichinter_internal_INTERREPFOLL=Responsable suivi de l'intervention
|
||||
TypeContact_fichinter_internal_INTERVENING=Intervenant
|
||||
|
||||
@ -250,6 +250,7 @@ ChartNotGenerated=Graphique non g
|
||||
GeneratedOn=Généré le %s
|
||||
Generate=Générer
|
||||
Duration=Durée
|
||||
TotalDuration=Durée totale
|
||||
Summary=Résumé
|
||||
MyBookmarks=Mes marques pages
|
||||
OtherInformationsBoxes=Autres boîtes d'informations
|
||||
|
||||
@ -48,6 +48,14 @@ function fichinter_prepare_head($fichinter)
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
|
||||
if ($conf->use_preview_tabs)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/apercu.php?id='.$fichinter->id;
|
||||
$head[$h][1] = $langs->trans('Preview');
|
||||
$head[$h][2] = 'preview';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$fichinter->id;
|
||||
$head[$h][1] = $langs->trans('Note');
|
||||
$head[$h][2] = 'note';
|
||||
|
||||
@ -3121,4 +3121,35 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
|
||||
return $imgThumbName;
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Converti les heures et minutes en secondes
|
||||
* \param iHours Heures
|
||||
* \param iMinutes Minutes
|
||||
* \param iSeconds Secondes
|
||||
* \return iResult Temps en secondes
|
||||
*/
|
||||
function ConvertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0)
|
||||
{
|
||||
$iResult=($iHours*3600)+($iMinutes*60)+$iSeconds;
|
||||
return $iResult;
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Converti les secondes en heures et minutes
|
||||
* \param iSecond Nombre de secondes
|
||||
* \param format Choix de l'affichage (all:affichage complet, hour: n'affiche que les heures, min: n'affiche que les minutes)
|
||||
* \return sTime Temps formaté
|
||||
*/
|
||||
function ConvertSecondToTime($iSecond,$format='all'){
|
||||
if ($format == 'all'){
|
||||
$sTime=date("H",$iSecond)-1;
|
||||
$sTime.='h'.date("i",$iSecond);
|
||||
}else if ($format == 'hour'){
|
||||
$sTime=date("H",$iSecond)-1;
|
||||
}else if ($format == 'min'){
|
||||
$sTime=date("i",$iSecond);
|
||||
}
|
||||
return $sTime;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.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
|
||||
@ -315,7 +316,7 @@ class Project extends CommonObject
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Supprime l'projet dans la base
|
||||
* \brief Supprime le projet dans la base
|
||||
* \param Utilisateur
|
||||
*/
|
||||
|
||||
@ -363,7 +364,7 @@ class Project extends CommonObject
|
||||
$result = -2;
|
||||
}
|
||||
|
||||
if ($result ==0)
|
||||
if ($result == 0)
|
||||
{
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_actors (fk_projet_task, fk_user) ";
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.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
|
||||
@ -151,23 +152,23 @@ Function PLineSelect(&$inc, $parent, $lines, &$level)
|
||||
|
||||
if ($_POST["action"] == 'createtask' && $user->rights->projet->creer)
|
||||
{
|
||||
$pro = new Project($db);
|
||||
$project = new Project($db);
|
||||
|
||||
$result = $pro->fetch($_GET["id"]);
|
||||
$result = $project->fetch($_GET["id"]);
|
||||
|
||||
if ($result == 0)
|
||||
{
|
||||
{
|
||||
$task_parent = $_POST["task_parent"]?$_POST["task_parent"]:0;
|
||||
$project->CreateTask($user, $_POST["task_name"], $task_parent);
|
||||
|
||||
$pro->CreateTask($user, $_POST["task_name"], $_POST["task_parent"]);
|
||||
|
||||
Header("Location:fiche.php?id=".$pro->id);
|
||||
}
|
||||
Header("Location:fiche.php?id=".$project->id);
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'addtime' && $user->rights->projet->creer)
|
||||
{
|
||||
$pro = new Project($db);
|
||||
$result = $pro->fetch($_GET["id"]);
|
||||
$project = new Project($db);
|
||||
$result = $project->fetch($_GET["id"]);
|
||||
|
||||
if ($result == 0)
|
||||
{
|
||||
@ -181,12 +182,12 @@ if ($_POST["action"] == 'addtime' && $user->rights->projet->creer)
|
||||
$id = ereg_replace("task","",$key);
|
||||
|
||||
$date = mktime(12,12,12,$_POST["$id"."month"],$_POST["$id"."day"],$_POST["$id"."year"]);
|
||||
$pro->TaskAddTime($user, $id , $post, $date);
|
||||
$project->TaskAddTime($user, $id , $post, $date);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Header("Location:fiche.php?id=".$pro->id);
|
||||
Header("Location:fiche.php?id=".$project->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -253,11 +254,14 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
||||
/* Nouvelle tâche */
|
||||
print '<tr><td>'.$langs->trans("NewTask").'</td><td colspan="3">';
|
||||
print '<input type="text" size="25" name="task_name" class="flat"> ';
|
||||
print '<select class="flat" name="task_parent">';
|
||||
print '<option value="0" selected="true"> </option>';
|
||||
PLineSelect($j, 0, $tasksarray, $level);
|
||||
print '</select> ';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
if ($tasksarray)
|
||||
{
|
||||
print '<select class="flat" name="task_parent">';
|
||||
print '<option value="0" selected="true"> </option>';
|
||||
PLineSelect($j, 0, $tasksarray, $level);
|
||||
print '</select>';
|
||||
}
|
||||
print ' <input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table></form><br />';
|
||||
|
||||
@ -1219,7 +1219,7 @@ insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titr
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1406, 'commercial', '$leftmenu=="contracts"', 1402, '/contrat/services.php?leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1407, 'commercial', '$leftmenu=="contracts"', 1402, '/contrat/services.php?leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1500, 'commercial', '', 5, '/fichinter/index.php?leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1501, 'commercial', '$leftmenu=="ficheinter"', 1500, '/societe.php?leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1501, 'commercial', '$leftmenu=="ficheinter"', 1500, '/fichinter/fiche.php?action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1502, 'commercial', '$leftmenu=="ficheinter"', 1500, '/fichinter/index.php?leftmenu=ficheinter', 'List', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 1);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1600, 'accountancy', '', 6, '/compta/index.php?leftmenu=suppliers', 'Suppliers', 0, 'companies', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 0);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1601, 'accountancy', '', 1600, '/soc.php?leftmenu=suppliers&action=create&type=f', 'NewSupplier', 1, 'companies', '$user->rights->societe->creer && $user->rights->fournisseur->lire', '', 2, 0);
|
||||
|
||||
@ -247,7 +247,7 @@ insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titr
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1406, 'commercial', '$leftmenu=="contracts"', 1402, '/contrat/services.php?leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1407, 'commercial', '$leftmenu=="contracts"', 1402, '/contrat/services.php?leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1500, 'commercial', '', 5, '/fichinter/index.php?leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1501, 'commercial', '$leftmenu=="ficheinter"', 1500, '/societe.php?leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1501, 'commercial', '$leftmenu=="ficheinter"', 1500, '/fichinter/fiche.php?action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1502, 'commercial', '$leftmenu=="ficheinter"', 1500, '/fichinter/index.php?leftmenu=ficheinter', 'List', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 1);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1600, 'accountancy', '', 6, '/compta/index.php?leftmenu=suppliers', 'Suppliers', 0, 'companies', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 0);
|
||||
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (1601, 'accountancy', '', 1600, '/soc.php?leftmenu=suppliers&action=create&type=f', 'NewSupplier', 1, 'companies', '$user->rights->societe->creer && $user->rights->fournisseur->lire', '', 2, 0);
|
||||
@ -821,6 +821,17 @@ alter table llx_boxes modify box_order varchar(3) NOT NULL;
|
||||
-- V4.1 update llx_boxes set box_order = concat('A',box_order) where length(box_order) = 2 and substring(box_order,-1) in ('1','3','5','7','9');
|
||||
-- V4.1 update llx_boxes set box_order = concat('B',box_order) where length(box_order) = 2 and substring(box_order,-1) in ('0','2','4','6','8');
|
||||
|
||||
create table llx_fichinterdet
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_fichinter integer,
|
||||
date date,
|
||||
description text,
|
||||
duree integer,
|
||||
rang integer DEFAULT 0
|
||||
)type=innodb;
|
||||
|
||||
ALTER TABLE llx_fichinter ADD COLUMN model_pdf varchar(50) after note_public;
|
||||
|
||||
alter table llx_bordereau_cheque modify number integer;
|
||||
ALTER TABLE llx_facturedet ADD COLUMN special_code tinyint(4) default 0;
|
||||
ALTER TABLE llx_facturedet ADD COLUMN special_code tinyint(4) default 0;
|
||||
|
||||
@ -30,14 +30,15 @@ create table llx_fichinter
|
||||
tms timestamp,
|
||||
datec datetime, -- date de creation
|
||||
date_valid datetime, -- date de validation
|
||||
datei date, -- date de l'intervention
|
||||
datei date, -- date de livraison du bon d'intervention
|
||||
fk_user_author integer, -- createur de la fiche
|
||||
fk_user_valid integer, -- valideur de la fiche
|
||||
fk_statut smallint DEFAULT 0,
|
||||
duree real,
|
||||
duree real, -- durée totale de l'intervention
|
||||
description text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(50),
|
||||
|
||||
UNIQUE INDEX (ref)
|
||||
)type=innodb;
|
||||
|
||||
31
mysql/tables/llx_fichinterdet.sql
Normal file
31
mysql/tables/llx_fichinterdet.sql
Normal file
@ -0,0 +1,31 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.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 2 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, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- $Source$
|
||||
-- ===================================================================
|
||||
|
||||
create table llx_fichinterdet
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_fichinter integer,
|
||||
date date, -- 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
|
||||
)type=innodb;
|
||||
Loading…
Reference in New Issue
Block a user