Quand on ferme une facture en partie paye, elle apparait avec un statut "paye partiellement".
This commit is contained in:
parent
54b48dc64d
commit
105fc64197
@ -181,8 +181,8 @@ if ($_GET["id"] > 0)
|
||||
print '</div>';
|
||||
|
||||
|
||||
// Affiche forumlaire upload
|
||||
if (defined('MAIN_UPLOAD_DOC') && $conf->upload)
|
||||
// Affiche formulaire upload
|
||||
if ($conf->upload)
|
||||
{
|
||||
print_titre($langs->trans('AttachANewFile'));
|
||||
|
||||
|
||||
@ -541,7 +541,7 @@ if ($_GET['action'] == 'deleteline' && $user->rights->facture->creer && !$conf->
|
||||
|
||||
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
|
||||
{
|
||||
if ($user->rights->facture->supprimer )
|
||||
if ($user->rights->facture->supprimer)
|
||||
{
|
||||
$fac = new Facture($db);
|
||||
$result = $fac->delete($_GET['facid']);
|
||||
@ -2106,7 +2106,7 @@ else
|
||||
if ($user->societe_id == 0 && $_GET['action'] <> 'valid' && $_GET['action'] <> 'editline')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
|
||||
// Editer une facture déjà validée, sans paiement effectué et pas exporté en compta
|
||||
if ($fac->statut == 1)
|
||||
{
|
||||
@ -2119,20 +2119,20 @@ else
|
||||
$ventilExportCompta++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($conf->global->FACTURE_ENABLE_EDITDELETE && $user->rights->facture->modifier
|
||||
&& ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=modif">'.$langs->trans('Edit').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Récurrente
|
||||
if (! $conf->global->FACTURE_DISABLE_RECUR)
|
||||
{
|
||||
print ' <a class="butAction" href="facture/fiche-rec.php?facid='.$fac->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Valider
|
||||
if ($fac->statut == 0 && $num_lignes > 0)
|
||||
{
|
||||
@ -2156,80 +2156,55 @@ else
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// on vérifie si la facture est en numérotation provisoire
|
||||
$facref = substr($fac->ref, 1, 4);
|
||||
if ($facref == PROV)
|
||||
{
|
||||
// Supprimer
|
||||
if ($fac->statut == 0 && $user->rights->facture->supprimer && $_GET['action'] != 'delete')
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
}
|
||||
else if ($conf->global->FACTURE_ENABLE_EDITDELETE)
|
||||
{
|
||||
if ($fac->statut == 0 && $user->rights->facture->supprimer && $_GET['action'] != 'delete')
|
||||
{
|
||||
// On ne peut supprimer que la dernière facture validée
|
||||
// pour ne pas avoir de trou dans les numéros
|
||||
$sql = "SELECT MAX(facnumber)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$maxfacnumber = $db->fetch_row($resql);
|
||||
}
|
||||
|
||||
// On vérifie si les lignes de factures ont été exportées en compta et/ou ventilées
|
||||
$ventilExportCompta = 0 ;
|
||||
for ($i = 0 ; $i < sizeof($fac->lignes) ; $i++)
|
||||
{
|
||||
if ($fac->lignes[$i]->export_compta <> 0 && $fac->lignes[$i]->code_ventilation <> 0)
|
||||
{
|
||||
$ventilExportCompta++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($maxfacnumber[0] == $fac->ref && $ventilExportCompta == 0)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// On vérifie si la facture est supprimable. Si oui, on propose bouton supprimer
|
||||
if ($fac->is_erasable() && $user->rights->facture->supprimer && $_GET['action'] != 'delete')
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
|
||||
// Envoyer
|
||||
if ($fac->statut == 1 && $user->rights->facture->envoyer)
|
||||
{
|
||||
print ' <a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=presend">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Envoyer une relance
|
||||
if ($fac->statut == 1 && price($resteapayer) > 0 && $user->rights->facture->envoyer)
|
||||
{
|
||||
print ' <a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=prerelance">'.$langs->trans('SendRemindByMail').'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Emettre paiement
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
|
||||
{
|
||||
print ' <a class="butAction" href="paiement.php?facid='.$fac->id.'&action=create">'.$langs->trans('DoPaiement').'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Classer 'payé'
|
||||
if ($fac->statut == 1 && price($resteapayer) <= 0
|
||||
&& $fac->paye == 0 && $user->rights->facture->paiement)
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement
|
||||
&& price($resteapayer) <= 0)
|
||||
{
|
||||
print ' <a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=payed">'.$langs->trans('ClassifyPayed').'</a>';
|
||||
}
|
||||
|
||||
// Classer 'abandonnée' (possible si validée et pas encore classer payée)
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
|
||||
|
||||
// Classer 'fermée' (possible si validée et pas encore classer payée)
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement
|
||||
&& price($resteapayer) > 0)
|
||||
{
|
||||
print ' <a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=canceled">'.$langs->trans('ClassifyCanceled').'</a>';
|
||||
}
|
||||
if ($totalpaye > 0)
|
||||
{
|
||||
print ' <a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=canceled">'.$langs->trans('ClassifyPayedPartially').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' <a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=canceled">'.$langs->trans('ClassifyCanceled').'</a>';
|
||||
|
||||
// \todo
|
||||
// Ajouter bouton "Annuler et Créer facture remplacement"
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
|
||||
* Copyright (C) 2004-2006 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
|
||||
@ -16,13 +16,9 @@
|
||||
* 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$
|
||||
*
|
||||
* Ce fichier a vocation de disparaitre, la configuration se faisant
|
||||
* dorénavant dans la base de donnée
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -32,7 +28,7 @@
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
\class Conf
|
||||
\brief Classe de stockage de la config courante
|
||||
\todo Deplacer ce fichier dans htdocs/lib
|
||||
@ -67,8 +63,8 @@ class Conf
|
||||
var $webcal;
|
||||
var $propal;
|
||||
var $categorie;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Positionne toutes les variables de configuration
|
||||
* \param $db Handler d'accès base
|
||||
@ -77,8 +73,7 @@ class Conf
|
||||
function setValues($db)
|
||||
{
|
||||
dolibarr_syslog("functions.inc.php::setValues");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Definition de toutes les Constantes globales d'environnement
|
||||
* - En constante php (\todo a virer)
|
||||
@ -90,7 +85,7 @@ class Conf
|
||||
{
|
||||
$numr = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
while ($i < $numr)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
@ -102,9 +97,9 @@ class Conf
|
||||
}
|
||||
}
|
||||
$db->free($result);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Nettoyage variables des gestionnaires de menu
|
||||
* conf->menu_top et conf->menu_left sont définis dans main.inc.php (selon user)
|
||||
@ -113,36 +108,29 @@ class Conf
|
||||
if (! $this->global->MAIN_MENUFRONT_BARRETOP) $this->global->MAIN_MENUFRONT_BARRETOP="default.php";
|
||||
if (! $this->global->MAIN_MENU_BARRELEFT) $this->global->MAIN_MENU_BARRELEFT="default.php";
|
||||
if (! $this->global->MAIN_MENUFRONT_BARRELEFT) $this->global->MAIN_MENUFRONT_BARRELEFT="default.php";
|
||||
|
||||
|
||||
/*
|
||||
* Charge l'objet de traduction et positionne langage courant global
|
||||
* Charge l'objet de traduction et positionne langage courant global
|
||||
*/
|
||||
if (! $this->global->MAIN_LANG_DEFAULT) $this->global->MAIN_LANG_DEFAULT="fr_FR";
|
||||
|
||||
|
||||
/*
|
||||
* Autres parametres globaux de configurations
|
||||
*/
|
||||
$this->users->dir_output=DOL_DATA_ROOT."/users";
|
||||
|
||||
|
||||
/*
|
||||
* Utilise dans tous les upload de fichier
|
||||
* necessaire pour desactiver dans la demo
|
||||
* Autorisation globale d'uploader (necessaire pour desactiver dans la demo)
|
||||
* conf->upload peut etre écrasée dans main.inc.php (selon user)
|
||||
*/
|
||||
if (defined('MAIN_UPLOAD_DOC') && MAIN_UPLOAD_DOC == 1)
|
||||
{
|
||||
$this->upload = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->upload = 0;
|
||||
}
|
||||
|
||||
|
||||
if ($this->global->MAIN_UPLOAD_DOC) $this->upload = 1;
|
||||
else $this->upload = 0;
|
||||
|
||||
/*
|
||||
* Definition des parametres d'activation de module et dependants des modules
|
||||
* Chargement d'include selon etat activation des modules
|
||||
*/
|
||||
|
||||
|
||||
// Module bookmark4u
|
||||
$this->bookmark4u->enabled=defined('MAIN_MODULE_BOOKMARK4U')?MAIN_MODULE_BOOKMARK4U:0;
|
||||
$this->bookmark->enabled=defined('MAIN_MODULE_BOOKMARK')?MAIN_MODULE_BOOKMARK:0;
|
||||
@ -156,7 +144,7 @@ class Conf
|
||||
$this->commande->enabled=defined("MAIN_MODULE_COMMANDE")?MAIN_MODULE_COMMANDE:0;
|
||||
$this->commande->dir_output=DOL_DATA_ROOT."/commande";
|
||||
$this->commande->dir_images=DOL_DATA_ROOT."/commande/images";
|
||||
|
||||
|
||||
// Module expeditions
|
||||
$this->expedition->enabled=defined("MAIN_MODULE_EXPEDITION")?MAIN_MODULE_EXPEDITION:0;
|
||||
// Sous module bons d'expedition
|
||||
@ -167,7 +155,7 @@ class Conf
|
||||
$this->livraison->enabled=defined("MAIN_SUBMODULE_LIVRAISON")?MAIN_SUBMODULE_LIVRAISON:0;
|
||||
$this->livraison->dir_output=DOL_DATA_ROOT."/livraison";
|
||||
$this->livraison->dir_images=DOL_DATA_ROOT."/livraison/images";
|
||||
|
||||
|
||||
// Module societe
|
||||
$this->societe->enabled=defined("MAIN_MODULE_SOCIETE")?MAIN_MODULE_SOCIETE:0;
|
||||
$this->societe->dir_output=DOL_DATA_ROOT."/societe";
|
||||
@ -282,12 +270,12 @@ class Conf
|
||||
$this->export->dir_ouput=DOL_DATA_ROOT."/export";
|
||||
// Module ldap
|
||||
$this->ldap->enabled=defined("MAIN_MODULE_LDAP")?MAIN_MODULE_LDAP:0;
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Modification de quelques variable de conf en fonction des Constantes
|
||||
*/
|
||||
|
||||
|
||||
// societe
|
||||
if (! $this->global->SOCIETE_CODECLIENT_ADDON) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard";
|
||||
if (! $this->global->SOCIETE_CODEFOURNISSEUR_ADDON) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON="mod_codeclient_leopard";
|
||||
@ -295,58 +283,59 @@ class Conf
|
||||
// Pour compatibilite ascendante:
|
||||
if ($this->global->CODECLIENT_ADDON) $this->global->SOCIETE_CODECLIENT_ADDON=$this->global->CODECLIENT_ADDON;
|
||||
if ($this->global->CODEFOURNISSEUR_ADDON) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON=$this->global->CODEFOURNISSEUR_ADDON;
|
||||
|
||||
|
||||
// securite
|
||||
if (! $this->global->USER_PASSWORD_GENERATED) $this->global->USER_PASSWORD_GENERATED='standard';
|
||||
|
||||
|
||||
// conf->use_preview_tabs
|
||||
$this->use_preview_tabs=1;
|
||||
if (isset($this->global->MAIN_USE_PREVIEW_TABS)) $this->use_preview_tabs=$this->global->MAIN_USE_PREVIEW_TABS;
|
||||
|
||||
|
||||
// conf->use_javascript
|
||||
$this->use_javascript=1;
|
||||
if (isset($this->global->MAIN_DISABLE_JAVASCRIPT)) $this->use_javascript=! $this->global->MAIN_DISABLE_JAVASCRIPT;
|
||||
|
||||
|
||||
// conf->use_ajax
|
||||
$this->use_ajax=0; // Pas d' Ajax par defaut
|
||||
if (isset($this->global->MAIN_DISABLE_AJAX)) $this->use_ajax=! $this->global->MAIN_DISABLE_AJAX;
|
||||
|
||||
|
||||
// conf->use_popup_calendar
|
||||
$this->use_popup_calendar=""; // Pas de date popup par defaut
|
||||
if (isset($this->global->MAIN_POPUP_CALENDAR)) $this->use_popup_calendar=$this->global->MAIN_POPUP_CALENDAR;
|
||||
|
||||
|
||||
// conf->monnaie
|
||||
if (! $this->global->MAIN_MONNAIE) $this->global->MAIN_MONNAIE='EUR';
|
||||
if (! $this->global->MAIN_MONNAIE) $this->global->MAIN_MONNAIE='EUR';
|
||||
$this->monnaie=$this->global->MAIN_MONNAIE;
|
||||
|
||||
|
||||
// $this->compta->mode = Option du module Compta: Defini le mode de calcul des etats comptables (CA,...)
|
||||
$this->compta->mode = 'RECETTES-DEPENSES'; // Par défaut
|
||||
if (defined('COMPTA_MODE') && COMPTA_MODE) {
|
||||
// Peut etre 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
|
||||
$this->compta->mode = COMPTA_MODE;
|
||||
}
|
||||
|
||||
|
||||
// $this->defaulttx
|
||||
if (defined('FACTURE_TVAOPTION') && FACTURE_TVAOPTION == 'franchise') {
|
||||
if (defined('FACTURE_TVAOPTION') && FACTURE_TVAOPTION == 'franchise')
|
||||
{
|
||||
$this->defaulttx='0'; // Taux par défaut des factures clients
|
||||
}
|
||||
else {
|
||||
$this->defaulttx=''; // Pas de taux par défaut des factures clients, le premier sera pris
|
||||
}
|
||||
|
||||
|
||||
// $this->liste_limit = constante de taille maximale des listes
|
||||
if (! $this->global->MAIN_SIZE_LISTE_LIMIT) $this->global->MAIN_SIZE_LISTE_LIMIT=20;
|
||||
$this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT;
|
||||
|
||||
|
||||
// $this->produit->limit_size = constante de taille maximale des select de produit
|
||||
if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=50;
|
||||
$this->produit->limit_size=$this->global->PRODUIT_LIMIT_SIZE;
|
||||
|
||||
|
||||
// $this->theme et $this->css
|
||||
if (! $this->global->MAIN_THEME) $this->global->MAIN_THEME="eldy";
|
||||
$this->theme=$this->global->MAIN_THEME;
|
||||
$this->css = "theme/".$this->theme."/".$this->theme.".css";
|
||||
|
||||
|
||||
// $this->email_from = email pour envoi par Dolibarr des mails auto (notifications, ...)
|
||||
// $this->mailing->email_from = email pour envoi par Dolibarr des mailings
|
||||
$this->email_from="dolibarr-robot@domain.com";
|
||||
@ -359,7 +348,7 @@ class Conf
|
||||
$this->mailing->email_from=MAILING_EMAIL_FROM;
|
||||
}
|
||||
else $this->mailing->email_from=$this->email_from;
|
||||
|
||||
|
||||
// $this->adherent->email_resil, ...
|
||||
if (defined("MAIN_MAIL_RESIL"))
|
||||
{
|
||||
@ -393,19 +382,19 @@ class Conf
|
||||
{
|
||||
$this->adherent->email_new_subject=MAIN_MAIL_NEW_SUBJECT;
|
||||
}
|
||||
|
||||
|
||||
// Format de la date
|
||||
// \todo Mettre format dans fichier langue
|
||||
$this->format_date_text_short="%d %b %Y";
|
||||
$this->format_date_short="%d/%m/%Y";
|
||||
$this->format_date_short_java="dd/MM/yyyy";
|
||||
|
||||
|
||||
/* \todo Ajouter une option Gestion de la TVA dans le module compta qui permet de désactiver la fonction TVA
|
||||
* (pour particuliers ou libéraux en franchise)
|
||||
* En attendant, valeur forcée à 1
|
||||
*/
|
||||
$this->compta->tva=1;
|
||||
|
||||
|
||||
// Delais de tolerance des alertes
|
||||
$this->actions->warning_delay=$this->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
|
||||
$this->commande->traitement->warning_delay=$this->global->MAIN_DELAY_ORDERS_TO_PROCESS*24*60*60;
|
||||
@ -417,7 +406,7 @@ class Conf
|
||||
$this->contrat->services->expires->warning_delay=$this->global->MAIN_DELAY_RUNNING_SERVICES*24*60*60;
|
||||
$this->adherent->cotisation->warning_delay=$this->global->MAIN_DELAY_MEMBERS*24*60*60;
|
||||
$this->bank->rappro->warning_delay=$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE*24*60*60;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -62,7 +62,8 @@ class Facture extends CommonObject
|
||||
var $total;
|
||||
var $note;
|
||||
var $note_public;
|
||||
var $paye;
|
||||
var $statut;
|
||||
var $paye; // 1 si facture payée COMPLETEMENT, 0 sinon
|
||||
var $propalid;
|
||||
var $projetid;
|
||||
var $date_lim_reglement;
|
||||
@ -1540,7 +1541,8 @@ class Facture extends CommonObject
|
||||
if (! $paye)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
|
||||
if ($statut == 3) return $langs->trans('Bill'.$prefix.'StatusCanceled');
|
||||
if ($statut == 3 && $alreadypayed <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpayed');
|
||||
if ($statut == 3 && $alreadypayed > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPayedPartially');
|
||||
if ($alreadypayed <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPayed');
|
||||
return $langs->trans('Bill'.$prefix.'StatusStarted');
|
||||
}
|
||||
@ -1555,7 +1557,8 @@ class Facture extends CommonObject
|
||||
if (! $paye)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
|
||||
if ($statut == 3) return $langs->trans('Bill'.$prefix.'StatusCanceled');
|
||||
if ($statut == 3 && $alreadypayed <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpayed');
|
||||
if ($statut == 3 && $alreadypayed > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPayedPartially');
|
||||
if ($alreadypayed <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPayed');
|
||||
return $langs->trans('Bill'.$prefix.'StatusStarted');
|
||||
}
|
||||
@ -1569,14 +1572,15 @@ class Facture extends CommonObject
|
||||
$prefix='Short';
|
||||
if (! $paye)
|
||||
{
|
||||
if ($statut == 0) return img_picto($langs->trans('Bill'.$prefix.'StatusDraft'),'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft');
|
||||
if ($statut == 3) return img_picto($langs->trans('Bill'.$prefix.'StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
|
||||
if ($alreadypayed <= 0) return img_picto($langs->trans('Bill'.$prefix.'StatusNotPayed'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPayed');
|
||||
return img_picto($langs->trans('Bill'.$prefix.'StatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted');
|
||||
if ($statut == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft');
|
||||
if ($statut == 3 && $alreadypayed <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusClosedUnpayed');
|
||||
if ($statut == 3 && $alreadypayed > 0) return img_picto($langs->trans('BillStatusClosedPayedPartially'),'statut7').' '.$langs->trans('Bill'.$prefix.'StatusClosedPayedPartially');
|
||||
if ($alreadypayed <= 0) return img_picto($langs->trans('BillStatusNotPayed'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPayed');
|
||||
return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted');
|
||||
}
|
||||
else
|
||||
{
|
||||
return img_picto($langs->trans('Bill'.$prefix.'StatusPayed'),'statut6').' '.$langs->trans('Bill'.$prefix.'StatusPayed');
|
||||
return img_picto($langs->trans('BillStatusPayed'),'statut6').' '.$langs->trans('Bill'.$prefix.'StatusPayed');
|
||||
}
|
||||
}
|
||||
if ($mode == 3)
|
||||
@ -1584,14 +1588,15 @@ class Facture extends CommonObject
|
||||
$prefix='Short';
|
||||
if (! $paye)
|
||||
{
|
||||
if ($statut == 0) return img_picto($langs->trans('Bill'.$prefix.'StatusDraft'),'statut0');
|
||||
if ($statut == 3) return img_picto($langs->trans('Bill'.$prefix.'StatusCanceled'),'statut5');
|
||||
if ($alreadypayed <= 0) return img_picto($langs->trans('Bill'.$prefix.'StatusNotPayed'),'statut1');
|
||||
return img_picto($langs->trans('Bill'.$prefix.'StatusStarted'),'statut3');
|
||||
if ($statut == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0');
|
||||
if ($statut == 3 && $alreadypayed <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5');
|
||||
if ($statut == 3 && $alreadypayed > 0) return img_picto($langs->trans('BillStatusClosedPayedPartially'),'statut7');
|
||||
if ($alreadypayed <= 0) return img_picto($langs->trans('BillStatusNotPayed'),'statut1');
|
||||
return img_picto($langs->trans('BillStatusStarted'),'statut3');
|
||||
}
|
||||
else
|
||||
{
|
||||
return img_picto($langs->trans('Bill'.$prefix.'StatusPayed'),'statut6');
|
||||
return img_picto($langs->trans('BillStatusPayed'),'statut6');
|
||||
}
|
||||
}
|
||||
if ($mode == 4)
|
||||
@ -1599,7 +1604,8 @@ class Facture extends CommonObject
|
||||
if (! $paye)
|
||||
{
|
||||
if ($statut == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft');
|
||||
if ($statut == 3) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('BillStatusCanceled');
|
||||
if ($statut == 3 && $alreadypayed <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
|
||||
if ($statut == 3 && $alreadypayed > 0) return img_picto($langs->trans('BillStatusClosedPayedPartially'),'statut7').' '.$langs->trans('Bill'.$prefix.'StatusClosedPayedPartially');
|
||||
if ($alreadypayed <= 0) return img_picto($langs->trans('BillStatusNotPayed'),'statut1').' '.$langs->trans('BillStatusNotPayed');
|
||||
return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted');
|
||||
}
|
||||
@ -1613,14 +1619,15 @@ class Facture extends CommonObject
|
||||
$prefix='Short';
|
||||
if (! $paye)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans('Bill'.$prefix.'StatusDraft').' '.img_picto($langs->trans('Bill'.$prefix.'StatusDraft'),'statut0');
|
||||
if ($statut == 3) return $langs->trans('Bill'.$prefix.'StatusCanceled').' '.img_picto($langs->trans('Bill'.$prefix.'StatusCanceled'),'statut5');
|
||||
if ($alreadypayed <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPayed').' '.img_picto($langs->trans('Bill'.$prefix.'StatusNotPayed'),'statut1');
|
||||
return $langs->trans('Bill'.$prefix.'StatusStarted').' '.img_picto($langs->trans('Bill'.$prefix.'StatusStarted'),'statut3');
|
||||
if ($statut == 0) return $langs->trans('Bill'.$prefix.'StatusDraft').' '.img_picto($langs->trans('BillStatusDraft'),'statut0');
|
||||
if ($statut == 3 && $alreadypayed <= 0) return $langs->trans('Bill'.$prefix.'StatusCanceled').' '.img_picto($langs->trans('BillStatusCanceled'),'statut5');
|
||||
if ($statut == 3 && $alreadypayed > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPayedPartially').' '.img_picto($langs->trans('BillStatusClosedPayedPartially'),'statut7');
|
||||
if ($alreadypayed <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPayed').' '.img_picto($langs->trans('BillStatusNotPayed'),'statut1');
|
||||
return $langs->trans('Bill'.$prefix.'StatusStarted').' '.img_picto($langs->trans('BillStatusStarted'),'statut3');
|
||||
}
|
||||
else
|
||||
{
|
||||
return $langs->trans('Bill'.$prefix.'StatusPayed').' '.img_picto($langs->trans('Bill'.$prefix.'StatusPayed'),'statut6');
|
||||
return $langs->trans('Bill'.$prefix.'StatusPayed').' '.img_picto($langs->trans('BillStatusPayed'),'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1827,6 +1834,59 @@ class Facture extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoi si une facture peut etre supprimée complètement
|
||||
* La règle est la suivante:
|
||||
* Si facture brouillon -> oui, fin de règle
|
||||
* Si facture dernière, sans paiement et non exporté en compta -> oui
|
||||
* \param user Utilisateur créant la demande
|
||||
* \return int <0 si ko, 0=non, 1=oui
|
||||
*/
|
||||
function is_erasable()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Si facture brouillon
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Si facture non brouillon
|
||||
if ($conf->compta->enabled && $conf->global->FACTURE_ENABLE_EDITDELETE)
|
||||
{
|
||||
// On ne peut supprimer que la dernière facture validée
|
||||
// pour ne pas avoir de trou dans les numéros
|
||||
$sql = "SELECT MAX(facnumber)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$maxfacnumber = $db->fetch_row($resql);
|
||||
}
|
||||
|
||||
// On vérifie si les lignes de factures ont été exportées en compta et/ou ventilées
|
||||
$ventilExportCompta = 0 ;
|
||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||
{
|
||||
if ($this->lignes[$i]->export_compta <> 0 && $this->lignes[$i]->code_ventilation <> 0)
|
||||
{
|
||||
$ventilExportCompta++;
|
||||
}
|
||||
}
|
||||
|
||||
// Si derniere facture et si non ventilée, on peut supprimer
|
||||
if ($maxfacnumber[0] == $this->ref && $ventilExportCompta == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Créé une demande de prélèvement
|
||||
* \param user Utilisateur créant la demande
|
||||
|
||||
@ -28,7 +28,9 @@ PaymentsAlreadyDone=Payments already done
|
||||
PaymentMode=Payment mode
|
||||
PaymentConditionsShort=Payment conditions
|
||||
ClassifyPayed=Classify 'Payed'
|
||||
ClassifyPayedPartially=Classify 'Payed partially'
|
||||
ClassifyCanceled=Classify 'Abandonned'
|
||||
ClassifyClosed=Classify 'Closed'
|
||||
CreateBill=Create Invoice
|
||||
AddBill=Add invoice
|
||||
DeleteBill=Delete invoice
|
||||
@ -48,12 +50,16 @@ BillStatusCanceled=Abandonned
|
||||
BillStatusValidated=Validated (need to be payed)
|
||||
BillStatusStarted=Started
|
||||
BillStatusNotPayed=Not payed
|
||||
BillStatusClosedUnpayed=Closed (unpayed)
|
||||
BillStatusClosedPayedPartially=Payed (partially)
|
||||
BillShortStatusDraft=Draft
|
||||
BillShortStatusPayed=Payed
|
||||
BillShortStatusCanceled=Abandonned
|
||||
BillShortStatusValidated=Validated
|
||||
BillShortStatusStarted=Started
|
||||
BillShortStatusNotPayed=Not payed
|
||||
BillShortStatusClosedUnpayed=Closed
|
||||
BillShortStatusClosedPayedPartially=Payed
|
||||
PaymentStatusToValidShort=A valider
|
||||
ErrorVATIntraNotConfigured=Intracommunautary VAT number not yet defined
|
||||
ErrorNoPaiementModeConfigured=No paiment mode yet defined
|
||||
|
||||
@ -28,7 +28,9 @@ PaymentsAlreadyDone=Versements d
|
||||
PaymentMode=Mode règlement
|
||||
PaymentConditionsShort=Conditions règlement
|
||||
ClassifyPayed=Classer 'Payée'
|
||||
ClassifyPayedPartially=Classer 'Payée partiellement'
|
||||
ClassifyCanceled=Classer 'Abandonnée'
|
||||
ClassifyClosed=Classer 'Fermée'
|
||||
CreateBill=Créer Facture
|
||||
AddBill=Créer facture
|
||||
DeleteBill=Supprimer facture
|
||||
@ -48,12 +50,16 @@ BillStatusCanceled=Abandonn
|
||||
BillStatusValidated=Validée (à payer)
|
||||
BillStatusStarted=Paiement commencé
|
||||
BillStatusNotPayed=Impayée
|
||||
BillStatusClosedUnpayed=Fermée (impayée)
|
||||
BillStatusClosedPayedPartially=Payée (partiellement)
|
||||
BillShortStatusDraft=Brouillon
|
||||
BillShortStatusPayed=Payée
|
||||
BillShortStatusCanceled=Abandonnée
|
||||
BillShortStatusValidated=Validée
|
||||
BillShortStatusStarted=Commencée
|
||||
BillShortStatusNotPayed=Impayée
|
||||
BillShortStatusClosedUnpayed=Fermée
|
||||
BillShortStatusClosedPayedPartially=Payée
|
||||
PaymentStatusToValidShort=A valider
|
||||
ErrorVATIntraNotConfigured=Numéro de TVA intracommunautaire pas encore configuré
|
||||
ErrorNoPaiementModeConfigured=Aucun mode de règlement défini
|
||||
|
||||
@ -246,7 +246,7 @@ if ($product->id)
|
||||
|
||||
|
||||
// Affiche forumlaire upload
|
||||
if (defined('MAIN_UPLOAD_DOC') && $conf->upload && $user->rights->produit->creer)
|
||||
if ($conf->upload && $user->rights->produit->creer)
|
||||
{
|
||||
print_titre($langs->trans('AttachANewFile'));
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user