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

This commit is contained in:
Regis Houssin 2017-10-03 17:32:40 +02:00
commit ed5dca652d
169 changed files with 1341 additions and 954 deletions

View File

@ -325,6 +325,9 @@ script:
set +e set +e
echo echo
#cat $TRAVIS_BUILD_DIR/upgrade400500-2.log #cat $TRAVIS_BUILD_DIR/upgrade400500-2.log
#cat $TRAVIS_BUILD_DIR/upgrade500600.log
#cat $TRAVIS_BUILD_DIR/upgrade500600-2.log
#cat $TRAVIS_BUILD_DIR/upgrade500600-3.log
#cat /tmp/dolibarr_install.log #cat /tmp/dolibarr_install.log
- | - |

View File

@ -16,6 +16,8 @@ Following changes may create regressions for some external modules, but were nec
* The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__, * The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__,
__PROPALREF__, ...) __PROPALREF__, ...)
* Some REST API to access the dictionary (country, town, ...) were moved into a common API. * Some REST API to access the dictionary (country, town, ...) were moved into a common API.
* Page bank/index.php and bank/bankentries.php were renamed into bank/list.php and bank/bankentries_list.php to
follow page naming conventions (so default filter/sort order features can also work).
***** ChangeLog for 6.0.1 compared to 6.0.* ***** ***** ChangeLog for 6.0.1 compared to 6.0.* *****

View File

@ -149,7 +149,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
$condpayment = trim($fields[36]); $condpayment = trim($fields[36]);
if ($condpayment == 'A la commande') $condpayment = 'A réception de commande'; if ($condpayment == 'A la commande') $condpayment = 'A réception de commande';
if ($condpayment == 'A reception facture') $condpayment = 'Réception de facture'; if ($condpayment == 'A reception facture') $condpayment = 'Réception de facture';
$object->cond_reglement_id = dol_getIdFromCode($db, $condpayment, 'c_payment_term', 'libelle_facture', 'rowid'); $object->cond_reglement_id = dol_getIdFromCode($db, $condpayment, 'c_payment_term', 'libelle_facture', 'rowid', 1);
if (empty($object->cond_reglement_id)) if (empty($object->cond_reglement_id))
{ {
print " - Error cant find payment mode for ".$condpayment."\n"; print " - Error cant find payment mode for ".$condpayment."\n";

View File

@ -87,7 +87,7 @@ if ($object->id > 0)
dol_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user'); dol_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -1431,7 +1431,7 @@ else
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++; if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
if (! empty($conf->societe->enabled)) $rowspan++; if (! empty($conf->societe->enabled)) $rowspan++;
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -1558,16 +1558,17 @@ class Adherent extends CommonObject
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small) * @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
* @param int $maxlen length max label * @param int $maxlen length max label
* @param string $option Page for link * @param string $option Page for link
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref * @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
* @param string $morecss Add more css on link * @param string $morecss Add more css on link
* @return string Chaine avec URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/ */
function getNomUrl($withpictoimg=0,$maxlen=0,$option='card',$mode='',$morecss='') function getNomUrl($withpictoimg=0, $maxlen=0, $option='card', $mode='', $morecss='', $save_lastsearch_value=-1)
{ {
global $conf, $langs; global $conf, $langs;
@ -1591,15 +1592,24 @@ class Adherent extends CommonObject
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs); $label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
$label.='</div>'; $label.='</div>';
if ($option == 'card' || $option == 'category') if (empty($option) || $option == 'card' || $option == 'category')
{ {
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.'"'; $url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
} }
if ($option == 'subscription') if ($option == 'subscription')
{ {
$link = '<a href="'.DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id.'"'; $url = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id;
} }
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$link = '<a href="'.$url.'"';
$linkclose=""; $linkclose="";
if (empty($notooltip)) if (empty($notooltip))
{ {

View File

@ -110,7 +110,7 @@ if ($id > 0)
dol_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user'); dol_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -96,7 +96,7 @@ $head = member_prepare_head($object);
dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user'); dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -74,7 +74,7 @@ if ($id)
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">"; print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -461,7 +461,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$paiement = new Paiement($db); $paiement = new Paiement($db);
$paiement->datepaye = $paymentdate; $paiement->datepaye = $paymentdate;
$paiement->amounts = $amounts; $paiement->amounts = $amounts;
$paiement->paiementid = dol_getIdFromCode($db,$operation,'c_paiement'); $paiement->paiementid = dol_getIdFromCode($db,$operation,'c_paiement','code','id',1);
$paiement->num_paiement = $num_chq; $paiement->num_paiement = $num_chq;
$paiement->note = $label; $paiement->note = $label;
@ -601,7 +601,7 @@ if ($rowid > 0)
dol_fiche_head($head, 'subscription', $langs->trans("Member"), -1, 'user'); dol_fiche_head($head, 'subscription', $langs->trans("Member"), -1, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -365,7 +365,7 @@ if ($rowid > 0)
dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group'); dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -93,7 +93,7 @@ $head = member_type_prepare_head($object);
dol_fiche_head($head, 'ldap', $langs->trans("MemberType"), -1, 'group'); dol_fiche_head($head, 'ldap', $langs->trans("MemberType"), -1, 'group');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -80,8 +80,7 @@ if ($action == "save" && empty($cancel))
{ {
$param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; $param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
//print "param=".$param." - ".$_POST[$param]; //print "param=".$param." - ".$_POST[$param];
if (GETPOST($param,'alpha')) $res = dolibarr_set_const($db,$param,GETPOST($param,'alpha'),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db,$param,(GETPOST($param,'alpha')?GETPOST($param,'alpha'):''),'chaine',0,'',$conf->entity);
else $res = dolibarr_del_const($db,$param,$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
} }

View File

@ -1,16 +1,16 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com> * Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -54,6 +54,7 @@ $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$rowid=GETPOST('rowid','alpha'); $rowid=GETPOST('rowid','alpha');
$entity=GETPOST('entity','int');
$code=GETPOST('code','alpha'); $code=GETPOST('code','alpha');
$allowed=$user->admin; $allowed=$user->admin;
@ -181,8 +182,8 @@ $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; $tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
$tabsql[10]= "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; $tabsql[10]= "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[11]= "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; $tabsql[11]= "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder FROM ".MAIN_DB_PREFIX.'c_payment_term AS c'; $tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = " . getEntity($tabname[12]);
$tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.accountancy_code FROM ".MAIN_DB_PREFIX."c_paiement AS c"; $tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.accountancy_code, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = " . getEntity($tabname[13]);
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1"; $tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format"; $tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
$tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel"; $tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
@ -259,8 +260,8 @@ $tabfield[8] = "code,libelle,country_id,country".(! empty($conf->global->SOCIETE
$tabfield[9] = "code,label,unicode"; $tabfield[9] = "code,label,unicode";
$tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[11]= "element,source,code,libelle,position"; $tabfield[11]= "element,source,code,libelle,position";
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder"; $tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
$tabfield[13]= "code,libelle,type,accountancy_code"; $tabfield[13]= "code,libelle,type,accountancy_code,entity";
$tabfield[14]= "code,libelle,price,organization,country_id,country"; $tabfield[14]= "code,libelle,price,organization,country_id,country";
$tabfield[15]= "code,libelle,width,height,unit"; $tabfield[15]= "code,libelle,width,height,unit";
$tabfield[16]= "code,libelle,sortorder"; $tabfield[16]= "code,libelle,sortorder";
@ -335,8 +336,8 @@ $tabfieldinsert[8] = "code,libelle,fk_country".(! empty($conf->global->SOCIETE_S
$tabfieldinsert[9] = "code_iso,label,unicode"; $tabfieldinsert[9] = "code_iso,label,unicode";
$tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[11]= "element,source,code,libelle,position"; $tabfieldinsert[11]= "element,source,code,libelle,position";
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder"; $tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
$tabfieldinsert[13]= "code,libelle,type,accountancy_code"; $tabfieldinsert[13]= "code,libelle,type,accountancy_code,entity";
$tabfieldinsert[14]= "code,libelle,price,organization,fk_pays"; $tabfieldinsert[14]= "code,libelle,price,organization,fk_pays";
$tabfieldinsert[15]= "code,label,width,height,unit"; $tabfieldinsert[15]= "code,label,width,height,unit";
$tabfieldinsert[16]= "code,label,sortorder"; $tabfieldinsert[16]= "code,label,sortorder";
@ -733,7 +734,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
} }
else if ($value == 'entity') { else if ($value == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity; $_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
} }
if ($i) $sql.=","; if ($i) $sql.=",";
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position' if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
@ -785,7 +786,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
} }
else if ($field == 'entity') { else if ($field == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity; $_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
} }
if ($i) $sql.=","; if ($i) $sql.=",";
$sql.= $field."="; $sql.= $field."=";
@ -798,6 +799,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i++; $i++;
} }
$sql.= " WHERE ".$rowidcol." = '".$rowid."'"; $sql.= " WHERE ".$rowidcol." = '".$rowid."'";
$sql.= " AND entity = '".getEntity($tabname[$id])."'";
dol_syslog("actionmodify", LOG_DEBUG); dol_syslog("actionmodify", LOG_DEBUG);
//print $sql; //print $sql;
@ -820,7 +822,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; } else { $rowidcol="rowid"; }
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'"; $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
dol_syslog("delete", LOG_DEBUG); dol_syslog("delete", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
@ -844,10 +846,10 @@ if ($action == $acts[0])
else { $rowidcol="rowid"; } else { $rowidcol="rowid"; }
if ($rowid) { if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'"; $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
} }
elseif ($code) { elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'"; $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : '');
} }
$result = $db->query($sql); $result = $db->query($sql);
@ -864,10 +866,10 @@ if ($action == $acts[1])
else { $rowidcol="rowid"; } else { $rowidcol="rowid"; }
if ($rowid) { if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'"; $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
} }
elseif ($code) { elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'"; $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : '');
} }
$result = $db->query($sql); $result = $db->query($sql);
@ -884,10 +886,10 @@ if ($action == 'activate_favorite')
else { $rowidcol="rowid"; } else { $rowidcol="rowid"; }
if ($rowid) { if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'"; $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
} }
elseif ($code) { elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'"; $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : '');
} }
$result = $db->query($sql); $result = $db->query($sql);
@ -904,10 +906,10 @@ if ($action == 'disable_favorite')
else { $rowidcol="rowid"; } else { $rowidcol="rowid"; }
if ($rowid) { if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'"; $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
} }
elseif ($code) { elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'"; $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : '');
} }
$result = $db->query($sql); $result = $db->query($sql);
@ -959,6 +961,7 @@ print "<br>\n";
$param = '&id='.$id; $param = '&id='.$id;
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id; if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
if ($search_code != '') $param.= '&search_code='.urlencode($search_country_id); if ($search_code != '') $param.= '&search_code='.urlencode($search_country_id);
if ($entity != '') $param.= '&entity=' . (int) $entity;
$paramwithsearch = $param; $paramwithsearch = $param;
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder; if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield; if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
@ -1016,6 +1019,7 @@ if ($id)
if ($tabname[$id]) if ($tabname[$id])
{ {
$alabelisused=0; $alabelisused=0;
$withentity=null;
$fieldlist=explode(',',$tabfield[$id]); $fieldlist=explode(',',$tabfield[$id]);
@ -1026,6 +1030,11 @@ if ($id)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
if ($fieldlist[$field] == 'entity') {
$withentity = getEntity($tabname[$id]);
continue;
}
// Determine le nom du champ par rapport aux noms possibles // Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees // dans les dictionnaires de donnees
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
@ -1119,6 +1128,8 @@ if ($id)
if ($id == 4) print '<td></td>'; if ($id == 4) print '<td></td>';
print '<td>'; print '<td>';
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="'.$id.'">';
if (! is_null($withentity))
print '<input type="hidden" name="entity" value="'.$withentity.'">';
print '</td>'; print '</td>';
print '<td style="min-width: 26px;"></td>'; print '<td style="min-width: 26px;"></td>';
print '<td style="min-width: 26px;"></td>'; print '<td style="min-width: 26px;"></td>';
@ -1197,7 +1208,9 @@ if ($id)
$filterfound=0; $filterfound=0;
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
$showfield=1; // By defaut if ($fieldlist[$field] == 'entity') continue;
$showfield=1; // By default
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
@ -1239,6 +1252,8 @@ if ($id)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
if ($fieldlist[$field] == 'entity') continue;
// Determine le nom du champ par rapport aux noms possibles // Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees // dans les dictionnaires de donnees
$showfield=1; // By defaut $showfield=1; // By defaut
@ -1349,12 +1364,16 @@ if ($id)
$error=$hookmanager->error; $errors=$hookmanager->errors; $error=$hookmanager->error; $errors=$hookmanager->errors;
// Show fields // Show fields
if (empty($reshook)) fieldList($fieldlist, $obj, $tabname[$id], 'edit'); if (empty($reshook)) {
$withentity = fieldList($fieldlist, $obj, $tabname[$id], 'edit');
}
print '<td colspan="3" align="center">'; print '<td colspan="3" align="center">';
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>'; print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">'; print '<input type="hidden" name="rowid" value="'.$rowid.'">';
if (! is_null($withentity))
print '<input type="hidden" name="entity" value="'.$withentity.'">';
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>'; print '</td>';
@ -1369,11 +1388,19 @@ if ($id)
if (empty($reshook)) if (empty($reshook))
{ {
$withentity=null;
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
$showfield=1; $showfield=1;
$align="left"; $align="left";
$valuetoshow=$obj->{$fieldlist[$field]}; $valuetoshow=$obj->{$fieldlist[$field]};
if ($fieldlist[$field] == 'entity') {
$withentity = $valuetoshow;
continue;
}
if ($value == 'element') if ($value == 'element')
{ {
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
@ -1588,7 +1615,8 @@ if ($id)
// If rowidcol not defined // If rowidcol not defined
if (empty($rowidcol) || in_array($id, array(6,7,8,13,17,19,27))) $rowidcol='rowid'; if (empty($rowidcol) || in_array($id, array(6,7,8,13,17,19,27))) $rowidcol='rowid';
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((! empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0')?$obj->{$rowidcol}:(! empty($obj->code)?urlencode($obj->code):'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((! empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0')?$obj->{$rowidcol}:(! empty($obj->code)?urlencode($obj->code):'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
if ($param) $url .= '&'.$param; if (! empty($param)) $url .= '&'.$param;
if (! is_null($withentity)) $url .= '&entity='.$withentity;
$url.='&'; $url.='&';
// Favorite // Favorite
@ -1735,8 +1763,15 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
$withentity=null;
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
if ($fieldlist[$field] == 'entity') {
$withentity = $obj->{$fieldlist[$field]};
continue;
}
if (in_array($fieldlist[$field], array('code', 'libelle', 'type')) && $tabname == MAIN_DB_PREFIX."c_actioncomm" && in_array($obj->type, array('system','systemauto'))) if (in_array($fieldlist[$field], array('code', 'libelle', 'type')) && $tabname == MAIN_DB_PREFIX."c_actioncomm" && in_array($obj->type, array('system','systemauto')))
{ {
$hidden = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''); $hidden = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'');
@ -1948,5 +1983,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
print '</td>'; print '</td>';
} }
} }
return $withentity;
} }

View File

@ -136,7 +136,7 @@ switch ($action)
$cond_reglement_id = 0; $cond_reglement_id = 0;
break; break;
case 'ESP': case 'ESP':
$mode_reglement_id = dol_getIdFromCode($db,'LIQ','c_paiement'); $mode_reglement_id = dol_getIdFromCode($db,'LIQ','c_paiement','code','id',1);
$cond_reglement_id = 0; $cond_reglement_id = 0;
$note .= $langs->trans("Cash")."\n"; $note .= $langs->trans("Cash")."\n";
$note .= $langs->trans("Received").' : '.$obj_facturation->montantEncaisse()." ".$conf->currency."\n"; $note .= $langs->trans("Received").' : '.$obj_facturation->montantEncaisse()." ".$conf->currency."\n";
@ -145,11 +145,11 @@ switch ($action)
$note .= '--------------------------------------'."\n\n"; $note .= '--------------------------------------'."\n\n";
break; break;
case 'CB': case 'CB':
$mode_reglement_id = dol_getIdFromCode($db,'CB','c_paiement'); $mode_reglement_id = dol_getIdFromCode($db,'CB','c_paiement','code','id',1);
$cond_reglement_id = 0; $cond_reglement_id = 0;
break; break;
case 'CHQ': case 'CHQ':
$mode_reglement_id = dol_getIdFromCode($db,'CHQ','c_paiement'); $mode_reglement_id = dol_getIdFromCode($db,'CHQ','c_paiement','code','id',1);
$cond_reglement_id = 0; $cond_reglement_id = 0;
break; break;
} }

View File

@ -1271,8 +1271,8 @@ class Propal extends CommonObject
$sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc"; $sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
$sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement"; $sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
$sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."propal as p"; $sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."propal as p";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id AND cp.entity = ' . getEntity('c_paiement');
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid AND cr.entity = ' . getEntity('c_payment_term');
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';

View File

@ -1716,7 +1716,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">'; print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">'; print '<input type="button" class="button" name="cancel" value="' . $langs->trans("Cancel") . '" onclick="javascript:history.go(-1)">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';

View File

@ -1559,8 +1559,8 @@ class Commande extends CommonOrder
$sql.= ', ca.code as availability_code, ca.label as availability_label'; $sql.= ', ca.code as availability_code, ca.label as availability_label';
$sql.= ', dr.code as demand_reason_code'; $sql.= ', dr.code as demand_reason_code';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON (c.fk_cond_reglement = cr.rowid)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON (c.fk_cond_reglement = cr.rowid AND cr.entity = ' . getEntity('c_payment_term') . ')';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON (c.fk_mode_reglement = p.id)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON (c.fk_mode_reglement = p.id AND p.entity = ' . getEntity('c_paiement') . ')';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON (c.fk_availability = ca.rowid)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON (c.fk_availability = ca.rowid)';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON (c.fk_input_reason = ca.rowid)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON (c.fk_input_reason = ca.rowid)';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';

View File

@ -149,7 +149,7 @@ dol_fiche_head($head, 'annual', $langs->trans("FinancialAccount"), -1, 'account'
$title=$langs->trans("FinancialAccount")." : ".$object->label; $title=$langs->trans("FinancialAccount")." : ".$object->label;
$link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start-1)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start+1)."'>".img_next('', 'class="valignbottom"')."</a>":""); $link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start-1)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start+1)."'>".img_next('', 'class="valignbottom"')."</a>":"");
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
if (!empty($id)) if (!empty($id))

