New: Support note on trips module

This commit is contained in:
Laurent Destailleur 2010-01-14 23:21:22 +00:00
parent 6afc9d152c
commit 935431eba3
12 changed files with 314 additions and 64 deletions

View File

@ -4,6 +4,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 2.8 compared to 2.7 ***** ***** ChangeLog for 2.8 compared to 2.7 *****
For users: For users:
- New: Support note on trips module
- New: Can link contacts to projects - New: Can link contacts to projects
- New: Can removed attached file on email form if attachment was wrong. - New: Can removed attached file on email form if attachment was wrong.
- New: Add option to show your logo on top of left menu. - New: Add option to show your logo on top of left menu.

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
@ -34,16 +34,22 @@ require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
class Deplacement extends CommonObject class Deplacement extends CommonObject
{ {
var $db; var $db;
var $errors; var $error;
var $element='deplacement';
var $table_element='deplacement';
var $table_element_line = '';
var $fk_element = '';
var $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;
var $fk_user_author; var $fk_user_author;
var $fk_user; var $fk_user;
var $km; var $km;
var $note; var $note;
var $note_public;
var $socid; var $socid;
/** /**
* \brief Constructeur de la classe * \brief Constructeur de la classe
* \param DB handler acces base de donnees * \param DB handler acces base de donnees
@ -66,7 +72,7 @@ class Deplacement extends CommonObject
function create($user) function create($user)
{ {
global $conf; global $conf;
// Check parameters // Check parameters
if (empty($this->type) || $this->type < 0) if (empty($this->type) || $this->type < 0)
{ {
@ -78,21 +84,25 @@ class Deplacement extends CommonObject
$this->error='ErrorBadParameter'; $this->error='ErrorBadParameter';
return -1; return -1;
} }
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."deplacement ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."deplacement (";
$sql.= "datec"; $sql.= "datec";
$sql.= ", entity"; $sql.= ", entity";
$sql.= ", fk_user_author"; $sql.= ", fk_user_author";
$sql.= ", fk_user"; $sql.= ", fk_user";
$sql.= ", type"; $sql.= ", type";
$sql.= ", note";
$sql.= ", note_public";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= $this->db->idate(mktime()); $sql.= $this->db->idate(mktime());
$sql.= ", ".$conf->entity; $sql.= ", ".$conf->entity;
$sql.= ", ".$user->id; $sql.= ", ".$user->id;
$sql.= ", ".$this->fk_user; $sql.= ", ".$this->fk_user;
$sql.= ", '".$this->type."'"; $sql.= ", '".$this->type."'";
$sql.= ", note = ".($this->note?"'".addslashes($this->note)."'":"null");
$sql.= ", note_public = ".($this->note_public?"'".addslashes($this->note_public)."'":"null");
$sql.= ")"; $sql.= ")";
dol_syslog("Deplacement::create sql=".$sql, LOG_DEBUG); dol_syslog("Deplacement::create sql=".$sql, LOG_DEBUG);
@ -116,13 +126,13 @@ class Deplacement extends CommonObject
{ {
$this->error=$this->db->error()." sql=".$sql; $this->error=$this->db->error()." sql=".$sql;
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
/** /**
* *
*/ */
function update($user) function update($user)
{ {
@ -130,7 +140,7 @@ class Deplacement extends CommonObject
// Clean parameters // Clean parameters
$this->km=price2num($this->km); $this->km=price2num($this->km);
// Check parameters // Check parameters
if (! is_numeric($this->km)) $this->km = 0; if (! is_numeric($this->km)) $this->km = 0;
if (empty($this->type) || $this->type < 0) if (empty($this->type) || $this->type < 0)
@ -143,13 +153,15 @@ class Deplacement extends CommonObject
$this->error='ErrorBadParameter'; $this->error='ErrorBadParameter';
return -1; return -1;
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."deplacement "; $sql = "UPDATE ".MAIN_DB_PREFIX."deplacement ";
$sql .= " SET km = ".$this->km; // This is a distance or amount $sql .= " SET km = ".$this->km; // This is a distance or amount
$sql .= " , dated = '".$this->db->idate($this->date)."'"; $sql .= " , dated = '".$this->db->idate($this->date)."'";
$sql .= " , type = '".$this->type."'"; $sql .= " , type = '".$this->type."'";
$sql .= " , fk_user = ".$this->fk_user; $sql .= " , fk_user = ".$this->fk_user;
$sql .= " , fk_soc = ".($this->socid > 0?$this->socid:'null'); $sql .= " , fk_soc = ".($this->socid > 0?$this->socid:'null');
$sql .= " , note = ".($this->note?"'".addslashes($this->note)."'":"null");
$sql .= " , note_public = ".($this->note_public?"'".addslashes($this->note_public)."'":"null");
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
dol_syslog("Deplacement::update sql=".$sql, LOG_DEBUG); dol_syslog("Deplacement::update sql=".$sql, LOG_DEBUG);
@ -166,11 +178,11 @@ class Deplacement extends CommonObject
} }
/** /**
* * Load an object from database
*/ */
function fetch($id) function fetch($id)
{ {
$sql = "SELECT rowid, fk_user, type, km, fk_soc,".$this->db->pdate("dated")." as dated"; $sql = "SELECT rowid, fk_user, type, km, fk_soc, dated, note, note_public";
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement";
$sql.= " WHERE rowid = ".$id; $sql.= " WHERE rowid = ".$id;
@ -182,11 +194,13 @@ class Deplacement extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->date = $obj->dated; $this->date = $this->db->jdate($obj->dated);
$this->fk_user = $obj->fk_user; $this->fk_user = $obj->fk_user;
$this->socid = $obj->fk_soc; $this->socid = $obj->fk_soc;
$this->km = $obj->km; $this->km = $obj->km;
$this->type = $obj->type; $this->type = $obj->type;
$this->note = $obj->note;
$this->note_public = $obj->note_public;
return 1; return 1;
} }
@ -204,6 +218,7 @@ class Deplacement extends CommonObject
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."deplacement WHERE rowid = ".$id; $sql = "DELETE FROM ".MAIN_DB_PREFIX."deplacement WHERE rowid = ".$id;
dol_syslog("Deplacement::delete sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {

View File

@ -193,17 +193,25 @@ else
if ($mesg) print $mesg."<br>"; if ($mesg) print $mesg."<br>";
$h=0;
$head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$deplacement->id";
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
$head[$h][0] = DOL_URL_ROOT."/compta/deplacement/note.php?id=$deplacement->id";
$head[$h][1] = $langs->trans("Note");
$head[$h][2] = 'note';
$h++;
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');
if ($_GET["action"] == 'edit') if ($_GET["action"] == 'edit')
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($deplacement->socid); $soc->fetch($deplacement->socid);
$h=0;
$head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$deplacement->id";
$head[$h][1] = $langs->trans("Card");
dol_fiche_head($head, $hselected, $langs->trans("TripCard"), 0, 'trip');
print "<form name='update' action=\"fiche.php\" method=\"post\">\n"; print "<form name='update' action=\"fiche.php\" method=\"post\">\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -246,15 +254,8 @@ else
} }
else else
{ {
$h=0;
$head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$deplacement->id";
$head[$h][1] = $langs->trans("Card");
dol_fiche_head($head, $hselected, $langs->trans("TripCard"), 0, 'trip');
/* /*
* Confirmation de la suppression du d<EFBFBD>placement * Confirmation de la suppression du deplacement
*/ */
if ($_GET["action"] == 'delete') if ($_GET["action"] == 'delete')
{ {

View File

@ -0,0 +1,202 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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.
*/
/**
* \file htdocs/compta/deplacement/note.php
* \ingroup trip
* \brief Notes on a trip card
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/deplacement/deplacement.class.php");
$socid=isset($_GET["socid"])?$_GET["socid"]:isset($_POST["socid"])?$_POST["socid"]:"";
if (!$user->rights->deplacement->lire)
accessforbidden();
$langs->load("companies");
$langs->load("bills");
$langs->load("trips");
// Securiy check
if ($user->societe_id > 0)
{
unset($_GET["action"]);
$socid = $user->societe_id;
}
$trip = new Deplacement($db);
/******************************************************************************/
/* Actions */
/******************************************************************************/
if ($_POST["action"] == 'update_public' && $user->rights->deplacement->creer)
{
$db->begin();
$trip->fetch($_GET["id"]);
$res=$trip->update_note_public($_POST["note_public"],$user);
if ($res < 0)
{
$mesg='<div class="error">'.$fac->error.'</div>';
$db->rollback();
}
else
{
$db->commit();
}
}
if ($_POST["action"] == 'update' && $user->rights->deplacement->creer)
{
$db->begin();
$trip->fetch($_GET["id"]);
$res=$trip->update_note($_POST["note"],$user);
if ($res < 0)
{
$mesg='<div class="error">'.$fac->error.'</div>';
$db->rollback();
}
else
{
$db->commit();
}
}
/******************************************************************************/
/* Affichage fiche */
/******************************************************************************/
llxHeader();
$html = new Form($db);
$id = $_GET['id'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{
$trip = new Deplacement($db);
$trip->fetch($id,$ref);
$soc = new Societe($db, $trip->socid);
$soc->fetch($trip->socid);
$h=0;
$head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$trip->id";
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
$head[$h][0] = DOL_URL_ROOT."/compta/deplacement/note.php?id=$trip->id";
$head[$h][1] = $langs->trans("Note");
$head[$h][2] = 'note';
$h++;
dol_fiche_head($head, 'note', $langs->trans("TripCard"), 0, 'trip');
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
$morehtmlref='';
print $html->showrefnav($trip,'ref','',1,'ref','ref',$morehtmlref);
print '</td></tr>';
print '<tr><td>'.$langs->trans("Type").'</td><td>'.$langs->trans($trip->type).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("CompanyVisited").'</td>';
print '<td>';
if ($soc->id) print $soc->getNomUrl(1);
print '</td></tr>';
// Note publique
print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
print '<td valign="top" colspan="3">';
if ($_GET["action"] == 'edit')
{
print '<form method="post" action="note.php?id='.$trip->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update_public">';
print '<textarea name="note_public" cols="80" rows="8">'.$trip->note_public."</textarea><br>";
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</form>';
}
else
{
print ($trip->note_public?nl2br($trip->note_public):"&nbsp;");
}
print "</td></tr>";
// Note privee
if (! $user->societe_id)
{
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
print '<td valign="top" colspan="3">';
if ($_GET["action"] == 'edit')
{
print '<form method="post" action="note.php?id='.$trip->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<textarea name="note" cols="80" rows="8">'.$trip->note."</textarea><br>";
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</form>';
}
else
{
print ($trip->note?nl2br($trip->note):"&nbsp;");
}
print "</td></tr>";
}
print "</table>";
/*
* Actions
*/
print '</div>';
print '<div class="tabsAction">';
if ($user->rights->deplacement->creer && $_GET["action"] <> 'edit')
{
print "<a class=\"butAction\" href=\"note.php?id=$trip->id&amp;action=edit\">".$langs->trans('Modify')."</a>";
}
print "</div>";
}
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -21,11 +21,11 @@
* *
*/ */
/** /**
\file htdocs/compta/deplacement/pre.inc.php * \file htdocs/compta/deplacement/pre.inc.php
\ingroup deplacement * \ingroup deplacement
\brief Fichier gestionnaire du menu deplacement * \brief Fichier gestionnaire du menu deplacement
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
require("./deplacement.class.php"); require("./deplacement.class.php");

View File

@ -98,7 +98,8 @@ if ($_GET['action'] == 'reopen' && $user->rights->facture->creer)
{ {
$fac = new Facture($db); $fac = new Facture($db);
$result = $fac->fetch($_GET['facid']); $result = $fac->fetch($_GET['facid']);
if ($fac->statut == 3 && ($fac->close_code == 'badcustomer' || $fac->close_code == 'abandon')) if ($fac->statut == 2
|| ($fac->statut == 3 && $fac->close_code != 'replaced'))
{ {
$result = $fac->set_unpaid($user); $result = $fac->set_unpaid($user);
if ($result > 0) if ($result > 0)
@ -3250,10 +3251,23 @@ else
} }
} }
// Reopen a standard paid invoice
if ($fac->type == 1 && $fac->statut == 2) // A paid invoice (partially or completely)
{
if (! $facidnext)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a>';
}
else
{
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>';
}
}
// Reopen a classified invoice // Reopen a classified invoice
if ($fac->statut == 3 && // A abandoned invoice if ($fac->statut == 3 && // A abandoned invoice
$fac->getIdReplacingInvoice() == 0 && // Not replaced by another invoice $fac->getIdReplacingInvoice() == 0 && // Not replaced by another invoice
($fac->close_code == 'badcustomer' || $fac->close_code == 'abandon')) $fac->close_code != 'replaced') // Not replaced by another invoice
{ {
if (! $facidnext) if (! $facidnext)
{ {
@ -3399,6 +3413,10 @@ else
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Delete').'</a>'; print '<a class="butActionRefused" href="#" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Delete').'</a>';
} }
elseif ($fac->getSommePaiement())
{
print '<a class="butActionRefused" href="#" title="'.$langs->trans("DisabledBecausePayments").'">'.$langs->trans('Delete').'</a>';
}
else else
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
@ -3721,7 +3739,7 @@ else
$sql = 'SELECT '; $sql = 'SELECT ';
$sql.= ' f.rowid as facid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,'; $sql.= ' f.rowid as facid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,';
$sql.= ' '.$db->pdate('f.datef').' as df, '.$db->pdate('f.date_lim_reglement').' as datelimite,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,'; $sql.= ' f.paye as paye, f.fk_statut,';
$sql.= ' s.nom, s.rowid as socid'; $sql.= ' s.nom, s.rowid as socid';
if (! $sall) $sql.= ' ,sum(pf.amount) as am'; if (! $sall) $sql.= ' ,sum(pf.amount) as am';
@ -3858,6 +3876,8 @@ else
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$var=!$var; $var=!$var;
$datelimit=$db->jdate($objp->datelimite);
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td nowrap="nowrap">'; print '<td nowrap="nowrap">';
@ -3885,10 +3905,10 @@ else
// Date // Date
if ($objp->df > 0) if ($objp->df > 0)
{ {
$y = dol_print_date($objp->df,'%Y'); $y = dol_print_date($db->jdate($objp->df),'%Y');
$m = dol_print_date($objp->df,'%m'); $m = dol_print_date($db->jdate($objp->df),'%m');
$mt = dol_print_date($objp->df,'%b'); $mt = dol_print_date($db->jdate($objp->df),'%b');
$d = dol_print_date($objp->df,'%d'); $d = dol_print_date($db->jdate($objp->df),'%d');
print '<td align="center" nowrap>'; print '<td align="center" nowrap>';
print $d; print $d;
print ' <a href="'.$_SERVER["PHP_SELF"].'?year='.$y.'&amp;month='.$m.'">'; print ' <a href="'.$_SERVER["PHP_SELF"].'?year='.$y.'&amp;month='.$m.'">';
@ -3902,8 +3922,8 @@ else
} }
// Date limit // Date limit
print '<td align="center" nowrap="1">'.dol_print_date($objp->datelimite,'day'); print '<td align="center" nowrap="1">'.dol_print_date($datelimit,'day');
if ($objp->datelimite < ($now - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) if ($datelimit < ($now - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am)
{ {
print img_warning($langs->trans('Late')); print img_warning($langs->trans('Late'));
} }

View File

@ -37,7 +37,7 @@ if (!$user->rights->facture->lire)
$langs->load("companies"); $langs->load("companies");
$langs->load("bills"); $langs->load("bills");
// S<EFBFBD>curit<EFBFBD> acc<63>s // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
unset($_GET["action"]); unset($_GET["action"]);

View File

@ -41,7 +41,7 @@ $langs->load('companies');
$id=isset($_GET["id"])?$_GET["id"]:$_POST["id"]; $id=isset($_GET["id"])?$_GET["id"]:$_POST["id"];
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
// TODO ajouter r<EFBFBD>gle pour restreindre acces paiement // TODO ajouter regle pour restreindre acces paiement
//$result = restrictedArea($user, 'facture', $id,''); //$result = restrictedArea($user, 'facture', $id,'');
$mesg=''; $mesg='';
@ -206,9 +206,10 @@ print '</table>';
/* /*
* Liste des factures * List of invoices
*/ */
$allow_delete = 1 ;
$disable_delete = 0;
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom, s.rowid as socid'; $sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom, s.rowid as socid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
$sql.= ' WHERE pf.fk_facture = f.rowid'; $sql.= ' WHERE pf.fk_facture = f.rowid';
@ -251,9 +252,9 @@ if ($resql)
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';
print '<td align="right">'.price($objp->amount).'</td>'; print '<td align="right">'.price($objp->amount).'</td>';
print "</tr>\n"; print "</tr>\n";
if ($objp->paye == 1) if ($objp->paye == 1) // If at least one invoice is paid, disable delete
{ {
$allow_delete = 0; $disable_delete = 1;
} }
$total = $total + $objp->amount; $total = $total + $objp->amount;
$i++; $i++;
@ -288,11 +289,19 @@ if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
} }
} }
} }
if ($user->societe_id == 0 && $allow_delete && $_GET['action'] == '')
if ($user->societe_id == 0 && $_GET['action'] == '')
{ {
if ($user->rights->facture->paiement) if ($user->rights->facture->paiement)
{ {
print '<a class="butActionDelete" href="fiche.php?id='.$_GET['id'].'&amp;action=delete">'.$langs->trans('Delete').'</a>'; if (! $disable_delete)
{
print '<a class="butActionDelete" href="fiche.php?id='.$_GET['id'].'&amp;action=delete">'.$langs->trans('Delete').'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovedPaiementWithOneInvoicePaid")).'">'.$langs->trans('Delete').'</a>';
}
} }
} }

