diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index 43265aefe0e..2233447b3be 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -30,15 +30,16 @@ require("./pre.inc.php"); -if (!$user->rights->societe->lire) accessforbidden(); - $langs->load("companies"); -llxHeader('','Contacts'); - $sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; $sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; $page=$_GET["page"]; +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="p.name"; +if ($page < 0) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; $socid=$_GET["socid"]; $type=$_GET["type"]; @@ -52,13 +53,11 @@ if ($user->societe_id > 0) $action = ''; $socid = $user->societe_id; } +if (!$user->rights->societe->lire) accessforbidden(); -if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="p.name"; -if ($page < 0) { $page = 0 ; } -$limit = $conf->liste_limit; -$offset = $limit * $page ; + +llxHeader('','Contacts'); if ($type == "c") @@ -139,18 +138,18 @@ if ($result) { $num = $db->num_rows(); - print_barre_liste($langs->trans("ListOfContacts").($label?" (".$label.")":""),$page, "contact.php", "&type=$type",$sortfield,$sortorder,"",$num); + print_barre_liste($langs->trans("ListOfContacts").($label?" (".$label.")":""),$page, $_SERVER["PHP_SELF"], "&type=$type",$sortfield,$sortorder,"",$num); print ''; print ''; - print_liste_field_titre($langs->trans("Lastname"),"contact.php","p.name", $begin,"&type=$type","",$sortfield); - print_liste_field_titre($langs->trans("Firstname"),"contact.php","p.firstname", $begin,"&type=$type","",$sortfield); - print_liste_field_titre($langs->trans("Company"),"contact.php","s.nom", $begin,"&type=$type","",$sortfield); + print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.name", $begin,"&type=$type","",$sortfield); + print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin,"&type=$type","",$sortfield); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", $begin,"&type=$type","",$sortfield); print ''; print ''; print "\n"; - print ''; + print ''; print ''; print ''; print ''; @@ -173,7 +172,7 @@ if ($result) print ' '.$obj->name.''; print ""; - print '\n"; print ''; diff --git a/htdocs/compta/bank/account.class.php b/htdocs/compta/bank/account.class.php index a1d0bd4a831..c0bee43c2cd 100644 --- a/htdocs/compta/bank/account.class.php +++ b/htdocs/compta/bank/account.class.php @@ -856,6 +856,19 @@ class AccountLine } } + function getNomUrl($withpicto=0) + { + global $langs; + + $result=''; + + $lien = ''; + $lienfin=''; + + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowTransaction"),'account').$lienfin.' '); + $result.=$lien.$this->rowid.$lienfin; + return $result; + } } ?> diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index 777572e3360..be3426024d0 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -40,17 +40,27 @@ $langs->load('companies'); $mesg=''; +$sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; +$sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; +$page=$_GET["page"]; +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="b.emetteur"; +if ($page < 0) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; + + /* * Actions */ if ($_GET['action'] == 'create' && $_GET["accountid"] > 0 && $user->rights->banque) { - $remise = new RemiseCheque($db); - $result = $remise->Create($user, $_GET["accountid"]); + $remisecheque = new RemiseCheque($db); + $result = $remisecheque->Create($user, $_GET["accountid"]); if ($result === 0) { - Header("Location: fiche.php?id=".$remise->id); + Header("Location: fiche.php?id=".$remisecheque->id); exit; } else @@ -61,12 +71,12 @@ if ($_GET['action'] == 'create' && $_GET["accountid"] > 0 && $user->rights->banq if ($_GET['action'] == 'remove' && $_GET["id"] > 0 && $_GET["lineid"] > 0 && $user->rights->banque) { - $remise = new RemiseCheque($db); - $remise->id = $_GET["id"]; - $result = $remise->RemoveCheck($_GET["lineid"]); + $remisecheque = new RemiseCheque($db); + $remisecheque->id = $_GET["id"]; + $result = $remisecheque->RemoveCheck($_GET["lineid"]); if ($result === 0) { - Header("Location: fiche.php?id=".$remise->id); + Header("Location: fiche.php?id=".$remisecheque->id); exit; } else @@ -77,9 +87,9 @@ if ($_GET['action'] == 'remove' && $_GET["id"] > 0 && $_GET["lineid"] > 0 && $us if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->banque) { - $remise = new RemiseCheque($db); - $remise->id = $_GET["id"]; - $result = $remise->Delete(); + $remisecheque = new RemiseCheque($db); + $remisecheque->id = $_GET["id"]; + $result = $remisecheque->Delete(); if ($result == 0) { Header("Location: index.php"); @@ -93,12 +103,12 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user- if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->banque) { - $remise = new RemiseCheque($db); - $remise->Fetch($_GET["id"]); - $result = $remise->Validate($user); + $remisecheque = new RemiseCheque($db); + $remisecheque->Fetch($_GET["id"]); + $result = $remisecheque->Validate($user); if ($result == 0) { - Header("Location: fiche.php?id=".$remise->id); + Header("Location: fiche.php?id=".$remisecheque->id); exit; } else @@ -109,12 +119,12 @@ if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user- if ($_POST['action'] == 'builddoc' && $user->rights->banque) { - $remise = new RemiseCheque($db); - $result = $remise->Fetch($_GET["id"]); + $remisecheque = new RemiseCheque($db); + $result = $remisecheque->Fetch($_GET["id"]); if ($result == 0) { - $result = $remise->GeneratePdf($_POST["model"]); - Header("Location: fiche.php?id=".$remise->id); + $result = $remisecheque->GeneratePdf($_POST["model"]); + Header("Location: fiche.php?id=".$remisecheque->id); exit; } else @@ -142,8 +152,8 @@ if ($_GET['action'] == 'new') } else { - $remise = new RemiseCheque($db); - $result = $remise->Fetch($_GET["id"]); + $remisecheque = new RemiseCheque($db); + $result = $remisecheque->Fetch($_GET["id"]); $h=0; $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/cheque/fiche.php?id='.$_GET["id"]; @@ -161,7 +171,7 @@ else */ if ($_GET['action'] == 'delete') { - $html->form_confirm('fiche.php?id='.$remise->id, $langs->trans("DeleteCheckReceipt"), 'Etes-vous sūr de vouloir supprimer ce bordereau ?', 'confirm_delete'); + $html->form_confirm('fiche.php?id='.$remisecheque->id, $langs->trans("DeleteCheckReceipt"), 'Etes-vous sūr de vouloir supprimer ce bordereau ?', 'confirm_delete'); print '
'; } @@ -171,7 +181,7 @@ else if ($_GET['action'] == 'valide') { $facid = $_GET['facid']; - $html->form_confirm('fiche.php?id='.$remise->id, $langs->trans("ValidateCheckReceipt"), 'Etes-vous sūr de vouloir valider ce bordereau, auncune modification n\'est possible une fois le bordereau validé ?', 'confirm_valide'); + $html->form_confirm('fiche.php?id='.$remisecheque->id, $langs->trans("ValidateCheckReceipt"), 'Etes-vous sūr de vouloir valider ce bordereau, auncune modification n\'est possible une fois le bordereau validé ?', 'confirm_valide'); print '
'; } } @@ -262,44 +272,49 @@ if ($_GET['action'] == 'new') } else { + $paymentstatic=new Paiement($db); + $accountlinestatic=new AccountLine($db); $accountstatic=new Account($db); - $accountstatic->id=$remise->account_id; - $accountstatic->label=$remise->account_label; + $accountstatic->id=$remisecheque->account_id; + $accountstatic->label=$remisecheque->account_label; - $remise->load_previous_next_id(); - $previous_id = $remise->previous_id ? ''.img_previous().'':''; - $next_id = $remise->next_id ? ''.img_next().'':''; + $remisecheque->load_previous_next_id(); + $previous_id = $remisecheque->previous_id ? ''.img_previous().'':''; + $next_id = $remisecheque->next_id ? ''.img_next().'':''; print '
'.$langs->trans("Email").''.$langs->trans("Phone").'
$obj->firstname'.img_object($langs->trans("ShowCompany"),"company").' '; + print ''.img_object($langs->trans("ShowCompany"),"company").' '; print "idp\">$obj->nom'.$obj->email.' 
'; print '"; print "\n"; - print ''; + print ''; print ''; print ''; print '
'.$langs->trans('Numero').''; if ($previous_id || $next_id) print '
'; // print ''; - print $remise->number; + print $remisecheque->number; //print $previous_id.' '.$next_id; if ($previous_id || $next_id) print ''.$previous_id.''.$next_id.'
'; print "
'.$langs->trans('Date').''.dolibarr_print_date($remise->date_bordereau).'
'.$langs->trans('Date').''.dolibarr_print_date($remisecheque->date_bordereau).'
'.$langs->trans('Account').''; print $accountstatic->getNomUrl(1); print '
'.$langs->trans('Total').''; - print price($remise->amount); + print price($remisecheque->amount); print '