View File

@ -23,7 +23,7 @@
*/ */
/** /**
* \file htdocs/compta/bank/bankentries.php * \file htdocs/compta/bank/bankentries_list.php
* \ingroup banque * \ingroup banque
* \brief List of bank transactions * \brief List of bank transactions
*/ */
@ -405,7 +405,7 @@ if ($id > 0 || ! empty($ref))
$head=bank_prepare_head($object); $head=bank_prepare_head($object);
dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
@ -447,7 +447,7 @@ if ($id > 0 || ! empty($ref))
if ($object->canBeConciliated() > 0) { if ($object->canBeConciliated() > 0) {
// If not cash account and can be reconciliate // If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) { if ($user->rights->banque->consolidate) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
} else { } else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>'; print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
} }
@ -559,7 +559,7 @@ if (! empty($thirdparty)) $mode_balance_ok=false;
$sql.= $db->plimit($limit+1,$offset); $sql.= $db->plimit($limit+1,$offset);
dol_syslog('compta/bank/bankentries.php', LOG_DEBUG); dol_syslog('compta/bank/bankentries_list.php', LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
@ -1161,7 +1161,7 @@ if ($resql)
if (! empty($arrayfields['type']['checked'])) if (! empty($arrayfields['type']['checked']))
{ {
print '<td align="center" class="nowrap">'; print '<td align="center" 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'); $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','',getEntity('c_paiement'));
if ($labeltype == 'SOLD') print '&nbsp;'; //$langs->trans("InitialBankBalance"); if ($labeltype == 'SOLD') print '&nbsp;'; //$langs->trans("InitialBankBalance");
else print $labeltype; else print $labeltype;
print "</td>\n"; print "</td>\n";

View File

@ -76,7 +76,7 @@ if ($result)
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td><a href=\"".DOL_URL_ROOT."/compta/bank/bankentries.php?bid=$objp->rowid\">$objp->label</a></td>"; print "<td><a href=\"".DOL_URL_ROOT."/compta/bank/bankentries_list.php?bid=$objp->rowid\">$objp->label</a></td>";
print '<td align="right">'.$objp->nombre.'</td>'; print '<td align="right">'.$objp->nombre.'</td>';
print '<td align="right">'.price(abs($objp->somme))."</td>"; print '<td align="right">'.price(abs($objp->somme))."</td>";
print '<td align="right">'.price(abs(price2num($objp->somme / $objp->nombre,'MT')))."</td>"; print '<td align="right">'.price(abs(price2num($objp->somme / $objp->nombre,'MT')))."</td>";

View File

@ -262,7 +262,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->
if ($result > 0) if ($result > 0)
{ {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
header("Location: ".DOL_URL_ROOT."/compta/bank/index.php"); header("Location: ".DOL_URL_ROOT."/compta/bank/list.php");
exit; exit;
} }
else else
@ -576,7 +576,7 @@ else
// Print form confirm // Print form confirm
print $formconfirm; print $formconfirm;
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref=''; $morehtmlref='';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

View File

@ -412,8 +412,9 @@ class Account extends CommonObject
if (is_numeric($oper)) // Clean oper to have a code instead of a rowid if (is_numeric($oper)) // Clean oper to have a code instead of a rowid
{ {
$sql ="SELECT code FROM ".MAIN_DB_PREFIX."c_paiement"; $sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_paiement";
$sql.=" WHERE id=".$oper; $sql.= " WHERE id=".$oper;
$sql.= " AND entity = " . getEntity('c_paiement') . ")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -1186,7 +1187,7 @@ class Account extends CommonObject
$response = new WorkboardResponse(); $response = new WorkboardResponse();
$response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24; $response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24;
$response->label=$langs->trans("TransactionsToConciliate"); $response->label=$langs->trans("TransactionsToConciliate");
$response->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank'; $response->url=DOL_URL_ROOT.'/compta/bank/list.php?leftmenu=bank&amp;mainmenu=bank';
$response->img=img_object('',"payment"); $response->img=img_object('',"payment");
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
@ -1279,14 +1280,15 @@ class Account extends CommonObject
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto Include picto into link * @param int $withpicto Include picto into link
* @param string $mode ''=Link to card, 'transactions'=Link to transactions card * @param string $mode ''=Link to card, 'transactions'=Link to transactions card
* @param string $option ''=Show ref, 'reflabel'=Show ref+label * @param string $option ''=Show ref, 'reflabel'=Show ref+label
* @return string Chaine avec URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0, $mode='', $option='') function getNomUrl($withpicto=0, $mode='', $option='', $save_lastsearch_value=-1)
{ {
global $conf, $langs; global $conf, $langs;
@ -1306,20 +1308,28 @@ class Account extends CommonObject
if (empty($mode)) if (empty($mode))
{ {
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.$linkclose; $url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id;
$linkend='</a>';
} }
else if ($mode == 'transactions') else if ($mode == 'transactions')
{ {
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?id='.$this->id.$linkclose; $url = DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$this->id;
$linkend='</a>';
} }
else if ($mode == 'receipts') else if ($mode == 'receipts')
{ {
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id.$linkclose; $url = DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id;
$linkend='</a>';
} }
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$link = '<a href="'.$url.$linkclose;
$linkend='</a>';
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' '); if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
$result.=$link.$this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '').$linkend; $result.=$link.$this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '').$linkend;
return $result; return $result;

View File

@ -117,7 +117,7 @@ if ($id > 0 || !empty($ref)) {
$totalsize+=$file['size']; $totalsize+=$file['size'];
} }
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

View File

@ -760,7 +760,7 @@ $head=bank_prepare_head($object);
dol_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0,'account');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
if ($account) if ($account)
{ {

View File

@ -58,7 +58,7 @@ $h++;
dol_fiche_head($head, $hselected, $langs->trans("LineRecord"), -1, 'account'); dol_fiche_head($head, $hselected, $langs->trans("LineRecord"), -1, 'account');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -297,7 +297,7 @@ if ($result)
dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account'); dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($bankline, 'rowid', $linkback); dol_banner_tab($bankline, 'rowid', $linkback);

View File

@ -19,7 +19,7 @@
*/ */
/** /**
* \file htdocs/compta/bank/index.php * \file htdocs/compta/bank/list.php
* \ingroup banque * \ingroup banque
* \brief Home page of bank module * \brief Home page of bank module
*/ */
@ -611,7 +611,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['balance']['checked'])) if (! empty($arrayfields['balance']['checked']))
{ {
print '<td align="right">'; print '<td align="right">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, 0, -1, $obj->currency_code).'</a>'; print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, 0, -1, $obj->currency_code).'</a>';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield']; if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield'];

View File

@ -328,7 +328,7 @@ if (empty($numref))
$head=bank_prepare_head($object); $head=bank_prepare_head($object);
dol_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0,'account');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
@ -340,7 +340,7 @@ if (empty($numref))
if ($object->canBeConciliated() > 0) { if ($object->canBeConciliated() > 0) {
// If not cash account and can be reconciliate // If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) { if ($user->rights->banque->consolidate) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
} else { } else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>'; print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
} }

