Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2014-05-01 16:27:16 +02:00
commit 21716a0c7c
37 changed files with 857 additions and 233 deletions

View File

@ -49,9 +49,11 @@ For users:
- New: Extrafields can be used as substitution key %EXTRA_XXX% into emails texts for members.
- Fix: Project Task numbering customs rule works.
- Fix: Add actions events not implemented.
- Fix: Price min of composition is not supplier price min by quantity
- Fix: [ bug #1356 ] Bank accountancy number is limited to 8 numbers
- New: Add categories translation
- Fix: Price min of composition is not supplier price min by quantity.
- Fix: [ bug #1356 ] Bank accountancy number is limited to 8 numbers.
- New: Add categories translation.
- New: Enable option "clone target emailing".
- New: Improved tax module: Add specific page for salaries payment
TODO
- New: Predefined product and free product use same form.

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
@ -187,9 +187,6 @@ if ($id > 0)
dol_print_error($db,$object->error);
}
/*
* Affichage onglets
*/
$head = societe_prepare_head($object);
@ -397,7 +394,6 @@ if ($id > 0)
print '</tr>';
}
// Multiprice level
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
@ -410,7 +406,11 @@ if ($id > 0)
print '<a href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
}
print '</td></tr></table>';
print '</td><td colspan="3">'.$object->price_level."</td>";
print '</td><td colspan="3">';
print $object->price_level;
$keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$object->price_level;
if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel);
print "</td>";
print '</tr>';
}
@ -887,11 +887,9 @@ if ($id > 0)
}
print '</div>';
print "<br>\n";
if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
{
print '<br>';
// List of contacts
show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
}

View File

@ -305,8 +305,55 @@ class Mailing extends CommonObject
if (! $error)
{
//Clone target
if (!empty($option2)) {
require_once DOL_DOCUMENT_ROOT .'/core/modules/mailings/modules_mailings.php';
$mailing_target = new MailingTargets($this->db);
$target_array=array();
$sql = "SELECT fk_contact, ";
$sql.=" lastname, ";
$sql.=" firstname,";
$sql.=" email,";
$sql.=" other,";
$sql.=" source_url,";
$sql.=" source_id ,";
$sql.=" source_type ";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles ";
$sql.= " WHERE fk_mailing = ".$fromid;
dol_syslog(get_class($this)."::createFromClone sql=".$sql);
$result=$this->db->query($sql);
if ($result)
{
if ($this->db->num_rows($result))
{
while ($obj = $this->db->fetch_object($result)) {
$target_array[]=array('fk_contact'=>$obj->fk_contact,
'lastname'=>$obj->lastname,
'firstname'=>$obj->firstname,
'email'=>$obj->email,
'other'=>$obj->other,
'source_url'=>$obj->source_url,
'source_id'=>$obj->source_id,
'source_type'=>$obj->source_type);
}
}
}
else
{
$this->error=$this->db->lasterror();
dol_syslog("Mailing::createFromClone ".$this->error, LOG_ERR);
return -1;
}
$mailing_target->add_to_target($object->id, $target_array);
}
}

View File

@ -822,7 +822,7 @@ else
$formquestion=array(
'text' => $langs->trans("ConfirmClone"),
array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1),
array('type' => 'checkbox', 'name' => 'clone_receivers', 'label' => $langs->trans("CloneReceivers").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true)
array('type' => 'checkbox', 'name' => 'clone_receivers', 'label' => $langs->trans("CloneReceivers"), 'value' => 0)
);
// Paiement incomplet. On demande si motif = escompte ou autre
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneEMailing'),$langs->trans('ConfirmCloneEMailing',$object->ref),'confirm_clone',$formquestion,'yes',2,240);

View File

@ -43,6 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("banks");
$langs->load("categories");
$langs->load("bills");
$langs->load("companies");
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
$ref = GETPOST('ref','alpha');
@ -464,10 +465,11 @@ if ($id > 0 || ! empty($ref))
if ($mode_search && ! empty($conf->tax->enabled))
{
// VAT
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='payment_vat'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='payment_vat'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."tva as t ON bu2.url_id = t.rowid";
// Salary payment
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment_salary'";
// Salary payment
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment_salary'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as sal ON bu3.url_id = sal.rowid";
}
if ($mode_search && ! empty($conf->adherent->enabled))
@ -586,7 +588,7 @@ if ($id > 0 || ! empty($ref))
$paymentvatstatic->ref=$links[$key]['url_id'];
print ' '.$paymentvatstatic->getNomUrl(2);
}
elseif ($links[$key]['type']=='payment_salary')
elseif ($links[$key]['type']=='payment_salary')
{
$paymentsalstatic->id=$links[$key]['url_id'];
$paymentsalstatic->ref=$links[$key]['url_id'];
@ -627,7 +629,7 @@ if ($id > 0 || ! empty($ref))
{
}
elseif ($links[$key]['type']=='user')
elseif ($links[$key]['type']=='user')
{
}
@ -669,7 +671,7 @@ if ($id > 0 || ! empty($ref))
$societestatic->nom=$links[$key]['label'];
print $societestatic->getNomUrl(1,'',16);
}
else if ($links[$key]['type']=='user')
else if ($links[$key]['type']=='user')
{
$userstatic->id=$links[$key]['url_id'];
$userstatic->lastname=$links[$key]['label'];

View File

@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
$langs->load("banks");
$langs->load("categories");
$langs->load("companies");
// Security check
if ($user->societe_id) $socid=$user->societe_id;
@ -251,7 +252,7 @@ if ($resql)
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->dv),"day")."</td>\n";
// Payment type
print "<td align=\"center\">";
print '<td class="nowrap">';
$labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle');
if ($labeltype == 'SOLD') print '&nbsp;'; //$langs->trans("InitialBankBalance");
else print $labeltype;

View File

@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("banks");
$langs->load("categories");
$langs->load("bills");
$langs->load("companies");
// Security check
if (isset($_GET["account"]) || isset($_GET["ref"]))

View File