View File

@ -18,11 +18,11 @@
*/ */
/** /**
\file htdocs/compta/pre.inc.php * \file htdocs/compta/pre.inc.php
\ingroup compta * \ingroup compta
\brief Fichier gestionnaire du menu compta * \brief Fichier gestionnaire du menu compta
\version $Id$ * \version $Id$
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -78,14 +78,14 @@ function llxHeader($head = '', $title='', $help_url='')
$menu->add(DOL_URL_ROOT."/compta/commande/liste.php?leftmenu=orders&amp;afacturer=1", $langs->trans("MenuOrdersToBill")); $menu->add(DOL_URL_ROOT."/compta/commande/liste.php?leftmenu=orders&amp;afacturer=1", $langs->trans("MenuOrdersToBill"));
} }
// Les d<EFBFBD>penses // Les depenses
if ($conf->fournisseur->enabled) if ($conf->fournisseur->enabled)
{ {
$langs->load("suppliers"); $langs->load("suppliers");
$menu->add(DOL_URL_ROOT."/fourn/index.php", $langs->trans("Suppliers")); $menu->add(DOL_URL_ROOT."/fourn/index.php", $langs->trans("Suppliers"));
} }
if ($conf->deplacement->enabled && $user->societe_id == 0) if ($conf->deplacement->enabled)
{ {
$langs->load("trips"); $langs->load("trips");
$menu->add(DOL_URL_ROOT."/compta/deplacement/", $langs->trans("Trips")); $menu->add(DOL_URL_ROOT."/compta/deplacement/", $langs->trans("Trips"));
@ -102,7 +102,7 @@ function llxHeader($head = '', $title='', $help_url='')
} }
// Vision des recettes-d<EFBFBD>penses // Vision des recettes-depenses
if ($conf->banque->enabled && $user->rights->banque->lire) if ($conf->banque->enabled && $user->rights->banque->lire)
{ {
$langs->load("banks"); $langs->load("banks");

View File

@ -2040,7 +2040,7 @@ class Facture extends CommonObject
* \brief Renvoi le libelle d'un statut donne * \brief Renvoi le libelle d'un statut donne
* \param paye Etat paye * \param paye Etat paye
* \param statut Id statut * \param statut Id statut
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Pict * \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* \param alreadypaid Montant deja paye * \param alreadypaid Montant deja paye
* \param type Type facture * \param type Type facture
* \return string Libelle du statut * \return string Libelle du statut

View File

@ -14,6 +14,7 @@ ALTER TABLE llx_stock_mouvement ADD COLUMN label varchar(128);
ALTER TABLE llx_deplacement ADD COLUMN ref varchar(30) DEFAULT NULL AFTER rowid; ALTER TABLE llx_deplacement ADD COLUMN ref varchar(30) DEFAULT NULL AFTER rowid;
ALTER TABLE llx_deplacement ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; ALTER TABLE llx_deplacement ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_deplacement ADD COLUMN note_public text;
ALTER TABLE llx_element_element DROP INDEX idx_element_element_idx1; ALTER TABLE llx_element_element DROP INDEX idx_element_element_idx1;
ALTER TABLE llx_element_element DROP INDEX idx_element_element_targetid; ALTER TABLE llx_element_element DROP INDEX idx_element_element_targetid;

View File

@ -32,5 +32,6 @@ create table llx_deplacement
type varchar(12) NOT NULL, type varchar(12) NOT NULL,
km real, km real,
fk_soc integer, fk_soc integer,
note text note text,
note_public text
)type=innodb; )type=innodb;