View File

@ -93,7 +93,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$head=bank_prepare_head($object); $head=bank_prepare_head($object);
dol_fiche_head($head, 'cash', $langs->trans("FinancialAccount"), -1, 'account'); dol_fiche_head($head, 'cash', $langs->trans("FinancialAccount"), -1, 'account');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);

View File

@ -96,7 +96,7 @@ $sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
$sql.= " pst.code as payment_code"; $sql.= " pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id AND pst.entity = " . getEntity('c_paiement');
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " WHERE v.entity = ".$conf->entity; $sql.= " WHERE v.entity = ".$conf->entity;

View File

@ -139,7 +139,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id AND pct.entity = " . getEntity('c_paiement');
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pc.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pc.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " WHERE cs.fk_type = c.id"; $sql.= " WHERE cs.fk_type = c.id";
@ -260,7 +260,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$sql.= " FROM ".MAIN_DB_PREFIX."tva as pv"; $sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id AND pct.entity = " . getEntity('c_paiement');
$sql.= " WHERE pv.entity = ".$conf->entity; $sql.= " WHERE pv.entity = ".$conf->entity;
if ($year > 0) if ($year > 0)
{ {
@ -474,7 +474,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id AND pct.entity = " . getEntity('c_paiement');
$sql.= " , ".MAIN_DB_PREFIX."user as u"; $sql.= " , ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE s.entity IN (".getEntity('user').")"; $sql.= " WHERE s.entity IN (".getEntity('user').")";
$sql.= " AND u.rowid = s.fk_user"; $sql.= " AND u.rowid = s.fk_user";

View File

@ -716,9 +716,13 @@ if (empty($reshook))
if ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_SITUATION) if ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_SITUATION)
{ {
// If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT // If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT
$sql = 'SELECT SUM(pf.amount) as total_paiements
FROM llx_c_paiement as c, llx_paiement_facture as pf, llx_paiement as p $sql = 'SELECT SUM(pf.amount) as total_paiements';
WHERE pf.fk_facture = '.$object->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
$sql.= ' WHERE pf.fk_facture = '.$object->id;
$sql.= ' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid';
$sql.= ' AND c.entity = ' . getEntity('c_paiement');
$sql.= ' ORDER BY p.datep, p.tms';
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) dol_print_error($db); if (! $resql) dol_print_error($db);
@ -3798,6 +3802,7 @@ else if ($id > 0 || ! empty($ref))
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid'; $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid'; $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
$sql .= ' WHERE pf.fk_facture = ' . $object->id . ' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid'; $sql .= ' WHERE pf.fk_facture = ' . $object->id . ' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid';
$sql .= ' AND c.entity = ' . getEntity('c_paiement');
$sql .= ' ORDER BY p.datep, p.tms'; $sql .= ' ORDER BY p.datep, p.tms';
$result = $db->query($sql); $result = $db->query($sql);

View File

@ -378,7 +378,59 @@ class Invoices extends DolibarrApi
} }
/** /**
* Validate an order * Sets an invoice as draft
*
* @param int $id Order ID
* @param int $idwarehouse Warehouse ID
*
* @url POST {id}/settodraft
*
* @return array
*
* @throws 200
* @throws 304
* @throws 401
* @throws 404
* @throws 500
*
*/
function settodraft($id, $idwarehouse=-1)
{
if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->invoice->set_draft(DolibarrApiAccess::$user, $idwarehouse);
if ($result == 0) {
throw new RestException(304, 'Nothing done.');
}
if ($result < 0) {
throw new RestException(500, 'Error : '.$this->invoice->error);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($this->invoice);
}
/**
* Validate an invoice
* *
* @param int $id Order ID * @param int $id Order ID
* @param int $idwarehouse Warehouse ID * @param int $idwarehouse Warehouse ID
@ -411,20 +463,82 @@ class Invoices extends DolibarrApi
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger); $result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
if ($result == 0) { if ($result == 0) {
throw new RestException(500, 'Error nothing done. May be object is already validated'); throw new RestException(304, 'Error nothing done. May be object is already validated');
} }
if ($result < 0) { if ($result < 0) {
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error); throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
} }
return array(
'success' => array( $result = $this->invoice->fetch($id);
'code' => 200, if( ! $result ) {
'message' => 'Invoice validated (Ref='.$this->invoice->ref.')' throw new RestException(404, 'Invoice not found');
) }
);
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($this->invoice);
} }
/**
* Sets an invoice as paid
*
* @param int $id Order ID
* @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple)
* @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple)
*
* @url POST {id}/settopaid
*
* @return array An invoice object
*
* @throws 200
* @throws 304
* @throws 401
* @throws 404
* @throws 500
*/
function settopaid($id, $close_code='', $close_note='')
{
if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->invoice->set_paid(DolibarrApiAccess::$user, $close_code, $close_note);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated');
}
if ($result < 0) {
throw new RestException(500, 'Error : '.$this->invoice->error);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($this->invoice);
}
/** /**
* Clean sensible object datas * Clean sensible object datas
* *

View File

@ -262,8 +262,8 @@ class FactureRec extends CommonInvoice
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
//$sql.= ', el.fk_source'; //$sql.= ', el.fk_source';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid AND c.entity = ' . getEntity('c_payment_term');
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id AND p.entity = ' . getEntity('c_paiement');
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'"; //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'";
if ($rowid) $sql.= ' WHERE f.rowid='.$rowid; if ($rowid) $sql.= ' WHERE f.rowid='.$rowid;
elseif ($ref) $sql.= " WHERE f.titre='".$this->db->escape($ref)."'"; elseif ($ref) $sql.= " WHERE f.titre='".$this->db->escape($ref)."'";

View File

@ -1076,18 +1076,19 @@ class Facture extends CommonInvoice
} }
/** /**
* Return clicable link of object (with eventually picto) * Return clicable link of object (with eventually picto)
* *
* @param int $withpicto Add picto into link * @param int $withpicto Add picto into link
* @param string $option Where point the link * @param string $option Where point the link
* @param int $max Maxlength of ref * @param int $max Maxlength of ref
* @param int $short 1=Return just URL * @param int $short 1=Return just URL
* @param string $moretitle Add more text to title tooltip * @param string $moretitle Add more text to title tooltip
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @param int $addlinktonotes 1=Add link to notes * @param int $addlinktonotes 1=Add link to notes
* @return string String with URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0,$addlinktonotes=0) function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $moretitle='', $notooltip=0, $addlinktonotes=0, $save_lastsearch_value=-1)
{ {
global $langs, $conf, $user, $form; global $langs, $conf, $user, $form;
@ -1100,6 +1101,14 @@ class Facture extends CommonInvoice
if ($short) return $url; if ($short) return $url;
if ($option !== 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$picto='bill'; $picto='bill';
if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice
if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note
@ -1197,8 +1206,8 @@ class Facture extends CommonInvoice
$sql.= ', f.fk_incoterms, f.location_incoterms'; $sql.= ', f.fk_incoterms, f.location_incoterms';
$sql.= ", i.libelle as libelle_incoterms"; $sql.= ", i.libelle as libelle_incoterms";
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid AND c.entity = ' . getEntity('c_payment_term');
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id AND p.entity = ' . getEntity('c_paiement');
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid';
$sql.= ' WHERE f.entity = '.$conf->entity; $sql.= ' WHERE f.entity = '.$conf->entity;
if ($rowid) $sql.= " AND f.rowid=".$rowid; if ($rowid) $sql.= " AND f.rowid=".$rowid;
@ -3171,6 +3180,7 @@ class Facture extends CommonInvoice
//$sql.= ' WHERE pf.'.$field.' = 1'; //$sql.= ' WHERE pf.'.$field.' = 1';
$sql.= ' AND pf.'.$field2.' = p.rowid'; $sql.= ' AND pf.'.$field2.' = p.rowid';
$sql.= ' AND p.fk_paiement = t.id'; $sql.= ' AND p.fk_paiement = t.id';
$sql.= ' AND t.entity = ' . getEntity('c_paiement');
if ($filtertype) $sql.=" AND t.code='PRE'"; if ($filtertype) $sql.=" AND t.code='PRE'";
dol_syslog(get_class($this)."::getListOfPayments", LOG_DEBUG); dol_syslog(get_class($this)."::getListOfPayments", LOG_DEBUG);
@ -3659,7 +3669,7 @@ class Facture extends CommonInvoice
if (! $error) if (! $error)
{ {
// Force payment mode of invoice to withdraw // Force payment mode of invoice to withdraw
$payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement'); $payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement', 'code', 'id', 1);
if ($payment_mode_id > 0) if ($payment_mode_id > 0)
{ {
$result=$this->setPaymentMethods($payment_mode_id); $result=$this->setPaymentMethods($payment_mode_id);

View File

@ -91,6 +91,7 @@ class PaymentTerm // extends CommonObject
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_payment_term("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_payment_term(";
$sql.= "rowid,"; $sql.= "rowid,";
$sql.= "entity,";
$sql.= "code,"; $sql.= "code,";
$sql.= "sortorder,"; $sql.= "sortorder,";
$sql.= "active,"; $sql.= "active,";
@ -101,6 +102,7 @@ class PaymentTerm // extends CommonObject
$sql.= "decalage"; $sql.= "decalage";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->db->escape($this->rowid)."'").","; $sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->db->escape($this->rowid)."'").",";
$sql.= " ".(! isset($this->entity)?getEntity('c_payment_term'):"'".$this->db->escape($this->entity)."'").",";
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").","; $sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
$sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->db->escape($this->sortorder)."'").","; $sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->db->escape($this->sortorder)."'").",";
$sql.= " ".(! isset($this->active)?'NULL':"'".$this->db->escape($this->active)."'").","; $sql.= " ".(! isset($this->active)?'NULL':"'".$this->db->escape($this->active)."'").",";
@ -165,6 +167,7 @@ class PaymentTerm // extends CommonObject
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql.= " t.rowid,";
$sql.= " t.entity";
$sql.= " t.code,"; $sql.= " t.code,";
$sql.= " t.sortorder,"; $sql.= " t.sortorder,";
@ -178,6 +181,7 @@ class PaymentTerm // extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t"; $sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
$sql.= " WHERE t.rowid = ".$id; $sql.= " WHERE t.rowid = ".$id;
$sql.= " AND t.entity = " . getEntity('c_payment_term');
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -227,6 +231,7 @@ class PaymentTerm // extends CommonObject
$sql.= " t.rowid"; $sql.= " t.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t"; $sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
$sql.= " WHERE t.code = 'RECEP'"; $sql.= " WHERE t.code = 'RECEP'";
$sql.= " AND t.entity = " . getEntity('c_payment_term');
dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG); dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -255,9 +260,10 @@ class PaymentTerm // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user=null, $notrigger=0) function update($user=null, $notrigger=0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
// Clean parameters // Clean parameters
@ -276,8 +282,8 @@ class PaymentTerm // extends CommonObject
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."c_payment_term SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."c_payment_term SET";
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").","; $sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").",";
$sql.= " sortorder=".(isset($this->sortorder)?$this->sortorder:"null").","; $sql.= " sortorder=".(isset($this->sortorder)?$this->sortorder:"null").",";
$sql.= " active=".(isset($this->active)?$this->active:"null").","; $sql.= " active=".(isset($this->active)?$this->active:"null").",";
@ -286,37 +292,38 @@ class PaymentTerm // extends CommonObject
$sql.= " type_cdr=".(isset($this->type_cdr)?$this->type_cdr:"null").","; $sql.= " type_cdr=".(isset($this->type_cdr)?$this->type_cdr:"null").",";
$sql.= " nbjour=".(isset($this->nbjour)?$this->nbjour:"null").","; $sql.= " nbjour=".(isset($this->nbjour)?$this->nbjour:"null").",";
$sql.= " decalage=".(isset($this->decalage)?$this->decalage:"null").""; $sql.= " decalage=".(isset($this->decalage)?$this->decalage:"null")."";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid = " . $this->id;
$sql.= " AND entity = " . getEntity('c_payment_term');
$this->db->begin(); $this->db->begin();
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error) if (! $error)
{ {
if (! $notrigger) if (! $notrigger)
{ {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger. // want this action call a trigger.
//// Call triggers // Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db); //$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; } //if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers // End call triggers
} }
} }
// Commit or rollback // Commit or rollback
if ($error) if ($error)
{ {
foreach($this->errors as $errmsg) foreach($this->errors as $errmsg)
{ {
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg); $this->error.=($this->error?', '.$errmsg:$errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return -1*$error; return -1*$error;
@ -326,7 +333,7 @@ class PaymentTerm // extends CommonObject
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
} }
/** /**
@ -342,7 +349,8 @@ class PaymentTerm // extends CommonObject
$error=0; $error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_payment_term"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."c_payment_term";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid = " . $this->id;
$sql.= " AND t.entity = " . getEntity('c_payment_term');
$this->db->begin(); $this->db->begin();

View File

@ -144,7 +144,7 @@ if ($id > 0 || ! empty($ref))
// Invoice content // Invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer

View File

@ -113,7 +113,7 @@ if ($id > 0 || ! empty($ref))
// Invoice content // Invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer

View File

@ -1169,7 +1169,7 @@ else
// Recurring invoice content // Recurring invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/invoicetemplate_list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/invoicetemplate_list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref=''; $morehtmlref='';
if ($action != 'editref') $morehtmlref.=$form->editfieldkey($object->ref, 'ref', $object->ref, $object, $user->rights->facture->creer, '', '', 0, 2); if ($action != 'editref') $morehtmlref.=$form->editfieldkey($object->ref, 'ref', $object->ref, $object, $user->rights->facture->creer, '', '', 0, 2);

View File

@ -58,7 +58,7 @@ $totalpaye = $object->getSommePaiement();
// Invoice content // Invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer

View File

@ -81,7 +81,7 @@ if ($id > 0 || ! empty($ref))
// Invoice content // Invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer

View File

@ -151,7 +151,7 @@ if ($object->id > 0)
// Invoice content // Invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer

View File

@ -251,7 +251,7 @@ if (empty($reshook))
$paiement->datepaye = $datepaye; $paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id $paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
$paiement->paiementid = dol_getIdFromCode($db,GETPOST('paiementcode'),'c_paiement'); $paiement->paiementid = dol_getIdFromCode($db,GETPOST('paiementcode'),'c_paiement','code','id',1);
$paiement->num_paiement = GETPOST('num_paiement'); $paiement->num_paiement = GETPOST('num_paiement');
$paiement->note = GETPOST('comment'); $paiement->note = GETPOST('comment');
@ -526,21 +526,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
* List of unpaid invoices * List of unpaid invoices
*/ */
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type, '; $sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,';
$sql.= ' f.datef as df, f.fk_soc as socid'; $sql.= ' f.datef as df, f.fk_soc as socid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' WHERE f.entity IN ('.getEntity('facture', $conf->entity).')';
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS)) {
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON (f.fk_soc = s.rowid)';
}
$sql.= ' WHERE f.entity = '.$conf->entity;
$sql.= ' AND (f.fk_soc = '.$facture->socid; $sql.= ' AND (f.fk_soc = '.$facture->socid;
// Can pay invoices of all child of parent company
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) { if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) {
$sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')'; $sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')';
} }
// Can pay invoices of all child of myself
if(!empty($conf->global->FACTURE_PAYMENTS_ON_SUBSIDIARY_COMPANIES)){
$sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->id.')';
}
$sql.= ') AND f.paye = 0'; $sql.= ') AND f.paye = 0';
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled $sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
if ($facture->type != 2) if ($facture->type != 2)
@ -831,7 +829,8 @@ if (! GETPOST('action','aZ09'))
$sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement'; $sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'c_paiement as c'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'c_paiement as c';
$sql.= ' WHERE p.fk_facture = f.rowid AND p.fk_paiement = c.id'; $sql.= ' WHERE p.fk_facture = f.rowid AND p.fk_paiement = c.id';
$sql.= ' AND f.entity = '.$conf->entity; $sql.= ' AND f.entity = ' . $conf->entity;
$sql.= ' AND c.entity = ' . getEntity('c_paiement');
if ($socid) if ($socid)
{ {
$sql.= ' AND f.fk_soc = '.$socid; $sql.= ' AND f.fk_soc = '.$socid;

View File

@ -71,7 +71,8 @@ if ($socid)
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
} }
$sql.= " WHERE p.fk_paiement = c.id"; $sql.= " WHERE p.fk_paiement = c.id";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = " . $conf->entity;
$sql.= " AND c.entity = " . getEntity('c_paiement');
if ($socid) if ($socid)
{ {
$sql.= " AND f.fk_soc = ".$socid; $sql.= " AND f.fk_soc = ".$socid;

View File

@ -792,7 +792,7 @@ class RemiseCheque extends CommonObject
$rejectedPayment = new Paiement($db); $rejectedPayment = new Paiement($db);
$rejectedPayment->amounts = array(); $rejectedPayment->amounts = array();
$rejectedPayment->datepaye = $rejection_date; $rejectedPayment->datepaye = $rejection_date;
$rejectedPayment->paiementid = dol_getIdFromCode($this->db, 'CHQ', 'c_paiement'); $rejectedPayment->paiementid = dol_getIdFromCode($this->db, 'CHQ', 'c_paiement','code','id',1);
$rejectedPayment->num_paiement = $payment->numero; $rejectedPayment->num_paiement = $payment->numero;
while($obj = $db->fetch_object($resql)) while($obj = $db->fetch_object($resql))

View File

@ -203,7 +203,7 @@ if ($resql)
// Bank // Bank
print '<td>'; print '<td>';
if ($objp->bid) print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.'</a>'; if ($objp->bid) print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.'</a>';
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';

View File

@ -93,6 +93,7 @@ class Paiement extends CommonObject
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid '; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
$sql.= ' WHERE p.fk_paiement = c.id'; $sql.= ' WHERE p.fk_paiement = c.id';
$sql.= ' AND c.entity = ' . getEntity('c_paiement');
if ($id > 0) if ($id > 0)
$sql.= ' AND p.rowid = '.$id; $sql.= ' AND p.rowid = '.$id;
else if ($ref) else if ($ref)

View File

@ -119,7 +119,8 @@ if (GETPOST("orphelins"))
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c)"; $sql.= " ".MAIN_DB_PREFIX."c_paiement as c)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
$sql.= " WHERE p.fk_paiement = c.id"; $sql.= " WHERE p.fk_paiement = c.id";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = " . $conf->entity;
$sql.= " AND c.entity = " . getEntity('c_paiement');
$sql.= " AND pf.fk_facture IS NULL"; $sql.= " AND pf.fk_facture IS NULL";
// Add where from hooks // Add where from hooks
$parameters=array(); $parameters=array();
@ -150,7 +151,8 @@ else
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
} }
$sql.= " WHERE p.fk_paiement = c.id"; $sql.= " WHERE p.fk_paiement = c.id";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = " . $conf->entity;
$sql.= " AND c.entity = " . getEntity('c_paiement');
if (! $user->rights->societe->client->voir && ! $socid) if (! $user->rights->societe->client->voir && ! $socid)
{ {
$sql.= " AND sc.fk_user = " .$user->id; $sql.= " AND sc.fk_user = " .$user->id;

View File

@ -822,7 +822,7 @@ else
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity = " . getEntity('c_paiement');
$sql.= " WHERE p.entity = ".getEntity('expensereport'); $sql.= " WHERE p.entity = ".getEntity('expensereport');
$sql.= " AND p.fk_statut>=5"; $sql.= " AND p.fk_statut>=5";
@ -906,7 +906,7 @@ else
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."don as p"; $sql.= " FROM ".MAIN_DB_PREFIX."don as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity = " . getEntity('c_paiement');
$sql.= " WHERE p.entity = ".getEntity('donation'); $sql.= " WHERE p.entity = ".getEntity('donation');
$sql.= " AND fk_statut >= 2"; $sql.= " AND fk_statut >= 2";
} }