'; - $sql = "SELECT b.amount,b.emetteur,".$db->pdate("b.dateo")." as date,b.rowid,b.banque,"; - $sql.= " ba.rowid as bid, ba.label"; + + // Liste des cheques + $sql = "SELECT b.rowid,b.amount,"; + $sql.= " b.num_chq,b.emetteur,".$db->pdate("b.dateo")." as date,b.banque,"; + $sql.= " p.rowid as pid"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; - $sql.= ",".MAIN_DB_PREFIX."bank_account as ba"; - $sql.= " WHERE b.fk_type= 'CHQ' AND b.fk_account = ba.rowid"; - $sql.= " AND b.fk_bordereau = ".$remise->id; - $sql.= " ORDER BY b.emetteur ASC, b.rowid ASC"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid"; + $sql.= " WHERE b.fk_type= 'CHQ'"; + $sql.= " AND b.fk_bordereau = ".$remisecheque->id; + $sql.= " ORDER BY $sortfield $sortorder"; $resql = $db->query($sql); @@ -308,10 +323,17 @@ else $num = $db->num_rows($resql); print ''; - print ''; - print ''; - print ''; - print ''; + + $param="&id=".$remisecheque->id; + print ''; + ''; + print ''; + print_liste_field_titre($langs->trans("Num"),$_SERVER["PHP_SELF"],"b.num_chq", "",$param,'align="center"',$sortfield); + print_liste_field_titre($langs->trans("CheckTransmitter"),$_SERVER["PHP_SELF"],"b.emetteur", "",$param,"",$sortfield); + print_liste_field_titre($langs->trans("Bank"),$_SERVER["PHP_SELF"],"b.banque", "",$param,"",$sortfield); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"b.amount", "",$param,'align="right"',$sortfield); + print_liste_field_titre($langs->trans("LineRecord"),$_SERVER["PHP_SELF"],"b.rowid", "",$param,'align="center"',$sortfield); + print_liste_field_titre($langs->trans("DateOperation"),$_SERVER["PHP_SELF"],"b.dateo", "",$param,'align="center"',$sortfield); print "\n"; $i=1; $var=false; @@ -320,13 +342,27 @@ else $account_id = $objp->bid; $accounts[$objp->bid] += 1; - print ""; - print ''; - print ''; + print ""; + print ''; + print ''; + print ''; + print ''; print ''; - if($remise->statut == 0) + print ''; + print $accountlinestatic->getNomUrl(1); + } + else + { + print ' '; + } + print ''; + print ''; + if($remisecheque->statut == 0) + { + print ''; } else { @@ -349,10 +385,10 @@ print ''; if ($_GET['action'] != 'new') { - if ($remise->statut == 1) + if ($remisecheque->statut == 1) { //show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0); - $dir = DOL_DATA_ROOT.'/compta/bordereau/'.get_exdir($remise->number); + $dir = DOL_DATA_ROOT.'/compta/bordereau/'.get_exdir($remisecheque->number); $gen = array('Blochet'); $html->show_documents("remisecheque","",$dir,'',$gen,0); } @@ -369,12 +405,12 @@ if ($user->societe_id == 0 && sizeof($accounts) == 1 && $_GET['action'] == 'new' print ''.$langs->trans('NewCheckReceipt').''; } -if ($user->societe_id == 0 && $remise->statut == 0 && $_GET['action'] == '') +if ($user->societe_id == 0 && $remisecheque->statut == 0 && $_GET['action'] == '') { print ''.$langs->trans('Valid').''; } -if ($user->societe_id == 0 && $remise->statut == 0 && $_GET['action'] == '') +if ($user->societe_id == 0 && $remisecheque->statut == 0 && $_GET['action'] == '') { print ''.$langs->trans('Delete').'';
#'.$langs->trans("CheckTransmitter").''.$langs->trans("Bank").''.$langs->trans("Amount").'
'.$langs->trans("Num").'  
$i'.$objp->emetteur.''.$objp->banque.'
'.$i.''.$objp->num_chq.''.dolibarr_trunc($objp->emetteur,24).''.dolibarr_trunc($objp->banque,24).''.price($objp->amount).''; + $accountlinestatic->rowid=$objp->rowid; + if ($accountlinestatic->rowid) { - print ''.img_delete().''.dolibarr_print_date($objp->date).''.img_delete().'