mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix: Database compatibility
This commit is contained in:
parent
3ff226575e
commit
6d82aeda67
|
|
@ -703,7 +703,7 @@ else
|
|||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($result);
|
||||
if ($obj->code) $code_pays=$obj->code;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ require("../main.inc.php");
|
|||
$langs->load("admin");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
|
@ -36,15 +36,15 @@ llxHeader();
|
|||
|
||||
if (! strlen(OSC_DB_NAME))
|
||||
{
|
||||
print "Non dispo";
|
||||
llxFooter();
|
||||
print "Non dispo";
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="lower(p.label),p.price";
|
||||
$sortfield="lower(p.label),p.price";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
|
|
@ -58,29 +58,31 @@ $sql = "SELECT l.languages_id, l.name, l.code FROM ".$conf->global->OSC_DB_NAME.
|
|||
|
||||
$sql .= $db->plimit( $limit ,$offset);
|
||||
|
||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print "<TR class=\"liste_titre\">";
|
||||
print "<td>id</td>";
|
||||
print "<td>Name</td>";
|
||||
print "<TD>Code</TD>";
|
||||
print "</TR>\n";
|
||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print "<TR class=\"liste_titre\">";
|
||||
print "<td>id</td>";
|
||||
print "<td>Name</td>";
|
||||
print "<TD>Code</TD>";
|
||||
print "</TR>\n";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object();
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD>$objp->languages_id</TD>\n";
|
||||
print "<TD>$objp->name</TD>\n";
|
||||
print "<TD>$objp->code</TD>\n";
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD>$objp->languages_id</TD>\n";
|
||||
print "<TD>$objp->name</TD>\n";
|
||||
print "<TD>$objp->code</TD>\n";
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
|
||||
print "</TABLE>";
|
||||
|
|
|
|||
|
|
@ -165,13 +165,14 @@ if ($conf->global->MAIN_MODULE_NOTIFICATION)
|
|||
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||
$sql.= " ORDER BY u.name ASC";
|
||||
|
||||
if ($db->query($sql))
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<option value="'.$obj->rowid.'">'.$obj->firstname." ".$obj->name;
|
||||
$i++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ if ($result)
|
|||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
|
|
|
|||
|
|
@ -57,9 +57,10 @@ $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREF
|
|||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $dbosc->plimit( $limit ,$offset);
|
||||
|
||||
if ( $dbosc->query($sql) )
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows();
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
|
|
@ -70,7 +71,7 @@ if ( $dbosc->query($sql) )
|
|||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object();
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="fiche.php?id='.$objp->customers_id.'">'.$objp->customers_firstname."</a></td>\n";
|
||||
|
|
|
|||
|
|
@ -59,14 +59,15 @@ $sql = "SELECT sum(t.value) as value";
|
|||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
|
||||
$sql .= " WHERE t.class = 'ot_subtotal'";
|
||||
|
||||
if ( $dbosc->query($sql) )
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows();
|
||||
$num = $dbosc->num_rows($resql);
|
||||
|
||||
$var=True;
|
||||
if ($num > 0)
|
||||
{
|
||||
$objp = $dbosc->fetch_object();
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>Somme des commandes</td>';
|
||||
|
|
@ -86,15 +87,15 @@ else
|
|||
$sql = "SELECT sum(t.value) as value";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
|
||||
$sql .= " WHERE t.class = 'ot_shipping'";
|
||||
|
||||
if ( $dbosc->query($sql) )
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows();
|
||||
$num = $dbosc->num_rows($resql);
|
||||
|
||||
$var=True;
|
||||
if ($num > 0)
|
||||
{
|
||||
$objp = $dbosc->fetch_object();
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>Somme des frais de port</td>';
|
||||
|
|
|
|||
|
|
@ -75,39 +75,40 @@ if ($_GET['id'])
|
|||
$sql .= " WHERE orders_id = " . $_GET['id'];
|
||||
//$commande->id;
|
||||
// echo $sql;
|
||||
if ( $dbosc->query($sql) )
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows();
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td align="left" width="40%">'.$langs->trans("Products").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Number").'</td><td align="right">'.$langs->trans("Price").'</td><td align="right">Prix final</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object();
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td align="left" width="40%">';
|
||||
print '<a href="fiche.php?id='.$objp->products_id.'"><img src="/theme/'.$conf->theme.'/img/filenew.png" border="0" width="16" height="16" alt="Fiche livre"></a>';
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td align="left" width="40%">'.$langs->trans("Products").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Number").'</td><td align="right">'.$langs->trans("Price").'</td><td align="right">Prix final</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td align="left" width="40%">';
|
||||
print '<a href="fiche.php?id='.$objp->products_id.'"><img src="/theme/'.$conf->theme.'/img/filenew.png" border="0" width="16" height="16" alt="Fiche livre"></a>';
|
||||
|
||||
print '<a href="fiche.php?id='.$objp->products_id.'">'.$objp->products_name.'</a>';
|
||||
print "</td>";
|
||||
print '<a href="fiche.php?id='.$objp->products_id.'">'.$objp->products_name.'</a>';
|
||||
print "</td>";
|
||||
|
||||
print '<td align="center"><a href="fiche.php?id='.$objp->rowid."\">$objp->products_quantity</a></TD>\n";
|
||||
print "<td align=\"right\"><a href=\"fiche.php?id=$objp->rowid\">".price($objp->products_price)."</a></TD>\n";
|
||||
print "<td align=\"right\"><a href=\"fiche.php?id=$objp->rowid\">".price($objp->final_price)."</a></TD>\n";
|
||||
print '<td align="center"><a href="fiche.php?id='.$objp->rowid."\">$objp->products_quantity</a></TD>\n";
|
||||
print "<td align=\"right\"><a href=\"fiche.php?id=$objp->rowid\">".price($objp->products_price)."</a></TD>\n";
|
||||
print "<td align=\"right\"><a href=\"fiche.php?id=$objp->rowid\">".price($objp->final_price)."</a></TD>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$dbosc->free();
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $dbosc->error();
|
||||
print $dbosc->error();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -55,9 +55,10 @@ $sql .= " WHERE o.orders_id = t.orders_id AND t.class = 'ot_total'";
|
|||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $dbosc->plimit( $limit ,$offset);
|
||||
|
||||
if ( $dbosc->query($sql) )
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows();
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
|
|
@ -69,7 +70,7 @@ if ( $dbosc->query($sql) )
|
|||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object();
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/boutique/index.php
|
||||
\ingroup boutique
|
||||
\brief Page accueil zone boutique
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/boutique/index.php
|
||||
\ingroup boutique
|
||||
\brief Page accueil zone boutique
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php');
|
||||
|
|
@ -41,8 +41,8 @@ print '<tr><td valign="top" width="40%" class="notopnoleft">';
|
|||
|
||||
|
||||
/*
|
||||
/* Chiffre d'affaire
|
||||
*/
|
||||
/* Chiffre d'affaire
|
||||
*/
|
||||
//print_barre_liste("Chiffre d'affaire", $page, "ca.php");
|
||||
|
||||
print_titre($langs->trans('SalesTurnover'));
|
||||
|
|
@ -60,80 +60,52 @@ $sql .= " GROUP BY mois ORDER BY mois";
|
|||
$result=$dbosc->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $dbosc->num_rows($result);
|
||||
$num = $dbosc->num_rows($result);
|
||||
|
||||
$var=True;
|
||||
$i=0;
|
||||
if ($num > 0)
|
||||
{
|
||||
while ($i < $num)
|
||||
$var=True;
|
||||
$i=0;
|
||||
if ($num > 0)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td align="left">'.$objp->mois.'</td>';
|
||||
print '<td align="right">'.price($objp->value).'</td>';
|
||||
$objp = $dbosc->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td align="left">'.$objp->mois.'</td>';
|
||||
print '<td align="right">'.price($objp->value).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$dbosc->free();
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
/* mensuel
|
||||
|
||||
$sql = "SELECT sum(t.value) as value";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
|
||||
$sql .= " JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o ON o.orders_id = t.orders_id";
|
||||
$sql .= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(".$dbosc->db->idate(mktime()).") AND MONTH(o.date_purchased) = MONTH(".$this->db->idate(mktime()).")";
|
||||
|
||||
if ( $dbosc->query($sql) )
|
||||
{
|
||||
$num = $dbosc->num_rows();
|
||||
|
||||
$var=True;
|
||||
if ($num > 0)
|
||||
{
|
||||
$objp = $dbosc->fetch_object();
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>CA du mois en cours </td>';
|
||||
print '<td align="right">'.price($objp->value).'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
*/
|
||||
|
||||
print "</table>";
|
||||
print '</td><td valign="top" width="60%" class="notopnoleftnoright">';
|
||||
print_titre($langs->trans("Orders"));
|
||||
|
||||
/*
|
||||
* 5 derni<EFBFBD>res commandes re<EFBFBD>ues
|
||||
* 5 derniees commandes recues
|
||||
select o.orders_id, o.customers_id, o.customers_name, o.date_purchased, o.payement_method, o.status, t.value
|
||||
from orders_total as t
|
||||
join orders as o on o.orders_id = t.orders_id where t.class = 'ot_subtotal' order by o.date_purchased desc
|
||||
from orders_total as t
|
||||
join orders as o on o.orders_id = t.orders_id where t.class = 'ot_subtotal' order by o.date_purchased desc
|
||||
*/
|
||||
$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
|
||||
$sql .= " WHERE t.class = 'ot_subtotal' ORDER BY o.date_purchased desc";
|
||||
|
||||
if ( $dbosc->query($sql) )
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$langs->load("orders");
|
||||
$num = $dbosc->num_rows();
|
||||
$num = $dbosc->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
|
|
@ -145,7 +117,7 @@ if ( $dbosc->query($sql) )
|
|||
while ($i < $num)
|
||||
{
|
||||
|
||||
$obj = $dbosc->fetch_object();
|
||||
$obj = $dbosc->fetch_object($resql);
|
||||
print "<tr><td>$obj->orders_id</td><td>$obj->customers_name</td><td>".price($obj->value)."</td><td>$obj->payment_method</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -154,41 +126,42 @@ if ( $dbosc->query($sql) )
|
|||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
/*
|
||||
* 5 derni<EFBFBD>res commandes en attente
|
||||
*/
|
||||
*/
|
||||
$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
|
||||
$sql .= " WHERE t.class = 'ot_subtotal' and o.orders_status = 5 order by o.date_purchased desc";
|
||||
|
||||
if ( $dbosc->query($sql) )
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$langs->load("orders");
|
||||
$num = $dbosc->num_rows();
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("En Attente").'</td></tr>';
|
||||
$langs->load("orders");
|
||||
$num = $dbosc->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("En Attente").'</td></tr>';
|
||||
|
||||
$num = min($num,OSC_MAXNBCOM);
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
$obj = $dbosc->fetch_object();
|
||||
$obj = $dbosc->fetch_object($resql);
|
||||
print "<tr><td>$obj->orders_id</td><td>$obj->customers_name</td><td>".price($obj->value)."</td><td>$obj->payment_method</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -198,68 +171,69 @@ $sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payme
|
|||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
|
||||
$sql .= " WHERE t.class = 'ot_subtotal' and o.orders_status = 2 order by o.date_purchased desc";
|
||||
|
||||
if ( $dbosc->query($sql) )
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$langs->load("orders");
|
||||
$num = $dbosc->num_rows();
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("Traitement en cours").'</td></tr>';
|
||||
$langs->load("orders");
|
||||
$num = $dbosc->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("Traitement en cours").'</td></tr>';
|
||||
|
||||
$num = min($num,OSC_MAXNBCOM);
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
$obj = $dbosc->fetch_object();
|
||||
$obj = $dbosc->fetch_object($resql);
|
||||
print "<tr><td>$obj->orders_id</td><td>$obj->customers_name</td><td>".price($obj->value)."</td><td>$obj->payment_method</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
|
||||
print '</td></tr><tr>';
|
||||
/*
|
||||
* Derniers clients qui ont command<EFBFBD>
|
||||
*/
|
||||
* Derniers clients qui ont command<EFBFBD>
|
||||
*/
|
||||
$sql = "SELECT o.orders_id, o.customers_name, o.delivery_country, o.date_purchased, t.value, s.orders_status_name as statut";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
|
||||
$sql .= " JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_status as s on o.orders_status = s.orders_status_id and s.language_id = 1";
|
||||
$sql .= " WHERE t.class = 'ot_subtotal' order by o.date_purchased desc";
|
||||
|
||||
if ( $dbosc->query($sql) )
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$langs->load("orders");
|
||||
$num = $dbosc->num_rows();
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="7">'.$langs->trans("Derniers clients").'</td></tr>';
|
||||
$langs->load("orders");
|
||||
$num = $dbosc->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="7">'.$langs->trans("Derniers clients").'</td></tr>';
|
||||
|
||||
$num = min($num,OSC_MAXNBCOM);
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
$obj = $dbosc->fetch_object();
|
||||
print "<tr><td>$obj->date_purchased</td><td>$obj->customers_name</td><td>$obj->delivery_country</td><td>".price($obj->value)."</td><td>$obj->payment_method</td><td>$obj->orders_id</td><td>$obj->statut</td></tr>";
|
||||
$i++;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $dbosc->fetch_object($resql);
|
||||
print "<tr><td>$obj->date_purchased</td><td>$obj->customers_name</td><td>$obj->delivery_country</td><td>".price($obj->value)."</td><td>$obj->payment_method</td><td>$obj->orders_id</td><td>$obj->statut</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
||||
|
|
|
|||
|
|
@ -58,9 +58,10 @@ $sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID;
|
|||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $dbosc->plimit( $limit ,$offset);
|
||||
|
||||
if ( $dbosc->query($sql) )
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows();
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print "<table class=\noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
|
|
@ -70,7 +71,7 @@ if ( $dbosc->query($sql) )
|
|||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object();
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td width='70%'><a href=\"fiche.php?id=$objp->rowid\">$objp->customers_firstname $objp->customers_lastname</a></TD>\n";
|
||||
|
|
@ -79,7 +80,7 @@ if ( $dbosc->query($sql) )
|
|||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$dbosc->free();
|
||||
$dbosc->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -54,9 +54,10 @@ $sql .= " FROM ".DB_NAME_OSC.".customers as c";
|
|||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $dbosc->plimit( $limit ,$offset);
|
||||
|
||||
if ( $dbosc->query($sql) )
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows();
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
|
|
@ -67,7 +68,7 @@ if ( $dbosc->query($sql) )
|
|||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object();
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="fiche.php?id='.$objp->customers_id.'">'.$objp->customers_firstname."</a></td>\n";
|
||||
|
|
@ -78,7 +79,7 @@ if ( $dbosc->query($sql) )
|
|||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$dbosc->free();
|
||||
$dbosc->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -123,14 +123,15 @@ if ($mode == 'search')
|
|||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ( $db->num_rows() == 1)
|
||||
if ( $db->num_rows($resql) == 1)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
$socid = $obj->rowid;
|
||||
}
|
||||
$db->free();
|
||||
$db->free($resql);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -498,9 +498,10 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire && 0) // \todo A REF
|
|||
$sql.= " ORDER BY c.tms DESC";
|
||||
$sql.= $db->plimit(5, 0);
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
|
|
@ -513,8 +514,8 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire && 0) // \todo A REF
|
|||
$var=false;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
print "<tr $bc[$var]><td><a href=\"../contrat/fiche.php?id=".$obj->contratid."\">".img_object($langs->trans("ShowContract","contract"))." ".$obj->ref."</a></td>";
|
||||
$obj = $db->fetch_object($resql);
|
||||
print "<tr ".$bc[$var]."><td><a href=\"../contrat/fiche.php?id=".$obj->contratid."\">".img_object($langs->trans("ShowContract","contract"))." ".$obj->ref."</a></td>";
|
||||
print "<td><a href=\"fiche.php?socid=".$obj->rowid."\">".img_object($langs->trans("ShowCompany","company"))." ".$obj->nom."</a></td>\n";
|
||||
print "<td align=\"right\">".$staticcontrat->LibStatut($obj->statut,3)."</td></tr>\n";
|
||||
$var=!$var;
|
||||
|
|
|
|||
|
|
@ -1475,16 +1475,17 @@ class Propal extends CommonObject
|
|||
$sql.= " AND sourcetype = '".$this->element."'";
|
||||
$sql.= " AND targettype = 'commande'";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$nump = $this->db->num_rows();
|
||||
$nump = $this->db->num_rows($resql);
|
||||
|
||||
if ($nump)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $nump)
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$ga[$i] = $obj->fk_target;
|
||||
$i++;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ $langs->load("propal");
|
|||
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$socid = $user->societe_id;
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -52,16 +52,16 @@ print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
|||
|
||||
if ($conf->propal->enabled)
|
||||
{
|
||||
$var=false;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAProposal").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sf_ref" size="18"></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td nowrap>'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
|
||||
print '</tr>';
|
||||
print "</form></table><br>\n";
|
||||
$var=false;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAProposal").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sf_ref" size="18"></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td nowrap>'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
|
||||
print '</tr>';
|
||||
print "</form></table><br>\n";
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -112,49 +112,49 @@ if ($resql)
|
|||
*/
|
||||
if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.ref, p.price, s.nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.fk_statut = 0";
|
||||
$sql.= " AND p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql = "SELECT p.rowid, p.ref, p.price, s.nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.fk_statut = 0";
|
||||
$sql.= " AND p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=true;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
$total=0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder"" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("ProposalsDraft").'</td></tr>';
|
||||
$total=0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder"" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("ProposalsDraft").'</td></tr>';
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a>';
|
||||
print '</td><td align="right">';
|
||||
print price($obj->price);
|
||||
print "</td></tr>";
|
||||
$i++;
|
||||
$total += $obj->price;
|
||||
}
|
||||
if ($total>0) {
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td></tr>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a>';
|
||||
print '</td><td align="right">';
|
||||
print price($obj->price);
|
||||
print "</td></tr>";
|
||||
$i++;
|
||||
$total += $obj->price;
|
||||
}
|
||||
if ($total>0) {
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td></tr>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -171,53 +171,53 @@ if ($conf->agenda->enabled) show_array_actions_to_do(10);
|
|||
*/
|
||||
if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.total as total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.fk_statut = c.id";
|
||||
$sql.= " AND p.fk_statut = 1";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY p.rowid DESC";
|
||||
$sql.= $db->plimit(5, 0);
|
||||
$sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.total as total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.fk_statut = c.id";
|
||||
$sql.= " AND p.fk_statut = 1";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY p.rowid DESC";
|
||||
$sql.= $db->plimit(5, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ProposalsOpened").'</td></tr>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ProposalsOpened").'</td></tr>';
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td><a href=\"../propal.php?id=".$obj->propalid."\">";
|
||||
print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a></td>';
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td><a href=\"../propal.php?id=".$obj->propalid."\">";
|
||||
print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a></td>';
|
||||
|
||||
print "<td><a href=\"fiche.php?id=".$obj->socid."\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom."</a></td>\n";
|
||||
print "<td align=\"right\">";
|
||||
print dol_print_date($db->jdate($obj->dp),'day')."</td>\n";
|
||||
print "<td align=\"right\">".price($obj->total_ttc)."</td></tr>\n";
|
||||
$i++;
|
||||
$total += $obj->price;
|
||||
}
|
||||
if ($total>0) {
|
||||
print '<tr class="liste_total"><td colspan="3" align="right">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td></tr>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
print "<td><a href=\"fiche.php?id=".$obj->socid."\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom."</a></td>\n";
|
||||
print "<td align=\"right\">";
|
||||
print dol_print_date($db->jdate($obj->dp),'day')."</td>\n";
|
||||
print "<td align=\"right\">".price($obj->total_ttc)."</td></tr>\n";
|
||||
$i++;
|
||||
$total += $obj->price;
|
||||
}
|
||||
if ($total>0) {
|
||||
print '<tr class="liste_total"><td colspan="3" align="right">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td></tr>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
|
|
@ -237,28 +237,29 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.
|
|||
$sql.= " ORDER BY s.tms ASC";
|
||||
$sql.= $db->plimit(15, 0);
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
if ($num > 0 )
|
||||
{
|
||||
$var=true;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ProspectToContact").'</td></tr>';
|
||||
|
||||
while ($i < $num)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num > 0 )
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td width=\"12%\"><a href=\"".DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$obj->rowid."\">";
|
||||
print img_object($langs->trans("ShowCompany"),"company");
|
||||
print ' '.$obj->nom.'</a></td></tr>';
|
||||
$i++;
|
||||
$var=true;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ProspectToContact").'</td></tr>';
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td width=\"12%\"><a href=\"".DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$obj->rowid."\">";
|
||||
print img_object($langs->trans("ShowCompany"),"company");
|
||||
print ' '.$obj->nom.'</a></td></tr>';
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1245,13 +1245,14 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
|||
$sql = 'SELECT pt.rowid, pt.description as product, pt.price, pt.qty, pt.remise_percent';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt WHERE pt.fk_propal = '.$propalid.' AND pt.fk_product = 0';
|
||||
$sql .= ' ORDER BY pt.rowid ASC';
|
||||
if ($db->query($sql))
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object();
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td> </td>';
|
||||
print '<td>'.img_object($langs->trans('ShowProduct'),'product').' '.$objp->product.'</td>';
|
||||
|
|
@ -1937,9 +1938,9 @@ else
|
|||
if ($commande->statut == 0 && $user->rights->commande->creer && $_GET["action"] <> 'editline')
|
||||
{
|
||||
$var=true;
|
||||
|
||||
|
||||
$commande->showAddFreeProductForm(1);
|
||||
|
||||
|
||||
// Add predefined products/services
|
||||
if ($conf->product->enabled || $conf->service->enabled)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -91,13 +91,14 @@ if ($conf->commande->enabled)
|
|||
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("DraftOrders").'</td></tr>';
|
||||
$langs->load("orders");
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
|
|
@ -105,7 +106,7 @@ if ($conf->commande->enabled)
|
|||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap">';
|
||||
print "<a href=\"fiche.php?id=".$obj->rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."</a></td>";
|
||||
|
|
@ -206,9 +207,10 @@ if ($conf->commande->enabled)
|
|||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= " ORDER BY c.rowid DESC";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
|
@ -221,7 +223,7 @@ if ($conf->commande->enabled)
|
|||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap">';
|
||||
|
||||
|
|
@ -275,9 +277,10 @@ if ($conf->commande->enabled)
|
|||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= " ORDER BY c.rowid DESC";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
|
@ -290,7 +293,7 @@ if ($conf->commande->enabled)
|
|||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td width="20%" nowrap="nowrap">';
|
||||
|
||||
|
|
|
|||
|
|
@ -79,9 +79,10 @@ if ($mode == 'search') {
|
|||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
}
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
if ( $db->num_rows() == 1) {
|
||||
$obj = $db->fetch_object();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
if ( $db->num_rows($resql) == 1) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$socid = $obj->rowid;
|
||||
}
|
||||
$db->free();
|
||||
|
|
@ -143,10 +144,10 @@ if ($socid)
|
|||
|
||||
$sql.= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
if ($action == 'facturer') {
|
||||
|
|
@ -193,7 +194,7 @@ if ($result)
|
|||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
|
|
@ -212,7 +213,7 @@ if ($result)
|
|||
|
||||
print '</form>';
|
||||
|
||||
$db->free();
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -54,11 +54,12 @@ if ($mode == 'search')
|
|||
$sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'";
|
||||
}
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ( $db->num_rows() == 1)
|
||||
if ( $db->num_rows($resql) == 1)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
$socid = $obj->rowid;
|
||||
}
|
||||
$db->free();
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ class BonPrelevement extends CommonObject
|
|||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
\file htdocs/compta/prelevement/ligne-prelevement.class.php
|
||||
\ingroup prelevement
|
||||
\brief Fichier de la classe des lignes de prelevements
|
||||
\version $Revision$
|
||||
*/
|
||||
\file htdocs/compta/prelevement/ligne-prelevement.class.php
|
||||
\ingroup prelevement
|
||||
\brief Fichier de la classe des lignes de prelevements
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -35,77 +35,77 @@
|
|||
|
||||
class LignePrelevement
|
||||
{
|
||||
var $id;
|
||||
var $db;
|
||||
var $id;
|
||||
var $db;
|
||||
|
||||
var $statuts = array();
|
||||
var $statuts = array();
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB Handler acces base de donnees
|
||||
* \param user Objet user
|
||||
*/
|
||||
function LignePrelevement($DB, $user)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->user = $user;
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB Handler acces base de donnees
|
||||
* \param user Objet user
|
||||
*/
|
||||
function LignePrelevement($DB, $user)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->user = $user;
|
||||
|
||||
// List of language codes for status
|
||||
/*$this->statuts[0] = "Waiting";
|
||||
$this->statuts[2] = "Credited";
|
||||
$this->statuts[3] = "Refused";*/
|
||||
}
|
||||
// List of language codes for status
|
||||
/*$this->statuts[0] = "Waiting";
|
||||
$this->statuts[2] = "Credited";
|
||||
$this->statuts[3] = "Refused";*/
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Recupere l'objet prelevement
|
||||
* \param rowid id de la facture a recuperer
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
global $conf;
|
||||
/**
|
||||
* \brief Recupere l'objet prelevement
|
||||
* \param rowid id de la facture a recuperer
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$result = 0;
|
||||
$result = 0;
|
||||
|
||||
$sql = "SELECT pl.rowid, pl.amount, p.ref, p.rowid as bon_rowid";
|
||||
$sql.= ", pl.statut, pl.fk_soc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " WHERE pl.rowid=".$rowid;
|
||||
$sql.= " AND p.rowid = pl.fk_prelevement_bons";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql = "SELECT pl.rowid, pl.amount, p.ref, p.rowid as bon_rowid";
|
||||
$sql.= ", pl.statut, pl.fk_soc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " WHERE pl.rowid=".$rowid;
|
||||
$sql.= " AND p.rowid = pl.fk_prelevement_bons";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->amount = $obj->amount;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->statut = $obj->statut;
|
||||
$this->bon_ref = $obj->ref;
|
||||
$this->bon_rowid = $obj->bon_rowid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result++;
|
||||
dol_syslog("LignePrelevement::Fetch rowid=$rowid numrows=0");
|
||||
}
|
||||
$this->id = $obj->rowid;
|
||||
$this->amount = $obj->amount;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->statut = $obj->statut;
|
||||
$this->bon_ref = $obj->ref;
|
||||
$this->bon_rowid = $obj->bon_rowid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result++;
|
||||
dol_syslog("LignePrelevement::Fetch rowid=$rowid numrows=0");
|
||||
}
|
||||
|
||||
$this->db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
$result++;
|
||||
dol_syslog("LignePrelevement::Fetch rowid=$rowid");
|
||||
dol_syslog($this->db->error());
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result++;
|
||||
dol_syslog("LignePrelevement::Fetch rowid=$rowid");
|
||||
dol_syslog($this->db->error());
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -21,312 +21,312 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/prelevement/class/rejet-prelevement.class.php
|
||||
\ingroup prelevement
|
||||
\brief File of class to manage standing orders rejects
|
||||
\version $Revision$
|
||||
*/
|
||||
\file htdocs/compta/prelevement/class/rejet-prelevement.class.php
|
||||
\ingroup prelevement
|
||||
\brief File of class to manage standing orders rejects
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\class RejetPrelevement
|
||||
\brief Class to manage standing orders rejects
|
||||
*/
|
||||
\class RejetPrelevement
|
||||
\brief Class to manage standing orders rejects
|
||||
*/
|
||||
class RejetPrelevement
|
||||
{
|
||||
var $id;
|
||||
var $db;
|
||||
var $id;
|
||||
var $db;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB Handler acces base de donnees
|
||||
* \param user Utilisateur
|
||||
*/
|
||||
function RejetPrelevement($DB, $user)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->user = $user;
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB Handler acces base de donnees
|
||||
* \param user Utilisateur
|
||||
*/
|
||||
function RejetPrelevement($DB, $user)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->user = $user;
|
||||
|
||||
$this->motifs = array();
|
||||
/* $this->motifs[0] = "Non renseigne";
|
||||
$this->motifs[1] = "Provision insuffisante";
|
||||
$this->motifs[2] = "Tirage conteste";
|
||||
$this->motifs[3] = "Pas de bon <20> payer";
|
||||
$this->motifs[4] = "Opposition sur compte";
|
||||
$this->motifs[5] = "RIB inexploitable";
|
||||
$this->motifs[6] = "Compte solde";
|
||||
$this->motifs[7] = "Decision judiciaire";
|
||||
$this->motifs[8] = "Autre motif";*/
|
||||
}
|
||||
$this->motifs = array();
|
||||
/* $this->motifs[0] = "Non renseigne";
|
||||
$this->motifs[1] = "Provision insuffisante";
|
||||
$this->motifs[2] = "Tirage conteste";
|
||||
$this->motifs[3] = "Pas de bon <20> payer";
|
||||
$this->motifs[4] = "Opposition sur compte";
|
||||
$this->motifs[5] = "RIB inexploitable";
|
||||
$this->motifs[6] = "Compte solde";
|
||||
$this->motifs[7] = "Decision judiciaire";
|
||||
$this->motifs[8] = "Autre motif";*/
|
||||
}
|
||||
|
||||
function create($user, $id, $motif, $date_rejet, $bonid, $facturation=0)
|
||||
{
|
||||
$error = 0;
|
||||
$this->id = $id;
|
||||
$this->bon_id = $bonid;
|
||||
function create($user, $id, $motif, $date_rejet, $bonid, $facturation=0)
|
||||
{
|
||||
$error = 0;
|
||||
$this->id = $id;
|
||||
$this->bon_id = $bonid;
|
||||
|
||||
dol_syslog("RejetPrelevement::Create id $id");
|
||||
dol_syslog("RejetPrelevement::Create id $id");
|
||||
|
||||
$facs = $this->_get_list_factures();
|
||||
$facs = $this->_get_list_factures();
|
||||
|
||||
$this->db->begin();
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
/* Insert la ligne de rejet dans la base */
|
||||
/* Insert la ligne de rejet dans la base */
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_rejet (";
|
||||
$sql.= "fk_prelevement_lignes";
|
||||
$sql.= ", date_rejet";
|
||||
$sql.= ", motif";
|
||||
$sql.= ", fk_user_creation";
|
||||
$sql.= ", date_creation";
|
||||
$sql.= ", afacturer";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $id;
|
||||
$sql.= ", '".$this->db->idate($date_rejet)."'";
|
||||
$sql.= ", ".$motif;
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", ".$this->db->idate(mktime());
|
||||
$sql.= ", ".$facturation;
|
||||
$sql.= ")";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_rejet (";
|
||||
$sql.= "fk_prelevement_lignes";
|
||||
$sql.= ", date_rejet";
|
||||
$sql.= ", motif";
|
||||
$sql.= ", fk_user_creation";
|
||||
$sql.= ", date_creation";
|
||||
$sql.= ", afacturer";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $id;
|
||||
$sql.= ", '".$this->db->idate($date_rejet)."'";
|
||||
$sql.= ", ".$motif;
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", ".$this->db->idate(mktime());
|
||||
$sql.= ", ".$facturation;
|
||||
$sql.= ")";
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
$result=$this->db->query($sql);
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
dol_syslog("RejetPrelevement::create Erreur 4");
|
||||
dol_syslog("RejetPrelevement::create Erreur 4 $sql");
|
||||
$error++;
|
||||
}
|
||||
if (!$result)
|
||||
{
|
||||
dol_syslog("RejetPrelevement::create Erreur 4");
|
||||
dol_syslog("RejetPrelevement::create Erreur 4 $sql");
|
||||
$error++;
|
||||
}
|
||||
|
||||
/* Tag la ligne de prev comme rejetee */
|
||||
/* Tag la ligne de prev comme rejetee */
|
||||
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes ";
|
||||
$sql.= " SET statut = 3";
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes ";
|
||||
$sql.= " SET statut = 3";
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
dol_syslog("RejetPrelevement::create Erreur 5");
|
||||
$error++;
|
||||
}
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
dol_syslog("RejetPrelevement::create Erreur 5");
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
for ($i = 0 ; $i < sizeof($facs) ; $i++)
|
||||
{
|
||||
$fac = new Facture($this->db);
|
||||
$fac->fetch($facs[$i]);
|
||||
for ($i = 0 ; $i < sizeof($facs) ; $i++)
|
||||
{
|
||||
$fac = new Facture($this->db);
|
||||
$fac->fetch($facs[$i]);
|
||||
|
||||
/* Emet un paiement negatif */
|
||||
/* Emet un paiement negatif */
|
||||
|
||||
$pai = new Paiement($this->db);
|
||||
$pai = new Paiement($this->db);
|
||||
|
||||
$pai->amounts = array();
|
||||
// On remplace la virgule eventuelle par un point sinon
|
||||
// certaines install de PHP renvoie uniquement la partie
|
||||
// entiere negative
|
||||
$pai->amounts = array();
|
||||
// On remplace la virgule eventuelle par un point sinon
|
||||
// certaines install de PHP renvoie uniquement la partie
|
||||
// entiere negative
|
||||
|
||||
$pai->amounts[$facs[$i]] = price2num($fac->total_ttc * -1);
|
||||
$pai->datepaye = $this->db->idate($date_rejet);
|
||||
$pai->paiementid = 3; // prelevement
|
||||
$pai->num_paiement = "Rejet";
|
||||
$pai->amounts[$facs[$i]] = price2num($fac->total_ttc * -1);
|
||||
$pai->datepaye = $this->db->idate($date_rejet);
|
||||
$pai->paiementid = 3; // prelevement
|
||||
$pai->num_paiement = "Rejet";
|
||||
|
||||
if ($pai->create($this->user, 1) == -1) // on appelle en no_commit
|
||||
if ($pai->create($this->user, 1) == -1) // on appelle en no_commit
|
||||
{
|
||||
$error++;
|
||||
dol_syslog("RejetPrelevement::Create Erreur creation paiement facture ".$facs[$i]);
|
||||
$error++;
|
||||
dol_syslog("RejetPrelevement::Create Erreur creation paiement facture ".$facs[$i]);
|
||||
}
|
||||
|
||||
/* Valide le paiement */
|
||||
/* Valide le paiement */
|
||||
|
||||
if ($pai->valide() < 0)
|
||||
if ($pai->valide() < 0)
|
||||
{
|
||||
$error++;
|
||||
dol_syslog("RejetPrelevement::Create Erreur validation du paiement");
|
||||
$error++;
|
||||
dol_syslog("RejetPrelevement::Create Erreur validation du paiement");
|
||||
}
|
||||
|
||||
/* Tag la facture comme impayee */
|
||||
dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref);
|
||||
$fac->set_unpaid($fac->id, $user);
|
||||
/* Tag la facture comme impayee */
|
||||
dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref);
|
||||
$fac->set_unpaid($fac->id, $user);
|
||||
|
||||
/* Envoi un email <20> l'emetteur de la demande de prev */
|
||||
$this->_send_email($fac);
|
||||
}
|
||||
/* Envoi un email <20> l'emetteur de la demande de prev */
|
||||
$this->_send_email($fac);
|
||||
}
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
dol_syslog("RejetPrelevement::Create Commit");
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement::Create Rollback");
|
||||
$this->db->rollback();
|
||||
}
|
||||
if ($error == 0)
|
||||
{
|
||||
dol_syslog("RejetPrelevement::Create Commit");
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement::Create Rollback");
|
||||
$this->db->rollback();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Envoi mail
|
||||
* \param fac Invoice object
|
||||
*/
|
||||
function _send_email($fac)
|
||||
{
|
||||
global $langs;
|
||||
/**
|
||||
* \brief Envoi mail
|
||||
* \param fac Invoice object
|
||||
*/
|
||||
function _send_email($fac)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$userid = 0;
|
||||
$userid = 0;
|
||||
|
||||
$sql = "SELECT fk_user_demande";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql.= " WHERE pfd.fk_prelevement_bons = ".$this->bon_id;
|
||||
$sql.= " AND pfd.fk_facture = ".$fac->id;
|
||||
$sql = "SELECT fk_user_demande";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql.= " WHERE pfd.fk_prelevement_bons = ".$this->bon_id;
|
||||
$sql.= " AND pfd.fk_facture = ".$fac->id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$userid = $row[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement::_send_email Erreur lecture user");
|
||||
}
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$userid = $row[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement::_send_email Erreur lecture user");
|
||||
}
|
||||
|
||||
if ($userid > 0)
|
||||
{
|
||||
$emuser = new User($this->db);
|
||||
$emuser->fetch($userid);
|
||||
if ($userid > 0)
|
||||
{
|
||||
$emuser = new User($this->db);
|
||||
$emuser->fetch($userid);
|
||||
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($fac->socid);
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($fac->socid);
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
||||
|
||||
$subject = "Prelevement rejete";
|
||||
$sendto = $emuser->getFullName($langs)." <".$emuser->email.">";
|
||||
$from = $this->user->getFullName($langs)." <".$this->user->email.">";
|
||||
$msgishtml=0;
|
||||
$subject = "Prelevement rejete";
|
||||
$sendto = $emuser->getFullName($langs)." <".$emuser->email.">";
|
||||
$from = $this->user->getFullName($langs)." <".$this->user->email.">";
|
||||
$msgishtml=0;
|
||||
|
||||
$arr_file = array();
|
||||
$arr_mime = array();
|
||||
$arr_name = array();
|
||||
$arr_file = array();
|
||||
$arr_mime = array();
|
||||
$arr_name = array();
|
||||
|
||||
$message = "Bonjour,\n";
|
||||
$message .= "\nLe prelevement de la facture ".$fac->ref." pour le compte de la societe ".$soc->nom." d'un montant de ".price($fac->total_ttc)." a ete rejete par la banque.";
|
||||
$message .= "\n\n--\n".$this->user->getFullName($langs);
|
||||
$message = "Bonjour,\n";
|
||||
$message .= "\nLe prelevement de la facture ".$fac->ref." pour le compte de la societe ".$soc->nom." d'un montant de ".price($fac->total_ttc)." a ete rejete par la banque.";
|
||||
$message .= "\n\n--\n".$this->user->getFullName($langs);
|
||||
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,
|
||||
$arr_file,$arr_mime,$arr_name,
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,
|
||||
$arr_file,$arr_mime,$arr_name,
|
||||
'', '', 0, $msgishtml,$this->user->email);
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
dol_syslog("RejetPrelevement::_send_email email envoye");
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement::_send_email Erreur envoi email");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement::_send_email Userid invalide");
|
||||
}
|
||||
}
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
dol_syslog("RejetPrelevement::_send_email email envoye");
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement::_send_email Erreur envoi email");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement::_send_email Userid invalide");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Recupere la liste des factures concernees
|
||||
*/
|
||||
function _get_list_factures()
|
||||
{
|
||||
global $conf;
|
||||
/**
|
||||
* \brief Recupere la liste des factures concernees
|
||||
*/
|
||||
function _get_list_factures()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$arr = array();
|
||||
/*
|
||||
* Renvoie toutes les factures associ<EFBFBD>e <EFBFBD> un pr<EFBFBD>l<EFBFBD>vement
|
||||
*
|
||||
*/
|
||||
$arr = array();
|
||||
/*
|
||||
* Renvoie toutes les factures associ<EFBFBD>e <EFBFBD> un pr<EFBFBD>l<EFBFBD>vement
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT f.rowid as facid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE pf.fk_prelevement_lignes = ".$this->id;
|
||||
$sql.= " AND pf.fk_facture = f.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql = "SELECT f.rowid as facid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE pf.fk_prelevement_lignes = ".$this->id;
|
||||
$sql.= " AND pf.fk_facture = f.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $this->db->num_rows();
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $this->db->num_rows();
|
||||
|
||||
if ($num)
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row();
|
||||
$arr[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row();
|
||||
$arr[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$this->db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement Erreur");
|
||||
}
|
||||
$this->db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement Erreur");
|
||||
}
|
||||
|
||||
return $arr;
|
||||
return $arr;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Recupere l'objet prelevement
|
||||
* \param rowid id de la facture a recuperer
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
/**
|
||||
* \brief Recupere l'objet prelevement
|
||||
* \param rowid id de la facture a recuperer
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
|
||||
$sql = "SELECT pr.date_rejet as dr, motif";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_rejet as pr";
|
||||
$sql.= " WHERE pr.fk_prelevement_lignes =".$rowid;
|
||||
$sql = "SELECT pr.date_rejet as dr, motif";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_rejet as pr";
|
||||
$sql.= " WHERE pr.fk_prelevement_lignes =".$rowid;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
$this->id = $rowid;
|
||||
$this->date_rejet = $this->db->jdate($obj->dr);
|
||||
$this->motif = $this->motifs[$obj->motif];
|
||||
|
||||
$this->id = $rowid;
|
||||
$this->date_rejet = $this->db->jdate($obj->dr);
|
||||
$this->motif = $this->motifs[$obj->motif];
|
||||
$this->db->free($resql);
|
||||
|
||||
$this->db->free();
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid numrows=0");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid");
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid numrows=0");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid");
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -194,9 +194,10 @@ $sql.= " AND pfd.traite = 0";
|
|||
$sql.= " AND pfd.fk_facture = f.rowid";
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
if ($num)
|
||||
|
|
@ -207,7 +208,7 @@ if ( $db->query($sql) )
|
|||
$var = True;
|
||||
while ($i < $num && $i < 20)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
$invoicestatic->id=$obj->rowid;
|
||||
|
|
|
|||
|
|
@ -210,10 +210,9 @@ class ChargeSociales extends CommonObject
|
|||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
if ($this->db->num_rows()) {
|
||||
$obj = $this->db->fetch_object();
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
return $obj->amount;
|
||||
} else {
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -326,9 +326,10 @@ print "</table>";
|
|||
}
|
||||
$sql .= " GROUP BY f.facnumber,f.rowid,s.nom, s.rowid, f.total_ttc";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
if ($num)
|
||||
|
|
@ -337,7 +338,7 @@ print "</table>";
|
|||
$total_ttc_Rac = $totalam_Rac = $total_Rac = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
$total_ttc_Rac += $obj->total_ttc;
|
||||
$totalam_Rac += $obj->am;
|
||||
$i++;
|
||||
|
|
@ -346,7 +347,7 @@ print "</table>";
|
|||
print "<tr $bc[$var]><td align=\"right\" colspan=\"5\"><i>Facture a encaisser : </i></td><td align=\"right\"><i>".price($total_ttc_Rac)."</i></td><td colspan=\"5\"><-- bug ici car n'exclut pas le deja r<>gl<67> des factures partiellement r<>gl<67>es</td></tr>";
|
||||
$total_CA +=$total_ttc_Rac;
|
||||
}
|
||||
$db->free();
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -377,9 +378,10 @@ print "</table>";
|
|||
}
|
||||
$sql .= " GROUP BY p.rowid";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
if ($num)
|
||||
|
|
@ -388,7 +390,7 @@ print "</table>";
|
|||
$total_pr = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
$total_pr += $obj->total_ttc-$obj->tot_fttc;
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -396,7 +398,7 @@ print "</table>";
|
|||
print "<tr $bc[$var]><td align=\"right\" colspan=\"5\"><i>Signe et non facture:</i></td><td align=\"right\"><i>".price($total_pr)."</i></td><td colspan=\"5\"><-- bug ici, ca devrait exclure le deja facture</td></tr>";
|
||||
$total_CA += $total_pr;
|
||||
}
|
||||
$db->free();
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -140,19 +140,20 @@ else
|
|||
|
||||
|
||||
/*
|
||||
* Derniers groupes cr<EFBFBD><EFBFBD>s
|
||||
* Derniers groupes crees
|
||||
*/
|
||||
$max=5;
|
||||
|
||||
$sql = "SELECT g.rowid, g.nom, g.note, g.entity, g.datec";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g";
|
||||
$sql.= " WHERE g.entity IN (0,".$conf->entity.")";
|
||||
$sql.= " ORDER BY g.datec DESC";
|
||||
if ($max) $sql.= " LIMIT $max";
|
||||
$sql.= $db->order("g.datec","DESC");
|
||||
$sql.= $db->limit($max);
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("LastGroupsCreated",($num ? $num : $max)).'</td></tr>';
|
||||
$var = true;
|
||||
|
|
@ -160,7 +161,7 @@ if ( $db->query($sql) )
|
|||
|
||||
while ($i < $num && (! $max || $i < $max))
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
|
@ -176,7 +177,7 @@ if ( $db->query($sql) )
|
|||
}
|
||||
print "</table><br>";
|
||||
|
||||
$db->free();
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -65,9 +65,10 @@ $sql .= " WHERE s.rowid = c.fk_soc";
|
|||
$sql .= " AND c.email IS NOT NULL";
|
||||
$sql .= " ORDER BY c.email ASC";
|
||||
|
||||
if ($db->query($sql))
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print "Lines ".$num."\n";
|
||||
|
||||
|
|
@ -83,18 +84,17 @@ if ($db->query($sql))
|
|||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($obj->email <> $oldemail)
|
||||
{
|
||||
$page->write_string($j, 0, $obj->nom);
|
||||
$page->write_string($j, 1, $obj->firstname);
|
||||
$page->write_string($j, 2, $obj->name);
|
||||
$page->write_string($j, 3, $obj->email);
|
||||
$j++;
|
||||
|
||||
$page->write_string($j, 0, $obj->nom);
|
||||
$page->write_string($j, 1, $obj->firstname);
|
||||
$page->write_string($j, 2, $obj->name);
|
||||
$page->write_string($j, 3, $obj->email);
|
||||
$j++;
|
||||
|
||||
$oldemail = $obj->email;
|
||||
$oldemail = $obj->email;
|
||||
}
|
||||
|
||||
$i++;
|
||||
|
|
|
|||
|
|
@ -59,9 +59,10 @@ $sql .= " AND sc.fk_soc = s.rowid";
|
|||
$sql .= " AND sc.fk_user = u.rowid";
|
||||
$sql .= " ORDER BY u.email ASC, s.rowid ASC";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$oldemail = '';
|
||||
$message = '';
|
||||
|
|
@ -72,7 +73,7 @@ if ( $db->query($sql) )
|
|||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($obj->email <> $oldemail)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user