View File

@ -698,7 +698,7 @@ if (! empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES'
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity = " . getEntity('c_paiement');
$sql.= " WHERE p.entity = ".getEntity('expensereport'); $sql.= " WHERE p.entity = ".getEntity('expensereport');
$sql.= " AND p.fk_statut>=5"; $sql.= " AND p.fk_statut>=5";
@ -761,7 +761,7 @@ if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount"; $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."don as p"; $sql.= " FROM ".MAIN_DB_PREFIX."don as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity = " . getEntity('c_paiement');
$sql.= " WHERE p.entity = ".getEntity('donation'); $sql.= " WHERE p.entity = ".getEntity('donation');
$sql.= " AND fk_statut >= 2"; $sql.= " AND fk_statut >= 2";
if (! empty($date_start) && ! empty($date_end)) if (! empty($date_start) && ! empty($date_end))

View File

@ -105,7 +105,7 @@ $sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.da
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
$sql.= " pst.code as payment_code"; $sql.= " pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $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.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id AND pst.entity = " . getEntity('c_paiement');
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid,"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid,";
$sql.= " ".MAIN_DB_PREFIX."user as u"; $sql.= " ".MAIN_DB_PREFIX."user as u";

View File

@ -581,6 +581,7 @@ if ($id > 0)
$sql.= " AND p.fk_charge = cs.rowid"; $sql.= " AND p.fk_charge = cs.rowid";
$sql.= " AND cs.entity = ".$conf->entity; $sql.= " AND cs.entity = ".$conf->entity;
$sql.= " AND p.fk_typepaiement = c.id"; $sql.= " AND p.fk_typepaiement = c.id";
$sql.= " AND c.entity = " . getEntity('c_paiement');
$sql.= " ORDER BY dp DESC"; $sql.= " ORDER BY dp DESC";
//print $sql; //print $sql;

View File

@ -83,7 +83,7 @@ class ChargeSociales extends CommonObject
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id AND p.entity = ' . getEntity('c_paiement');
if ($ref) $sql.= " WHERE cs.rowid = ".$ref; if ($ref) $sql.= " WHERE cs.rowid = ".$ref;
else $sql.= " WHERE cs.rowid = ".$id; else $sql.= " WHERE cs.rowid = ".$id;

View File

@ -205,6 +205,7 @@ class PaymentSocialContribution extends CommonObject
$sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as pt, ".MAIN_DB_PREFIX."paiementcharge as t)"; $sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as pt, ".MAIN_DB_PREFIX."paiementcharge as t)";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
$sql.= " WHERE t.rowid = ".$id." AND t.fk_typepaiement = pt.id"; $sql.= " WHERE t.rowid = ".$id." AND t.fk_typepaiement = pt.id";
$sql.= " AND pt.entity = " . getEntity('c_paiement');
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);

