diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 6705587a024..97a0ef4b55b 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -135,13 +135,18 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
{
$propal = new Propal($db);
$propal->fetch($_GET['propalid']);
+ $propal->fetch_client();
$result = $propal->delete_product($_GET['lineid']);
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
}
@@ -161,6 +166,7 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
$result=$propal->valid($user);
if ($result >= 0)
{
+ // Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
@@ -313,15 +319,18 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
{
$db->commit();
- // Generation document PDF
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $id, $_REQUEST['model'], $outputlangs);
- dol_syslog('Redirect to '.$_SERVER["PHP_SELF"].'?propalid='.$id);
+
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$id);
exit;
}
@@ -615,14 +624,20 @@ if ($_GET['action'] == 'modif' && $user->rights->propale->creer)
*/
$propal = new Propal($db);
$propal->fetch($_GET['propalid']);
+ $propal->fetch_client();
$propal->set_draft($user);
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
+
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
}
@@ -758,11 +773,15 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
if ($result > 0)
{
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
@@ -791,6 +810,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
dol_print_error($db,$propal->error);
exit;
}
+ $propal->fetch_client();
// Define info_bits
$info_bits=0;
@@ -822,11 +842,15 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
'HT',
$info_bits);
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
}
@@ -839,16 +863,22 @@ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer)
{
$propal = new Propal($db);
$propal->fetch($_GET['propalid']);
+ $propal->fetch_client();
+
if ($_REQUEST['model'])
{
$propal->setDocModel($user, $_REQUEST['model']);
}
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
$result=propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
if ($result <= 0)
@@ -913,15 +943,21 @@ if ($_GET['action'] == 'up' && $user->rights->propale->creer)
{
$propal = new Propal($db, '', $_GET["propalid"]);
$propal->fetch($_GET['propalid']);
+ $propal->fetch_client();
$propal->line_up($_GET['rowid']);
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
+
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET["propalid"].'#'.$_GET['rowid']);
exit;
}
@@ -930,15 +966,21 @@ if ($_GET['action'] == 'down' && $user->rights->propale->creer)
{
$propal = new Propal($db, '', $_GET["propalid"]);
$propal->fetch($_GET['propalid']);
+ $propal->fetch_client();
$propal->line_down($_GET['rowid']);
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$propal->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
+
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET["propalid"].'#'.$_GET['rowid']);
exit;
}
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 97f0727de81..6e43d49f2e6 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -119,14 +119,20 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
{
$commande = new Commande($db);
$commande->fetch($_GET['id']);
+ $commande->fetch_client();
+
$result = $commande->delete_line($_GET['lineid']);
if ($result > 0)
{
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $_GET['id'], $commande->modelpdf, $outputlangs);
}
@@ -445,11 +451,15 @@ if ($_POST['action'] == 'addline' && $user->rights->commande->creer)
if ($result > 0)
{
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
@@ -478,6 +488,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
{
$commande = new Commande($db,'',$_POST['id']);
if (! $commande->fetch($_POST['id']) > 0) dol_print_error($db);
+ $commande->fetch_client();
// Clean parameters
$date_start='';
@@ -541,11 +552,15 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
if ($result >= 0)
{
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
}
@@ -568,15 +583,20 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
{
$commande = new Commande($db);
$commande->fetch($_GET['id']); // Load order and lines
+ $commande->fetch_client();
$result=$commande->valid($user);
if ($result >= 0)
{
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
}
@@ -605,15 +625,20 @@ if ($_GET['action'] == 'modif' && $user->rights->commande->creer)
*/
$commande = new Commande($db);
$commande->fetch($_GET['id']); // Load order and lines
+ $commande->fetch_client();
$result = $commande->set_draft($user);
if ($result >= 0)
{
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
}
@@ -627,15 +652,22 @@ if ($_GET['action'] == 'up' && $user->rights->commande->creer)
{
$commande = new Commande($db,'',$_GET['id']);
$commande->fetch($_GET['id']);
+ $commande->fetch_client();
$commande->line_up($_GET['rowid']);
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
+
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
+
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit;
}
@@ -644,15 +676,21 @@ if ($_GET['action'] == 'down' && $user->rights->commande->creer)
{
$commande = new Commande($db,'',$_GET['id']);
$commande->fetch($_GET['id']);
+ $commande->fetch_client();
$commande->line_down($_GET['rowid']);
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
+
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit;
}
@@ -667,16 +705,22 @@ if ($_REQUEST['action'] == 'builddoc') // In get or post
// Sauvegarde le dernier modele choisi pour generer un document
$commande = new Commande($db, 0, $_REQUEST['id']);
$result=$commande->fetch($_REQUEST['id']);
+ $commande->fetch_client();
+
if ($_REQUEST['model'])
{
$commande->setDocModel($user, $_REQUEST['model']);
}
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$commande->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
$result=commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
if ($result <= 0)
@@ -1274,7 +1318,7 @@ else
*/
if ($_GET['action'] == 'delete')
{
- $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
+ $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
if ($ret == 'html') print '
';
}
@@ -1302,7 +1346,7 @@ else
$text.='
';
$text.=$notify->confirmMessage('NOTIFY_VAL_ORDER',$commande->socid);
}
- $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', '', 0, 1);
+ $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', '', 0, 1);
if ($ret == 'html') print '
';
}
@@ -1311,7 +1355,7 @@ else
*/
if ($_GET['action'] == 'close')
{
- $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close', '', 0, 1);
+ $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close', '', 0, 1);
if ($ret == 'html') print '
';
}
@@ -1320,7 +1364,7 @@ else
*/
if ($_GET['action'] == 'cancel')
{
- $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel', '', 0, 1);
+ $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel', '', 0, 1);
if ($ret == 'html') print '
';
}
@@ -1329,7 +1373,7 @@ else
*/
if ($_GET['action'] == 'ask_deleteline')
{
- $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
+ $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
if ($ret == 'html') print '
';
}
@@ -1371,7 +1415,7 @@ else
print '
';
if ($user->rights->commande->creer && $_GET['action'] == 'refcustomer')
{
- print ' | ';
print '';
- print 'rowid.'">';
+ print 'id.'&action=ask_deleteline&lineid='.$objp->rowid.'">';
print img_delete();
print ' | ';
if ($num > 1)
@@ -1777,7 +1821,7 @@ else
print '';
}
else
{
print '';
}
@@ -513,7 +555,7 @@ elseif ($fichinterid)
$head = fichinter_prepare_head($fichinter);
- dol_fiche_head($head, 'card', $langs->trans("InterventionCard"));
+ dol_fiche_head($head, 'card', $langs->trans("InterventionCard"), 0, 'intervention');
// Confirmation de la suppression de la fiche d'intervention
if ($_GET['action'] == 'delete')
diff --git a/htdocs/fichinter/fichinter.class.php b/htdocs/fichinter/fichinter.class.php
index 76f89900c46..144aecfd790 100644
--- a/htdocs/fichinter/fichinter.class.php
+++ b/htdocs/fichinter/fichinter.class.php
@@ -369,6 +369,30 @@ class Fichinter extends CommonObject
}
}
+ /**
+ * \brief Return clicable name (with picto eventually)
+ * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
+ * \return string Chaine avec URL
+ */
+ function getNomUrl($withpicto=0)
+ {
+ global $langs;
+
+ $result='';
+
+ $lien = '';
+ $lienfin='';
+
+ $picto='intervention';
+
+ $label=$langs->trans("Show").': '.$this->ref;
+
+ if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
+ if ($withpicto && $withpicto != 2) $result.=' ';
+ if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
+ return $result;
+ }
+
/**
* \brief Verifie si la ref n'est pas deja utilisee
* \param soc objet societe
diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php
index 1ca35203140..814d15bb6cd 100644
--- a/htdocs/fichinter/index.php
+++ b/htdocs/fichinter/index.php
@@ -20,7 +20,7 @@
/**
* \file htdocs/fichinter/index.php
- * \brief Page accueil espace fiches interventions
+ * \brief List of all interventions
* \ingroup ficheinter
* \version $Id$
*/
@@ -87,7 +87,7 @@ if ($result)
{
$num = $db->num_rows($result);
- $fichinter_static=new Fichinter($db);
+ $interventionstatic=new Fichinter($db);
$urlparam="&socid=$socid";
print_barre_liste($langs->trans("ListOfInterventions"), $page, "index.php",$urlparam,$sortfield,$sortorder,'',$num);
@@ -127,13 +127,17 @@ if ($result)
$objp = $db->fetch_object($result);
$var=!$var;
print "";
- print "| fichid."\">".img_object($langs->trans("Show"),"task").' '.$objp->ref." | \n";
+ print "";
+ $interventionstatic->id=$objp->fichid;
+ $interventionstatic->ref=$objp->ref;
+ print $interventionstatic->getNomUrl(1);
+ print " | \n";
print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44)." | \n";
print ''.dol_htmlentitiesbr(dol_trunc($objp->description,20)).' | ';
print ''.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).' | ';
print ''.dol_print_date($objp->dp,'dayhour')." | \n";
print ''.ConvertSecondToTime($objp->duree).' | ';
- print ''.$fichinter_static->LibStatut($objp->fk_statut,5).' | ';
+ print ''.$interventionstatic->LibStatut($objp->fk_statut,5).' | ';
print "
\n";
diff --git a/htdocs/fichinter/info.php b/htdocs/fichinter/info.php
index 291cc4f949e..0c44b7f7b72 100644
--- a/htdocs/fichinter/info.php
+++ b/htdocs/fichinter/info.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2009 Laurent Destailleur
+ * Copyright (C) 2009-2010 Laurent Destailleur
*
* 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
@@ -18,11 +18,11 @@
*/
/**
- \file htdocs/fichinter/info.php
- \ingroup fichinter
- \brief Page d'affichage des infos d'une fiche d'intervention
- \version $Id$
-*/
+ * \file htdocs/fichinter/info.php
+ * \ingroup fichinter
+ * \brief Page d'affichage des infos d'une fiche d'intervention
+ * \version $Id$
+ */
require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
@@ -51,7 +51,7 @@ $societe = new Societe($db);
$societe->fetch($fichinter->socid);
$head = fichinter_prepare_head($fichinter);
-dol_fiche_head($head, 'info', $langs->trans('InterventionCard'));
+dol_fiche_head($head, 'info', $langs->trans('InterventionCard'), 0, 'intervention');
$fichinter->info($fichinter->id);
diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php
index 5ae80d49ca6..ae95aa27fc1 100644
--- a/htdocs/fichinter/note.php
+++ b/htdocs/fichinter/note.php
@@ -17,10 +17,10 @@
*/
/**
- \file htdocs/fichinter/note.php
- \ingroup fichinter
- \brief Fiche d'information sur une fiche d'intervention
- \version $Id$
+ * \file htdocs/fichinter/note.php
+ * \ingroup fichinter
+ * \brief Fiche d'information sur une fiche d'intervention
+ * \version $Id$
*/
require('./pre.inc.php');
@@ -99,13 +99,13 @@ if ($_GET['id'])
if ( $societe->fetch($fichinter->socid) )
{
$head = fichinter_prepare_head($fichinter);
- dol_fiche_head($head, 'note', $langs->trans('InterventionCard'));
+ dol_fiche_head($head, 'note', $langs->trans('InterventionCard'), 0, 'intervention');
print '';
print '| '.$langs->trans('Ref').' | '.$fichinter->ref.' |
';
- // Société
+ // Soci�t�
print '| '.$langs->trans('Company').' | '.$societe->getNomUrl(1).' |
';
// Note publique
@@ -126,7 +126,7 @@ if ($_GET['id'])
}
print "";
- // Note privée
+ // Note priv�e
if (! $user->societe_id)
{
print '| '.$langs->trans("NotePrivate").' : | ';
@@ -146,7 +146,7 @@ if ($_GET['id'])
}
print "
";
}
-
+
print "
";
print '';
diff --git a/htdocs/fichinter/rapport.php b/htdocs/fichinter/rapport.php
index ec8bf183ad7..2542b6ca338 100644
--- a/htdocs/fichinter/rapport.php
+++ b/htdocs/fichinter/rapport.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004 Laurent Destailleur
+ * Copyright (C) 2004-2010 Laurent Destailleur
* Copyright (C) 2005-2009 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -28,20 +28,19 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter');
-llxHeader();
-
/*
- * Liste
- *
+ * View
*/
+llxHeader();
+
if ($sortorder == "")
{
- $sortorder="ASC";
+ $sortorder="ASC";
}
if ($sortfield == "")
{
- $sortfield="f.datei";
+ $sortfield="f.datei";
}
if ($page == -1) { $page = 0 ; }
@@ -61,13 +60,13 @@ $sql.= " AND f.entity = ".$conf->entity;
if ($socid > 0)
{
- $sql .= " AND s.rowid = " . $socid;
+ $sql .= " AND s.rowid = " . $socid;
}
if (empty ($MM))
- $MM=strftime("%m",time());
+$MM=strftime("%m",time());
if (empty($YY))
- $YY=strftime("%Y",time());;
+$YY=strftime("%Y",time());;
echo "";
echo "\n
";
$start="$YY-$MM-01 00:00:00";
if ($MM ==12)
{
- $y = $YY+1;
- $end="$y-01-01 00:00:00";
+ $y = $YY+1;
+ $end="$y-01-01 00:00:00";
}
else
{
- $m = $MM+1;
- $end="$YY-$m-01 00:00:00";
+ $m = $MM+1;
+ $end="$YY-$m-01 00:00:00";
}
$sql .= " AND datei >= '".$start."' AND datei < '".$end."'" ;
@@ -94,52 +93,51 @@ $sql .= " ORDER BY $sortfield $sortorder ";
if ( $db->query($sql) )
{
- $num = $db->num_rows();
- $title = $langs->trans("Report")." ".dol_print_date(strtotime($start),"%B %Y");
- print_barre_liste($title, $page, "rapport.php","&socid=".$socid,$sortfield,$sortorder,'',$num);
+ $num = $db->num_rows();
+ $title = $langs->trans("Report")." ".dol_print_date(strtotime($start),"%B %Y");
+ print_barre_liste($title, $page, "rapport.php","&socid=".$socid,$sortfield,$sortorder,'',$num);
- $i = 0;
- print '';
- print "";
- print '| Num | ';
- if (empty($socid))
- print ''.$langs->trans("Customers").' | ';
- print ''.$langs->trans("Description").' | ';
+ $i = 0;
+ print '';
+ print "";
+ print '| Num | ';
+ if (empty($socid))
+ print ''.$langs->trans("Customers").' | ';
+ print ''.$langs->trans("Description").' | ';
- print 'Date | ';
- print ''.$langs->trans("Duration").' | ';
- print "
\n";
- $var=True;
- $DureeTotal = 0;
- while ($i < $num)
- {
- $objp = $db->fetch_object();
- $var=!$var;
- print "";
- print '| '.$objp->ref.' | \n';
+ print 'Date | ';
+ print ''.$langs->trans("Duration").' | ';
+ print "
\n";
+ $var=True;
+ $DureeTotal = 0;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object();
+ $var=!$var;
+ print "";
+ print '| '.$objp->ref.' | \n';
- if (empty($socid))
- {
- if (!empty($MM))
- $filter="&MM=$MM&YY=$YY";
- print ' ';
- print "rowid.$filter."\">".$objp->nom." | \n";
- }
- print ''.nl2br($objp->description).' | ';
- print "".dol_print_date($objp->dp,"%d %B %Y")." | \n";
- print ''.sprintf("%.1f",$objp->duree).' | ';
- $DureeTotal += $objp->duree;
- print "
\n";
+ if (empty($socid))
+ {
+ if (!empty($MM)) $filter="&MM=$MM&YY=$YY";
+ print ' ';
+ print "rowid.$filter."\">".$objp->nom." | \n";
+ }
+ print ''.nl2br($objp->description).' | ';
+ print "".dol_print_date($objp->dp,"%d %B %Y")." | \n";
+ print ''.sprintf("%.1f",$objp->duree).' | ';
+ $DureeTotal += $objp->duree;
+ print "\n";
- $i++;
- }
- print "
";
- $db->free();
- print "
".$langs->trans("Total")." $DureeTotal jour[s]";
+ $i++;
+ }
+ print "
";
+ $db->free();
+ print "
".$langs->trans("Total")." $DureeTotal jour[s]";
}
else
{
- dol_print_error($db);
+ dol_print_error($db);
}
$db->close();
diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php
index b4b79b65fab..a9ff49449e2 100644
--- a/htdocs/livraison/fiche.php
+++ b/htdocs/livraison/fiche.php
@@ -56,11 +56,11 @@ if ($_POST["action"] == 'add')
$db->begin();
// Creation de l'objet livraison
- $livraison = new Livraison($db);
+ $delivery = new Livraison($db);
- $livraison->date_livraison = time();
- $livraison->note = $_POST["note"];
- $livraison->commande_id = $_POST["commande_id"];
+ $delivery->date_livraison = time();
+ $delivery->note = $_POST["note"];
+ $delivery->commande_id = $_POST["commande_id"];
if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
{
@@ -70,7 +70,7 @@ if ($_POST["action"] == 'add')
// On boucle sur chaque ligne de commande pour completer objet livraison
// avec qte a livrer
$commande = new Commande($db);
- $commande->fetch($livraison->commande_id);
+ $commande->fetch($delivery->commande_id);
$commande->fetch_lines();
for ($i = 0 ; $i < sizeof($commande->lignes) ; $i++)
{
@@ -78,21 +78,21 @@ if ($_POST["action"] == 'add')
$idl = "idl".$i;
if ($_POST[$qty] > 0)
{
- $livraison->addline($_POST[$idl],$_POST[$qty]);
+ $delivery->addline($_POST[$idl],$_POST[$qty]);
}
}
- $ret=$livraison->create($user);
+ $ret=$delivery->create($user);
if ($ret > 0)
{
$db->commit();
- Header("Location: fiche.php?id=".$livraison->id);
+ Header("Location: fiche.php?id=".$delivery->id);
exit;
}
else
{
$db->rollback();
- $mesg=''.$livraison->error.'
';
+ $mesg=''.$delivery->error.'
';
$_GET["commande_id"]=$_POST["commande_id"];
$_GET["action"]='create';
}
@@ -100,20 +100,38 @@ if ($_POST["action"] == 'add')
if ($_REQUEST["action"] == 'confirm_valid' && $_REQUEST["confirm"] == 'yes' && $user->rights->expedition->livraison->valider)
{
- $livraison = new Livraison($db);
- $livraison->fetch($_GET["id"]);
- $result = $livraison->valid($user);
- //$livraison->PdfWrite();
+ $delivery = new Livraison($db);
+ $delivery->fetch($_GET["id"]);
+ $delivery->fetch_client();
+
+ $result = $delivery->valid($user);
+
+ // Define output language
+ $outputlangs = $langs;
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$delivery->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+ $result=delivery_order_pdf_create($db, $_REQUEST['id'],$_REQUEST['model'],$outputlangs);
+ if ($result <= 0)
+ {
+ dol_print_error($db,$result);
+ exit;
+ }
}
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->expedition->livraison->supprimer)
{
- $livraison = new Livraison($db);
- $livraison->fetch($_GET["id"]);
- $expedition_id = $livraison->expedition_id;
+ $delivery = new Livraison($db);
+ $delivery->fetch($_GET["id"]);
+ $expedition_id = $delivery->expedition_id;
$db->begin();
- $result=$livraison->delete();
+ $result=$delivery->delete();
if ($result > 0)
{
@@ -147,11 +165,15 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
$delivery->setDocModel($user, $_REQUEST['model']);
}
+ // Define output language
$outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$delivery->client->default_lang;
+ if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $outputlangs->setDefaultLang($newlang);
}
$result=delivery_order_pdf_create($db, $_REQUEST['id'],$_REQUEST['model'],$outputlangs);
if ($result <= 0)
@@ -364,34 +386,34 @@ else
{
if ($_GET["id"] > 0)
{
- $livraison = new Livraison($db);
- $result = $livraison->fetch($_GET["id"]);
- $livraison->fetch_client();
+ $delivery = new Livraison($db);
+ $result = $delivery->fetch($_GET["id"]);
+ $delivery->fetch_client();
$expedition=new Expedition($db);
- $result = $expedition->fetch($livraison->expedition_id);
+ $result = $expedition->fetch($delivery->expedition_id);
$typeobject = $expedition->origin;
- if ($livraison->origin_id)
+ if ($delivery->origin_id)
{
- $object = $livraison->origin;
- $livraison->fetch_object();
+ $object = $delivery->origin;
+ $delivery->fetch_object();
}
- if ( $livraison->id > 0)
+ if ( $delivery->id > 0)
{
$soc = new Societe($db);
- $soc->fetch($livraison->socid);
+ $soc->fetch($delivery->socid);
$h=0;
if ($conf->expedition_bon->enabled)
{
- $head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$livraison->expedition_id;
+ $head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$delivery->expedition_id;
$head[$h][1] = $langs->trans("SendingCard");
$h++;
}
- $head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$livraison->id;
+ $head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$delivery->id;
$head[$h][1] = $langs->trans("DeliveryCard");
$hselected = $h;
$h++;
@@ -405,7 +427,7 @@ else
if ($_GET["action"] == 'delete')
{
$expedition_id = $_GET["expid"];
- $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm"),'confirm_delete','','',1);
+ $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm"),'confirm_delete','','',1);
if ($ret == 'html') print '
';
}
@@ -415,7 +437,7 @@ else
*/
if ($_GET["action"] == 'valid')
{
- $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm"),'confirm_valid','','',1);
+ $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$delivery->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm"),'confirm_valid','','',1);
if ($ret == 'html') print '
';
}
@@ -427,7 +449,7 @@ else
// Ref
print '| '.$langs->trans("Ref").' | ';
- print ''.$livraison->ref.' |
';
+ print ''.$delivery->ref.' | ';
// Client
print '| '.$langs->trans("Customer").' | ';
@@ -458,24 +480,24 @@ else
// Ref client
print '
| '.$langs->trans("RefCustomer").' | ';
- print ''.$livraison->ref_client." | \n";
+ print ''.$delivery->ref_client." | \n";
print '
';
// Date
print '| '.$langs->trans("Date").' | ';
- print ''.dol_print_date($livraison->date_creation,'dayhourtext')." | \n";
+ print ''.dol_print_date($delivery->date_creation,'dayhourtext')." | \n";
print '
';
// Statut
print '| '.$langs->trans("Status").' | ';
- print ''.$livraison->getLibStatut(4)." | \n";
+ print ''.$delivery->getLibStatut(4)." | \n";
print '
';
if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
{
// Entrepot
$entrepot = new Entrepot($db);
- $entrepot->fetch($livraison->entrepot_id);
+ $entrepot->fetch($delivery->entrepot_id);
print '| '.$langs->trans("Warehouse").' | ';
print ''.$entrepot->libelle.' | ';
print '
';
@@ -487,7 +509,7 @@ else
* Lignes produits
*/
- $num_prod = sizeof($livraison->lignes);
+ $num_prod = sizeof($delivery->lignes);
$i = 0; $total = 0;
print '';
@@ -508,40 +530,40 @@ else
$var=!$var;
print "";
- if ($livraison->lignes[$i]->fk_product > 0)
+ if ($delivery->lignes[$i]->fk_product > 0)
{
$product = new Product($db);
- $product->fetch($livraison->lignes[$i]->fk_product);
+ $product->fetch($delivery->lignes[$i]->fk_product);
print '';
// Affiche ligne produit
- $text = '';
- if ($livraison->lignes[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
+ $text = '';
+ if ($delivery->lignes[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
else $text.= img_object($langs->trans('ShowProduct'),'product');
- $text.= ' '.$livraison->lignes[$i]->ref.'';
- $text.= ' - '.$livraison->lignes[$i]->label;
- $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($livraison->lignes[$i]->description));
+ $text.= ' '.$delivery->lignes[$i]->ref.'';
+ $text.= ' - '.$delivery->lignes[$i]->label;
+ $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($delivery->lignes[$i]->description));
//print $description;
print $html->textwithtooltip($text,$description,3,'','',$i);
- print_date_range($livraison->lignes[$i]->date_start,$livraison->lignes[$i]->date_end);
+ print_date_range($delivery->lignes[$i]->date_start,$delivery->lignes[$i]->date_end);
if ($conf->global->PRODUIT_DESC_IN_FORM)
{
- print ($livraison->lignes[$i]->description && $livraison->lignes[$i]->description!=$livraison->lignes[$i]->label)?' '.dol_htmlentitiesbr($livraison->lignes[$i]->description):'';
+ print ($delivery->lignes[$i]->description && $delivery->lignes[$i]->description!=$delivery->lignes[$i]->label)?' '.dol_htmlentitiesbr($delivery->lignes[$i]->description):'';
}
}
else
{
print " | ";
- if ($livraison->lignes[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
+ if ($delivery->lignes[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product');
- print $text.' '.nl2br($livraison->lignes[$i]->description);
+ print $text.' '.nl2br($delivery->lignes[$i]->description);
print_date_range($objp->date_start,$objp->date_end);
print " | \n";
}
- print ''.$livraison->lignes[$i]->qty_asked.' | ';
- print ''.$livraison->lignes[$i]->qty_shipped.' | ';
+ print ''.$delivery->lignes[$i]->qty_asked.' | ';
+ print ''.$delivery->lignes[$i]->qty_shipped.' | ';
print "
";
@@ -563,20 +585,20 @@ else
// if (! preg_match('/^(valid|delete)/i',$_REQUEST["action"]))
// {
- if ($livraison->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0)
+ if ($delivery->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0)
{
- print ''.$langs->trans("Validate").'';
+ print ''.$langs->trans("Validate").'';
}
if ($user->rights->expedition->livraison->supprimer)
{
if ($conf->expedition_bon->enabled)
{
- print ''.$langs->trans("Delete").'';
+ print ''.$langs->trans("Delete").'';
}
else
{
- print ''.$langs->trans("Delete").'';
+ print ''.$langs->trans("Delete").'';
}
}
// }
@@ -591,14 +613,14 @@ else
* Documents generated
*/
- $livraisonref = dol_sanitizeFileName($livraison->ref);
- $filedir = $conf->expedition->dir_output . "/receipt/" . $livraisonref;
- $urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id;
+ $deliveryref = dol_sanitizeFileName($delivery->ref);
+ $filedir = $conf->expedition->dir_output . "/receipt/" . $deliveryref;
+ $urlsource = $_SERVER["PHP_SELF"]."?id=".$delivery->id;
$genallowed=$user->rights->expedition->livraison->creer;
$delallowed=$user->rights->expedition->livraison->supprimer;
- $somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf,'',0,0,28,0,'','','',$soc->default_lang);
+ $somethingshown=$formfile->show_documents('livraison',$deliveryref,$filedir,$urlsource,$genallowed,$delallowed,$delivery->modelpdf,'',0,0,28,0,'','','',$soc->default_lang);
if ($genallowed && ! $somethingshown) $somethingshown=1;
print '';
|