diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 30f8090eb01..2906b1d905b 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -1621,9 +1621,10 @@ class Adherent /** * \brief Renvoie nom clicable (avec eventuellement le picto) * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * \param maxlen Longueur max libelle * \return string Chaine avec URL */ - function getNomUrl($withpicto=0) + function getNomUrl($withpicto=0,$maxlen=0) { global $langs; @@ -1637,7 +1638,7 @@ class Adherent if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; - $result.=$lien.$this->ref.$lienfin; + $result.=$lien.($maxlen?dolibarr_trunc($this->ref,$maxlen):$this->ref).$lienfin; return $result; } diff --git a/htdocs/chargesociales.class.php b/htdocs/chargesociales.class.php index c05689ecf53..0cddc16798e 100644 --- a/htdocs/chargesociales.class.php +++ b/htdocs/chargesociales.class.php @@ -244,9 +244,10 @@ class ChargeSociales /** * \brief Renvoie nom clicable (avec eventuellement le picto) * \param withpicto Inclut le picto dans le lien + * \param maxlen Longueur max libelle * \return string Chaine avec URL */ - function getNomUrl($withpicto=0) + function getNomUrl($withpicto=0,$maxlen=0) { global $langs; @@ -256,7 +257,7 @@ class ChargeSociales $lienfin=''; if ($withpicto) $result.=($lien.img_object($langs->trans("ShowBill"),'bill').$lienfin.' '); - $result.=$lien.$this->lib.$lienfin; + $result.=$lien.($maxlen?dolibarr_trunc($this->lib,$maxlen):$this->lib).$lienfin; return $result; } diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 0b144fdbd48..3c80d159ad9 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -32,6 +32,9 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/societe.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); +require_once(DOL_DOCUMENT_ROOT."/chargesociales.class.php"); if (!$user->rights->banque->lire) accessforbidden(); @@ -105,6 +108,9 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"]=='yes' && $user->r */ llxHeader(); +$societestatic=new Societe($db); +$chargestatic=new ChargeSociales($db); +$memberstatic=new Adherent($db); $html = new Form($db); @@ -119,7 +125,7 @@ if ($account > 0) $viewline = 20; } $acct = new Account($db); - $acct->fetch($account); + $result=$acct->fetch($account); // Chargement des categories bancaires dans $options $nbcategories=0; @@ -148,22 +154,40 @@ if ($account > 0) * * */ - $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."bank as b"; - $sql .= " WHERE b.fk_account=".$acct->id; + + // Definition de sql_rech $sql_rech=""; + $mode_search = 0; if ($_POST["req_desc"]) { $sql_rech .= " AND b.label like '%".strtolower($_POST["req_desc"])."%'"; $mode_search = 1; } - else + if ($_POST["req_debit"]) { - $mode_search = 0; + $sql_rech.=" AND amount = -".$_POST["req_debit"]; + $mode_search = 1; + } + if ($_POST["req_credit"]) + { + $sql_rech.=" AND amount = ".$_POST["req_credit"]; + $mode_search = 1; + } + if ($_POST["thirdparty"]) + { + $sql_rech.=" AND (IFNULL(s.nom,'bidon') like '%".$_POST["thirdparty"]."%')"; + $mode_search = 1; } - if ($_POST["req_debit"]) $sql_rech.=" AND amount = -".$_POST["req_debit"]; - if ($_POST["req_credit"]) $sql_rech.=" AND amount = ".$_POST["req_credit"]; - $sql .= $sql_rech; + $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."bank as b"; + if ($mode_search) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND bu.type='company'"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.idp"; + } + $sql.= " WHERE b.fk_account=".$acct->id; + $sql.= $sql_rech; + dolibarr_syslog("account.php count transactions - sql=".$sql); $result=$db->query($sql); if ($result) { @@ -201,7 +225,6 @@ if ($account > 0) $limitsql = $nbline; } - // Onglets $head=bank_prepare_head($acct); dolibarr_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0); @@ -245,22 +268,20 @@ if ($account > 0) // Formulaire de saisie d'une opération hors factures if ($user->rights->banque->modifier && $_GET["action"]=='addline') { - $html=new Form($db); - print '