View File

@ -133,7 +133,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs,"; $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs,";
$sql.= " ".MAIN_DB_PREFIX."paiementcharge as pc"; $sql.= " ".MAIN_DB_PREFIX."paiementcharge as pc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id AND pct.entity = " . getEntity('c_paiement');
$sql.= " WHERE cs.fk_type = c.id AND pc.fk_charge = cs.rowid"; $sql.= " WHERE cs.fk_type = c.id AND pc.fk_charge = cs.rowid";
$sql.= " AND cs.entity = ".$conf->entity; $sql.= " AND cs.entity = ".$conf->entity;
if ($year > 0) if ($year > 0)

View File

@ -100,7 +100,7 @@ $bankstatic = new Account($db);
$sql = "SELECT t.rowid, t.amount, t.label, t.datev as dv, t.datep as dp, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,"; $sql = "SELECT t.rowid, t.amount, t.label, t.datev as dv, t.datep as dp, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; $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.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id AND pst.entity = " . getEntity('c_paiement');
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " WHERE t.entity = ".$conf->entity; $sql.= " WHERE t.entity = ".$conf->entity;

View File

@ -210,7 +210,7 @@ else
dol_fiche_head($head, 'agenda', $title, -1, 'contact'); dol_fiche_head($head, 'agenda', $title, -1, 'contact');
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))

View File

@ -1064,7 +1064,7 @@ else
} }
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))

View File

@ -987,38 +987,52 @@ class Contact extends CommonObject
* Return name of contact with link (and eventually picto) * Return name of contact with link (and eventually picto)
* Use $this->id, $this->lastname, $this->firstname, this->civility_id * Use $this->id, $this->lastname, $this->firstname, this->civility_id
* *
* @param int $withpicto Include picto with link * @param int $withpicto Include picto with link
* @param string $option Where the link point to * @param string $option Where the link point to
* @param int $maxlen Max length of * @param int $maxlen Max length of
* @param string $moreparam Add more param into URL * @param string $moreparam Add more param into URL
* @return string String with URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='') function getNomUrl($withpicto=0, $option='', $maxlen=0, $moreparam='', $save_lastsearch_value=-1)
{ {
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
$result=''; $result='';
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
$label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
//if ($this->civility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
if (! empty($this->poste)) $label.= '<br><b>' . $langs->trans("Poste") . ':</b> '.$this->poste;
$label.= '<br><b>' . $langs->trans("EMail") . ':</b> '.$this->email;
$phonelist=array();
if ($this->phone_pro) $phonelist[]=$this->phone_pro;
if ($this->phone_mobile) $phonelist[]=$this->phone_mobile;
if ($this->phone_perso) $phonelist[]=$this->phone_perso;
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',$phonelist);
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'"'; $label = '<u>' . $langs->trans("ShowContact") . '</u>';
$linkclose=""; $label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) //if ($this->civility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
{ if (! empty($this->poste)) $label.= '<br><b>' . $langs->trans("Poste") . ':</b> '.$this->poste;
$label=$langs->trans("ShowContact"); $label.= '<br><b>' . $langs->trans("EMail") . ':</b> '.$this->email;
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; $phonelist=array();
} if ($this->phone_pro) $phonelist[]=$this->phone_pro;
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; if ($this->phone_mobile) $phonelist[]=$this->phone_mobile;
$linkclose.= ' class="classfortooltip">'; if ($this->phone_perso) $phonelist[]=$this->phone_perso;
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',$phonelist);
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
$url = DOL_URL_ROOT.'/contact/card.php?id='.$this->id;
if ($option !== 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$url .= $moreparam;
$linkstart = '<a href="'.$url.'"';
$linkclose="";
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowContact");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.= ' class="classfortooltip">';
if (! is_object($hookmanager)) if (! is_object($hookmanager))
{ {
@ -1030,18 +1044,17 @@ class Contact extends CommonObject
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $linkclose = $hookmanager->resPrint; if ($reshook > 0) $linkclose = $hookmanager->resPrint;
$link.=$linkclose; $linkstart.=$linkclose;
$linkend='</a>'; $linkend='</a>';
if ($option == 'xxx') if ($option == 'xxx')
{ {
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkstart = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>'; $linkend='</a>';
} }
if ($withpicto) $result.=($link.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' '); if ($withpicto) $result.=($linkstart.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' ');
$result.=$link.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend; $result.=$linkstart.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend;
return $result; return $result;
} }

View File

@ -107,7 +107,7 @@ if ($object->id)
$totalsize+=$file['size']; $totalsize+=$file['size'];
} }
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))

