New: Add clone feature on invoices.
Fix: Fix clone feature on emailings. Revert option to use predefined invoices
This commit is contained in:
parent
80f5696564
commit
fba4488a4d
@ -21,10 +21,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/admin/facture.php
|
||||
\ingroup facture
|
||||
\brief Page d'administration/configuration du module Facture
|
||||
\version $Id$
|
||||
* \file htdocs/admin/facture.php
|
||||
* \ingroup facture
|
||||
* \brief Page d'administration/configuration du module Facture
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -167,11 +167,6 @@ if ($_POST["action"] == 'setforcedate')
|
||||
dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION",$_POST["forcedate"]);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'set_disable_repeatable')
|
||||
{
|
||||
dolibarr_set_const($db, "FACTURE_DISABLE_RECUR",$_POST["disable_repeatable"]);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'set_enable_editdelete')
|
||||
{
|
||||
dolibarr_set_const($db, "FACTURE_ENABLE_EDITDELETE",$_POST["enable_editdelete"]);
|
||||
@ -581,20 +576,7 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
// Active facture r<>currentes
|
||||
$var=! $var;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="action" value="set_disable_repeatable">';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("DisableRepeatable");
|
||||
print '</td><td width="60" align="center">';
|
||||
print $html->selectyesno("disable_repeatable",$conf->global->FACTURE_DISABLE_RECUR,1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
// Active la possibilit<69> d'<27>diter/supprimer une facture valid<69>e sans paiement
|
||||
// Active la possibilite d'editer/supprimer une facture validee sans paiement
|
||||
$var=! $var;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="action" value="set_enable_editdelete">';
|
||||
|
||||
@ -51,8 +51,8 @@ $substitutionarrayfortest=array(
|
||||
|
||||
|
||||
|
||||
// Action envoi mailing pour tous
|
||||
if ($_POST["action"] == 'confirm_clone')
|
||||
// Action clone object
|
||||
if ($_POST["action"] == 'confirm_clone' && $_POST['confirm'] == 'yes')
|
||||
{
|
||||
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
|
||||
{
|
||||
@ -60,13 +60,19 @@ if ($_POST["action"] == 'confirm_clone')
|
||||
}
|
||||
else
|
||||
{
|
||||
$mil=new Mailing($db);
|
||||
$result=$mil->createFromClone($_REQUEST['id'],$_REQUEST["clone_content"],$_REQUEST["clone_receivers"]);
|
||||
$object=new Mailing($db);
|
||||
$result=$object->createFromClone($_REQUEST['id'],$_REQUEST["clone_content"],$_REQUEST["clone_receivers"]);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/mailing/fiche.php?id='.$result);
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
$_GET['action']='';
|
||||
$_GET['id']=$_REQUEST['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -566,11 +572,11 @@ else
|
||||
// Clone confirmation
|
||||
if ($_GET["action"] == 'clone')
|
||||
{
|
||||
// Crée un tableau formulaire
|
||||
// Create an array for form
|
||||
$formquestion=array(
|
||||
'text' => $langs->trans("ConfirmClone"),
|
||||
array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1),
|
||||
array('type' => 'checkbox', 'name' => 'clone_receviers', 'label' => $langs->trans("CloneReceivers").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true)
|
||||
'text' => $langs->trans("ConfirmClone"),
|
||||
array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1),
|
||||
array('type' => 'checkbox', 'name' => 'clone_receviers', 'label' => $langs->trans("CloneReceivers").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true)
|
||||
);
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$mil->id,$langs->trans('CloneEMailing'),$langs->trans('ConfirmCloneEMailing',$mil->ref),'confirm_clone',$formquestion,'yes');
|
||||
@ -599,31 +605,31 @@ else
|
||||
|
||||
if ($mil->statut == 0 && $user->rights->mailing->creer)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?action=edit&id='.$mil->id.'">'.$langs->trans("EditMailing").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$mil->id.'">'.$langs->trans("EditMailing").'</a>';
|
||||
}
|
||||
|
||||
//print '<a class="butAction" href="fiche.php?action=test&id='.$mil->id.'">'.$langs->trans("PreviewMailing").'</a>';
|
||||
|
||||
print '<a class="butAction" href="fiche.php?action=test&id='.$mil->id.'">'.$langs->trans("TestMailing").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=test&id='.$mil->id.'">'.$langs->trans("TestMailing").'</a>';
|
||||
|
||||
if ($mil->statut == 0 && $mil->nbemail > 0 && $user->rights->mailing->valider)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?action=valide&id='.$mil->id.'">'.$langs->trans("ValidMailing").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=valide&id='.$mil->id.'">'.$langs->trans("ValidMailing").'</a>';
|
||||
}
|
||||
|
||||
if (($mil->statut == 1 || $mil->statut == 2) && $mil->nbemail > 0 && $user->rights->mailing->valider)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?action=sendall&id='.$mil->id.'">'.$langs->trans("SendMailing").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=sendall&id='.$mil->id.'">'.$langs->trans("SendMailing").'</a>';
|
||||
}
|
||||
|
||||
if ($user->rights->mailing->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/mailing/fiche.php?action=clone&object=emailing&id='.$mil->id.'">'.$langs->trans("ToClone").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=clone&object=emailing&id='.$mil->id.'">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
if ($mil->statut <= 1 && $user->rights->mailing->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="fiche.php?action=delete&id='.$mil->id.'">'.$langs->trans("DeleteMailing").'</a>';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$mil->id.'">'.$langs->trans("DeleteMailing").'</a>';
|
||||
}
|
||||
|
||||
print '<br /><br /></div>';
|
||||
|
||||
@ -213,7 +213,7 @@ class Mailing
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get object from database
|
||||
* \brief Load an object from its id and create a new one in database
|
||||
* \param fromid Id of object to clone
|
||||
* \return int New id of clone
|
||||
*/
|
||||
@ -231,27 +231,29 @@ class Mailing
|
||||
$object->fetch($fromid);
|
||||
$object->id=0;
|
||||
$object->statut=0;
|
||||
|
||||
// Clear fields
|
||||
$object->titre=$langs->trans("CopyOf").' '.$object->titre;
|
||||
|
||||
// If no option copy content
|
||||
if (empty($option1))
|
||||
{
|
||||
// Clear values
|
||||
$this->nbemail = 0;
|
||||
$this->titre = $langs->trans("Draft").' '.mktime();
|
||||
$this->sujet = '';
|
||||
$this->body = '';
|
||||
$object->nbemail = 0;
|
||||
$object->titre = $langs->trans("Draft").' '.mktime();
|
||||
$object->sujet = '';
|
||||
$object->body = '';
|
||||
|
||||
$this->email_from = '';
|
||||
$this->email_replyto = '';
|
||||
$this->email_errorsto = '';
|
||||
$object->email_from = '';
|
||||
$object->email_replyto = '';
|
||||
$object->email_errorsto = '';
|
||||
|
||||
$this->user_creat = $user->id;
|
||||
$this->user_valid = '';
|
||||
$object->user_creat = $user->id;
|
||||
$object->user_valid = '';
|
||||
|
||||
$this->date_creat = '';
|
||||
$this->date_valid = '';
|
||||
$this->date_envoi = '';
|
||||
$object->date_creat = '';
|
||||
$object->date_valid = '';
|
||||
$object->date_envoi = '';
|
||||
}
|
||||
|
||||
// Create clone
|
||||
|
||||
@ -70,7 +70,7 @@ function llxHeader($head = "", $title="", $help_url='')
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/facture/impayees.php",$langs->trans("Unpayed"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/paiement/liste.php",$langs->trans("Payments"));
|
||||
|
||||
if (! $conf->global->FACTURE_DISABLE_RECUR)
|
||||
if ($conf->global->FACTURE_ENABLE_RECUR)
|
||||
{
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/facture/fiche-rec.php", $langs->trans("Repeatable"));
|
||||
}
|
||||
|
||||
@ -69,6 +69,31 @@ $usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
|
||||
// Action clone object
|
||||
if ($_POST["action"] == 'confirm_clone' && $_POST['confirm'] == 'yes')
|
||||
{
|
||||
if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$object=new Facture($db);
|
||||
$result=$object->createFromClone($_REQUEST['facid']);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$result);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
$_GET['action']='';
|
||||
$_GET['id']=$_REQUEST['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET['action'] == 'reopen' && $user->rights->facture->creer)
|
||||
{
|
||||
$fac = new Facture($db);
|
||||
@ -203,6 +228,15 @@ if ($_POST['action'] == 'setconditions')
|
||||
if ($result < 0) dolibarr_print_error($facture->db,$facture->error);
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'setpaymentterm')
|
||||
{
|
||||
$facture = new Facture($db);
|
||||
$facture->fetch($_GET['facid']);
|
||||
$date_lim_reglement=dolibarr_mktime(12,0,0,$_POST['paymenttermmonth'],$_POST['paymenttermday'],$_POST['paymenttermyear']);
|
||||
$result=$facture->cond_reglement($facture->cond_reglement_id,$date_lim_reglement);
|
||||
if ($result < 0) dolibarr_print_error($facture->db,$facture->error);
|
||||
}
|
||||
|
||||
if ($_REQUEST['action'] == 'setremisepercent' && $user->rights->facture->creer)
|
||||
{
|
||||
$fac = new Facture($db);
|
||||
@ -444,7 +478,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
||||
|
||||
$db->begin();
|
||||
|
||||
// Facture remplacement
|
||||
// Replacement invoice
|
||||
if ($_POST['type'] == 1)
|
||||
{
|
||||
$datefacture = dolibarr_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
@ -462,8 +496,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Si facture remplacement
|
||||
|
||||
// This is a replacement invoice
|
||||
$result=$facture->fetch($_POST['fac_replacement']);
|
||||
|
||||
$facture->date = $datefacture;
|
||||
@ -481,7 +514,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
||||
$facture->fk_facture_source = $_POST['fac_replacement'];
|
||||
$facture->type = 1;
|
||||
|
||||
$facid=$facture->create_clone($user);
|
||||
$facid=$facture->createFromCurrent($user);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1373,6 +1406,41 @@ if ($_GET['action'] == 'create')
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Factures prédéfinnies
|
||||
// TODO Use instead invoice in llx_facture table with a particular status
|
||||
if ($conf->global->FACTURE_ENABLE_RECUR)
|
||||
{
|
||||
if ($_GET['propalid'] == 0 && $_GET['commandeid'] == 0 && $_GET['contratid'] == 0)
|
||||
{
|
||||
$sql = 'SELECT r.rowid, r.titre, r.amount FROM '.MAIN_DB_PREFIX.'facture_rec as r';
|
||||
$sql.= ' WHERE r.fk_soc = '.$soc->id;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('CreateFromRepeatableInvoice').'</td><td><select class="flat" name="fac_rec">';
|
||||
print '<option value="0" selected="true"></option>';
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
print '<option value="'.$objp->rowid.'">'.$objp->titre.' : '.$objp->amount.'</option>';
|
||||
$i++;
|
||||
}
|
||||
print '</select></td></tr>';
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tiers
|
||||
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">';
|
||||
print $soc->getNomUrl(1);
|
||||
@ -1664,41 +1732,6 @@ if ($_GET['action'] == 'create')
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Factures récurrentes
|
||||
*/
|
||||
if (! $conf->global->FACTURE_DISABLE_RECUR)
|
||||
{
|
||||
if ($_GET['propalid'] == 0 && $_GET['commandeid'] == 0 && $_GET['contratid'] == 0)
|
||||
{
|
||||
$sql = 'SELECT r.rowid, r.titre, r.amount FROM '.MAIN_DB_PREFIX.'facture_rec as r';
|
||||
$sql .= ' WHERE r.fk_soc = '.$soc->id;
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<tr><td colspan="3">'.$langs->trans('CreateFromRepeatableInvoice').' : <select class="flat" name="fac_rec">';
|
||||
print '<option value="0" selected="true"></option>';
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object();
|
||||
print '<option value="'.$objp->rowid.'">'.$objp->titre.' : '.$objp->amount.'</option>';
|
||||
$i++;
|
||||
}
|
||||
print '</select></td></tr>';
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bouton "Create Draft"
|
||||
print '<tr><td colspan="3" align="center"><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></td></tr>';
|
||||
print "</table>\n";
|
||||
@ -1885,9 +1918,7 @@ else
|
||||
|
||||
dolibarr_fiche_head($head, 'compta', $langs->trans('InvoiceCustomer'));
|
||||
|
||||
/*
|
||||
* Confirmation de la conversion de l'avoir en reduc
|
||||
*/
|
||||
// Confirmation de la conversion de l'avoir en reduc
|
||||
if ($_GET['action'] == 'converttoreduc')
|
||||
{
|
||||
$text=$langs->trans('ConfirmConvertToReduc');
|
||||
@ -1895,9 +1926,7 @@ else
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de la facture
|
||||
*/
|
||||
// Confirmation de la suppression de la facture
|
||||
if ($_GET['action'] == 'delete')
|
||||
{
|
||||
$text=$langs->trans('ConfirmDeleteBill');
|
||||
@ -1905,9 +1934,7 @@ else
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la validation
|
||||
*/
|
||||
// Confirmation de la validation
|
||||
if ($_GET['action'] == 'valid')
|
||||
{
|
||||
// on vérifie si la facture est en numérotation provisoire
|
||||
@ -1934,9 +1961,7 @@ else
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation du classement payé
|
||||
*/
|
||||
// Confirmation du classement payé
|
||||
if ($_GET['action'] == 'payed' && $resteapayer <= 0)
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedBill',$fac->ref),'confirm_payed');
|
||||
@ -1970,12 +1995,10 @@ else
|
||||
);
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedPartially',$fac->ref),'confirm_payed_partially',$formquestion);
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation du classement abandonne
|
||||
*/
|
||||
// Confirmation du classement abandonne
|
||||
if ($_GET['action'] == 'canceled')
|
||||
{
|
||||
// S'il y a une facture de remplacement pas encore validée (etat brouillon),
|
||||
@ -2013,22 +2036,32 @@ else
|
||||
);
|
||||
|
||||
$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('CancelBill'),$langs->trans('ConfirmCancelBill',$fac->ref),'confirm_canceled',$formquestion);
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression d'une ligne produit
|
||||
*/
|
||||
// Confirmation de la suppression d'une ligne produit
|
||||
if ($_GET['action'] == 'delete_product_line' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&rowid='.$_GET["rowid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline');
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Facture
|
||||
*/
|
||||
// Clone confirmation
|
||||
if ($_GET["action"] == 'clone')
|
||||
{
|
||||
// Create an array for form
|
||||
$formquestion=array(
|
||||
//'text' => $langs->trans("ConfirmClone"),
|
||||
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1)
|
||||
);
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$fac->ref),'confirm_clone',$formquestion,'yes');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
// Invoice content
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -2307,13 +2340,24 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
// Date limite reglement
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DateMaxPayment').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DateMaxPayment');
|
||||
print '</td>';
|
||||
if ($fac->type != 2 && $_GET['action'] != 'editpaymentterm' && $fac->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&facid='.$fac->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($fac->type != 2)
|
||||
{
|
||||
print dolibarr_print_date($fac->date_lim_reglement,'daytext');
|
||||
if ($fac->date_lim_reglement < (time() - $conf->facture->client->warning_delay) && ! $fac->paye && $fac->statut == 1 && ! $fac->am) print img_warning($langs->trans('Late'));
|
||||
if ($_GET['action'] == 'editpaymentterm')
|
||||
{
|
||||
$html->form_date($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->date_lim_reglement,'paymentterm');
|
||||
}
|
||||
else
|
||||
{
|
||||
print dolibarr_print_date($fac->date_lim_reglement,'daytext');
|
||||
if ($fac->date_lim_reglement < (time() - $conf->facture->client->warning_delay) && ! $fac->paye && $fac->statut == 1 && ! $fac->am) print img_warning($langs->trans('Late'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2667,7 +2711,7 @@ else
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
print '<td align="center" rowspan="1" colspan="5" valign="middle"><input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
|
||||
print '<br /><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
|
||||
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
|
||||
print '</tr>' . "\n";
|
||||
if ($conf->service->enabled)
|
||||
{
|
||||
@ -2868,15 +2912,6 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
// Récurrente
|
||||
if (! $conf->global->FACTURE_DISABLE_RECUR && $fac->type == 0)
|
||||
{
|
||||
if (! $facidnext)
|
||||
{
|
||||
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 && (($fac->type < 2 && $fac->total_ttc >= 0) || ($fac->type == 2 && $fac->total_ttc <= 0)))
|
||||
{
|
||||
@ -2988,12 +3023,27 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($fac->type == 0 && $user->rights->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=clone&object=invoice">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
// Clone as predefined
|
||||
if ($conf->global->FACTURE_ENABLE_RECUR && $fac->type == 0 && $fac->statut == 0 && $user->rights->facture->creer)
|
||||
{
|
||||
if (! $facidnext)
|
||||
{
|
||||
print '<a class="butAction" href="facture/fiche-rec.php?facid='.$fac->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Supprimer
|
||||
if ($fac->is_erasable() && $user->rights->facture->supprimer && $_GET['action'] != 'delete')
|
||||
{
|
||||
if ($facidnext)
|
||||
{
|
||||
print '<span class="butActionDeleteRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Delete').'</span>';
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3190,7 +3240,7 @@ else
|
||||
$formmail->withto=$liste;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtoccc=$conf->global->FACTURE_EMAIL_USECCC;
|
||||
$formmail->withtopic=$langs->trans('SendBillRef','__FACREF__');
|
||||
$formmail->withtopic=$langs->transnoentities('SendBillRef','__FACREF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
@ -3254,7 +3304,7 @@ else
|
||||
$formmail->withfrom=1;
|
||||
$formmail->withto=$liste;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtopic=$langs->trans('SendReminderBillRef','__FACREF__');
|
||||
$formmail->withtopic=$langs->transnoentities('SendReminderBillRef','__FACREF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
|
||||
@ -67,7 +67,7 @@ function llxHeader($head = "", $title="", $help_url='')
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/facture/impayees.php",$langs->trans("Unpayed"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/paiement/liste.php",$langs->trans("Payments"));
|
||||
|
||||
if (! $conf->global->FACTURE_DISABLE_RECUR)
|
||||
if ($conf->global->FACTURE_ENABLE_RECUR)
|
||||
{
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/facture/fiche-rec.php", $langs->trans("Repeatable"));
|
||||
}
|
||||
|
||||
@ -125,11 +125,11 @@ class Facture extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Création de la facture en base
|
||||
\param user Object utilisateur qui crée
|
||||
\param notrigger 1 ne declenche pas les triggers, 0 sinon
|
||||
\return int <0 si ko, >0 si ok
|
||||
*/
|
||||
* \brief Create invoice in database
|
||||
* \param user Object uset that create
|
||||
* \param notrigger 1 ne declenche pas les triggers, 0 sinon
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function create($user,$notrigger=0)
|
||||
{
|
||||
global $langs,$conf,$mysoc;
|
||||
@ -337,12 +337,12 @@ class Facture extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\brief Create a new invoice in database from current invoice
|
||||
\param user Object user that ask creation
|
||||
\param invertdetail Reverse sign of amounts for lines
|
||||
\return int <0 si ko, >0 si ok
|
||||
* \brief Create a new invoice in database from current invoice
|
||||
* \param user Object user that ask creation
|
||||
* \param invertdetail Reverse sign of amounts for lines
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function create_clone($user,$invertdetail=0)
|
||||
function createFromCurrent($user,$invertdetail=0)
|
||||
{
|
||||
// Charge facture source
|
||||
$facture=new Facture($this->db);
|
||||
@ -376,8 +376,7 @@ class Facture extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
dolibarr_syslog("Facture::create_clone invertdetail=".$invertdetail." socid=".$this->socid." nboflines=".sizeof($facture->lignes));
|
||||
|
||||
dolibarr_syslog("Facture::createFromCurrent invertdetail=".$invertdetail." socid=".$this->socid." nboflines=".sizeof($facture->lignes));
|
||||
|
||||
$facid = $facture->create($user);
|
||||
|
||||
@ -385,6 +384,68 @@ class Facture extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Load an object from its id and create a new one in database
|
||||
* \param fromid Id of object to clone
|
||||
* \param invertdetail Reverse sign of amounts for lines
|
||||
* \return int New id of clone
|
||||
*/
|
||||
function createFromClone($fromid,$invertdetail=0)
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
$object=new Facture($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
$object->fetch($fromid);
|
||||
$object->id=0;
|
||||
$object->statut=0;
|
||||
|
||||
// Clear fields
|
||||
$object->user_author = $user->id;
|
||||
$object->user_valid = '';
|
||||
$object->fk_facture_source = 0;
|
||||
$object->date_creation = '';
|
||||
$object->date_validation = '';
|
||||
$object->ref_client = '';
|
||||
$object->close_code = '';
|
||||
$object->close_note = '';
|
||||
$object->products = $object->lignes; // Tant que products encore utilisé
|
||||
|
||||
// Create clone
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$object->error;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $object->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
@ -436,7 +497,7 @@ class Facture extends CommonObject
|
||||
$sql.= ','.$this->db->pdate('f.date_lim_reglement').' as dlr';
|
||||
$sql.= ','.$this->db->pdate('f.datec').' as datec';
|
||||
$sql.= ','.$this->db->pdate('f.date_valid').' as datev';
|
||||
$sql.= ', f.note, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.model_pdf';
|
||||
$sql.= ', f.note, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf';
|
||||
$sql.= ', f.fk_facture_source';
|
||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet';
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
@ -489,8 +550,11 @@ class Facture extends CommonObject
|
||||
$this->note = $obj->note;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->user_author = $obj->fk_user_author;
|
||||
$this->user_valid = $obj->fk_user_valid;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
|
||||
$this->commande_id = $obj->fk_commande;
|
||||
|
||||
$this->lignes = array();
|
||||
|
||||
if ($this->commande_id)
|
||||
@ -607,6 +671,128 @@ class Facture extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Update database
|
||||
* \param user User that modify
|
||||
* \param notrigger 0=launch triggers after, 1=disable triggers
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user=0, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->facnumber)) $this->facnumber=trim($this->ref);
|
||||
if (isset($this->type)) $this->type=trim($this->type);
|
||||
if (isset($this->ref_client)) $this->ref_client=trim($this->ref_client);
|
||||
if (isset($this->increment)) $this->increment=trim($this->increment);
|
||||
if (isset($this->socid)) $this->socid=trim($this->socid);
|
||||
if (isset($this->paye)) $this->paye=trim($this->paye);
|
||||
if (isset($this->amount)) $this->amount=trim($this->amount);
|
||||
if (isset($this->remise_percent)) $this->remise_percent=trim($this->remise_percent);
|
||||
if (isset($this->remise_absolue)) $this->remise_absolue=trim($this->remise_absolue);
|
||||
if (isset($this->remise)) $this->remise=trim($this->remise);
|
||||
if (isset($this->close_code)) $this->close_code=trim($this->close_code);
|
||||
if (isset($this->close_note)) $this->close_note=trim($this->close_note);
|
||||
if (isset($this->total_tva)) $this->tva=trim($this->total_tva);
|
||||
if (isset($this->total_ht)) $this->total_ht=trim($this->total_ht);
|
||||
if (isset($this->total_ttc)) $this->total_ttc=trim($this->total_ttc);
|
||||
if (isset($this->statut)) $this->statut=trim($this->statut);
|
||||
if (isset($this->user_author)) $this->user_author=trim($this->user_author);
|
||||
if (isset($this->fk_user_valid)) $this->fk_user_valid=trim($this->fk_user_valid);
|
||||
if (isset($this->fk_facture_source)) $this->fk_facture_source=trim($this->fk_facture_source);
|
||||
if (isset($this->projetid)) $this->projetid=trim($this->projetid);
|
||||
if (isset($this->cond_reglement_id)) $this->cond_reglement_id=trim($this->cond_reglement_id);
|
||||
if (isset($this->mode_reglement_id)) $this->mode_reglement_id=trim($this->mode_reglement_id);
|
||||
if (isset($this->note)) $this->note=trim($this->note);
|
||||
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
|
||||
if (isset($this->modelpdf)) $this->modelpdf=trim($this->modelpdf);
|
||||
if (isset($this->import_key)) $this->import_key=trim($this->import_key);
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET";
|
||||
|
||||
$sql.= " facnumber=".(isset($this->ref)?"'".addslashes($this->ref)."'":"null").",";
|
||||
$sql.= " type=".(isset($this->type)?$this->type:"null").",";
|
||||
$sql.= " ref_client=".(isset($this->ref_client)?"'".addslashes($this->ref_client)."'":"null").",";
|
||||
$sql.= " increment=".(isset($this->increment)?"'".addslashes($this->increment)."'":"null").",";
|
||||
$sql.= " fk_soc=".(isset($this->socid)?$this->socid:"null").",";
|
||||
$sql.= " datec=".(strval($this->date_creation)!='' ? "'".$this->db->idate($this->date_creation)."'" : 'null').",";
|
||||
$sql.= " datef=".(strval($this->date)!='' ? "'".$this->db->idate($this->date)."'" : 'null').",";
|
||||
$sql.= " date_valid=".(strval($this->date_validation)!='' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
|
||||
$sql.= " paye=".(isset($this->paye)?$this->paye:"null").",";
|
||||
$sql.= " amount=".(isset($this->amount)?$this->amount:"null").",";
|
||||
$sql.= " remise_percent=".(isset($this->remise_percent)?$this->remise_percent:"null").",";
|
||||
$sql.= " remise_absolue=".(isset($this->remise_absolue)?$this->remise_absolue:"null").",";
|
||||
$sql.= " remise=".(isset($this->remise)?$this->remise:"null").",";
|
||||
$sql.= " close_code=".(isset($this->close_code)?"'".addslashes($this->close_code)."'":"null").",";
|
||||
$sql.= " close_note=".(isset($this->close_note)?"'".addslashes($this->close_note)."'":"null").",";
|
||||
$sql.= " tva=".(isset($this->total_tva)?$this->total_tva:"null").",";
|
||||
$sql.= " total=".(isset($this->total_ht)?$this->total_ht:"null").",";
|
||||
$sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").",";
|
||||
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
|
||||
$sql.= " fk_user_author=".(isset($this->user_author)?$this->user_author:"null").",";
|
||||
$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").",";
|
||||
$sql.= " fk_facture_source=".(isset($this->fk_facture_source)?$this->fk_facture_source:"null").",";
|
||||
$sql.= " fk_projet=".(isset($this->projetid)?$this->projetid:"null").",";
|
||||
$sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").",";
|
||||
$sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").",";
|
||||
$sql.= " date_lim_reglement=".(strval($this->date_lim_reglement)!='' ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'null').",";
|
||||
$sql.= " note=".(isset($this->note)?"'".addslashes($this->note)."'":"null").",";
|
||||
$sql.= " note_public=".(isset($this->note_public)?"'".addslashes($this->note_public)."'":"null").",";
|
||||
$sql.= " model_pdf=".(isset($this->modelpdf)?"'".addslashes($this->modelpdf)."'":"null").",";
|
||||
$sql.= " import_key=".(isset($this->import_key)?"'".addslashes($this->import_key)."'":"null")."";
|
||||
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dolibarr_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dolibarr_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Ajout en base d'une ligne remise fixe en ligne de facture
|
||||
* \param idremise Id de la remise fixe
|
||||
@ -1971,36 +2157,49 @@ class Facture extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Change les conditions de réglement de la facture
|
||||
* \param cond_reglement_id Id de la nouvelle condition de réglement
|
||||
* \return int >0 si ok, <0 si ko
|
||||
* \brief Change les conditions de réglement de la facture
|
||||
* \param cond_reglement_id Id de la nouvelle condition de réglement
|
||||
* \param date Date to force payment term
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function cond_reglement($cond_reglement_id)
|
||||
function cond_reglement($cond_reglement_id,$date='')
|
||||
{
|
||||
dolibarr_syslog('Facture::cond_reglement '.$cond_reglement_id, LOG_DEBUG);
|
||||
if ($this->statut >= 0 && $this->paye == 0)
|
||||
{
|
||||
$datelim=$this->calculate_date_lim_reglement($cond_reglement_id);
|
||||
// Define cond_reglement_id and datelim
|
||||
if (strval($date) != '')
|
||||
{
|
||||
$datelim=$date;
|
||||
$cond_reglement_id=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$datelim=$this->calculate_date_lim_reglement($cond_reglement_id);
|
||||
$cond_reglement_id=$cond_reglement_id;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
||||
$sql .= ' SET fk_cond_reglement = '.$cond_reglement_id;
|
||||
$sql .= ', date_lim_reglement='.$this->db->idate($datelim);
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
$sql.= ' SET fk_cond_reglement = '.$cond_reglement_id.',';
|
||||
$sql.= ' date_lim_reglement='.$this->db->idate($datelim);
|
||||
$sql.= ' WHERE rowid='.$this->id;
|
||||
|
||||
dolibarr_syslog('Facture::cond_reglement sql='.$sql, LOG_DEBUG);
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$this->cond_reglement_id = $cond_reglement_id;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog('Facture::cond_reglement Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
$this->cond_reglement_id = $cond_reglement_id;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog('Facture::cond_reglement Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog('Facture::cond_reglement, etat facture incompatible');
|
||||
$this->error='Etat facture incompatible '.$this->statut.' '.$this->paye;
|
||||
$this->error='Entity status not compatible '.$this->statut.' '.$this->paye;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@ -2143,7 +2342,7 @@ class Facture extends CommonObject
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$return[$obj->rowid]=array( 'id' => $obj->rowid,
|
||||
$return[$obj->rowid]=array( 'id' => $obj->rowid,
|
||||
'ref' => $obj->facnumber,
|
||||
'status' => $obj->fk_statut);
|
||||
}
|
||||
|
||||
@ -1605,7 +1605,7 @@ class Form
|
||||
* \brief Affiche formulaire de selection de conditions de paiement
|
||||
* \param page Page
|
||||
* \param selected Id condition pré-sélectionné
|
||||
* \param htmlname Nom du formulaire select
|
||||
* \param htmlname Name of select html field
|
||||
* \param addempty Ajoute entrée vide
|
||||
*/
|
||||
function form_conditions_reglement($page, $selected='', $htmlname='cond_reglement_id', $addempty=0)
|
||||
@ -1635,11 +1635,45 @@ class Form
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Affiche formulaire de selection d'une date
|
||||
* \param page Page
|
||||
* \param selected Date preselected
|
||||
* \param htmlname Name of input html field
|
||||
*/
|
||||
function form_date($page, $selected='', $htmlname)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($htmlname != "none")
|
||||
{
|
||||
print '<form method="post" action="'.$page.'" name="form'.$htmlname.'">';
|
||||
print '<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||
print '<table class="noborder" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print $this->select_date($selected,$htmlname,0,0,1,'form'.$htmlname);
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($selected)
|
||||
{
|
||||
$this->load_cache_types_paiements();
|
||||
print $this->cache_types_paiements[$selected]['label'];
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Affiche formulaire de selection des modes de reglement
|
||||
* \param page Page
|
||||
* \param selected Id mode pré-sélectionné
|
||||
* \param htmlname Nom du formulaire select
|
||||
* \param htmlname Name of select html field
|
||||
*/
|
||||
function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id')
|
||||
{
|
||||
@ -1992,7 +2026,7 @@ class Form
|
||||
* @param h 1=Affiche aussi les heures
|
||||
* @param m 1=Affiche aussi les minutes
|
||||
* @param empty 0=Champ obligatoire, 1=Permet une saisie vide
|
||||
* @param form_name Nom du formulaire de provenance. Utilisé pour les dates en popup style andre.
|
||||
* @param form_name Nom du formulaire de provenance. Utilisé pour les dates en popup.
|
||||
* @param d 1=Affiche aussi les jours, mois, annees
|
||||
*/
|
||||
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1)
|
||||
|
||||
@ -312,7 +312,7 @@ class FormMail
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
// CC
|
||||
// CCC
|
||||
if ($this->withtoccc || is_array($this->withtoccc))
|
||||
{
|
||||
print '<tr><td width="180">'.$langs->trans("MailCCC").'</td><td>';
|
||||
@ -332,7 +332,7 @@ class FormMail
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
// Accusé réception
|
||||
// Ask delivery receipt
|
||||
if ($this->withdeliveryreceipt)
|
||||
{
|
||||
print '<tr><td width="180">'.$langs->trans("DeliveryReceipt").'</td><td>';
|
||||
@ -403,12 +403,12 @@ class FormMail
|
||||
{
|
||||
$defaultmessage="";
|
||||
|
||||
// \todo A partir du type, proposer liste de messages dans table llx_models
|
||||
if ($this->param["models"]=='body') { $defaultmessage=$this->withbody; }
|
||||
if ($this->param["models"]=='facture_send') { $defaultmessage="Veuillez trouver ci-joint la facture __FACREF__\n\nCordialement\n\n"; }
|
||||
if ($this->param["models"]=='facture_relance') { $defaultmessage="Nous apportons à votre connaissance que la facture __FACREF__ ne semble pas avoir été réglée. La voici donc, pour rappel, en pièce jointe.\n\nCordialement\n\n"; }
|
||||
if ($this->param["models"]=='propal_send') { $defaultmessage="Veuillez trouver ci-joint la proposition commerciale __PROPREF__\n\nCordialement\n\n"; }
|
||||
if ($this->param["models"]=='order_send') { $defaultmessage="Veuillez trouver ci-joint la commande __ORDERREF__\n\nCordialement\n\n"; }
|
||||
// \TODO A partir du type, proposer liste de messages dans table llx_models
|
||||
if ($this->param["models"]=='body') { $defaultmessage=$this->withbody; }
|
||||
if ($this->param["models"]=='facture_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoice"); }
|
||||
if ($this->param["models"]=='facture_relance') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceReminder"); }
|
||||
if ($this->param["models"]=='propal_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendProposal"); }
|
||||
if ($this->param["models"]=='order_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendOrder"); }
|
||||
|
||||
$defaultmessage=make_substitutions($defaultmessage,$this->substit);
|
||||
|
||||
|
||||
@ -429,7 +429,7 @@ class MenuLeft {
|
||||
{
|
||||
if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/clients.php?action=facturer&leftmenu=customers_bills",$langs->trans("NewBill"),2,$user->rights->facture->creer);
|
||||
}
|
||||
if (! $conf->global->FACTURE_DISABLE_RECUR)
|
||||
if ($conf->global->FACTURE_ENABLE_RECUR)
|
||||
{
|
||||
if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),2,$user->rights->facture->lire);
|
||||
}
|
||||
|
||||
@ -411,7 +411,7 @@ class MenuLeft {
|
||||
{
|
||||
if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/clients.php?action=facturer&leftmenu=customers_bills",$langs->trans("NewBill"),2,$user->rights->facture->creer);
|
||||
}
|
||||
if (! $conf->global->FACTURE_DISABLE_RECUR)
|
||||
if ($conf->global->FACTURE_ENABLE_RECUR)
|
||||
{
|
||||
if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatable"),2,$user->rights->facture->lire);
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ insert into `llx_menu_constraint` (`rowid`, `action`) values (10, '$conf->contra
|
||||
insert into `llx_menu_constraint` (`rowid`, `action`) values (11, '$conf->fichinter->enabled');
|
||||
insert into `llx_menu_constraint` (`rowid`, `action`) values (12, '$conf->societe->enabled');
|
||||
insert into `llx_menu_constraint` (`rowid`, `action`) values (13, '$conf->facture->enabled');
|
||||
insert into `llx_menu_constraint` (`rowid`, `action`) values (14, '! $conf->global->FACTURE_DISABLE_RECUR');
|
||||
insert into `llx_menu_constraint` (`rowid`, `action`) values (14, '$conf->global->FACTURE_ENABLE_RECUR');
|
||||
insert into `llx_menu_constraint` (`rowid`, `action`) values (15, '$conf->don->enabled');
|
||||
insert into `llx_menu_constraint` (`rowid`, `action`) values (16, '$conf->deplacement->enabled');
|
||||
insert into `llx_menu_constraint` (`rowid`, `action`) values (17, '$conf->tax->enabled');
|
||||
|
||||
@ -239,7 +239,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
// Description de la ligne produit
|
||||
$libelleproduitservice=dol_htmlentitiesbr($fac->lignes[$i]->libelle,1);
|
||||
if ($fac->lignes[$i]->desc&&$fac->lignes[$i]->desc!=$fac->lignes[$i]->libelle)
|
||||
if ($fac->lignes[$i]->desc && $fac->lignes[$i]->desc != $fac->lignes[$i]->libelle)
|
||||
{
|
||||
if ($libelleproduitservice) $libelleproduitservice.="<br>";
|
||||
|
||||
|
||||
@ -254,13 +254,17 @@ class pdf_huitre extends ModelePDFFactures
|
||||
$pdf->MultiCell(110, 3, $note, 0, 'J');
|
||||
}
|
||||
|
||||
$pdf->SetFont('Arial','U',11);
|
||||
$pdf->SetXY(10, 225);
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").' : ';
|
||||
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$fac->cond_reglement_code)!=('PaymentCondition'.$fac->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$fac->cond_reglement_code):$fac->cond_reglement;
|
||||
$titre.=$lib_condition_paiement;
|
||||
$pdf->MultiCell(190, 5, $titre, 0, 'J');
|
||||
|
||||
// Show payments conditions
|
||||
if ($fac->type != 2 && ($fac->cond_reglement_code || $fac->cond_reglement))
|
||||
{
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").' : ';
|
||||
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$fac->cond_reglement_code)!=('PaymentCondition'.$fac->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$fac->cond_reglement_code):$fac->cond_reglement;
|
||||
$titre.=$lib_condition_paiement;
|
||||
$pdf->MultiCell(190, 5, $titre, 0, 'J');
|
||||
}
|
||||
|
||||
$this->_pagefoot($pdf, $fac, $outputlangs);
|
||||
$pdf->AliasNbPages();
|
||||
//----
|
||||
|
||||
@ -196,13 +196,13 @@ NonPercuRecuperable=Non-recoverable
|
||||
SetConditions=Set payment conditions
|
||||
SetMode=Set payment mode
|
||||
Billed=Billed
|
||||
RepeatableInvoice=Repeatable invoice
|
||||
RepeatableInvoices=Repeatable invoices
|
||||
Repeatable=Repeatable
|
||||
Repeatables=Repeatable
|
||||
ChangeIntoRepeatableInvoice=Change into repeatable
|
||||
CreateRepeatableInvoice=Create repeatable invoice
|
||||
CreateFromRepeatableInvoice=Create from repeatable invoice
|
||||
RepeatableInvoice=Pre-defined invoice
|
||||
RepeatableInvoices=Pre-defined invoices
|
||||
Repeatable=Pre-defined
|
||||
Repeatables=Pre-defined
|
||||
ChangeIntoRepeatableInvoice=Convert into pre-defined
|
||||
CreateRepeatableInvoice=Create pre-defined invoice
|
||||
CreateFromRepeatableInvoice=Create from pre-defined invoice
|
||||
CustomersInvoicesAndInvoiceLines=Customer invoices and invoices' lines
|
||||
CustomersInvoicesAndPayments=Customer invoices and payments
|
||||
ExportDataset_invoice_1=Customer invoices list and invoices' lines
|
||||
@ -240,6 +240,10 @@ InvoicePayed=Invoice payed
|
||||
PaymentNumber=Payment number
|
||||
RemoveDiscount=Remove discount
|
||||
WatermarkOnDraftBill=Watermark on draft invoices (nothing if empty)
|
||||
CloneInvoice=Clone invoice
|
||||
CloneMainAttributes=Clone object with its main attributes
|
||||
ConfirmCloneInvoice=Are you sure you want to clone this invoice ?
|
||||
DisabledBecauseReplacedInvoice=Action disabled because invoice has been replaced
|
||||
|
||||
# PaymentConditions
|
||||
PaymentConditionShortRECEP=Immediate
|
||||
|
||||
@ -34,6 +34,11 @@ Miscellanous=Miscellanous
|
||||
NbOfActiveNotifications=Number of notifications
|
||||
WarningInstallDirExists=Warning, install directory (%s) still exists. This is a serious security hole. You should removed it as soon as possible.
|
||||
WarningUntilDirRemoved=This warning will remain active as long as this directory is present (Shown only to admin users).
|
||||
PredefinedMailContentSendInvoice=Veuillez trouver ci-joint la facture __FACREF__\n\nCordialement\n\n
|
||||
PredefinedMailContentSendInvoiceReminder=Nous apportons à votre connaissance que la facture __FACREF__ ne semble pas avoir été réglée. La voici donc, pour rappel, en pièce jointe.\n\nCordialement\n\n
|
||||
PredefinedMailContentSendProposal=Veuillez trouver ci-joint la proposition commerciale __PROPREF__\n\nCordialement\n\n
|
||||
PredefinedMailContentSendOrder=Veuillez trouver ci-joint la commande __ORDERREF__\n\nCordialement\n\n
|
||||
##### Bookmark #####
|
||||
Bookmark=Bookmark
|
||||
Bookmarks=Bookmarks
|
||||
NewBookmark=New bookmark
|
||||
|
||||
@ -195,13 +195,13 @@ NonPercuRecuperable=Non per
|
||||
SetConditions=Définir conditions de règlement
|
||||
SetMode=Définir mode de règlement
|
||||
Billed=Facturé
|
||||
RepeatableInvoice=Facture récurrente
|
||||
RepeatableInvoices=Factures récurrentes
|
||||
Repeatable=Récurrente
|
||||
Repeatables=Récurrentes
|
||||
ChangeIntoRepeatableInvoice=Convertir en récurrente
|
||||
CreateRepeatableInvoice=Créer facture récurrente
|
||||
CreateFromRepeatableInvoice=Créer depuis facture récurrente
|
||||
RepeatableInvoice=Facture prédéfinie
|
||||
RepeatableInvoices=Factures prédéfinies
|
||||
Repeatable=Prédéfinie
|
||||
Repeatables=Prédéfinies
|
||||
ChangeIntoRepeatableInvoice=Convertir en prédéfinie
|
||||
CreateRepeatableInvoice=Créer facture prédéfinie
|
||||
CreateFromRepeatableInvoice=Créer depuis facture prédéfinie
|
||||
CustomersInvoicesAndInvoiceLines=Factures clients et lignes de factures
|
||||
CustomersInvoicesAndPayments=Factures clients et règlements
|
||||
ExportDataset_invoice_1=Factures clients et lignes de facture
|
||||
@ -240,6 +240,10 @@ PaymentNumber=Num
|
||||
RemoveDiscount=Supprimer remise
|
||||
WatermarkOnDraftBill=Filigrane sur les brouillons de factures (aucun si vide)
|
||||
UnpayedNotChecked=Aucune facture impayées n'a été sélectionnée
|
||||
CloneInvoice=Cloner facture
|
||||
CloneMainAttributes=Cloner l'objet avec ces attributs principaux
|
||||
ConfirmCloneInvoice=Etes-vous sur de vouloir cloner cette facture ?
|
||||
DisabledBecauseReplacedInvoice=Action désactivée car facture remplacée
|
||||
|
||||
# PaymentConditions
|
||||
PaymentConditionShortRECEP=A réception
|
||||
|
||||
@ -34,6 +34,10 @@ Miscellanous=Divers
|
||||
NbOfActiveNotifications=Nombre de notifications
|
||||
WarningInstallDirExists=Attention, le répertoire install (%s) existe toujours. Une fois l'install terminée, sa présence n'est plus nécessaire et représente une faille sérieuse de sécurité. Vous devriez l'effacer dès que possible.
|
||||
WarningUntilDirRemoved=Cette alerte restera active tant que le répertoire existera (alerte visible pour les utilisateurs admin uniquement).
|
||||
PredefinedMailContentSendInvoice=Veuillez trouver ci-joint la facture __FACREF__\n\nCordialement\n\n
|
||||
PredefinedMailContentSendInvoiceReminder=Nous apportons à votre connaissance que la facture __FACREF__ ne semble pas avoir été réglée. La voici donc, pour rappel, en pièce jointe.\n\nCordialement\n\n
|
||||
PredefinedMailContentSendProposal=Veuillez trouver ci-joint la proposition commerciale __PROPREF__\n\nCordialement\n\n
|
||||
PredefinedMailContentSendOrder=Veuillez trouver ci-joint la commande __ORDERREF__\n\nCordialement\n\n
|
||||
##### Bookmark #####
|
||||
Bookmark=Marque page
|
||||
Bookmarks=Marque pages
|
||||
|
||||
Loading…
Reference in New Issue
Block a user