Quand on ferme une facture en partie payée, elle apparait avec un statut "payée 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']);
|
||||
@ -2157,47 +2157,11 @@ 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)
|
||||
@ -2218,16 +2182,27 @@ else
|
||||
}
|
||||
|
||||
// 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,7 +1,7 @@
|
||||
<?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
|
||||
@ -19,10 +19,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
* Ce fichier a vocation de disparaitre, la configuration se faisant
|
||||
* dorénavant dans la base de donnée
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -78,7 +74,6 @@ class Conf
|
||||
{
|
||||
dolibarr_syslog("functions.inc.php::setValues");
|
||||
|
||||
|
||||
/*
|
||||
* Definition de toutes les Constantes globales d'environnement
|
||||
* - En constante php (\todo a virer)
|
||||
@ -125,18 +120,11 @@ class Conf
|
||||
$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
|
||||
@ -327,7 +315,8 @@ class Conf
|
||||
}
|
||||
|
||||
// $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 {
|
||||
|
||||
@ -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