View File

@ -61,7 +61,7 @@ if ($id > 0)
dol_fiche_head($head, 'info', $title, -1, 'contact'); dol_fiche_head($head, 'info', $title, -1, 'contact');
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '');

View File

@ -90,6 +90,8 @@ $head = contact_prepare_head($object);
dol_fiche_head($head, 'ldap', $title, -1, 'contact'); dol_fiche_head($head, 'ldap', $title, -1, 'contact');
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '<div class="fichecenter">'; print '<div class="fichecenter">';

View File

@ -75,7 +75,7 @@ if ($id > 0)
dol_fiche_head($head, 'note', $title, -1, 'contact'); dol_fiche_head($head, 'note', $title, -1, 'contact');
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))

View File

@ -231,7 +231,7 @@ else
dol_fiche_head($head, 'perso', $title, -1, 'contact'); dol_fiche_head($head, 'perso', $title, -1, 'contact');
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))

View File

@ -1311,7 +1311,7 @@ else
// Contract card // Contract card
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref=''; $morehtmlref='';

View File

@ -1938,19 +1938,29 @@ class Contrat extends CommonObject
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Max length of ref * @param int $maxlength Max length of ref
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$maxlength=0,$notooltip=0) function getNomUrl($withpicto=0, $maxlength=0, $notooltip=0, $save_lastsearch_value=-1)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
$result=''; $result='';
$url = DOL_URL_ROOT.'/contrat/card.php?id='.$this->id; $url = DOL_URL_ROOT.'/contrat/card.php?id='.$this->id;
$picto = 'contract';
//if ($option !== 'nolink')
//{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
//}
$picto = 'contract';
$label = ''; $label = '';
if ($user->rights->contrat->lire) { if ($user->rights->contrat->lire) {

View File

@ -134,7 +134,7 @@ if ($id > 0 || ! empty($ref))
// Contract card // Contract card
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref=''; $morehtmlref='';

View File

@ -107,7 +107,7 @@ if ($object->id)
// Contract card // Contract card
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref=''; $morehtmlref='';

View File

@ -62,7 +62,7 @@ dol_fiche_head($head, 'info', $langs->trans("Contract"), -1, 'contract');
// Contract card // Contract card
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref=''; $morehtmlref='';

View File

@ -323,16 +323,17 @@ if ($resql)
} }
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall != '') $param.='&sall='.$sall; if ($sall != '') $param.='&sall='.urlencode($sall);
if ($search_contract != '') $param.='&search_contract='.$search_contract; if ($search_contract != '') $param.='&search_contract='.urlencode($search_contract);
if ($search_name != '') $param.='&search_name='.$search_name; if ($search_name != '') $param.='&search_name='.urlencode($search_name);
if ($search_email != '') $param.='&search_email='.$search_email; if ($search_email != '') $param.='&search_email='.urlencode($search_email);
if ($search_ref_supplier != '') $param.='&search_ref_supplier='.$search_ref_supplier; if ($search_ref_customer != '') $param.='&search_ref_customer='.urlencode($search_ref_customer);
if ($search_sale != '') $param.='&search_sale=' .$search_sale; if ($search_ref_supplier != '') $param.='&search_ref_supplier='.urlencode($search_ref_supplier);
if ($show_files) $param.='&show_files=' .$show_files; if ($search_sale != '') $param.='&search_sale=' .urlencode($search_sale);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($show_files) $param.='&show_files=' .urlencode($show_files);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields // Add $param from extra fields
foreach ($search_array_options as $key => $val) foreach ($search_array_options as $key => $val)
{ {
@ -600,6 +601,11 @@ if ($resql)
$contracttmp->ref_customer=$obj->ref_customer; $contracttmp->ref_customer=$obj->ref_customer;
$contracttmp->ref_supplier=$obj->ref_supplier; $contracttmp->ref_supplier=$obj->ref_supplier;
if ($obj->socid > 0)
{
$result=$socstatic->fetch($obj->socid);
}
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['c.ref']['checked'])) if (! empty($arrayfields['c.ref']['checked']))
{ {
@ -631,7 +637,13 @@ if ($resql)
} }
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>'; print '<td>';
//print '<a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a>';
if ($obj->socid > 0)
{
print $socstatic->getNomUrl(1, '');
}
print '</td>';
} }
if (! empty($arrayfields['s.email']['checked'])) if (! empty($arrayfields['s.email']['checked']))
{ {
@ -683,7 +695,6 @@ if ($resql)
print '<td>'; print '<td>';
if ($obj->socid > 0) if ($obj->socid > 0)
{ {
$result=$socstatic->fetch($obj->socid);
$listsalesrepresentatives=$socstatic->getSalesRepresentatives($user); $listsalesrepresentatives=$socstatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) dol_print_error($db); if ($listsalesrepresentatives < 0) dol_print_error($db);
$nbofsalesrepresentative=count($listsalesrepresentatives); $nbofsalesrepresentative=count($listsalesrepresentatives);

View File

@ -74,7 +74,7 @@ if ($id > 0 || ! empty($ref))
// Contract card // Contract card
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref=''; $morehtmlref='';

View File

@ -450,8 +450,9 @@ abstract class CommonInvoice extends CommonObject
$sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage'; $sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage';
$sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c'; $sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c';
if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement; $sqltemp.= " WHERE c.entity = " . getEntity('c_payment_term');
else $sqltemp.= " WHERE c.code='".$this->db->escape($cond_reglement)."'"; if (is_numeric($cond_reglement)) $sqltemp.= " AND c.rowid=".$cond_reglement;
else $sqltemp.= " AND c.code='".$this->db->escape($cond_reglement)."'";
dol_syslog(get_class($this).'::calculate_date_lim_reglement', LOG_DEBUG); dol_syslog(get_class($this).'::calculate_date_lim_reglement', LOG_DEBUG);
$resqltemp=$this->db->query($sqltemp); $resqltemp=$this->db->query($sqltemp);

View File

@ -2737,7 +2737,8 @@ class Form
$sql = "SELECT rowid, code, libelle as label"; $sql = "SELECT rowid, code, libelle as label";
$sql.= " FROM ".MAIN_DB_PREFIX.'c_payment_term'; $sql.= " FROM ".MAIN_DB_PREFIX.'c_payment_term';
$sql.= " WHERE active > 0"; $sql.= " WHERE entity = " . getEntity('c_payment_term');
$sql.= " AND active > 0";
$sql.= " ORDER BY sortorder"; $sql.= " ORDER BY sortorder";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -2951,7 +2952,8 @@ class Form
$sql = "SELECT id, code, libelle as label, type, active"; $sql = "SELECT id, code, libelle as label, type, active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement"; $sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
//if ($active >= 0) $sql.= " WHERE active = ".$active; $sql.= " WHERE entity = " . getEntity('c_paiement');
//if ($active >= 0) $sql.= " AND active = ".$active;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)

View File

@ -559,7 +559,7 @@ class Translate
} }
elseif (preg_match('/^PaymentTypeShort([0-9A-Z]+)$/i',$key,$reg)) elseif (preg_match('/^PaymentTypeShort([0-9A-Z]+)$/i',$key,$reg))
{ {
$newstr=$this->getLabelFromKey($db,$reg[1],'c_paiement','code','libelle'); $newstr=$this->getLabelFromKey($db,$reg[1],'c_paiement','code','libelle','',getEntity('c_paiement'));
} }
elseif (preg_match('/^OppStatusShort([0-9A-Z]+)$/i',$key,$reg)) elseif (preg_match('/^OppStatusShort([0-9A-Z]+)$/i',$key,$reg))
{ {
@ -867,10 +867,11 @@ class Translate
* @param string $fieldkey Field for key * @param string $fieldkey Field for key
* @param string $fieldlabel Field for label * @param string $fieldlabel Field for label
* @param string $keyforselect Use another value than the translation key for the where into select * @param string $keyforselect Use another value than the translation key for the where into select
* @param int $entity Field for filter by entity
* @return string Label in UTF8 (but without entities) * @return string Label in UTF8 (but without entities)
* @see dol_getIdFromCode * @see dol_getIdFromCode
*/ */
function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel,$keyforselect='') function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel,$keyforselect='',$entity=null)
{ {
// If key empty // If key empty
if ($key == '') return ''; if ($key == '') return '';
@ -893,6 +894,8 @@ class Translate
$sql = "SELECT ".$fieldlabel." as label"; $sql = "SELECT ".$fieldlabel." as label";
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename; $sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
$sql.= " WHERE ".$fieldkey." = '".($keyforselect?$keyforselect:$key)."'"; $sql.= " WHERE ".$fieldkey." = '".($keyforselect?$keyforselect:$key)."'";
if (! is_null($entity))
$sql.= " AND entity = " . (int) $entity;
dol_syslog(get_class($this).'::getLabelFromKey', LOG_DEBUG); dol_syslog(get_class($this).'::getLabelFromKey', LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)

View File

@ -42,7 +42,7 @@ function bank_prepare_head(Account $object)
$head[$h][2] = 'bankname'; $head[$h][2] = 'bankname';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/bankentries.php?id=" . $object->id; $head[$h][0] = DOL_URL_ROOT . "/compta/bank/bankentries_list.php?id=" . $object->id;
$head[$h][1] = $langs->trans("BankTransactions"); $head[$h][1] = $langs->trans("BankTransactions");
$head[$h][2] = 'journal'; $head[$h][2] = 'journal';
$h++; $h++;

View File

@ -102,18 +102,20 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
/** /**
* Get list of entity id to use. * Get list of entity id to use.
* *
* @param string $element Current element * @param string $element Current element
* 'societe', 'socpeople', 'actioncomm', 'agenda', 'resource', * 'societe', 'socpeople', 'actioncomm', 'agenda', 'resource',
* 'product', 'productprice', 'stock', * 'product', 'productprice', 'stock',
* 'propal', 'supplier_proposal', 'facture', 'facture_fourn', * 'propal', 'supplier_proposal', 'facture', 'facture_fourn',
* 'categorie', 'bank_account', 'bank_account', 'adherent', 'user', * 'categorie', 'bank_account', 'bank_account', 'adherent', 'user',
* 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey', * 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey',
* 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project', * 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project',
* 'email_template', 'event', * 'email_template', 'event',
* @param int $shared 1=Return id of current entity + shared entities (default), 0=Return id of current entity only * @param int $shared 0=Return id of current entity only,
* 1=Return id of current entity + shared entities (default)
* @param int $forceentity Entity id
* @return mixed Entity id(s) to use * @return mixed Entity id(s) to use
*/ */
function getEntity($element, $shared=1) function getEntity($element, $shared=1, $forceentity=null)
{ {
global $conf, $mc; global $conf, $mc;
@ -124,7 +126,7 @@ function getEntity($element, $shared=1)
if (is_object($mc)) if (is_object($mc))
{ {
return $mc->getEntity($element, $shared); return $mc->getEntity($element, $shared, $forceentity);
} }
else else
{ {
@ -5952,15 +5954,16 @@ function dol_osencode($str)
* Return an id or code from a code or id. * Return an id or code from a code or id.
* Store also Code-Id into a cache to speed up next request on same key. * Store also Code-Id into a cache to speed up next request on same key.
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $key Code or Id to get Id or Code * @param string $key Code or Id to get Id or Code
* @param string $tablename Table name without prefix * @param string $tablename Table name without prefix
* @param string $fieldkey Field for search ('code' or 'id') * @param string $fieldkey Field for code
* @param string $fieldid Field to get ('id' or 'code') * @param string $fieldid Field for id
* @return int <0 if KO, Id of code if OK * @param int $entityfilter Filter by entity
* @return int <0 if KO, Id of code if OK
* @see $langs->getLabelFromKey * @see $langs->getLabelFromKey
*/ */
function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id',$entityfilter=0)
{ {
global $cache_codes; global $cache_codes;
@ -5976,6 +5979,8 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
$sql = "SELECT ".$fieldid." as valuetoget"; $sql = "SELECT ".$fieldid." as valuetoget";
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename; $sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
$sql.= " WHERE ".$fieldkey." = '".$db->escape($key)."'"; $sql.= " WHERE ".$fieldkey." = '".$db->escape($key)."'";
if (! empty($entityfilter))
$sql.= " AND entity IN (" . getEntity($tablename) . ")";
dol_syslog('dol_getIdFromCode', LOG_DEBUG); dol_syslog('dol_getIdFromCode', LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)

View File

@ -308,6 +308,10 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
{ {
if (! $user->rights->ftp->write) $deleteok=0; if (! $user->rights->ftp->write) $deleteok=0;
} }
else if ($feature == 'salaries')
{
if (! $user->rights->salaries->delete) $deleteok=0;
}
else if (! empty($feature2)) // This should be used for future changes else if (! empty($feature2)) // This should be used for future changes
{ {
foreach($feature2 as $subfeature) foreach($feature2 as $subfeature)

View File

@ -14,7 +14,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&amp;leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&amp;leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&amp;leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&amp;leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&amp;leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 2, 51, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&amp;leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 2, 51, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&amp;leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&amp;leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&amp;leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&amp;leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&amp;leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&amp;leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__);
@ -224,7 +224,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 41, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 41, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/compta/bank/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuBankAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 51, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuBankAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 51, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 52, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 52, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 53, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 53, __ENTITY__);
@ -283,10 +283,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2506__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/rejets.php?leftmenu=withdraw', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2506__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/rejets.php?leftmenu=withdraw', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2507__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/stats.php?leftmenu=withdraw', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2507__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/stats.php?leftmenu=withdraw', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__);
-- Bank -- Bank
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/list.php?leftmenu=bank&amp;mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?action=create&amp;leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?action=create&amp;leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__);
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php?leftmenu=bank', 'Rubriques', 1, 'categories', '$user->rights->banque->configurer', '', 0, 1, __ENTITY__); -- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php?leftmenu=bank', 'Rubriques', 1, 'categories', '$user->rights->banque->configurer', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/bankentries.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/bankentries_list.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/transfer.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/transfer.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__);
-- Bank - Categories -- Bank - Categories

View File

@ -339,7 +339,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
$numr = $db->num_rows($resql); $numr = $db->num_rows($resql);
$i = 0; $i = 0;
if ($numr > 0) $newmenu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire); if ($numr > 0) $newmenu->add('/compta/bank/list.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
while ($i < $numr) while ($i < $numr)
{ {
@ -347,7 +347,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); $newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{ {
$newmenu->add('/compta/bank/bankentries.php?id='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); $newmenu->add('/compta/bank/bankentries_list.php?id='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
} }
$i++; $i++;
} }

View File

@ -183,7 +183,7 @@ class MenuManager
//var_dump($canonnexturl); //var_dump($canonnexturl);
print '<ul>'."\n"; print '<ul>'."\n";
if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools'))) if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools')))
|| (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false)) || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/list.php') !== false))
{ {
// We add sub entry // We add sub entry
print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic

View File

@ -201,7 +201,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='bank'; $idsel='bank';
$menu->add('/compta/bank/index.php?mainmenu=bank&amp;leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 60, $id, $idsel, $classname); $menu->add('/compta/bank/list.php?mainmenu=bank&amp;leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 60, $id, $idsel, $classname);
} }
// Projects // Projects
@ -977,7 +977,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50);
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/compta/bank/index.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 51); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 51);
} }
if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled)) if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled))
{ {
@ -1146,11 +1146,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Bank-Caisse // Bank-Caisse
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
$newmenu->add("/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank'); $newmenu->add("/compta/bank/list.php?leftmenu=bank&amp;mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank');
$newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer); $newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer);
$newmenu->add("/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->lire, '', $mainmenu, 'bank'); $newmenu->add("/compta/bank/list.php?leftmenu=bank&amp;mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->lire, '', $mainmenu, 'bank');
$newmenu->add("/compta/bank/bankentries.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire); $newmenu->add("/compta/bank/bankentries_list.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire);
$newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire); $newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire);
$newmenu->add("/compta/bank/transfer.php",$langs->trans("MenuBankInternalTransfer"),1,$user->rights->banque->transfer); $newmenu->add("/compta/bank/transfer.php",$langs->trans("MenuBankInternalTransfer"),1,$user->rights->banque->transfer);
@ -1498,7 +1498,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$numr = $db->num_rows($resql); $numr = $db->num_rows($resql);
$i = 0; $i = 0;
if ($numr > 0) $newmenu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire); if ($numr > 0) $newmenu->add('/compta/bank/list.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
while ($i < $numr) while ($i < $numr)
{ {
@ -1506,7 +1506,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); $newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{ {
$newmenu->add('/compta/bank/bankentries.php?action=reconcile&contextpage=banktransactionlist-'.$objp->rowid.'&account='.$objp->rowid.'&id='.$objp->rowid.'&search_conciliated=0',$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); $newmenu->add('/compta/bank/bankentries_list.php?action=reconcile&contextpage=banktransactionlist-'.$objp->rowid.'&account='.$objp->rowid.'&id='.$objp->rowid.'&search_conciliated=0',$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
} }
$i++; $i++;
} }

View File

@ -193,7 +193,7 @@ class MenuManager
//var_dump($canonnexturl); //var_dump($canonnexturl);
print '<ul>'."\n"; print '<ul>'."\n";
if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools'))) if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools')))
|| (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false)) || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/list.php') !== false))
{ {
// We add sub entry // We add sub entry
print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic

View File

@ -199,7 +199,7 @@ class MenuManager
//var_dump($canonnexturl); //var_dump($canonnexturl);
print '<ul>'."\n"; print '<ul>'."\n";
if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools'))) if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools')))
|| (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false)) || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/list.php') !== false))
{ {
// We add sub entry // We add sub entry
print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic

View File

@ -406,7 +406,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
if (! $err) $err+=$this->insert_module_parts(); if (! $err) $err+=$this->insert_module_parts();
// Insert constant defined by modules (into llx_const) // Insert constant defined by modules (into llx_const)
if (! $err) $err+=$this->insert_const(); if (! $err && ! preg_match('/newboxdefonly/',$options)) $err+=$this->insert_const(); // Test on newboxdefonly to avoid to erase value during upgrade
// Insert boxes def into llx_boxes_def and boxes setup (into llx_boxes) // Insert boxes def into llx_boxes_def and boxes setup (into llx_boxes)
if (! $err && ! preg_match('/noboxes/',$options)) $err+=$this->insert_boxes($options); if (! $err && ! preg_match('/noboxes/',$options)) $err+=$this->insert_boxes($options);

View File

@ -820,7 +820,7 @@ class pdf_crabe extends ModelePDFFactures
$sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; $sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
$sql.= " cp.code"; $sql.= " cp.code";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id AND cp.entity = " . getEntity('c_paiement');
$sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id; $sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id;
//$sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = 1"; //$sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = 1";
$sql.= " ORDER BY p.datep"; $sql.= " ORDER BY p.datep";

View File

@ -249,23 +249,23 @@ class modFacture extends DolibarrModules
$this->export_dependencies_array[$r] = array('payment'=>'p.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r] = array('payment'=>'p.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra'; $keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country 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.'facture as f';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid';
$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.'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_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] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pt ON pt.id = p.fk_paiement'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pt ON pt.id = p.fk_paiement AND pt.entity = ' . getEntity('c_paiement');
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON b.rowid = p.fk_bank'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON b.rowid = p.fk_bank';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON ba.rowid = b.fk_account'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON ba.rowid = b.fk_account';
$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
$this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('facture').')'; $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('facture').')';
if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id;
$r++; $r++;
} }

View File

@ -165,7 +165,7 @@ class modSalaries extends DolibarrModules
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_user = u.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_user = u.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id AND cp.entity = ' . getEntity('c_paiement');
$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('user').')'; $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('user').')';
} }

