mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix: Mise au format unix de fichier php
This commit is contained in:
parent
e02f80ea23
commit
3a74b33a8a
|
|
@ -1,481 +1,481 @@
|
|||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/index.php
|
||||
\ingroup compta
|
||||
\brief Page accueil zone comptabilité
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$user->getrights(); // On a besoin des permissions sur plusieurs modules
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
|
||||
// Sécurité accés client
|
||||
$socidp='';
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
llxHeader("",$langs->trans("AccountancyTreasuryArea"));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (isset($_GET["action"]) && $_GET["action"] == 'add_bookmark')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$socidp." AND fk_user=".$user->id;
|
||||
if (! $db->query($sql) )
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");";
|
||||
if (! $db->query($sql) )
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET["action"]) && $_GET["action"] == 'del_bookmark')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE rowid=".$_GET["bid"];
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Affichage page
|
||||
*
|
||||
*/
|
||||
print_fiche_titre($langs->trans("AccountancyTreasuryArea"));
|
||||
|
||||
print '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||
|
||||
print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
||||
|
||||
/*
|
||||
* Zone recherche facture
|
||||
*/
|
||||
if ($conf->facture->enabled) {
|
||||
print '<form method="post" action="facture.php">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td colspan="3">'.$langs->trans("SearchABill").'</td></tr>';
|
||||
print "<tr $bc[0]><td>".$langs->trans("Ref").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>';
|
||||
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print "<tr $bc[0]><td>".$langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="18"></td>';
|
||||
print '</tr>';
|
||||
print "</table></form><br>";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Factures brouillons
|
||||
*/
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
{
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom, s.idp";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE s.idp = f.fk_soc AND f.fk_statut = 0";
|
||||
|
||||
if ($socidp)
|
||||
{
|
||||
$sql .= " AND f.fk_soc = $socidp";
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("DraftBills").' ('.$num.')</td></tr>';
|
||||
$i = 0;
|
||||
$tot_ttc = 0;
|
||||
$var = True;
|
||||
while ($i < $num && $i < 20)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td nowrap><a href="facture.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a></td>';
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,20).'</a></td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
$tot_ttc+=$obj->total_ttc;
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2" align="left">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($tot_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table><br>";
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Charges a payer
|
||||
*/
|
||||
if ($conf->compta->enabled)
|
||||
{
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
|
||||
$sql = "SELECT c.rowid, c.amount, cc.libelle";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as c, ".MAIN_DB_PREFIX."c_chargesociales as cc";
|
||||
$sql .= " WHERE c.fk_type = cc.id AND c.paye=0";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("ContributionsToPay").' ('.$num.')</td></tr>';
|
||||
$i = 0;
|
||||
$tot_ttc=0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->libelle.'</td>';
|
||||
print '<td align="right">'.price($obj->amount).'</td>';
|
||||
print '</tr>';
|
||||
$tot_ttc+=$obj->amount;
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td align="left">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($tot_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table><br>';
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Bookmark
|
||||
*/
|
||||
$sql = "SELECT s.idp, s.nom,b.rowid as bid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."bookmark as b";
|
||||
$sql .= " WHERE b.fk_soc = s.idp AND b.fk_user = ".$user->id;
|
||||
$sql .= " ORDER BY lower(s.nom) ASC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\"><td colspan=\"2\">".$langs->trans("Bookmarks")."</td></tr>\n";
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
|
||||
print '<td align="right"><a href="index.php?action=del_bookmark&bid='.$obj->bid.'">'.img_delete().'</a></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
||||
|
||||
|
||||
/*
|
||||
* Commandes à facturer
|
||||
*/
|
||||
if ($conf->commande->enabled && $user->rights->commande->lire)
|
||||
{
|
||||
$langs->load("orders");
|
||||
|
||||
$sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc";
|
||||
$sql .= " ,s.nom, s.idp, p.rowid, p.ref, p.total_ht, p.total_ttc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande AS p, llx_societe AS s";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."co_fa AS co_fa ON co_fa.fk_commande = p.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture AS f ON co_fa.fk_facture = f.rowid";
|
||||
$sql .= " WHERE p.fk_soc = s.idp";
|
||||
if ($socidp)
|
||||
{
|
||||
$sql .= " AND p.fk_soc = $socidp";
|
||||
}
|
||||
$sql .= " AND p.fk_statut >=1 AND p.facture=0";
|
||||
$sql .= " GROUP BY p.rowid";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td colspan="2">'.$langs->trans("OrdersToBill").' ('.$num.')</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("ToBill").'</td>';
|
||||
print '</tr>';
|
||||
$var = True;
|
||||
$tot_ht=$tot_ttc=$tot_tobill=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
// if ($obj->total_ttc-$obj->tot_fttc >0)
|
||||
// {
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td width=\"20%\"><a href=\"commande/fiche.php?id=$obj->rowid\">".img_object($langs->trans("ShowOrder"),"order").'</a> ';
|
||||
print "<a href=\"commande/fiche.php?id=$obj->rowid\">".$obj->ref.'</a></td>';
|
||||
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").'</a> ';
|
||||
print '<a href="fiche.php?socid='.$obj->idp.'">'.dolibarr_trunc($obj->nom,50).'</a></td>';
|
||||
print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc-$obj->tot_fttc).'</td></tr>';
|
||||
$tot_ht += $obj->total_ht;
|
||||
$tot_ttc += $obj->total_ttc;
|
||||
$tot_tobill += ($obj->total_ttc-$obj->tot_fttc);
|
||||
// }
|
||||
$i++;
|
||||
}
|
||||
$var=!$var;
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToBill").': '.price($tot_tobill).')</font> </td>';
|
||||
print '<td align="right">'.price($tot_ht).'</td>';
|
||||
print '<td align="right">'.price($tot_ttc).'</td>';
|
||||
print '<td align="right">'.price($tot_tobill).'</td>';
|
||||
print '</tr>';
|
||||
print '</table><br>';
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
{
|
||||
|
||||
/*
|
||||
* Factures impayées
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp, f.total, f.total_ttc, ".$db->pdate("f.date_lim_reglement")." as datelimite, sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||
$sql.= " WHERE s.idp = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1";
|
||||
if ($socidp) $sql .= " AND f.fk_soc = $socidp";
|
||||
$sql.= " GROUP BY f.facnumber, f.rowid, s.nom, s.idp, f.total, f.total_ttc";
|
||||
$sql.= " ORDER BY f.datef ASC ";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsCustomersUnpayed").' ('.$num.')</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountHT").'</td><td align="right">'.$langs->trans("AmountTTC").'</td><td align="right">'.$langs->trans("Received").'</td></tr>';
|
||||
$var = True;
|
||||
$total_ttc = $totalam = $total = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($i < $conf->liste_limit)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td nowrap><a href="facture.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a>';
|
||||
if ($obj->datelimite < (time() - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCustomer"),"company").' '.dolibarr_trunc($obj->nom,44).'</a></td>';
|
||||
print '<td align="right">'.price($obj->total).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="right">'.price($obj->am).'</td></tr>';
|
||||
}
|
||||
$total_ttc += $obj->total_ttc;
|
||||
$total += $obj->total;
|
||||
$totalam += $obj->am;
|
||||
$i++;
|
||||
}
|
||||
$var=!$var;
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToTake").': '.price($total_ttc-$totalam).')</font> </td>';
|
||||
print '<td align="right">'.price($total).'</td>';
|
||||
print '<td align="right">'.price($total_ttc).'</td>';
|
||||
print '<td align="right">'.price($totalam).'</td>';
|
||||
print '</tr>';
|
||||
print '</table><br>';
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// \todo Mettre ici recup des actions en rapport avec la compta
|
||||
$resql = 0;
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("TasksToDo").'</td>';
|
||||
print "</tr>\n";
|
||||
$var = True;
|
||||
$i = 0;
|
||||
while ($i < $db->num_rows($resql) )
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]><td>".strftime("%d %b %Y",$obj->da)."</td><td><a href=\"action/fiche.php\">$obj->libelle $obj->label</a></td></tr>";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
print "</table><br>";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Factures a payer
|
||||
*/
|
||||
if ($conf->facture->enabled) {
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
$sql = "SELECT ff.rowid, ff.facnumber, ff.libelle, ff.total_ht, ff.total_ttc, s.nom, s.idp";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
$sql .= " WHERE s.idp = ff.fk_soc";
|
||||
$sql .= " AND ff.paye=0";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsSuppliersUnpayed").' ('.$num.')</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td></tr>';
|
||||
print "</tr>\n";
|
||||
$i = 0;
|
||||
$var = True;
|
||||
$total = $total_ttc = $totalam = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'><td><a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a></td>';
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowSupplier"),"company").' '.dolibarr_trunc($obj->nom,50).'</a></td>';
|
||||
print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
$total += $obj->total_ht;
|
||||
$total_ttc += $obj->total_ttc;
|
||||
$totalam += $obj->am;
|
||||
$i++;
|
||||
}
|
||||
$var=!$var;
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToPay").': '.price($total_ttc-$totalam).')</font> </td>';
|
||||
print '<td align="right">'.price($total).'</td>';
|
||||
print '<td align="right">'.price($total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
print '</table><br>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/index.php
|
||||
\ingroup compta
|
||||
\brief Page accueil zone comptabilité
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$user->getrights(); // On a besoin des permissions sur plusieurs modules
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
|
||||
// Sécurité accés client
|
||||
$socidp='';
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
llxHeader("",$langs->trans("AccountancyTreasuryArea"));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (isset($_GET["action"]) && $_GET["action"] == 'add_bookmark')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$socidp." AND fk_user=".$user->id;
|
||||
if (! $db->query($sql) )
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");";
|
||||
if (! $db->query($sql) )
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET["action"]) && $_GET["action"] == 'del_bookmark')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE rowid=".$_GET["bid"];
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Affichage page
|
||||
*
|
||||
*/
|
||||
print_fiche_titre($langs->trans("AccountancyTreasuryArea"));
|
||||
|
||||
print '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||
|
||||
print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
||||
|
||||
/*
|
||||
* Zone recherche facture
|
||||
*/
|
||||
if ($conf->facture->enabled) {
|
||||
print '<form method="post" action="facture.php">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td colspan="3">'.$langs->trans("SearchABill").'</td></tr>';
|
||||
print "<tr $bc[0]><td>".$langs->trans("Ref").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>';
|
||||
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print "<tr $bc[0]><td>".$langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="18"></td>';
|
||||
print '</tr>';
|
||||
print "</table></form><br>";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Factures brouillons
|
||||
*/
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
{
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom, s.idp";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE s.idp = f.fk_soc AND f.fk_statut = 0";
|
||||
|
||||
if ($socidp)
|
||||
{
|
||||
$sql .= " AND f.fk_soc = $socidp";
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("DraftBills").' ('.$num.')</td></tr>';
|
||||
$i = 0;
|
||||
$tot_ttc = 0;
|
||||
$var = True;
|
||||
while ($i < $num && $i < 20)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td nowrap><a href="facture.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a></td>';
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,20).'</a></td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
$tot_ttc+=$obj->total_ttc;
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2" align="left">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($tot_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table><br>";
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Charges a payer
|
||||
*/
|
||||
if ($conf->compta->enabled)
|
||||
{
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
|
||||
$sql = "SELECT c.rowid, c.amount, cc.libelle";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as c, ".MAIN_DB_PREFIX."c_chargesociales as cc";
|
||||
$sql .= " WHERE c.fk_type = cc.id AND c.paye=0";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("ContributionsToPay").' ('.$num.')</td></tr>';
|
||||
$i = 0;
|
||||
$tot_ttc=0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->libelle.'</td>';
|
||||
print '<td align="right">'.price($obj->amount).'</td>';
|
||||
print '</tr>';
|
||||
$tot_ttc+=$obj->amount;
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td align="left">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($tot_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table><br>';
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Bookmark
|
||||
*/
|
||||
$sql = "SELECT s.idp, s.nom,b.rowid as bid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."bookmark as b";
|
||||
$sql .= " WHERE b.fk_soc = s.idp AND b.fk_user = ".$user->id;
|
||||
$sql .= " ORDER BY lower(s.nom) ASC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\"><td colspan=\"2\">".$langs->trans("Bookmarks")."</td></tr>\n";
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
|
||||
print '<td align="right"><a href="index.php?action=del_bookmark&bid='.$obj->bid.'">'.img_delete().'</a></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
||||
|
||||
|
||||
/*
|
||||
* Commandes à facturer
|
||||
*/
|
||||
if ($conf->commande->enabled && $user->rights->commande->lire)
|
||||
{
|
||||
$langs->load("orders");
|
||||
|
||||
$sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc";
|
||||
$sql .= " ,s.nom, s.idp, p.rowid, p.ref, p.total_ht, p.total_ttc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande AS p, llx_societe AS s";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."co_fa AS co_fa ON co_fa.fk_commande = p.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture AS f ON co_fa.fk_facture = f.rowid";
|
||||
$sql .= " WHERE p.fk_soc = s.idp";
|
||||
if ($socidp)
|
||||
{
|
||||
$sql .= " AND p.fk_soc = $socidp";
|
||||
}
|
||||
$sql .= " AND p.fk_statut >=1 AND p.facture=0";
|
||||
$sql .= " GROUP BY p.rowid";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td colspan="2">'.$langs->trans("OrdersToBill").' ('.$num.')</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("ToBill").'</td>';
|
||||
print '</tr>';
|
||||
$var = True;
|
||||
$tot_ht=$tot_ttc=$tot_tobill=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
// if ($obj->total_ttc-$obj->tot_fttc >0)
|
||||
// {
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td width=\"20%\"><a href=\"commande/fiche.php?id=$obj->rowid\">".img_object($langs->trans("ShowOrder"),"order").'</a> ';
|
||||
print "<a href=\"commande/fiche.php?id=$obj->rowid\">".$obj->ref.'</a></td>';
|
||||
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").'</a> ';
|
||||
print '<a href="fiche.php?socid='.$obj->idp.'">'.dolibarr_trunc($obj->nom,50).'</a></td>';
|
||||
print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc-$obj->tot_fttc).'</td></tr>';
|
||||
$tot_ht += $obj->total_ht;
|
||||
$tot_ttc += $obj->total_ttc;
|
||||
$tot_tobill += ($obj->total_ttc-$obj->tot_fttc);
|
||||
// }
|
||||
$i++;
|
||||
}
|
||||
$var=!$var;
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToBill").': '.price($tot_tobill).')</font> </td>';
|
||||
print '<td align="right">'.price($tot_ht).'</td>';
|
||||
print '<td align="right">'.price($tot_ttc).'</td>';
|
||||
print '<td align="right">'.price($tot_tobill).'</td>';
|
||||
print '</tr>';
|
||||
print '</table><br>';
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
{
|
||||
|
||||
/*
|
||||
* Factures impayées
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp, f.total, f.total_ttc, ".$db->pdate("f.date_lim_reglement")." as datelimite, sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||
$sql.= " WHERE s.idp = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1";
|
||||
if ($socidp) $sql .= " AND f.fk_soc = $socidp";
|
||||
$sql.= " GROUP BY f.facnumber, f.rowid, s.nom, s.idp, f.total, f.total_ttc";
|
||||
$sql.= " ORDER BY f.datef ASC ";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsCustomersUnpayed").' ('.$num.')</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountHT").'</td><td align="right">'.$langs->trans("AmountTTC").'</td><td align="right">'.$langs->trans("Received").'</td></tr>';
|
||||
$var = True;
|
||||
$total_ttc = $totalam = $total = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($i < $conf->liste_limit)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td nowrap><a href="facture.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a>';
|
||||
if ($obj->datelimite < (time() - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCustomer"),"company").' '.dolibarr_trunc($obj->nom,44).'</a></td>';
|
||||
print '<td align="right">'.price($obj->total).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="right">'.price($obj->am).'</td></tr>';
|
||||
}
|
||||
$total_ttc += $obj->total_ttc;
|
||||
$total += $obj->total;
|
||||
$totalam += $obj->am;
|
||||
$i++;
|
||||
}
|
||||
$var=!$var;
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToTake").': '.price($total_ttc-$totalam).')</font> </td>';
|
||||
print '<td align="right">'.price($total).'</td>';
|
||||
print '<td align="right">'.price($total_ttc).'</td>';
|
||||
print '<td align="right">'.price($totalam).'</td>';
|
||||
print '</tr>';
|
||||
print '</table><br>';
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// \todo Mettre ici recup des actions en rapport avec la compta
|
||||
$resql = 0;
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("TasksToDo").'</td>';
|
||||
print "</tr>\n";
|
||||
$var = True;
|
||||
$i = 0;
|
||||
while ($i < $db->num_rows($resql) )
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]><td>".strftime("%d %b %Y",$obj->da)."</td><td><a href=\"action/fiche.php\">$obj->libelle $obj->label</a></td></tr>";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
print "</table><br>";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Factures a payer
|
||||
*/
|
||||
if ($conf->facture->enabled) {
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
$sql = "SELECT ff.rowid, ff.facnumber, ff.libelle, ff.total_ht, ff.total_ttc, s.nom, s.idp";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
$sql .= " WHERE s.idp = ff.fk_soc";
|
||||
$sql .= " AND ff.paye=0";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsSuppliersUnpayed").' ('.$num.')</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td></tr>';
|
||||
print "</tr>\n";
|
||||
$i = 0;
|
||||
$var = True;
|
||||
$total = $total_ttc = $totalam = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'><td><a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a></td>';
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowSupplier"),"company").' '.dolibarr_trunc($obj->nom,50).'</a></td>';
|
||||
print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
$total += $obj->total_ht;
|
||||
$total_ttc += $obj->total_ttc;
|
||||
$totalam += $obj->am;
|
||||
$i++;
|
||||
}
|
||||
$var=!$var;
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToPay").': '.price($total_ttc-$totalam).')</font> </td>';
|
||||
print '<td align="right">'.price($total).'</td>';
|
||||
print '<td align="right">'.price($total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
print '</table><br>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,152 +1,152 @@
|
|||
<?php
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2003 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Martin Jansen <mj@php.net> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
define("AUTH_METHOD_NOT_SUPPORTED", -4);
|
||||
|
||||
/**
|
||||
* Storage class for fetching login data
|
||||
*
|
||||
* @author Martin Jansen <mj@php.net>
|
||||
* @package Auth
|
||||
*/
|
||||
class Auth_Container
|
||||
{
|
||||
|
||||
/**
|
||||
* User that is currently selected from the storage container.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
var $activeUser = "";
|
||||
|
||||
// {{{ Constructor
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Has to be overwritten by each storage class
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function Auth_Container()
|
||||
{
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ fetchData()
|
||||
|
||||
/**
|
||||
* Fetch data from storage container
|
||||
*
|
||||
* Has to be overwritten by each storage class
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function fetchData()
|
||||
{
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ verifyPassword()
|
||||
|
||||
/**
|
||||
* Crypt and verfiy the entered password
|
||||
*
|
||||
* @param string Entered password
|
||||
* @param string Password from the data container (usually this password
|
||||
* is already encrypted.
|
||||
* @param string Type of algorithm with which the password from
|
||||
* the container has been crypted. (md5, crypt etc.)
|
||||
* Defaults to "md5".
|
||||
* @return bool True, if the passwords match
|
||||
*/
|
||||
function verifyPassword($password1, $password2, $cryptType = "md5")
|
||||
{
|
||||
switch ($cryptType) {
|
||||
case "crypt" :
|
||||
return (($password2 == "**" . $password1) ||
|
||||
(crypt($password1, $password2) == $password2)
|
||||
);
|
||||
break;
|
||||
|
||||
case "none" :
|
||||
return ($password1 == $password2);
|
||||
break;
|
||||
|
||||
case "md5" :
|
||||
return (md5($password1) == $password2);
|
||||
break;
|
||||
|
||||
default :
|
||||
if (function_exists($cryptType)) {
|
||||
return ($cryptType($password1) == $password2);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ listUsers()
|
||||
|
||||
/**
|
||||
* List all users that are available from the storage container
|
||||
*/
|
||||
function listUsers()
|
||||
{
|
||||
return AUTH_METHOD_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ addUser()
|
||||
|
||||
/**
|
||||
* Add a new user to the storage container
|
||||
*
|
||||
* @param string Username
|
||||
* @param string Password
|
||||
* @param array Additional information
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function addUser($username, $password, $additional=null)
|
||||
{
|
||||
return AUTH_METHOD_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ removeUser()
|
||||
|
||||
/**
|
||||
* Remove user from the storage container
|
||||
*
|
||||
* @param string Username
|
||||
*/
|
||||
function removeUser($username)
|
||||
{
|
||||
return AUTH_METHOD_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2003 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Martin Jansen <mj@php.net> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
define("AUTH_METHOD_NOT_SUPPORTED", -4);
|
||||
|
||||
/**
|
||||
* Storage class for fetching login data
|
||||
*
|
||||
* @author Martin Jansen <mj@php.net>
|
||||
* @package Auth
|
||||
*/
|
||||
class Auth_Container
|
||||
{
|
||||
|
||||
/**
|
||||
* User that is currently selected from the storage container.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
var $activeUser = "";
|
||||
|
||||
// {{{ Constructor
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Has to be overwritten by each storage class
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function Auth_Container()
|
||||
{
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ fetchData()
|
||||
|
||||
/**
|
||||
* Fetch data from storage container
|
||||
*
|
||||
* Has to be overwritten by each storage class
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function fetchData()
|
||||
{
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ verifyPassword()
|
||||
|
||||
/**
|
||||
* Crypt and verfiy the entered password
|
||||
*
|
||||
* @param string Entered password
|
||||
* @param string Password from the data container (usually this password
|
||||
* is already encrypted.
|
||||
* @param string Type of algorithm with which the password from
|
||||
* the container has been crypted. (md5, crypt etc.)
|
||||
* Defaults to "md5".
|
||||
* @return bool True, if the passwords match
|
||||
*/
|
||||
function verifyPassword($password1, $password2, $cryptType = "md5")
|
||||
{
|
||||
switch ($cryptType) {
|
||||
case "crypt" :
|
||||
return (($password2 == "**" . $password1) ||
|
||||
(crypt($password1, $password2) == $password2)
|
||||
);
|
||||
break;
|
||||
|
||||
case "none" :
|
||||
return ($password1 == $password2);
|
||||
break;
|
||||
|
||||
case "md5" :
|
||||
return (md5($password1) == $password2);
|
||||
break;
|
||||
|
||||
default :
|
||||
if (function_exists($cryptType)) {
|
||||
return ($cryptType($password1) == $password2);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ listUsers()
|
||||
|
||||
/**
|
||||
* List all users that are available from the storage container
|
||||
*/
|
||||
function listUsers()
|
||||
{
|
||||
return AUTH_METHOD_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ addUser()
|
||||
|
||||
/**
|
||||
* Add a new user to the storage container
|
||||
*
|
||||
* @param string Username
|
||||
* @param string Password
|
||||
* @param array Additional information
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function addUser($username, $password, $additional=null)
|
||||
{
|
||||
return AUTH_METHOD_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ removeUser()
|
||||
|
||||
/**
|
||||
* Remove user from the storage container
|
||||
*
|
||||
* @param string Username
|
||||
*/
|
||||
function removeUser($username)
|
||||
{
|
||||
return AUTH_METHOD_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user