@ -725,6 +725,40 @@ class RemiseCheque extends CommonObject
}
}
/**
* Set the number of bordereau
*
* @param User $user Object user
* @param timestamp $number number of bordereau
* @return int <0 if KO, >0 if OK
*/
function set_number($user, $number)
{
if ($user->rights->banque->cheque)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " SET number = '".$number."'" ;
$sql.= " WHERE rowid = ".$this->id;
dol_syslog("RemiseCheque::set_number sql=$sql",LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$this->date_bordereau = $date;
return 1;
}
else
{
$this->error=$this->db->error();
dol_syslog("RemiseCheque::set_number ".$this->error,LOG_ERR);
return -1;
}
}
else
{
return -2;
}
}
/**
* Renvoie nom clicable (avec eventuellement le picto)

View File

@ -112,6 +112,25 @@ if ($action == 'setrefext' && $user->rights->banque->cheque)
}
}
if ($action == 'setref' && $user->rights->banque->cheque)
{
$result = $object->fetch(GETPOST('id','int'));
if ($result > 0)
{
$number=GETPOST('number');
$result=$object->set_number($user,$number);
if ($result < 0)
{
$mesg='<div class="error">'.$object->error.'</div>';
}
}
else
{
$mesg='<div class="error">'.$object->error.'</div>';
}
}
if ($action == 'create' && $_POST["accountid"] > 0 && $user->rights->banque->cheque)
{
if (is_array($_POST['toRemise']))
@ -481,12 +500,30 @@ else
$accountstatic->label=$object->account_label;
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="2" >';
print '<tr><td width=20%>';
print $form->showrefnav($object,'ref',$linkback, 1, 'number');
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Ref');
print '</td>';
if ($action != 'editref') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editref&amp;id='.$object->id.'">'.img_edit($langs->trans('SetRef'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($action == 'editref')
{
print '<form name="setdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setref">';
print '<input type="text" name="number" value="'.$object->number.'">';
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
}
else
{
print $form->showrefnav($object,'ref',$linkback, 1, 'number');
}
print "</td>";
print "</tr>\n";
print '</td>';
print '</tr>';
print '<tr><td>';

View File

@ -125,14 +125,14 @@ class PaymentSalary extends CommonObject
if (! $notrigger)
{
// Appel des triggers
// Start triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PAYMENT_SALARY_MODIFY',$this,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers
// End triggers
}
return 1;
@ -239,14 +239,14 @@ class PaymentSalary extends CommonObject
return -1;
}
// Appel des triggers
// Start triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PAYMENT_SALARY_DELETE',$this,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers
// End triggers
return 1;
}
@ -277,18 +277,23 @@ class PaymentSalary extends CommonObject
$this->fk_user_modif='';
}
/**
* Ajoute un paiement de salaire
*
* @param User $user Object user that insert
* @return int <0 if KO, rowid in tva table if OK
*/
/**
* Create in database
*
* @param User $user User that create
* @return int <0 if KO, >0 if OK
*/
function create($user)
{
global $conf,$langs;
// Clean parameters
$this->amount=price2num(trim($this->amount));
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
// Check parameters
if (! $this->label)
@ -314,20 +319,20 @@ class PaymentSalary extends CommonObject
if (! empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0))
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
return -6;
return -7;
}
$this->db->begin();
// Insertion dans table des paiement salaires
// Insert into llx_payment_salary
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_user";
$sql.= ", datep";
$sql.= ", datev";
$sql.= ", amount";
$sql.= ", fk_typepayment";
$sql.= ", num_payment";
$sql.=", note";
$sql.=", label";
if ($this->note) $sql.= ", note";
$sql.= ", label";
$sql.= ", datesp";
$sql.= ", dateep";
$sql.= ", fk_user_creat";
@ -338,10 +343,10 @@ class PaymentSalary extends CommonObject
$sql.= "'".$this->fk_user."'";
$sql.= ", '".$this->db->idate($this->datep)."'";
$sql.= ", '".$this->db->idate($this->datev)."'";
$sql.= ", ".$this->amount;
$sql.= ", ".$this->type_payment;
$sql.= ", ".$this->num_payment;
$sql.= ", '".$this->db->escape($this->note)."'";
$sql.= ", '".$this->amount."'";
$sql.= ", '".$this->type_payment."'";
$sql.= ", '".$this->num_payment."'";
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
$sql.= ", '".$this->db->escape($this->label)."'";
$sql.= ", '".$this->db->idate($this->datesp)."'";
$sql.= ", '".$this->db->idate($this->dateep)."'";
@ -354,23 +359,23 @@ class PaymentSalary extends CommonObject
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); // TODO devrait s'appeler payment_salary
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); // TODO should be called payment_salary
// Appel des triggers
// Start triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PAYMENT_SALARY_CREATE',$this,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers
// End triggers
if ($this->id > 0)
{
$ok=1;
if (! empty($conf->banque->enabled) && ! empty($this->amount))
{
// Insertion dans llx_bank
// Insert into llx_bank
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$acc = new Account($this->db);
@ -389,8 +394,8 @@ class PaymentSalary extends CommonObject
$user
);
// Mise a jour fk_bank dans llx_paiement.
// On connait ainsi le paiement qui a genere l'ecriture bancaire
// Update fk_bank into llx_paiement.
// So we know the payment which has generate the banking ecriture
if ($bank_line_id > 0)
{
$this->update_fk_bank($bank_line_id);
@ -464,9 +469,9 @@ class PaymentSalary extends CommonObject
}
/**
* Mise a jour du lien entre le paiement salaire et la ligne générée dans llx_bank
* Update link between payment salary and line generate into llx_bank
*
* @param int $id_bank Id compte bancaire
* @param int $id_bank Id bank account
* @return int <0 if KO, >0 if OK
*/
function update_fk_bank($id_bank)
@ -487,11 +492,11 @@ class PaymentSalary extends CommonObject
/**
* Renvoie nom clicable (avec eventuellement le picto)
* Send name clicable (with possibly the picto)
*
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param string $option Sur quoi pointe le lien
* @return string Chaine avec URL
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option link option
* @return string Chaine with URL
*/
function getNomUrl($withpicto=0,$option='')
{

View File

@ -75,8 +75,9 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$sal->label=GETPOST("label");
$sal->datesp=$datesp;
$sal->dateep=$dateep;
$sal->note=GETPOST("note");
$sal->type_payment=GETPOST("paymenttype");
$sal->num_payment=GETPOST('num_payment');
$sal->num_payment=GETPOST("num_payment");
if (empty($sal->fk_user) || $sal->fk_user < 0)
{
@ -243,20 +244,19 @@ if ($action == 'create')
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
print '</td></tr>';
// Type payment
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(GETPOST("paymenttype"), "paymenttype");
print "</td>\n";
print "</tr>";
// Number
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
}
// TYpe payment
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(GETPOST("paymenttype"), "paymenttype");
print "</td>\n";
print "</tr>";
// Number
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
// Other attributes
$parameters=array('colspan' => ' colspan="1"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook

View File

@ -33,7 +33,33 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$limit = $conf->liste_limit;
if (! $sortfield) $sortfield="s.datev";
if (! $sortorder) $sortorder="DESC";
$filtre=$_GET["filtre"];
if (empty($_REQUEST['typeid']))
{
$newfiltre=str_replace('filtre=','',$filtre);
$filterarray=explode('-',$newfiltre);
foreach($filterarray as $val)
{
$part=explode(':',$val);
if ($part[0] == 's.fk_typepayment') $typeid=$part[1];
}
}
else
{
$typeid=$_REQUEST['typeid'];
}
/*
* View
@ -41,20 +67,29 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
llxHeader();
$form = new Form($db);
$salstatic = new PaymentSalary($db);
$userstatic = new User($db);
print_fiche_titre($langs->trans("SalariesPayments"));
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm, s.num_payment,";
$sql.= " pst.code as payment_code";
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm, s.fk_typepayment as type,";
$sql.= " s.num_payment, pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id,";
$sql.= " ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = s.fk_user";
$sql.= " AND s.entity = ".$conf->entity;
$sql.= " ORDER BY dm DESC";
if (GETPOST("search_label")) $sql.=" AND s.label LIKE '%".$db->escape(GETPOST("search_label"))."%'";
if (GETPOST("search_amount")) $sql.=" AND s.amount = ".price2num(GETPOST("search_amount"));
if ($filtre) {
$filtre=str_replace(":","=",$filtre);
$sql .= " AND ".$filtre;
}
if ($typeid) {
$sql .= " AND s.fk_typepayment=".$typeid;
}
$sql.= " GROUP BY s.rowid, s.fk_typepayment, s.amount, s.datev, s.label";
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1,$offset);
$result = $db->query($sql);
if ($result)
@ -62,18 +97,44 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
$total = 0 ;
$var=true;
$param='';
if ($typeid) $param.='&amp;typeid='.$typeid;
print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines);
dol_htmloutput_mesg($mesg);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td class="nowrap" align="left">'.$langs->trans("Ref").'</td>';
print "<td>".$langs->trans("Person")."</td>";
print "<td>".$langs->trans("Label")."</td>";
print '<td class="nowrap" align="left">'.$langs->trans("DatePayment").'</td>';
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$paramlist,"",$sortfield,$sortorder);
print "<td align=\"right\">".$langs->trans("PayedByThisPayment")."</td>";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("");
print "</tr>\n";
$var=1;
while ($i < $num)
print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="'.GETPOST("search_label").'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
// Type
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
print '</td>';
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.GETPOST("search_amount").'"></td>';
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print "</tr>\n";
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
$var=!$var;
@ -92,6 +153,7 @@ if ($result)
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
// Amount
print "<td align=\"right\">".price($obj->amount,0,$outputlangs,1,-1,-1,$conf->currency)."</td>";
print "<td>&nbsp;</td>";
print "</tr>\n";
$total = $total + $obj->amount;
@ -99,9 +161,13 @@ if ($result)
$i++;
}
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total" align="right">'.price($total,0,$outputlangs,1,-1,-1,$conf->currency)."</td></tr>";
print '<td class="liste_total" align="right">'.price($total,0,$outputlangs,1,-1,-1,$conf->currency)."</td>";
print "<td>&nbsp;</td></tr>";
print "</table>";
print '</form>';
$db->free($result);
}
else

View File

@ -147,13 +147,13 @@ if ($resql)
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),"index.php","id","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),"index.php","cs.libelle","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),"index.php","type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PeriodEndDate"),"index.php","periode","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),"index.php","cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDue"),"index.php","cs.date_ech","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),"index.php","cs.paye","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"periode","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cs.paye","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
print '<tr class="liste_titre">';

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -41,6 +42,8 @@ class Tva extends CommonObject
var $datep;
var $datev;
var $amount;
var $type_payment;
var $num_payment;
var $label;
var $note;
var $fk_bank;
@ -118,12 +121,12 @@ class Tva extends CommonObject
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva");
// Appel des triggers
// Start triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('TVA_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
// End triggers
return $this->id;
}
@ -186,12 +189,12 @@ class Tva extends CommonObject
if (! $notrigger)
{
// Appel des triggers
// Start triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('TVA_MODIFY',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
// End triggers
}
return 1;
@ -215,6 +218,8 @@ class Tva extends CommonObject
$sql.= " t.datep,";
$sql.= " t.datev,";
$sql.= " t.amount,";
$sql.= " t.fk_typepayment,";
$sql.= " t.num_payment,";
$sql.= " t.label,";
$sql.= " t.note,";
$sql.= " t.fk_bank,";
@ -242,6 +247,8 @@ class Tva extends CommonObject
$this->datep = $this->db->jdate($obj->datep);
$this->datev = $this->db->jdate($obj->datev);
$this->amount = $obj->amount;
$this->type_payment = $obj->fk_typepayment;
$this->num_payment = $obj->num_payment;
$this->label = $obj->label;
$this->note = $obj->note;
$this->fk_bank = $obj->fk_bank;
@ -288,12 +295,12 @@ class Tva extends CommonObject
return -1;
}
// Appel des triggers
// Start triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('TVA_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
// End triggers
return 1;
}
@ -323,7 +330,7 @@ class Tva extends CommonObject
/**
* Hum la fonction s'appelle 'Solde' elle doit a mon avis calcluer le solde de TVA, non ?
* Balance of VAT
*
* @param int $year Year
* @return double Amount
@ -342,7 +349,7 @@ class Tva extends CommonObject
}
/**
* Total de la TVA des factures emises par la societe.
* Total of the VAT from invoices emitted by the society.
*
* @param int $year Year
* @return double Amount
@ -424,7 +431,7 @@ class Tva extends CommonObject
/**
* Total de la TVA reglee aupres de qui de droit
* Total of the VAT payed
*
* @param int $year Year
* @return double Amount
@ -466,7 +473,7 @@ class Tva extends CommonObject
/**
* Ajoute un paiement de TVA
* Create in database
*
* @param User $user Object user that insert
* @return int <0 if KO, rowid in tva table if OK
@ -479,7 +486,12 @@ class Tva extends CommonObject
// Clean parameters
$this->amount=price2num(trim($this->amount));
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
// Check parameters
if (! $this->label)
{
@ -496,51 +508,63 @@ class Tva extends CommonObject
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Account"));
return -5;
}
if (! empty($conf->banque->enabled) && (empty($this->paymenttype) || $this->paymenttype <= 0))
if (! empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0))
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
return -5;
}
// Insertion dans table des paiement tva
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva (datep, datev, amount";
if ($this->note) $sql.=", note";
if ($this->label) $sql.=", label";
$sql.= ", fk_user_creat, fk_bank, entity";
// Insert into llx_tva
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva (datep";
$sql.= ", datev";
$sql.= ", amount";
$sql.= ", fk_typepayment";
$sql.= ", num_payment";
if ($this->note) $sql.= ", note";
if ($this->label) $sql.= ", label";
$sql.= ", fk_user_creat";
$sql.= ", fk_bank";
$sql.= ", entity";
$sql.= ") ";
$sql.= " VALUES ('".$this->db->idate($this->datep)."',";
$sql.= "'".$this->db->idate($this->datev)."'," . $this->amount;
if ($this->note) $sql.=", '".$this->db->escape($this->note)."'";
$sql.= " VALUES (";
$sql.= "'".$this->db->idate($this->datep)."'";
$sql.= ", '".$this->db->idate($this->datev)."'";
$sql.= ", ".$this->amount;
$sql.= ", '".$this->type_payment."'";
$sql.= ", '".$this->num_payment."'";
if ($this->note) $sql.=", '".$this->db->escape($this->note)."'";
if ($this->label) $sql.=", '".$this->db->escape($this->label)."'";
$sql.=", '".$user->id."', NULL, ".$conf->entity;
$sql.= ", '".$user->id."'";
$sql.= ", NULL";
$sql.= ", ".$conf->entity;
$sql.= ")";
dol_syslog(get_class($this)."::addPayment sql=".$sql);
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva"); // TODO devrait s'appeler paiementtva
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva"); // TODO should be called paiementtva
// Appel des triggers
// Start triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('TVA_ADDPAYMENT',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
// End triggers
if ($this->id > 0)
{
$ok=1;
if (! empty($conf->banque->enabled) && ! empty($this->amount))
{
// Insertion dans llx_bank
// Insert into llx_bank
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$acc = new Account($this->db);
$result=$acc->fetch($this->accountid);
if ($result <= 0) dol_print_error($this->db);
$bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs($this->amount), '', '', $user);
$bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs($this->amount), '', '', $user);
// Update fk_bank into llx_tva. So we know vat line used to generate bank transaction
if ($bank_line_id > 0)
@ -589,9 +613,9 @@ class Tva extends CommonObject
}
/**
* Mise a jour du lien entre le paiement tva et la ligne g<EFBFBD>n<EFBFBD>r<EFBFBD>e dans llx_bank
* Update link between payment tva and line generate into llx_bank
*
* @param int $id_bank Id compte bancaire
* @param int $id_bank Id bank account
* @return int <0 if KO, >0 if OK
*/
function update_fk_bank($id_bank)
@ -610,13 +634,12 @@ class Tva extends CommonObject
}
}
/**
* Renvoie nom clicable (avec eventuellement le picto)
* Send name clicable (with possibly the picto)
*
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param string $option Sur quoi pointe le lien
* @return string Chaine avec URL
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option link option
* @return string Chaine with URL
*/
function getNomUrl($withpicto=0,$option='')
{

View File

@ -58,31 +58,51 @@ if ($_POST["cancel"] == $langs->trans("Cancel"))
if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
$db->begin();
$error=0;
$datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
$datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
$datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);
$tva->accountid=$_POST["accountid"];
$tva->paymenttype=$_POST["paiementtype"];
$tva->accountid=GETPOST("accountid");
$tva->type_payment=GETPOST("type_payment");
$tva->num_payment=GETPOST("num_payment");
$tva->datev=$datev;
$tva->datep=$datep;
$tva->amount=$_POST["amount"];
$tva->label=$_POST["label"];
$tva->amount=GETPOST("amount");
$tva->label=GETPOST("label");
$tva->note=GETPOST("note");
if (empty($tva->type_payment) || $tva->type_payment < 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors');
$error++;
}
if (empty($tva->amount))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")),'errors');
$error++;
}
$ret=$tva->addPayment($user);
if ($ret > 0)
{
$db->commit();
header("Location: reglement.php");
exit;
}
else
{
$db->rollback();
setEventMessage($tva->error, 'errors');
$action="create";
}
if (! $error)
{
$db->begin();
$ret=$tva->addPayment($user);
if ($ret > 0)
{
$db->commit();
header("Location: reglement.php");
exit;
}
else
{
$db->rollback();
setEventMessage($tva->error, 'errors');
$action="create";
}
}
$action='create';
}
if ($action == 'delete')
@ -180,10 +200,16 @@ if ($action == 'create')
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements($_POST["paiementtype"], "paiementtype");
print "</td>\n";
print "</tr>";
// Type payment
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(GETPOST("type_payment"), "type_payment");
print "</td>\n";
print "</tr>";
// Number
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
}
// Other attributes

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -27,14 +28,40 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
$langs->load("compta");
$langs->load("compta");
$langs->load("bills");
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$limit = $conf->liste_limit;
if (! $sortfield) $sortfield="t.datev";
if (! $sortorder) $sortorder="DESC";
$filtre=$_GET["filtre"];
if (empty($_REQUEST['typeid']))
{
$newfiltre=str_replace('filtre=','',$filtre);
$filterarray=explode('-',$newfiltre);
foreach($filterarray as $val)
{
$part=explode(':',$val);
if ($part[0] == 't.fk_typepayment') $typeid=$part[1];
}
}
else
{
$typeid=$_REQUEST['typeid'];
}
/*
* View
@ -42,14 +69,25 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
llxHeader();
$form = new Form($db);
$tva_static = new Tva($db);
print_fiche_titre($langs->trans("VATPayments"));
$sql = "SELECT rowid, amount, label, f.datev as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as f ";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " ORDER BY dm DESC";
$sql = "SELECT t.rowid, t.amount, t.label, t.datev as dm, t.fk_typepayment as type, t.num_payment, pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id";
$sql.= " WHERE t.entity = ".$conf->entity;
if (GETPOST("search_label")) $sql.=" AND t.label LIKE '%".$db->escape(GETPOST("search_label"))."%'";
if (GETPOST("search_amount")) $sql.=" AND t.amount = ".price2num(GETPOST("search_amount"));
if ($filtre) {
$filtre=str_replace(":","=",$filtre);
$sql .= " AND ".$filtre;
}
if ($typeid) {
$sql .= " AND t.fk_typepayment=".$typeid;
}
$sql.= " GROUP BY t.rowid, t.fk_typepayment, t.amount, t.datev, t.label";
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1,$offset);
$result = $db->query($sql);
if ($result)
@ -57,19 +95,55 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
$total = 0 ;
$var=true;
$param='';
if ($typeid) $param.='&amp;typeid='.$typeid;
print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines);
dol_htmloutput_mesg($mesg);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td class="nowrap" align="left">'.$langs->trans("Ref").'</td>';
print "<td>".$langs->trans("Label")."</td>";
print '<td class="nowrap" align="left">'.$langs->trans("DatePayment").'</td>';
print "<td align=\"right\">".$langs->trans("PayedByThisPayment")."</td>";
print "</tr>\n";
$var=1;
while ($i < $num)
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dm","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("");
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="'.GETPOST("search_label").'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
// Type
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
print '</td>';
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.GETPOST("search_amount").'"></td>';
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print "</tr>\n";
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
$var=!$var;
if ($obj->payment_code <> '')
{
$type = '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
}
else
{
$type = '<td>&nbsp;</td>';
}
print "<tr ".$bc[$var].">";
$tva_static->id=$obj->rowid;
@ -77,17 +151,24 @@ if ($result)
print "<td>".$tva_static->getNomUrl(1)."</td>\n";
print "<td>".dol_trunc($obj->label,40)."</td>\n";
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
// Type
print $type;
// Amount
$total = $total + $obj->amount;
print "<td align=\"right\">".price($obj->amount)."</td>";
print "<td align=\"right\">".price($obj->amount)."</td>";
print "<td>&nbsp;</td>";
print "</tr>\n";
$i++;
}
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total").'</td>';
print "<td align=\"right\"><b>".price($total)."</b></td></tr>";
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
print "<td align=\"right\"><b>".price($total)."</b></td>";
print "<td>&nbsp;</td></tr>";
print "</table>";
print '</form>';
$db->free($result);
}
else

View File

@ -711,7 +711,7 @@ else
if (! empty($conf->mailing->enabled))
{
$langs->load("mails");
print '<td class="nowrap">'.$langs->trans("NbOfEMailingsReceived").'</td>';
print '<td class="nowrap">'.$langs->trans("NbOfEMailingsSend").'</td>';
print '<td>'.$object->getNbOfEMailings().'</td>';
}
else
@ -936,7 +936,7 @@ else
if (! empty($conf->mailing->enabled))
{
$langs->load("mails");
print '<td class="nowrap">'.$langs->trans("NbOfEMailingsReceived").'</td>';
print '<td class="nowrap">'.$langs->trans("NbOfEMailingsSend").'</td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/mailing/liste.php?filteremail='.urlencode($object->email).'">'.$object->getNbOfEMailings().'</a></td>';
}
else

View File

@ -195,12 +195,86 @@ abstract class CommonDocGenerator
{
$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
}
$array_thirdparty=array_merge($array_thirdparty,array('company_options_'.$key => $object->array_options['options_'.$key]));
}
}
return $array_thirdparty;
}
$array_thirdparty = array_merge ( $array_thirdparty, array (
'company_options_' . $key => $object->array_options ['options_' . $key]
) );
}
}
return $array_thirdparty;
}
/**
* Define array with couple subtitution key => subtitution value
*
* @param Object $object contact
* @param Translate $outputlangs object for output
* @param array_key $array_key Name of the key for return array
* @return array of substitution key->code
*/
function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') {
global $conf;
if(empty($object->country) && ! empty($object->country_code))
{
$object->country = $outputlangs->transnoentitiesnoconv("Country" . $object->country_code);
}
if(empty($object->state) && ! empty($object->state_code))
{
$object->state = getState($object->state_code, 0);
}
$array_contact = array (
$array_key . '_fullname' => $object->getFullName($outputlangs, 1),
$array_key . '_lastname' => $object->lastname,
$array_key . '_firstname' => $object->firstname,
$array_key . '_address' => $object->address,
$array_key . '_zip' => $object->zip,
$array_key . '_town' => $object->town,
$array_key . '_state_id' => $object->state_id,
$array_key . '_state_code' => $object->state_code,
$array_key . '_state' => $object->state,
$array_key . '_country_id' => $object->country_id,
$array_key . '_country_code' => $object->country_code,
$array_key . '_country' => $object->country,
$array_key . '_poste' => $object->poste,
$array_key . '_socid' => $object->socid,
$array_key . '_statut' => $object->statut,
$array_key . '_code' => $object->code,
$array_key . '_email' => $object->email,
$array_key . '_jabberid' => $object->jabberid,
$array_key . '_phone_pro' => $object->phone_pro,
$array_key . '_phone_perso' => $object->phone_perso,
$array_key . '_phone_mobile' => $object->phone_mobile,
$array_key . '_fax' => $object->fax,
$array_key . '_birthday' => $object->birthday,
$array_key . '_default_lang' => $object->default_lang,
$array_key . '_note_public' => $object->note_public,
$array_key . '_note_private' => $object->note_private
);
// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options)) {
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label('contact', true);
$object->fetch_optionals($object->id, $extralabels);
foreach($extrafields->attribute_label as $key => $label)
{
if ($extrafields->attribute_type[$key] == 'price')
{
$object->array_options['options_' . $key] = price($object->array_options ['options_' . $key], 0, $outputlangs, 0, 0, - 1, $conf->currency);
}
elseif($extrafields->attribute_type[$key] == 'select')
{
$object->array_options['options_' . $key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_' . $key]];
}
$array_contact = array_merge($array_contact, array('contact_options_' . $key => $object->array_options['options_'. $key]));
}
}
return $array_contact;
}
/**
* Define array with couple subtitution key => subtitution value

View File

@ -168,7 +168,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql.= "'".$this->db->escape($targetarray['other'])."',";
$sql.= "'".$this->db->escape($targetarray['source_url'])."',";
$sql.= (empty($targetarray['source_id']) ? 'null' : "'".$this->db->escape($targetarray['source_id'])."'").",";
$sql .= "'".$this->db->escape(dol_hash($targetarray['email'].';'.$targetarray['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
$sql .= "'".$this->db->escape(dol_hash($targetarray['email'].';'.$targetarray['lastname'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
$sql .= "'".$this->db->escape($targetarray['source_type'])."')";
$result=$this->db->query($sql);
if ($result)

View File

@ -44,7 +44,7 @@ class modDeplacement extends DolibarrModules
$this->db = $db;
$this->numero = 75 ;
$this->family = "financial";
$this->family = "hr";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Gestion des notes de frais et deplacements"; // Si traduction Module75Desc non trouvee

View File

@ -183,12 +183,46 @@ class modFacture extends DolibarrModules
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='facture';
}
}
// End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as c on s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facturedet as fd';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'facturedet as fd';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
$this->export_sql_end[$r] .=' AND f.entity = '.$conf->entity;
@ -203,11 +237,45 @@ class modFacture extends DolibarrModules
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='facture';
}
}
// End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as c on s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid';
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';

View File

@ -255,11 +255,46 @@ class modFournisseur extends DolibarrModules
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='facture_fourn';
}
}
// End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as c ON s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture_fourn as f, '.MAIN_DB_PREFIX.'facture_fourn_det as fd';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture_fourn as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_extrafields as extra ON f.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'facture_fourn_det as fd';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture_fourn';
$this->export_sql_end[$r] .=' AND f.entity = '.$conf->entity;
@ -274,11 +309,45 @@ class modFournisseur extends DolibarrModules
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='facture_fourn';
}
}
// End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as c ON s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture_fourn as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_extrafields as extra ON f.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn as p ON pf.fk_paiementfourn = p.rowid';
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';

View File

@ -293,9 +293,69 @@ class doc_generic_odt extends ModeleThirdPartyDoc
// setVars failed, probably because key not found
}
}
// Make substitutions into odt of thirdparty + external modules
$tmparray=$this->get_substitutionarray_thirdparty($object,$outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object);
// Replace tags of lines for contacts
$contact_arrray=array();
$sql = "SELECT p.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
$sql .= " WHERE p.fk_soc = ".$object->id;
dol_syslog('doc_generic_odt :: sql='.$sql,LOG_DEBUG);
$result = $this->db->query($sql);
$num = $this->db->num_rows($result);
$var=true;
if ($num)
{
$i=0;
$contactstatic = new Contact($this->db);
while($i < $num)
{
$obj = $this->db->fetch_object($result);
$contact_arrray[$i] = $obj->rowid;
$i++;
}
}
if((is_array($contact_arrray) && count($contact_arrray) > 0))
{
try
{
$listlines = $odfHandler->setSegment('companycontacts');
foreach($contact_arrray as $array_key => $contact_id)
{
$res_contact = $contactstatic->fetch($contact_id);
//$contact['fullname']=$objectdetail->getFullName($outputlangs,1);
$tmparray=$this->get_substitutionarray_contact($contactstatic,$outputlangs,'contact');
foreach($tmparray as $key => $val)
{
try
{
$listlines->setVars($key, $val, true, 'UTF-8');
}
catch(OdfException $e)
{
}
catch(SegmentException $e)
{
}
}
$listlines->merge();
}
$odfHandler->mergeSegment($listlines);
}
catch(OdfException $e)
{
$this->error=$e->getMessage();
dol_syslog($this->error, LOG_WARNING);
//return -1;
}
}
// Call the ODTSubstitution hook
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
@ -330,8 +390,13 @@ class doc_generic_odt extends ModeleThirdPartyDoc
{
}
}
// Make substitutions into odt of thirdparty + external modules
$tmparray=$this->get_substitutionarray_thirdparty($object,$outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the beforeODTSave hook
// Call the beforeODTSave hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks

View File

@ -119,6 +119,7 @@ TargetsReset=Clear list
ToClearAllRecipientsClickHere=Click here to clear the recipient list for this emailing
ToAddRecipientsChooseHere=Add recipients by choosing from the lists
NbOfEMailingsReceived=Mass emailings received
NbOfEMailingsSend=Mass emailings sent
IdRecord=ID record
DeliveryReceipt=Delivery Receipt
YouCanUseCommaSeparatorForSeveralRecipients=You can use the <b>comma</b> separator to specify several recipients.

View File

@ -49,7 +49,7 @@ ErrorReservedTypeSystemSystemAuto=El uso del tipo 'system' y 'systemauto' está
ErrorCodeCantContainZero=El código no puede contener el valor 0
DisableJavascript=Desactivar las funciones Javascript y AJAX
ConfirmAjax=Utilizar los diálogos de confirmación Ajax
UseSearchToSelectCompany=Utilizar un formulário de búsqueda para seleccionar terceros (en vez de una lista desplegable).<br><br>Tenga en cuenta que si tiene un gran número de contactos (>100 000), puede mejorar el rendimiento mediante la constante COMPANY_DONOTSEARCH_ANYWHERE a 1 en Configuración->Varios. La búsqueda se limitará entonces al inicio de la cadena.
UseSearchToSelectCompany=Utilizar un formulario de búsqueda para seleccionar terceros (en vez de una lista desplegable).<br><br>Tenga en cuenta que si tiene un gran número de contactos (>100 000), puede mejorar el rendimiento mediante la constante COMPANY_DONOTSEARCH_ANYWHERE a 1 en Configuración->Varios. La búsqueda se limitará entonces al inicio de la cadena.
ActivityStateToSelectCompany= Agregar un filtro en la búsqueda para mostrar/ocultar los terceros en activo o que hayan dejado de ejercer
UseSearchToSelectContact=Utilizar un formulario de búsqueda para seleccionar contactos (en vez de una lista desplegable).<br><br>Tenga en cuenta que si tiene un gran número de contactos (>100 000), puede mejorar el rendimiento mediante la constante CONTACT_DONOTSEARCH_ANYWHERE a 1 en Configuración->Varios. La búsqueda se limitará entonces al inicio de la cadena.
SearchFilter=Opciones filtros de búsqueda
@ -360,7 +360,7 @@ ExtrafieldPhone = Teléfono
ExtrafieldPrice = Precio
ExtrafieldMail = Correo
ExtrafieldSelect = Lista de selección
ExtrafieldSelectList = Llista de selección de table
ExtrafieldSelectList = Lista desde una tabla
ExtrafieldSeparator=Separador
ExtrafieldCheckBox=Casilla de verificación
ExtrafieldRadio=Botón de selección excluyente
@ -467,7 +467,7 @@ Module410Desc=Interfaz con el calendario Webcalendar
Module500Name=Gastos especiales (impuestos, gastos sociales, dividendos)
Module500Desc=Gestión de los gastos especiales como impuestos, gastos sociales, dividendos y salarios
Module510Name=Salarios
Module510Desc=Manejo de salarios de empleados y sus pagos
Module510Desc=Gestión de salarios de empleados y sus pagos
Module600Name=Notificaciones
Module600Desc=Envío de notificaciones (por correo electrónico) sobre los eventos de trabajo Dolibarr
Module700Name=Donaciones
@ -1438,7 +1438,7 @@ AccountancyCodeBuy=Código contable compras
AgendaSetup=Módulo configuración de acciones y agenda
PasswordTogetVCalExport=Clave de autorización vcal export link
PastDelayVCalExport=No exportar los eventos de más de
AGENDA_USE_EVENT_TYPE=Use events types (managed into menu Setup -> Dictionnary -> Type of agenda events)
AGENDA_USE_EVENT_TYPE=Usar tipos de eventos (configurables desde Configuración->Diccionarios->Tipos de eventos de la agenda)
##### ClickToDial #####
ClickToDialDesc=Este módulo permite agregar un icono después del número de teléfono de contactos Dolibarr. Un clic en este icono, Llama a un servidor con una URL que se indica a continuación. Esto puede ser usado para llamar al sistema call center de Dolibarr que puede llamar al número de teléfono en un sistema SIP, por ejemplo.
##### Point Of Sales (CashDesk) #####

View File

@ -18,6 +18,7 @@ NewCompany=Nueva empresa (cliente potencial, cliente, proveedor)
NewThirdParty=Nuevo tercero (cliente potencial, cliente, proveedor)
NewSocGroup=Nueva agrupación de empresas
NewPrivateIndividual=Nuevo particular (cliente potencial, cliente, proveedor)
CreateDolibarrThirdPartySupplier=Crear un tercero (proveedor)
ProspectionArea=Área de prospección
SocGroup=Agrupamiento de empresas
IdThirdParty=ID tercero
@ -313,6 +314,7 @@ EditDeliveryAddress=Modificar dirección de envío
ThisUserIsNot=Este usuario no es ni un cliente potencial, ni un cliente, ni un proveedor
VATIntraCheck=Verificar
VATIntraCheckDesc=El link <b>%s</b> permite consultar al servicio europeo de control de números de IVA intracomunitario. Se requiere acceso a internet para que el servicio funcione
VATIntraCheckURL=http://ec.europa.eu/taxation_customs/vies/vieshome.do
VATIntraCheckableOnEUSite=Verificar en la web de la Comisión Europea
VATIntraManualCheck=Puede también realizar una verificación manual en la web europea <a href="%s" target="_blank">%s</a>
ErrorVATCheckMS_UNAVAILABLE=Comprobación imposible. El servicio de comprobación no es prestado por el país país miembro (%s).

View File

@ -48,7 +48,7 @@ LT2SupplierES=IRPF compras
VATCollected=IVA recuperado
ToPay=A pagar
ToGet=A devolver
SpecialExpensesArea=Área de pagos especiales
SpecialExpensesArea=Area para todos los pagos especiales
TaxAndDividendsArea=Área impuestos, cargas sociales y dividendos
SocialContribution=Carga social
SocialContributions=Cargas sociales

View File

@ -134,7 +134,7 @@ ErrorOpenIDSetupNotComplete=Ha configurado Dolibarr para aceptar la autentificac
ErrorWarehouseMustDiffers=El almacén de origen y destino deben de ser diferentes
ErrorBadFormat=¡El formato es erróneo!
ErrorPaymentDateLowerThanInvoiceDate=La fecha de pago (%s) no puede ser anterior a la fecha (%s) de la factura %s.
ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Error, this member is not yet linked to any thirdparty. Link member to an existing third party or create a new thirdparty before creating subscription with invoice.
ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Error, este miembro aún no está enlazado un tercero. Enlace el miembro a un tercero existente o cree un tercero nuevo antes de crear la suscripción con la factura.
# Warnings
WarningMandatorySetupNotComplete=Los parámetros obligatorios de configuración no están todavía definidos
WarningSafeModeOnCheckExecDir=Atención, está activada la opción PHP <b>safe_mode</b>, el comando deberá estar dentro de un directorio declarado dentro del parámetro php <b>safe_mode_exec_dir</b>.

View File

@ -58,7 +58,7 @@ Language_tr_TR=Turco
Language_sl_SI=Esloveno
Language_sv_SV=Sueco
Language_sv_SE=Sueco
Language_sq_AL=Albanian
Language_sq_AL=Albanés
Language_sk_SK=Eslovaco
Language_th_TH=Tailandés
Language_uk_UA=Ucranio

View File

@ -94,7 +94,7 @@ InformationLastAccessInError=Información sobre el último acceso a la base de d
DolibarrHasDetectedError=Dolibarr ha detectado un error técnico
InformationToHelpDiagnose=He aquí la información que podrá ayudar al diagnóstico
MoreInformation=Más información
TechnicalInformation=Technical information
TechnicalInformation=Información técnica
NotePublic=Nota (pública)
NotePrivate=Nota (privada)
PrecisionUnitIsLimitedToXDecimals=Dolibarr está configurado para limitar la precisión de los precios unitarios a <b>%s</b> decimales.

View File

@ -86,7 +86,6 @@ SubscriptionNotReceivedShort=No recibida
ListOfSubscriptions=Listado de afiliaciones
SendCardByMail=Enviar ficha por e-mail
AddMember=Añadir miembro
MemberType=Tipo de miembro
NoTypeDefinedGoToSetup=Ningún tipo de miembro definido. Vaya a Configuración -> Tipos de miembros
NewMemberType=Nuevo tipo de miembro
WelcomeEMail=E-mail
@ -171,6 +170,8 @@ LastSubscriptionAmount=Importe de la última cotización
MembersStatisticsByCountries=Estadísticas de miembros por país
MembersStatisticsByState=Estadísticas de miembros por departamento/provincia/región
MembersStatisticsByTown=Estadísticas de miembros por población
MembersStatisticsByRegion=Estadísticas de miembros por región
MemberByRegion=Miembros por región
NbOfMembers=Número de miembros
NoValidatedMemberYet=Ningún miembro validado encontrado
MembersByCountryDesc=Esta pantalla presenta una estadística del número de miembros por países. Sin embargo, el gráfico utiliza el servicio en línea de gráficos de Google y sólo es operativo cuando se encuentra disponible una conexión a Internet.

View File

@ -17,14 +17,14 @@ Notify_ORDER_SUPPLIER_APPROVE=Aprobación pedido a proveedor
Notify_ORDER_SUPPLIER_REFUSE=Rechazo pedido a proveedor
Notify_ORDER_VALIDATE=Validación pedido cliente
Notify_PROPAL_VALIDATE=Validación presupuesto cliente
Notify_PROPAL_CLOSE_SIGNED=Customer propal closed signed
Notify_PROPAL_CLOSE_REFUSED=Customer propal closed refused
Notify_PROPAL_CLOSE_SIGNED=Presupuesto cerrado como firmado
Notify_PROPAL_CLOSE_REFUSED=Presupuesto cerrado como rechazado
Notify_WITHDRAW_TRANSMIT=Transmisión domiciliación
Notify_WITHDRAW_CREDIT=Abono domiciliación
Notify_WITHDRAW_EMIT=Emisión domiciliación
Notify_ORDER_SENTBYMAIL=Envío pedido de cliente por e-mail
Notify_COMPANY_CREATE=Creación tercero
Notify_COMPANY_SENTBYMAIL=Mails sent from third party card
Notify_COMPANY_SENTBYMAIL=Correos enviados desde la ficha del tercero
Notify_PROPAL_SENTBYMAIL=Envío presupuesto por e-mail
Notify_BILL_PAYED=Cobro factura a cliente
Notify_BILL_CANCEL=Cancelación factura a cliente
@ -34,13 +34,13 @@ Notify_ORDER_SUPPLIER_SENTBYMAIL=Envío pedido a proveedor por e-mail
Notify_BILL_SUPPLIER_VALIDATE=Validación factura de proveedor
Notify_BILL_SUPPLIER_PAYED=Pago factura de proveedor
Notify_BILL_SUPPLIER_SENTBYMAIL=Envío factura de proveedor por e-mail
Notify_BILL_SUPPLIER_CANCELED=Supplier invoice cancelled
Notify_BILL_SUPPLIER_CANCELED=Factura del proveedor cancelada
Notify_CONTRACT_VALIDATE=Validación contrato
Notify_FICHEINTER_VALIDATE=Validación intervención
Notify_SHIPPING_VALIDATE=Validación envío
Notify_SHIPPING_SENTBYMAIL=Envío expedición por e-mail
Notify_MEMBER_VALIDATE=Validación miembro
Notify_MEMBER_MODIFY=Member modified
Notify_MEMBER_MODIFY=Miembro modificado
Notify_MEMBER_SUBSCRIPTION=Afiliación miembro
Notify_MEMBER_RESILIATE=Baja miembro
Notify_MEMBER_DELETE=Eliminación miembro

View File

@ -20,6 +20,6 @@ YouAreCurrentlyInSandboxMode=Actualmente se encuentra en modo "sandbox"
NewPaypalPaymentReceived=Nuevo pago Paypal recibido
NewPaypalPaymentFailed=Nuevo intento de pago Paypal sin éxito
PAYPAL_PAYONLINE_SENDEMAIL=E-Mail a avisar en caso de pago (con éxito o no)
ReturnURLAfterPayment=Return URL after payment
ReturnURLAfterPayment=URL de retorno después del pago
ValidationOfPaypalPaymentFailed=La validación del pago Paypal ha fallado
PaypalConfirmPaymentPageWasCalledButFailed=Payment confirmation page for Paypal was called by Paypal but confirmation failed
PaypalConfirmPaymentPageWasCalledButFailed=La página de confirmación de pago para Paypal fue llamada por Paypal pero la confirmación falló

View File

@ -106,6 +106,9 @@ ProjectReportDate=Cambiar las fechas de las tareas en función de la fecha de in
ErrorShiftTaskDate=Se ha producido un error en el cambio de las fechas de las tareas
ProjectsAndTasksLines=Proyectos y tareas
ProjectCreatedInDolibarr=Proyecto %s creado
TaskCreatedInDolibarr=La tarea %s fué creada
TaskModifiedInDolibarr=La tarea %s fué modificada
TaskDeletedInDolibarr=La tarea %s fué eliminada
##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Jefe de proyecto
TypeContact_project_external_PROJECTLEADER=Jefe de proyecto

View File

@ -121,6 +121,7 @@ TargetsReset=Vider liste
ToClearAllRecipientsClickHere=Pour vider la liste des destinataires de cet emailing, cliquez sur le bouton
ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les listes ci-dessous
NbOfEMailingsReceived=Emailings de masse reçus
NbOfEMailingsSend=Emailings de masse envoyé(s)
IdRecord=ID enregistrement
DeliveryReceipt=Accusé de réception
YouCanUseCommaSeparatorForSeveralRecipients=Vous pouvez utiliser le caractère de séparation <b>virgule</b> pour spécifier plusieurs destinataires.

View File

@ -44,11 +44,12 @@ $value = GETPOST('value','alpha');
// Pricing Rules
$select_pricing_rules=array(
'PRODUCT_PRICE_UNIQ'=>$langs->trans('PriceCatalogue'),
'PRODUIT_MULTIPRICES'=>$langs->trans('MultiPricesAbility'),
'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer')
'PRODUCT_PRICE_UNIQ'=>$langs->trans('PriceCatalogue'), // Unique price
'PRODUIT_MULTIPRICES'=>$langs->trans('MultiPricesAbility'), // Several prices according to a customer level
'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer') // Different price for each customer
);
if ($conf->global->MAIN_FEATURES_LEVEL==2) {
if ($conf->global->MAIN_FEATURES_LEVEL==2)
{
$select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity');
$select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY&PRODUIT_MULTIPRICES'] = $langs->trans('MultiPricesAbility') . '+' . $langs->trans('PriceByQuantity');
}
@ -103,33 +104,37 @@ if ($action == 'nbprod')
{
$res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", $value,'chaine',0,'',$conf->entity);
}
else if ($action == 'multiprix_num')
else if ($action == 'PRODUIT_MULTIPRICES_LIMIT')
{
$res = dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", $value,'chaine',0,'',$conf->entity);
}
if ($action == 'pricingrule')
{
$princingrules = GETPOST('princingrule','alpha');
foreach ($select_pricing_rules as $rule=>$label) {
if ($rule==$princingrules) {
if ( $princingrules =='PRODUCT_PRICE_UNIQ') {
$res = dolibarr_set_const($db, 'PRODUIT_MULTIPRICES', 0,'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0,'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES', 0,'chaine',0,'',$conf->entity);
} else {
foreach ($select_pricing_rules as $rule=>$label) // Loop on each possible mode
{
if ($rule == $princingrules) // We are on selected rule, we enable it
{
if ($princingrules == 'PRODUCT_PRICE_UNIQ') // For this case, we disable entries manually
{
$res = dolibarr_set_const($db, 'PRODUIT_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES', 0, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'PRODUCT_PRICE_UNIQ', 1, 'chaine', 0, '', $conf->entity);
}
else
{
$multirule=explode('&',$princingrules);
if (is_array($multirule) && count($multirule)>0) {
foreach($multirule as $rulesselected) {
$res = dolibarr_set_const($db, $rulesselected, 1,'chaine',0,'',$conf->entity);
}
} else {
$res = dolibarr_set_const($db, $rule, 1,'chaine',0,'',$conf->entity);
foreach($multirule as $rulesselected)
{
$res = dolibarr_set_const($db, $rulesselected, 1, 'chaine', 0, '', $conf->entity);
}
}
} else {
}
else // We clear this mode
{
if (strpos($rule,'&')===false) {
$res = dolibarr_set_const($db, $rule, 0,'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db, $rule, 0, 'chaine', 0, '', $conf->entity);
}
}
@ -337,7 +342,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
$var=!$var;
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="multiprix_num">';
print '<input type="hidden" name="action" value="PRODUIT_MULTIPRICES_LIMIT">';
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("MultiPricesNumPrices").'</td>';
print '<td align="right"><input size="3" type="text" class="flat" name="value" value="'.$conf->global->PRODUIT_MULTIPRICES_LIMIT.'"></td>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@ -59,14 +59,17 @@ if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit-
$result = $object->fetch($id);
// MultiPrix
if (! empty($conf->global->PRODUIT_MULTIPRICES)) {
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
$newprice = '';
$newprice_min = '';
$newpricebase = '';
$newvat = '';
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) {
if (isset($_POST ["price_" . $i])) {
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
{
if (isset($_POST ["price_" . $i]))
{
$level = $i;
$newprice = price2num($_POST ["price_" . $i], 'MU');
$newprice_min = price2num($_POST ["price_min_" . $i], 'MU');
@ -129,8 +132,8 @@ if ($action == 'update_price_by_qty') { // Ajout / Mise à jour d'un prix par qu
// $newminprice=price2num(GETPOST("price_min"),'MU'); // TODO : Add min price management
$quantity = GETPOST('quantity');
$remise_percent = price2num(GETPOST('remise_percent'));
$remise = 0; // TODO : allow dicsount by amount when available on documents
$remise = 0; // TODO : allow discount by amount when available on documents
if (empty($quantity)) {
$error ++;
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Qty")) . '</div>';
@ -327,15 +330,24 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) {
// TVA
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->multiprices_tva_tx ["$soc->price_level"], true) . '</td></tr>';
} else {
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) {
}
else
{
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
{
// TVA
if ($i == 1) // We show only price for level 1
{
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->multiprices_tva_tx [1], true) . '</td></tr>';
}
print '<tr><td>' . $langs->trans("SellingPrice") . ' ' . $i . '</td>';
print '<tr>';
// Label of price
print '<td>' . $langs->trans("SellingPrice") . ' ' . $i;
$keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i;
if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel);
print '</td>';
if ($object->multiprices_base_type ["$i"] == 'TTC') {
print '<td>' . price($object->multiprices_ttc ["$i"]);