View File

@ -284,8 +284,8 @@ class modSociete extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcomm as st ON s.fk_stcomm = st.id'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcomm as st ON s.fk_stcomm = st.id';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sc.fk_user = u.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sc.fk_user = u.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid AND payterm.entity = ' . getEntity('c_payment_term');
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id AND paymode.entity = ' . getEntity('c_paiement');
$this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe').')'; $this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe').')';
if (is_object($user) && empty($user->rights->societe->client->voir)) { if (is_object($user) && empty($user->rights->societe->client->voir)) {
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' '; $this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';

View File

@ -178,69 +178,71 @@ class pdf_paiement
// number of bill // number of bill
switch ($this->doc_type) { switch ($this->doc_type) {
case "client": case "client":
$sql = "SELECT p.datep as dp, f.facnumber"; $sql = "SELECT p.datep as dp, f.facnumber";
//$sql .= ", c.libelle as paiement_type, p.num_paiement"; //$sql .= ", c.libelle as paiement_type, p.num_paiement";
$sql.= ", c.code as paiement_code, p.num_paiement"; $sql.= ", c.code as paiement_code, p.num_paiement";
$sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount"; $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount";
$sql.= ", pf.amount as pf_amount"; $sql.= ", pf.amount as pf_amount";
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
$sql.= ", ba.ref as bankaccount"; $sql.= ", ba.ref as bankaccount";
$sql.= ", p.rowid as prowid"; $sql.= ", p.rowid as prowid";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f,"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf,"; $sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf,";
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
$sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,"; $sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,";
$sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " ".MAIN_DB_PREFIX."societe as s";
if (! $user->rights->societe->client->voir && ! $socid) if (! $user->rights->societe->client->voir && ! $socid)
{ {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
} }
$sql.= " WHERE f.fk_soc = s.rowid AND pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid"; $sql.= " WHERE f.fk_soc = s.rowid AND pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
$sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid "; $sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid ";
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND p.fk_paiement = c.id "; $sql.= " AND p.fk_paiement = c.id ";
$sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'"; $sql.= " AND c.entity = " . getEntity('c_paiement');
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";
{ if (! $user->rights->societe->client->voir && ! $socid)
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; {
} $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if (! empty($socid)) $sql .= " AND s.rowid = ".$socid; }
$sql.= " ORDER BY p.datep ASC, pf.fk_paiement ASC"; if (! empty($socid)) $sql .= " AND s.rowid = ".$socid;
break; $sql.= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
case "fourn": break;
$sql = "SELECT p.datep as dp, f.ref as facnumber"; case "fourn":
//$sql .= ", c.libelle as paiement_type, p.num_paiement"; $sql = "SELECT p.datep as dp, f.ref as facnumber";
$sql.= ", c.code as paiement_code, p.num_paiement"; //$sql .= ", c.libelle as paiement_type, p.num_paiement";
$sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount"; $sql.= ", c.code as paiement_code, p.num_paiement";
$sql.= ", pf.amount as pf_amount"; $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount";
if (! empty($conf->banque->enabled)) $sql.= ", pf.amount as pf_amount";
$sql.= ", ba.ref as bankaccount"; if (! empty($conf->banque->enabled))
$sql.= ", p.rowid as prowid"; $sql.= ", ba.ref as bankaccount";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p, ".MAIN_DB_PREFIX."facture_fourn as f,"; $sql.= ", p.rowid as prowid";
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf,"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p, ".MAIN_DB_PREFIX."facture_fourn as f,";
if (! empty($conf->banque->enabled)) $sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf,";
$sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,"; if (! empty($conf->banque->enabled))
$sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " ".MAIN_DB_PREFIX."societe as s";
{ if (! $user->rights->societe->client->voir && ! $socid)
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; {
} $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.fk_soc = s.rowid AND pf.fk_facturefourn = f.rowid AND pf.fk_paiementfourn = p.rowid"; }
if (! empty($conf->banque->enabled)) $sql.= " WHERE f.fk_soc = s.rowid AND pf.fk_facturefourn = f.rowid AND pf.fk_paiementfourn = p.rowid";
$sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid "; if (! empty($conf->banque->enabled))
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid ";
$sql.= " AND p.fk_paiement = c.id "; $sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'"; $sql.= " AND p.fk_paiement = c.id ";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND c.entity = " . getEntity('c_paiement');
{ $sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (! $user->rights->societe->client->voir && ! $socid)
} {
if (! empty($socid)) $sql .= " AND s.rowid = ".$socid; $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " ORDER BY p.datep ASC, pf.fk_paiementfourn ASC"; }
break; if (! empty($socid)) $sql .= " AND s.rowid = ".$socid;
} $sql.= " ORDER BY p.datep ASC, pf.fk_paiementfourn ASC";
break;
}
dol_syslog(get_class($this)."::write_file", LOG_DEBUG); dol_syslog(get_class($this)."::write_file", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);

View File

@ -39,8 +39,5 @@ class pdf_paiement_fourn extends pdf_paiement
{ {
parent::__construct($db); parent::__construct($db);
$this->doc_type = "fourn"; $this->doc_type = "fourn";
}
} }
}

View File

@ -933,7 +933,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; $sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
$sql.= " cp.code"; $sql.= " cp.code";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX."paiementfourn as p"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX."paiementfourn as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id AND cp.entity = " . getEntity('c_paiement');
$sql.= " WHERE pf.fk_paiementfourn = p.rowid and pf.fk_facturefourn = ".$object->id; $sql.= " WHERE pf.fk_paiementfourn = p.rowid and pf.fk_facturefourn = ".$object->id;
$sql.= " ORDER BY p.datep"; $sql.= " ORDER BY p.datep";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);

