';
-
+
print '';
@@ -989,8 +1000,8 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
if ($propalid)
{
/*
- * Produits
- */
+ * Produits
+ */
print_titre($langs->trans('Products'));
print '';
print ''.$langs->trans('Ref').' '.$langs->trans('Product').' ';
@@ -1057,99 +1068,99 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
}
else
{
- /* *************************************************************************** */
- /* */
- /* Mode vue et edition */
- /* */
- /* *************************************************************************** */
- $id = $_GET['id'];
- if ($id > 0)
- {
- if ($mesg) print $mesg.' ';
-
- $commande = new Commande($db);
- if ( $commande->fetch($_GET['id']) > 0)
+ /* *************************************************************************** */
+ /* */
+ /* Mode vue et edition */
+ /* */
+ /* *************************************************************************** */
+ $id = $_GET['id'];
+ if ($id > 0)
{
+ if ($mesg) print $mesg.' ';
+
+ $commande = new Commande($db);
+ if ( $commande->fetch($_GET['id']) > 0)
+ {
$soc = new Societe($db);
$soc->fetch($commande->socid);
-
+
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
-
+
$head = commande_prepare_head($commande);
dolibarr_fiche_head($head, 'order', $langs->trans("CustomerOrder"));
-
+
/*
* Confirmation de la suppression de la commande
*/
if ($_GET['action'] == 'delete')
- {
- $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete');
- print ' ';
- }
-
+ {
+ $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete');
+ print ' ';
+ }
+
/*
* Confirmation de la validation
*/
if ($_GET['action'] == 'validate')
{
// on verifie si la facture est en numerotation provisoire
- $ref = substr($commande->ref, 1, 4);
- if ($ref == 'PROV')
- {
- $num = $commande->getNextNumRef($soc);
- }
- else
- {
- $num = $commande->ref;
- }
-
- $text=$langs->trans('ConfirmValidateOrder',$num);
- $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_validate');
- print ' ';
+ $ref = substr($commande->ref, 1, 4);
+ if ($ref == 'PROV')
+ {
+ $num = $commande->getNextNumRef($soc);
+ }
+ else
+ {
+ $num = $commande->ref;
+ }
+
+ $text=$langs->trans('ConfirmValidateOrder',$num);
+ $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_validate');
+ print ' ';
}
-
+
/*
* Confirmation de la cloture
*/
if ($_GET['action'] == 'close')
- {
- $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close');
- print ' ';
- }
-
+ {
+ $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close');
+ print ' ';
+ }
+
/*
* Confirmation de l'annulation
*/
if ($_GET['action'] == 'cancel')
- {
- $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel');
- print ' ';
- }
-
+ {
+ $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel');
+ print ' ';
+ }
+
/*
* Confirmation de la suppression d'une ligne produit
*/
if ($_GET['action'] == 'ask_deleteline' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
- {
- $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline');
- print ' ';
- }
-
+ {
+ $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline');
+ print ' ';
+ }
+
/*
* Commande
*/
$nbrow=8;
if ($conf->projet->enabled) $nbrow++;
-
+
print '';
-
+
// Ref
print ''.$langs->trans('Ref').' ';
print ''.$commande->ref.' ';
print ' ';
-
+
// Ref commande client
print '';
print '';
@@ -1159,20 +1170,20 @@ else
print '
';
print ' ';
if ($user->rights->commande->creer && $_GET['action'] == 'RefCustomerOrder')
- {
- print '';
- }
+ {
+ print '';
+ }
else
- {
- print $commande->ref_client;
- }
+ {
+ print $commande->ref_client;
+ }
print ' ';
print ' ';
-
+
// Societe
print ''.$langs->trans('Company').' ';
@@ -1290,7 +1301,7 @@ else
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none');
}
print '';
-
+
//Note public lorsque le module expedition n'est pas active
if (!$conf->projet->enabled) $nbrow--;
if (!$conf->expedition->enabled)
@@ -1301,7 +1312,7 @@ else
print nl2br($commande->note_public);
print '';
}
-
+
print ' ';
print '';
print '';
@@ -1366,8 +1377,8 @@ else
print "\n";
/*
- * Lignes de commandes
- */
+ * Lignes de commandes
+ */
$sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, ';
$sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits,';
$sql.= ' l.total_ht, l.total_tva, l.total_ttc,';
@@ -1600,7 +1611,7 @@ else
$i++;
}
$db->free($resql);
-
+
$numlines=$num;
}
else
@@ -1609,8 +1620,8 @@ else
}
/*
- * Ajouter une ligne
- */
+ * Ajouter une ligne
+ */
if ($commande->statut == 0 && $user->rights->commande->creer && $_GET["action"] <> 'editline')
{
print ' ';
@@ -1676,60 +1687,60 @@ else
print ''.$langs->trans('ReductionShort').' ';
print ' ';
print ' ';
-
+
print '';
- }
+ // editeur wysiwyg
+ if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
+ {
+ require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
+ $doleditor=new DolEditor('np_desc','',100,'dolibarr_details');
+ $doleditor->Create();
+ }
+ else
+ {
+ print ' ';
+ }
+
+ print '';
+ print ' ';
+ print ' % ';
+ print ' ';
+ print '';
+
+ print '';
+ }
}
print '
';
print '';
-
+
/*
- * Boutons actions
- */
+ * Boutons actions
+ */
if ($_GET['action'] != 'presend')
{
if ($user->societe_id == 0 && $_GET['action'] <> 'editline')
{
print '';
-
+
// Valid
if ($commande->statut == 0 && $commande->total_ttc >= 0 && $numlines > 0 && $user->rights->commande->valider)
{
@@ -1755,7 +1766,7 @@ else
}
print '>'.$langs->trans('Validate').'';
}
-
+
// Edit
if ($commande->statut == 1)
{
@@ -1764,7 +1775,7 @@ else
print '
'.$langs->trans('Modify').' ';
}
}
-
+
// Send
if ($commande->statut > 0)
{
@@ -1778,26 +1789,26 @@ else
}
}
}
-
+
// Ship
if ($commande->statut > 0 && $commande->statut < 3 && $user->rights->expedition->creer
&& $commande->getNbOfProductsLines() > 0)
{
-
+
// Chargement des permissions
$error = $user->load_entrepots();
if (sizeof($user->entrepots) === 1)
{
print '
entrepots[0]['id'].'">';
print $langs->trans('ShipProduct').' ';
-
+
}
else
{
print '
'.$langs->trans('ShipProduct').' ';
}
}
-
+
// Cloturer
if ($commande->statut == 1 || $commande->statut == 2)
{
@@ -1816,7 +1827,7 @@ else
print '>'.$langs->trans('Close').'';
}
}
-
+
// Annuler commande
if ($commande->statut == 1)
{
@@ -1836,7 +1847,7 @@ else
print '>'.$langs->trans('CancelOrder').'';
}
}
-
+
// Supprimer commande
if ($commande->statut == 0 && $user->rights->commande->supprimer)
{
@@ -1852,22 +1863,22 @@ else
}
print '>'.$langs->trans('Delete').'';
}
-
+
print '
';
}
print ' ';
}
-
+
if ($_GET['action'] != 'presend')
{
print '';
print ' '; // ancre
-
+
/*
- * Documents generes
- *
- */
+ * Documents generes
+ *
+ */
$comref = sanitize_string($commande->ref);
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
$relativepath = $comref.'/'.$comref.'.pdf';
@@ -1875,16 +1886,16 @@ else
$urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id;
$genallowed=$user->rights->commande->creer;
$delallowed=$user->rights->commande->supprimer;
-
+
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
-
+
/*
- * Liste des factures
- */
+ * Liste des factures
+ */
$sql = 'SELECT f.rowid,f.facnumber, f.total_ttc, '.$db->pdate('f.datef').' as df';
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'co_fa as cf';
$sql .= ' WHERE f.rowid = cf.fk_facture AND cf.fk_commande = '. $commande->id;
-
+
$result = $db->query($sql);
if ($result)
{
@@ -1899,7 +1910,7 @@ else
print ' '.$langs->trans('Date').' ';
print ''.$langs->trans('Price').' ';
print ' ';
-
+
$var=True;
while ($i < $num)
{
@@ -1919,20 +1930,20 @@ else
dolibarr_print_error($db);
}
print '';
-
+
// List of actions on element
include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php');
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($commande,'order',$socid);
-
+
print '
';
}
/*
- * Action presend
- *
- */
+ * Action presend
+ *
+ */
if ($_GET['action'] == 'presend')
{
$ref = sanitize_string($commande->ref);
@@ -1979,10 +1990,10 @@ else
$formmail->clear_attached_files();
$formmail->add_attached_files($file,$ref.'.pdf','application/pdf');
}
-
+
// Show form
$formmail->show_form();
-
+
print ' ';
}
}
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 47bf66330e3..e8e49fb1838 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -290,6 +290,13 @@ if ($_GET['action'] == 'modif' && $user->rights->facture->modifier && $conf->glo
if ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0)
{
$fac->set_draft($user);
+ //regénération PDF
+ if ($_REQUEST['lang_id'])
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ }
+ facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
}
}
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index 176f79b30d1..4aba5d76746 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -19,11 +19,11 @@
*/
/**
- \file htdocs/fichinter/fiche.php
- \brief Fichier fiche intervention
- \ingroup ficheinter
- \version $Id$
-*/
+ \file htdocs/fichinter/fiche.php
+ \brief Fichier fiche intervention
+ \ingroup ficheinter
+ \version $Id$
+ */
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
@@ -71,16 +71,31 @@ if ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add' && ! $_REQUE
if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
{
- $fichinter = new Fichinter($db);
- $fichinter->id = $_GET["id"];
- $result=$fichinter->valid($user, $conf->fichinter->outputdir);
- if ($result < 0) $mesg=''.$fichinter->error.'
';
+ $fichinter = new Fichinter($db);
+ $fichinter->id = $_GET["id"];
+ $fichinter->fetch($_GET["id"]);
+
+ $result = $fichinter->valid($user, $conf->fichinter->outputdir);
+ if ($result >= 0)
+ {
+ if ($_REQUEST['lang_id'])
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ }
+
+ $result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs);
+ }
+ else
+ {
+ $mesg=''.$fichinter->error.'
';
+ }
}
if ($_POST["action"] == 'add')
{
$fichinter = new Fichinter($db);
-
+
$fichinter->date = dolibarr_mktime($_POST["phour"], $_POST["pmin"] , $_POST["psec"], $_POST["pmonth"], $_POST["pday"], $_POST["pyear"]);
$fichinter->socid = $_POST["socid"];
$fichinter->duree = $_POST["duree"];
@@ -106,24 +121,24 @@ if ($_POST["action"] == 'add')
}
else
{
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("ThirdParty")).'
';
- $_GET["action"] = 'create';
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("ThirdParty")).'
';
+ $_GET["action"] = 'create';
}
}
if ($_POST["action"] == 'update')
{
- $fichinter = new Fichinter($db);
-
- $fichinter->date = $db->idate(mktime(12, 1 , 1, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]));
- $fichinter->socid = $_POST["socid"];
- $fichinter->projet_id = $_POST["projetidp"];
- $fichinter->author = $user->id;
- $fichinter->description = $_POST["description"];
- $fichinter->ref = $_POST["ref"];
-
- $fichinter->update($_POST["id"]);
- $_GET["id"]=$_POST["id"]; // Force raffraichissement sur fiche venant d'etre cr��e
+ $fichinter = new Fichinter($db);
+
+ $fichinter->date = dolibarr_mktime($_POST["phour"], $_POST["pmin"] , $_POST["psec"], $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
+ $fichinter->socid = $_POST["socid"];
+ $fichinter->projet_id = $_POST["projetidp"];
+ $fichinter->author = $user->id;
+ $fichinter->description = $_POST["description"];
+ $fichinter->ref = $_POST["ref"];
+
+ $fichinter->update($_POST["id"]);
+ $_GET["id"]=$_POST["id"]; // Force raffraichissement sur fiche venant d'etre cr��e
}
/*
@@ -131,15 +146,16 @@ if ($_POST["action"] == 'update')
*/
if ($_REQUEST['action'] == 'builddoc') // En get ou en post
{
+ $fichinter = new Fichinter($db);
+ $fichinter->fetch($_GET['id']);
+ $fichinter->fetch_lines();
+
if ($_REQUEST['lang_id'])
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
- $fichinter = new Fichinter($db);
- $fichinter->fetch($_GET['id']);
-
$result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs);
if ($result <= 0)
{
@@ -153,21 +169,21 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
*/
if ($_POST['action'] == 'classin')
{
- $fichinter = new Fichinter($db);
- $fichinter->fetch($_GET['id']);
- $fichinter->set_project($user, $_POST['projetidp']);
+ $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 ($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')
@@ -195,16 +211,16 @@ if ($_POST['action'] == "addligne" && $user->rights->ficheinter->creer)
{
$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
+ $_POST['fichinterid'],
+ $desc,
+ $date_intervention,
+ $duration
);
if ($_REQUEST['lang_id'])
@@ -247,8 +263,8 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
- fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
-
+ fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
+
}
/*
@@ -282,30 +298,30 @@ if ($_GET['action'] == 'deleteline' && $user->rights->ficheinter->creer && !$con
*/
if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
{
- if ($user->rights->ficheinter->creer)
- {
- $fichinterline = new FichinterLigne($db);
- if ($fichinterline->fetch($_GET['ligne']) <= 0)
- {
- dolibarr_print_error($db);
- exit;
- }
- $result=$fichinterline->delete_line();
- $fichinter = new Fichinter($db);
- if ($fichinter->fetch($fichinterline->fk_fichinter) <= 0)
- {
- dolibarr_print_error($db);
- exit;
- }
- if ($_REQUEST['lang_id'])
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
- }
- fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
- }
- Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']);
- exit;
+ if ($user->rights->ficheinter->creer)
+ {
+ $fichinterline = new FichinterLigne($db);
+ if ($fichinterline->fetch($_GET['ligne']) <= 0)
+ {
+ dolibarr_print_error($db);
+ exit;
+ }
+ $result=$fichinterline->delete_line();
+ $fichinter = new Fichinter($db);
+ if ($fichinter->fetch($fichinterline->fk_fichinter) <= 0)
+ {
+ dolibarr_print_error($db);
+ exit;
+ }
+ if ($_REQUEST['lang_id'])
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ }
+ fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
+ }
+ Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']);
+ exit;
}
/*
@@ -337,7 +353,7 @@ if ($_GET['action'] == 'down' && $user->rights->ficheinter->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
- fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
+ fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit;
}
@@ -360,14 +376,14 @@ if ($_GET["action"] == 'create')
*/
if ($_GET["socid"] > 0)
{
- $societe=new Societe($db);
+ $societe=new Societe($db);
$societe->fetch($_GET["socid"]);
}
print_titre($langs->trans("AddIntervention"));
if ($mesg) print $mesg.' ';
-
+
if (! $conf->global->FICHEINTER_ADDON)
{
dolibarr_print_error($db,$langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_NotDefined"));
@@ -386,81 +402,81 @@ if ($_GET["action"] == 'create')
if ($_GET["socid"])
{
- print "";
+ print " ";
- print '';
+ print '';
print ' ';
print "".$langs->trans("Company")." ".$societe->getNomUrl(1)." ";
-
- print "".$langs->trans("Date")." ";
- $html->select_date(time(),"p",'','','','fichinter');
- print " ";
- print " ";
+ print "".$langs->trans("Date")." ";
+ $html->select_date(time(),"p",'','','','fichinter');
+ print " ";
- print "".$langs->trans("Ref")." ";
- print " \n";
+ print " ";
- if ($conf->projet->enabled)
- {
- // Projet associe
- $langs->load("project");
+ print "".$langs->trans("Ref")." ";
+ print " \n";
- print ''.$langs->trans("Project").' ';
-
- if ($_GET["socid"]) $numprojet = $societe->has_projects();
-
- if (!$numprojet)
+ if ($conf->projet->enabled)
{
- print '';
- print ''.$langs->trans("NoProject").' ';
+ // Projet associe
+ $langs->load("project");
- if ($user->rights->projet->creer)
+ print ''.$langs->trans("Project").' ';
+
+ if ($_GET["socid"]) $numprojet = $societe->has_projects();
+
+ if (!$numprojet)
{
- print ' id.'&action=create>'.$langs->trans("Add").' ';
+ print '';
}
- print '
';
+ else
+ {
+ select_projects($societe->id,'','projetidp');
+ }
+ print ' ';
+ }
+
+ // Model
+ print '';
+ print ''.$langs->trans("DefaultModel").' ';
+ print '';
+ $model=new ModelePDFFicheinter();
+ $liste=$model->liste_modeles($db);
+ $html->select_array('model',$liste,$conf->global->FICHEINTER_ADDON_PDF);
+ print " ";
+
+ print ''.$langs->trans("Description").' ';
+ print "";
+
+ if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_SOCIETE)
+ {
+ // Editeur wysiwyg
+ require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
+ $doleditor=new DolEditor('description','',280,'dolibarr_notes','In',true);
+ $doleditor->Create();
}
else
{
- select_projects($societe->id,'','projetidp');
+ print ' ';
}
+
print ' ';
- }
- // Model
- print '';
- print ''.$langs->trans("DefaultModel").' ';
- print '';
- $model=new ModelePDFFicheinter();
- $liste=$model->liste_modeles($db);
- $html->select_array('model',$liste,$conf->global->FICHEINTER_ADDON_PDF);
- print " ";
+ print '';
+ print ' ';
+ print ' ';
- print ''.$langs->trans("Description").' ';
- print "";
-
- if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_SOCIETE)
- {
- // Editeur wysiwyg
- require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
- $doleditor=new DolEditor('description','',280,'dolibarr_notes','In',true);
- $doleditor->Create();
- }
- else
- {
- print ' ';
- }
-
- print ' ';
-
- print '';
- print ' ';
- print ' ';
-
- print '
';
- print '';
+ print '
';
+ print ' ';
}
else
{
@@ -481,8 +497,8 @@ if ($_GET["action"] == 'create')
elseif ($_GET["id"] > 0)
{
/*
- * Affichage en mode visu
- */
+ * Affichage en mode visu
+ */
$fichinter = new Fichinter($db);
$result=$fichinter->fetch($_GET["id"]);
if (! $result > 0)
@@ -499,8 +515,8 @@ elseif ($_GET["id"] > 0)
dolibarr_fiche_head($head, 'card', $langs->trans("InterventionCard"));
/*
-* Confirmation de la suppression de la fiche d'intervention
-*/
+ * 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');
@@ -508,8 +524,8 @@ elseif ($_GET["id"] > 0)
}
/*
-* Confirmation de la validation de la fiche d'intervention
-*/
+ * 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');
@@ -517,8 +533,8 @@ elseif ($_GET["id"] > 0)
}
/*
-* Confirmation de la suppression d'une ligne d'intervention
-*/
+ * 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');
@@ -612,10 +628,10 @@ elseif ($_GET["id"] > 0)
}
print ' ';
}
-
+
// Duration
print ''.$langs->trans("TotalDuration").' '.ConvertSecondToTime($fichinter->duree).' ';
-
+
// Description
print '';
print '';
@@ -648,15 +664,15 @@ elseif ($_GET["id"] > 0)
}
print ' ';
print ' ';
-
+
// Statut
print ''.$langs->trans("Status").' '.$fichinter->getLibStatut(4).' ';
print "
";
-
+
/*
- * Lignes d'intervention
- */
+ * Lignes d'intervention
+ */
print '';
$sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang';
@@ -692,7 +708,7 @@ elseif ($_GET["id"] > 0)
print '';
print ' '; // ancre pour retourner sur la ligne
print nl2br($objp->description);
-
+
print ' '.dolibarr_print_date($objp->date_intervention,'day').' ';
print ''.ConvertSecondToTime($objp->duree).' ';
@@ -777,12 +793,12 @@ elseif ($_GET["id"] > 0)
print ''.dol_htmlentitiesbr_decode($objp->description).' ';
}
print '';
-
+
// Date d'intervention
print '';
$html->select_date($objp->date_intervention,'di',0,0,0,"date_intervention");
print ' ';
-
+
// Duration
print '';
$html->select_duree('duration',$objp->duree);
@@ -806,8 +822,8 @@ elseif ($_GET["id"] > 0)
}
/*
- * Ajouter une ligne
- */
+ * Ajouter une ligne
+ */
if ($fichinter->statut == 0 && $user->rights->ficheinter->creer && $_GET["action"] <> 'editline')
{
print ' ';
@@ -841,12 +857,12 @@ elseif ($_GET["id"] > 0)
print ' ';
}
print '';
-
+
// Date d'intervention
print '';
$html->select_date(time(),'di',0,0,0,"addinter");
print ' ';
-
+
// Dur�e
print '';
$html->select_duree('duration');
@@ -865,9 +881,9 @@ elseif ($_GET["id"] > 0)
/**
- * Barre d'actions
- *
- */
+ * Barre d'actions
+ *
+ */
print '';
if ($user->societe_id == 0)
@@ -887,7 +903,7 @@ elseif ($_GET["id"] > 0)
}
print '>'.$langs->trans("Valid").'';
}
-
+
// Delete
if ($fichinter->statut == 0 && $user->rights->ficheinter->supprimer)
{
@@ -904,13 +920,13 @@ elseif ($_GET["id"] > 0)
print '>'.$langs->trans('Delete').'';
}
}
-
+
print '
';
print '';
/*
- * Documents g�n�r�s
- */
+ * Documents g�n�r�s
+ */
$filename=sanitize_string($fichinter->ref);
$filedir=$conf->fichinter->dir_output . "/".$fichinter->ref;
$urlsource=$_SERVER["PHP_SELF"]."?id=".$fichinter->id;
diff --git a/htdocs/fichinter/fichinter.class.php b/htdocs/fichinter/fichinter.class.php
index 357fef795cd..1d50bc9b1b9 100644
--- a/htdocs/fichinter/fichinter.class.php
+++ b/htdocs/fichinter/fichinter.class.php
@@ -147,7 +147,7 @@ class Fichinter extends CommonObject
* Insertion dans la base
*/
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
- $sql .= " datei = ".$this->date;
+ $sql .= " datei = ".$this->db->idate($this->date);
$sql .= ", description = '".addslashes($this->description)."'";
$sql .= ", duree = ".$this->duree;
$sql .= ", fk_projet = ".$this->projet_id;
@@ -219,6 +219,8 @@ class Fichinter extends CommonObject
{
global $langs, $conf;
+ $this->db->begin();
+
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
$sql.= " SET fk_statut = 1, date_valid=now(), fk_user_valid=".$user->id;
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
@@ -234,12 +236,24 @@ class Fichinter extends CommonObject
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
- return 1;
+ if (! $error)
+ {
+ $this->db->commit();
+ return 1;
+ }
+ else
+ {
+ $this->db->rollback();
+ $this->error=join(',',$this->errors);
+ dolibarr_syslog("Fichinter::update ".$this->error,LOG_ERR);
+ return -1;
+ }
}
else
{
- $this->error=$this->db->error();
- dolibarr_syslog("Fichinter::update error ".$this->error,LOG_ERR);
+ $this->db->rollback();
+ $this->error=$this->db->lasterror();
+ dolibarr_syslog("Fichinter::update ".$this->error,LOG_ERR);
return -1;
}
}
diff --git a/htdocs/includes/modules/fichinter/modules_fichinter.php b/htdocs/includes/modules/fichinter/modules_fichinter.php
index 0cbf038e7e5..54248e3d173 100644
--- a/htdocs/includes/modules/fichinter/modules_fichinter.php
+++ b/htdocs/includes/modules/fichinter/modules_fichinter.php
@@ -174,7 +174,8 @@ function fichinter_create($db, $object, $modele='', $outputlangs='')
}
else
{
- print $langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_PDF_NotDefined");
+ dolibarr_syslog("Error ".$langs->trans("Error_FICHEINTER_ADDON_PDF_NotDefined"), LOG_ERR);
+ print "Error ".$langs->trans("Error_FICHEINTER_ADDON_PDF_NotDefined");
return 0;
}
}
@@ -188,6 +189,7 @@ function fichinter_create($db, $object, $modele='', $outputlangs='')
$obj = new $classname($db);
+ dolibarr_syslog("fichinter_create build PDF", LOG_DEBUG);
if ($obj->write_file($object,$outputlangs) > 0)
{
return 1;
diff --git a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
index 93329351361..511223b8946 100644
--- a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
+++ b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2007 Laurent Destailleur
+ * Copyright (C) 2004-2008 Laurent Destailleur
* Copyright (C) 2008 Raphael Bertrand (Resultic)
*
* This program is free software; you can redistribute it and/or modify
@@ -87,7 +87,7 @@ class pdf_soleil extends ModelePDFFicheinter
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("interventions");
-
+
$outputlangs->setPhpLang();
if ($conf->fichinter->dir_output)
@@ -117,7 +117,7 @@ class pdf_soleil extends ModelePDFFicheinter
return 0;
}
}
-
+
if (file_exists($dir))
{
// Protection et encryption du pdf
@@ -259,7 +259,6 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->writeHTMLCell(190, 5, 10, $tab_top + 8, dol_htmlentitiesbr($fichinter->description), 0, 'J', 0);
//dolibarr_syslog("desc=".dol_htmlentitiesbr($fichinter->description));
- $fichinter->fetch_lines();
$num = sizeof($fichinter->lignes);
$i=0;
if ($num)
@@ -268,12 +267,12 @@ class pdf_soleil extends ModelePDFFicheinter
{
$fichinterligne = $fichinter->lignes[$i];
- $valide = $fichinterligne->fetch($fichinterligne->id);
+ $valide = $fichinterligne->id ? $fichinterligne->fetch($fichinterligne->id) : 0;
if ($valide>0)
{
$pdf->SetXY (20, $tab_top + 16 + $i * 20);
$pdf->writeHTMLCell(190, 8, 20, $tab_top + 16 + $i * 20,
- dol_htmlentitiesbr("Date : ".dolibarr_print_date($fichinterligne->datei)." - Durée : ".ConvertSecondToTime($fichinterligne->duration)), 0, 'J', 0);
+ dol_htmlentitiesbr($langs->transnoentities("Date")." : ".dolibarr_print_date($fichinterligne->datei)." - ".$langs->transnoentities("Duration")." : ".ConvertSecondToTime($fichinterligne->duration)), 0, 'J', 0);
$pdf->SetXY (20, $tab_top + 22 + $i * 20);
$pdf->writeHTMLCell(170, 8, 20, $tab_top + 22 + $i * 20,