View File

@ -638,6 +638,7 @@ if (! empty($id) && $action != 'edit')
$sql.= " AND p.fk_donation = d.rowid"; $sql.= " AND p.fk_donation = d.rowid";
$sql.= " AND d.entity = ".$conf->entity; $sql.= " AND d.entity = ".$conf->entity;
$sql.= " AND p.fk_typepayment = c.id"; $sql.= " AND p.fk_typepayment = c.id";
$sql.= " AND c.entity = " . getEntity('c_paiement');
$sql.= " ORDER BY dp"; $sql.= " ORDER BY dp";
//print $sql; //print $sql;

View File

@ -611,7 +611,7 @@ class Don extends CommonObject
$sql.= " c.code as country_code, c.label as country"; $sql.= " c.code as country_code, c.label as country";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_projet"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_projet";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment AND cp.entity = " . getEntity('c_paiement');
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.fk_country = c.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.fk_country = c.rowid";
if (! empty($id)) if (! empty($id))
{ {

View File

@ -175,6 +175,7 @@ class PaymentDonation extends CommonObject
$sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as pt, ".MAIN_DB_PREFIX."payment_donation as t)"; $sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as pt, ".MAIN_DB_PREFIX."payment_donation as t)";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
$sql.= " WHERE t.rowid = ".$id." AND t.fk_typepayment = pt.id"; $sql.= " WHERE t.rowid = ".$id." AND t.fk_typepayment = pt.id";
$sql.= " AND pt.entity = " . getEntity('c_paiement');
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);

View File

@ -1439,7 +1439,7 @@ else if ($id || $ref)
} }
// Shipment card // Shipment card
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer shipment // Ref customer shipment
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1);

View File

@ -1486,14 +1486,15 @@ class Expedition extends CommonObject
/** /**
* Return clicable link of object (with eventually picto) * Return clicable link of object (with eventually picto)
* *
* @param int $withpicto Add picto into link * @param int $withpicto Add picto into link
* @param int $option Where point the link * @param int $option Where point the link
* @param int $max Max length to show * @param int $max Max length to show
* @param int $short Use short labels * @param int $short Use short labels
* @param int $notooltip 1=No tooltip * @param int $notooltip 1=No tooltip
* @return string String with URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option=0,$max=0,$short=0,$notooltip=0) function getNomUrl($withpicto=0, $option=0, $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
{ {
global $langs; global $langs;
@ -1506,6 +1507,14 @@ class Expedition extends CommonObject
if ($short) return $url; if ($short) return $url;
if ($option !== 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$linkclose=''; $linkclose='';
if (empty($notooltip)) if (empty($notooltip))
{ {

View File

@ -160,7 +160,7 @@ if ($id > 0 || ! empty($ref))
// Shipment card // Shipment card
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer shipment // Ref customer shipment

View File

@ -42,9 +42,10 @@ $result = restrictedArea($user, 'expedition',$expeditionid,'');
$diroutputmassaction=$conf->expedition->dir_output . '/temp/massgeneration/'.$user->id; $diroutputmassaction=$conf->expedition->dir_output . '/temp/massgeneration/'.$user->id;
$search_ref_exp = GETPOST("search_ref_exp"); $search_ref_exp = GETPOST("search_ref_exp", 'alpha');
$search_ref_liv = GETPOST('search_ref_liv'); $search_ref_liv = GETPOST('search_ref_liv', 'alpha');
$search_company = GETPOST("search_company"); $search_ref_customer = GETPOST('search_ref_customer', 'alpha');
$search_company = GETPOST("search_company", 'alpha');
$search_town=GETPOST('search_town','alpha'); $search_town=GETPOST('search_town','alpha');
$search_zip=GETPOST('search_zip','alpha'); $search_zip=GETPOST('search_zip','alpha');
$search_state=trim(GETPOST("search_state")); $search_state=trim(GETPOST("search_state"));
@ -133,6 +134,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
{ {
$search_ref_exp=''; $search_ref_exp='';
$search_ref_liv=''; $search_ref_liv='';
$search_ref_customer='';
$search_company=''; $search_company='';
$search_town=''; $search_town='';
$search_zip=""; $search_zip="";
@ -213,6 +215,7 @@ if ($socid)
if ($viewstatut <> '' && $viewstatut >= 0) { if ($viewstatut <> '' && $viewstatut >= 0) {
$sql.= " AND e.fk_statut = ".$viewstatut; $sql.= " AND e.fk_statut = ".$viewstatut;
} }
if ($search_ref_customer != '') $sql.=natural_search('e.ref_customer', $search_ref_customer);
if ($search_billed != '' && $search_billed >= 0) $sql.=' AND e.billed = '.$search_billed; if ($search_billed != '' && $search_billed >= 0) $sql.=' AND e.billed = '.$search_billed;
if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
@ -262,13 +265,14 @@ if ($resql)
$expedition = new Expedition($db); $expedition = new Expedition($db);
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.= "&amp;sall=".$sall; if ($sall) $param.= "&amp;sall=".urlencode($sall);
if ($search_ref_exp) $param.= "&amp;search_ref_exp=".$search_ref_exp; if ($search_ref_exp) $param.= "&amp;search_ref_exp=".urlencode($search_ref_exp);
if ($search_ref_liv) $param.= "&amp;search_ref_liv=".$search_ref_liv; if ($search_ref_liv) $param.= "&amp;search_ref_liv=".urlencode($search_ref_liv);
if ($search_company) $param.= "&amp;search_company=".$search_company; if ($search_ref_customer) $param.= "&amp;search_ref_customer=".urlencode($search_ref_customer);
if ($optioncss != '') $param.='&amp;optioncss='.$optioncss; if ($search_company) $param.= "&amp;search_company=".urlencode($search_company);
if ($optioncss != '') $param.='&amp;optioncss='.urlencode($optioncss);
// Add $param from extra fields // Add $param from extra fields
foreach ($search_array_options as $key => $val) foreach ($search_array_options as $key => $val)
{ {

View File

@ -102,7 +102,7 @@ if ($id > 0 || ! empty($ref))
// Shipment card // Shipment card
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer shipment // Ref customer shipment

Some files were not shown because too many files have changed in this diff Show More