New: Ajout gestion de parametres sur les boxes
New: Possibilité de mettre plusieurs boites de différents flux RSS.
This commit is contained in:
parent
ac8c73555c
commit
d7b7a2da94
@ -193,7 +193,7 @@ if ($resql)
|
|||||||
$module=eregi_replace('.php$','',$obj->file);
|
$module=eregi_replace('.php$','',$obj->file);
|
||||||
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/".$module.".php");
|
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/".$module.".php");
|
||||||
|
|
||||||
$box=new $module();
|
$box=new $module($db,$obj->note);
|
||||||
|
|
||||||
// if (in_array($obj->rowid, $actives) && $box->box_multiple <> 1)
|
// if (in_array($obj->rowid, $actives) && $box->box_multiple <> 1)
|
||||||
if (in_array($obj->rowid, $actives))
|
if (in_array($obj->rowid, $actives))
|
||||||
@ -273,7 +273,7 @@ if ($resql)
|
|||||||
|
|
||||||
$module=eregi_replace('.php$','',$obj->file);
|
$module=eregi_replace('.php$','',$obj->file);
|
||||||
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/".$module.".php");
|
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/".$module.".php");
|
||||||
$box=new $module();
|
$box=new $module($db,$obj->note);
|
||||||
|
|
||||||
$logo=eregi_replace("^object_","",$box->boximg);
|
$logo=eregi_replace("^object_","",$box->boximg);
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
|
|||||||
@ -53,17 +53,21 @@ class InfoBox
|
|||||||
/**
|
/**
|
||||||
* \brief Retourne tableau des boites elligibles pour la zone
|
* \brief Retourne tableau des boites elligibles pour la zone
|
||||||
* \param $zone ID de la zone (0 pour la Homepage, ...)
|
* \param $zone ID de la zone (0 pour la Homepage, ...)
|
||||||
* \return array Tableau des boites qualifiées
|
* \return array Tableau d'objet box
|
||||||
*/
|
*/
|
||||||
function listBoxes($zone)
|
function listBoxes($zone)
|
||||||
{
|
{
|
||||||
$boxes=array();
|
$boxes=array();
|
||||||
|
|
||||||
$sql = "SELECT b.rowid, b.box_id, d.file";
|
$sql = "SELECT b.rowid, b.box_id,";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
|
$sql.= " d.file, d.note";
|
||||||
$sql .= " WHERE b.box_id = d.rowid";
|
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
|
||||||
$sql .= " AND position = ".$zone;
|
$sql.= " WHERE b.box_id = d.rowid";
|
||||||
$sql .= " ORDER BY box_order";
|
$sql.= " AND position = ".$zone;
|
||||||
|
$sql.= " ORDER BY box_order";
|
||||||
|
|
||||||
|
dolibarr_syslog("InfoBox::listBoxes sql=$sql");
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -72,7 +76,12 @@ class InfoBox
|
|||||||
while ($j < $num)
|
while ($j < $num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
$boxes[$j]=eregi_replace('.php$','',$obj->file);
|
$boxname=eregi_replace('.php$','',$obj->file);
|
||||||
|
|
||||||
|
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/".$boxname.".php");
|
||||||
|
$box=new $boxname($this->db,$obj->note);
|
||||||
|
$boxes[$j]=$box;
|
||||||
|
|
||||||
$j++;
|
$j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,9 @@ class box_actions extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("action");
|
var $depends = array("action");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,9 @@ class box_bookmarks extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array();
|
var $depends = array();
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,9 @@ class box_clients extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("societe");
|
var $depends = array("societe");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,9 @@ class box_commandes extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("commercial");
|
var $depends = array("commercial");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -32,111 +32,115 @@ include_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php");
|
|||||||
|
|
||||||
class box_comptes extends ModeleBoxes {
|
class box_comptes extends ModeleBoxes {
|
||||||
|
|
||||||
var $boxcode="currentaccounts";
|
var $boxcode="currentaccounts";
|
||||||
var $boximg="object_bill";
|
var $boximg="object_bill";
|
||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("banque"); // Box active si module banque actif
|
var $depends = array("banque"); // Box active si module banque actif
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $db;
|
||||||
var $info_box_contents = array();
|
var $param;
|
||||||
|
|
||||||
/**
|
var $info_box_head = array();
|
||||||
* \brief Constructeur de la classe
|
var $info_box_contents = array();
|
||||||
*/
|
|
||||||
function box_comptes()
|
|
||||||
|
/**
|
||||||
|
* \brief Constructeur de la classe
|
||||||
|
*/
|
||||||
|
function box_comptes()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("boxes");
|
||||||
|
|
||||||
|
$this->boxlabel=$langs->trans('BoxCurrentAccounts');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Charge les données en mémoire pour affichage ultérieur
|
||||||
|
* \param $max Nombre maximum d'enregistrements à charger
|
||||||
|
*/
|
||||||
|
function loadBox($max=5)
|
||||||
|
{
|
||||||
|
global $user, $langs, $db;
|
||||||
|
$langs->load("boxes");
|
||||||
|
|
||||||
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts"));
|
||||||
|
|
||||||
|
if ($user->rights->banque->lire)
|
||||||
{
|
{
|
||||||
global $langs;
|
$sql = "SELECT rowid, label, bank, number";
|
||||||
$langs->load("boxes");
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||||
|
$sql .= " WHERE clos = 0 AND courant = 1";
|
||||||
|
$sql .= " ORDER BY label";
|
||||||
|
$sql .= $db->plimit($max, 0);
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans('BoxCurrentAccounts');
|
$result = $db->query($sql);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
if ($result)
|
||||||
* \brief Charge les données en mémoire pour affichage ultérieur
|
|
||||||
* \param $max Nombre maximum d'enregistrements à charger
|
|
||||||
*/
|
|
||||||
function loadBox($max=5)
|
|
||||||
{
|
|
||||||
global $user, $langs, $db;
|
|
||||||
$langs->load("boxes");
|
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts"));
|
|
||||||
|
|
||||||
if ($user->rights->banque->lire)
|
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid, label, bank, number";
|
$num = $db->num_rows($result);
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
|
|
||||||
$sql .= " WHERE clos = 0 AND courant = 1";
|
|
||||||
$sql .= " ORDER BY label";
|
|
||||||
$sql .= $db->plimit($max, 0);
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$i = 0;
|
||||||
|
$solde_total = 0;
|
||||||
|
|
||||||
if ($result)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
$acc = new Account($db);
|
||||||
|
$acc->fetch($objp->rowid);
|
||||||
|
$solde_total += $acc->solde();
|
||||||
|
|
||||||
$i = 0;
|
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||||
$solde_total = 0;
|
'logo' => $this->boximg,
|
||||||
|
'text' => stripslashes($objp->label),
|
||||||
|
'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid);
|
||||||
|
|
||||||
while ($i < $num)
|
$this->info_box_contents[$i][1] = array('align' => 'left',
|
||||||
{
|
'text' => stripslashes($objp->bank)
|
||||||
$objp = $db->fetch_object($result);
|
|
||||||
$acc = new Account($db);
|
|
||||||
$acc->fetch($objp->rowid);
|
|
||||||
$solde_total += $acc->solde();
|
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
|
||||||
'logo' => $this->boximg,
|
|
||||||
'text' => stripslashes($objp->label),
|
|
||||||
'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid);
|
|
||||||
|
|
||||||
$this->info_box_contents[$i][1] = array('align' => 'left',
|
|
||||||
'text' => stripslashes($objp->bank)
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('align' => 'left',
|
|
||||||
'text' => stripslashes($objp->number)
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->info_box_contents[$i][3] = array('align' => 'right',
|
|
||||||
'text' => price( $acc->solde() )
|
|
||||||
);
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Total
|
|
||||||
$this->info_box_contents[$i][-1] = array('class' => 'liste_total');
|
|
||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('align' => 'right',
|
|
||||||
//'width' => '75%',
|
|
||||||
'colspan' => '4',
|
|
||||||
'class' => 'liste_total',
|
|
||||||
'text' => $langs->trans('Total')
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$i][1] = array('align' => 'right',
|
$this->info_box_contents[$i][2] = array('align' => 'left',
|
||||||
'class' => 'liste_total',
|
'text' => stripslashes($objp->number)
|
||||||
'text' => price($solde_total)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][3] = array('align' => 'right',
|
||||||
|
'text' => price( $acc->solde() )
|
||||||
|
);
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
dolibarr_print_error($db);
|
// Total
|
||||||
}
|
$this->info_box_contents[$i][-1] = array('class' => 'liste_total');
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][0] = array('align' => 'right',
|
||||||
|
//'width' => '75%',
|
||||||
|
'colspan' => '4',
|
||||||
|
'class' => 'liste_total',
|
||||||
|
'text' => $langs->trans('Total')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$i][1] = array('align' => 'right',
|
||||||
|
'class' => 'liste_total',
|
||||||
|
'text' => price($solde_total)
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->info_box_contents[0][0] = array('align' => 'left',
|
dolibarr_print_error($db);
|
||||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||||
|
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function showBox()
|
}
|
||||||
{
|
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
function showBox()
|
||||||
}
|
{
|
||||||
|
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,21 +17,24 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
|
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
|
||||||
|
|
||||||
class box_energie_graph extends ModeleBoxes {
|
class box_energie_graph extends ModeleBoxes {
|
||||||
|
|
||||||
var $boxcode="energie_graph";
|
var $boxcode="energie_graph";
|
||||||
var $boximg="object_energie";
|
var $boximg="object_energie";
|
||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
|
var $depends = array("energie"); // Box active si module energie actif
|
||||||
|
|
||||||
var $box_multiple = 1;
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $box_multiple = 1;
|
||||||
var $info_box_contents = array();
|
|
||||||
|
var $info_box_head = array();
|
||||||
|
var $info_box_contents = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* \brief Constructeur de la classe
|
||||||
|
|||||||
@ -27,6 +27,10 @@ class box_energie_releve extends ModeleBoxes {
|
|||||||
var $boxcode="energie";
|
var $boxcode="energie";
|
||||||
var $boximg="object_energie";
|
var $boximg="object_energie";
|
||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
|
var $depends = array("energie");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|||||||
@ -39,17 +39,23 @@ class box_external_rss extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array();
|
var $depends = array();
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* \brief Constructeur de la classe
|
||||||
*/
|
*/
|
||||||
function box_external_rss()
|
function box_external_rss($DB,$param)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
|
$this->db=$DB;
|
||||||
|
$this->param=$param;
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastRssInfos");
|
$this->boxlabel=$langs->trans("BoxLastRssInfos");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,38 +65,41 @@ class box_external_rss extends ModeleBoxes {
|
|||||||
*/
|
*/
|
||||||
function loadBox($max=5)
|
function loadBox($max=5)
|
||||||
{
|
{
|
||||||
global $user, $langs, $db;
|
global $user, $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
for($site = 0; $site < 1; $site++) {
|
// On recupere numero de param de la boite
|
||||||
$rss = fetch_rss( @constant("EXTERNAL_RSS_URLRSS_" . $site) );
|
ereg('^([0-9]+) ',$this->param,$reg);
|
||||||
|
$site=$reg[1];
|
||||||
|
|
||||||
$title=$langs->trans("BoxTitleLastRssInfos",$max, @constant("EXTERNAL_RSS_TITLE_". $site));
|
// Recupere flux RSS definie dans EXTERNAL_RSS_URLRSS_$site
|
||||||
if ($rss->ERROR) {
|
$rss = fetch_rss( @constant("EXTERNAL_RSS_URLRSS_".$site) );
|
||||||
// Affiche warning car il y a eu une erreur
|
|
||||||
$title.=" ".img_error($langs->trans("FailedToRefreshDataInfoNotUpToDate",(isset($rss->date)?dolibarr_print_date($rss->date,"%d %b %Y %H:%M"):'unknown date')));
|
|
||||||
$this->info_box_head = array('text' => $title,'limit' => 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->info_box_head = array('text' => $title);
|
|
||||||
}
|
|
||||||
|
|
||||||
for($i = 0; $i < $max ; $i++){
|
|
||||||
$item = $rss->items[$i];
|
|
||||||
$href = $item['link'];
|
|
||||||
$title = utf8_decode(urldecode($item['title']));
|
|
||||||
$title=ereg_replace("([[:alnum:]])\?([[:alnum:]])","\\1'\\2",$title); // Gère problème des apostrophes mal codée/décodée par utf8
|
|
||||||
$title=ereg_replace("^\s+","",$title); // Supprime espaces de début
|
|
||||||
$this->info_box_contents["$href"]="$title";
|
|
||||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
|
||||||
'logo' => $this->boximg,
|
|
||||||
'text' => $title,
|
|
||||||
'url' => $href,
|
|
||||||
'target' => 'newrss');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$title=$langs->trans("BoxTitleLastRssInfos",$max, @constant("EXTERNAL_RSS_TITLE_". $site));
|
||||||
|
if ($rss->ERROR)
|
||||||
|
{
|
||||||
|
// Affiche warning car il y a eu une erreur
|
||||||
|
$title.=" ".img_error($langs->trans("FailedToRefreshDataInfoNotUpToDate",(isset($rss->date)?dolibarr_print_date($rss->date,"%d %b %Y %H:%M"):'unknown date')));
|
||||||
|
$this->info_box_head = array('text' => $title,'limit' => 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->info_box_head = array('text' => $title);
|
||||||
|
}
|
||||||
|
|
||||||
|
for($i = 0; $i < $max ; $i++)
|
||||||
|
{
|
||||||
|
$item = $rss->items[$i];
|
||||||
|
$href = $item['link'];
|
||||||
|
$title = utf8_decode(urldecode($item['title']));
|
||||||
|
$title=ereg_replace("([[:alnum:]])\?([[:alnum:]])","\\1'\\2",$title); // Gère problème des apostrophes mal codée/décodée par utf8
|
||||||
|
$title=ereg_replace("^\s+","",$title); // Supprime espaces de début
|
||||||
|
$this->info_box_contents["$href"]="$title";
|
||||||
|
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||||
|
'logo' => $this->boximg,
|
||||||
|
'text' => $title,
|
||||||
|
'url' => $href,
|
||||||
|
'target' => 'newrss');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,9 @@ class box_factures extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("facture");
|
var $depends = array("facture");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,6 +37,9 @@ class box_factures_fourn extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("facture","fournisseur");
|
var $depends = array("facture","fournisseur");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -36,9 +36,13 @@ class box_factures_fourn_imp extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("facture","fournisseur");
|
var $depends = array("facture","fournisseur");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* \brief Constructeur de la classe
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -38,6 +38,9 @@ class box_factures_imp extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("facture");
|
var $depends = array("facture");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,9 @@ class box_fournisseurs extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("fournisseur");
|
var $depends = array("fournisseur");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,6 +36,9 @@ class box_osc_clients extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("boutique");
|
var $depends = array("boutique");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,9 @@ class box_produits extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("produit");
|
var $depends = array("produit");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,9 @@ class box_propales extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("propale");
|
var $depends = array("propale");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,9 @@ class box_prospect extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("commercial");
|
var $depends = array("commercial");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,9 @@ class box_services_vendus extends ModeleBoxes {
|
|||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("produit","service");
|
var $depends = array("produit","service");
|
||||||
|
|
||||||
|
var $db;
|
||||||
|
var $param;
|
||||||
|
|
||||||
var $info_box_head = array();
|
var $info_box_head = array();
|
||||||
var $info_box_contents = array();
|
var $info_box_contents = array();
|
||||||
|
|
||||||
|
|||||||
@ -65,6 +65,7 @@ class ModeleBoxes
|
|||||||
$nbcol=sizeof($contents[0])+1;
|
$nbcol=sizeof($contents[0])+1;
|
||||||
$nblines=sizeof($contents);
|
$nblines=sizeof($contents);
|
||||||
|
|
||||||
|
print "\n<!-- Box start -->\n";
|
||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
|
|
||||||
// Affiche titre de la boite
|
// Affiche titre de la boite
|
||||||
@ -154,6 +155,9 @@ class ModeleBoxes
|
|||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
print "\n<!-- Box end -->\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
Snoopy - the PHP net client
|
Snoopy - the PHP net client
|
||||||
Author: Monte Ohrt <monte@ispi.net>
|
Author: Monte Ohrt <monte@ispi.net>
|
||||||
|
Modification: Laurent Destailleur (See LDR mark to find bug fix)
|
||||||
Copyright (c): 1999-2000 ispi, all rights reserved
|
Copyright (c): 1999-2000 ispi, all rights reserved
|
||||||
Version: 1.0
|
Version: 1.0
|
||||||
|
|
||||||
@ -497,7 +498,7 @@ class Snoopy
|
|||||||
|
|
||||||
// if($currentHeader == "\r\n")
|
// if($currentHeader == "\r\n")
|
||||||
if(preg_match("/^\r?\n$/", $currentHeader) )
|
if(preg_match("/^\r?\n$/", $currentHeader) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// if a header begins with Location: or URI:, set the redirect
|
// if a header begins with Location: or URI:, set the redirect
|
||||||
if(preg_match("/^(Location:|URI:)/i",$currentHeader))
|
if(preg_match("/^(Location:|URI:)/i",$currentHeader))
|
||||||
@ -643,8 +644,9 @@ class Snoopy
|
|||||||
if(!empty($this->user) || !empty($this->pass))
|
if(!empty($this->user) || !empty($this->pass))
|
||||||
$headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
|
$headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
|
||||||
|
|
||||||
for($curr_header = 0; $curr_header < count($headers); $curr_header++)
|
for($curr_header = 0; $curr_header < count($headers); $curr_header++) {
|
||||||
$cmdline_params .= " -H \"".$headers[$curr_header]."\"";
|
$cmdline_params .= " -H \"".$headers[$curr_header]."\"";
|
||||||
|
}
|
||||||
|
|
||||||
if(!empty($body))
|
if(!empty($body))
|
||||||
$cmdline_params .= " -d \"$body\"";
|
$cmdline_params .= " -d \"$body\"";
|
||||||
@ -656,7 +658,7 @@ class Snoopy
|
|||||||
|
|
||||||
# accept self-signed certs
|
# accept self-signed certs
|
||||||
$cmdline_params .= " -k";
|
$cmdline_params .= " -k";
|
||||||
exec($this->curl_path." -D \"/tmp/$headerfile\"".$cmdline_params." ".$URI,$results,$return);
|
exec($this->curl_path." -D \"/tmp/$headerfile\"".escapeshellcmd($cmdline_params)." ".escapeshellcmd($URI),$results,$return);
|
||||||
|
|
||||||
if($return)
|
if($return)
|
||||||
{
|
{
|
||||||
@ -697,11 +699,11 @@ class Snoopy
|
|||||||
|
|
||||||
if(preg_match("|^HTTP/|",$result_headers[$currentHeader]))
|
if(preg_match("|^HTTP/|",$result_headers[$currentHeader]))
|
||||||
{
|
{
|
||||||
$this->response_code = $result_headers[$currentHeader];
|
$this->response_code = $result_headers[$currentHeader];
|
||||||
if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$this->response_code, $match))
|
if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$this->response_code, $match))
|
||||||
{
|
{
|
||||||
$this->status= $match[1];
|
$this->status= $match[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->headers[] = $result_headers[$currentHeader];
|
$this->headers[] = $result_headers[$currentHeader];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,10 +93,14 @@ class RSSCache {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = fread( $fp, filesize($cache_file) );
|
if ($filesize = filesize($cache_file) ) {
|
||||||
$rss = $this->unserialize( $data );
|
$data = fread( $fp, filesize($cache_file) );
|
||||||
|
$rss = $this->unserialize( $data );
|
||||||
|
|
||||||
return $rss;
|
return $rss;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
@ -130,6 +134,18 @@ class RSSCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cache_age( $cache_key ) {
|
||||||
|
$filename = $this->file_name( $url );
|
||||||
|
if ( file_exists( $filename ) ) {
|
||||||
|
$mtime = filemtime( $filename );
|
||||||
|
$age = time() - $mtime;
|
||||||
|
return $age;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: serialize
|
Function: serialize
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
|
|||||||
@ -2,11 +2,11 @@
|
|||||||
/*
|
/*
|
||||||
* Project: MagpieRSS: a simple RSS integration tool
|
* Project: MagpieRSS: a simple RSS integration tool
|
||||||
* File: rss_fetch.inc, a simple functional interface
|
* File: rss_fetch.inc, a simple functional interface
|
||||||
to fetching and parsing RSS files, via the
|
to fetching and parsing RSS files, via the
|
||||||
function fetch_rss()
|
function fetch_rss()
|
||||||
* Author: Kellan Elliott-McCrea <kellan@protest.net>
|
* Author: Kellan Elliott-McCrea <kellan@protest.net>
|
||||||
* Modified by Laurent Destailleur <eldy@users.sourceforge.net> for Dolibarr
|
* Modification: Laurent Destailleur (See LDR mark to find bug fix)
|
||||||
* License: GPL
|
* License: GPL
|
||||||
*
|
*
|
||||||
* The lastest version of MagpieRSS can be obtained from:
|
* The lastest version of MagpieRSS can be obtained from:
|
||||||
* http://magpierss.sourceforge.net
|
* http://magpierss.sourceforge.net
|
||||||
@ -21,7 +21,7 @@
|
|||||||
// the current path in include_path.
|
// the current path in include_path.
|
||||||
// with thanks to rajiv and smarty
|
// with thanks to rajiv and smarty
|
||||||
if (!defined('DIR_SEP')) {
|
if (!defined('DIR_SEP')) {
|
||||||
define('DIR_SEP', DIRECTORY_SEPARATOR);
|
define('DIR_SEP', DIRECTORY_SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defined('MAGPIE_DIR')) {
|
if (!defined('MAGPIE_DIR')) {
|
||||||
@ -63,147 +63,148 @@ require_once( MAGPIE_EXTLIB . 'Snoopy.class.inc');
|
|||||||
|
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: fetch_rss:
|
Function: fetch_rss:
|
||||||
Purpose: return RSS object for the give url
|
Purpose: return RSS object for the give url
|
||||||
maintain the cache
|
maintain the cache
|
||||||
Input: url of RSS file
|
Input: url of RSS file
|
||||||
Output: parsed RSS object (see rss_parse.inc)
|
Output: parsed RSS object (see rss_parse.inc)
|
||||||
|
|
||||||
NOTES ON CACHEING:
|
NOTES ON CACHEING:
|
||||||
If caching is on (MAGPIE_CACHE_ON) fetch_rss will first check the cache.
|
If caching is on (MAGPIE_CACHE_ON) fetch_rss will first check the cache.
|
||||||
|
|
||||||
NOTES ON RETRIEVING REMOTE FILES:
|
NOTES ON RETRIEVING REMOTE FILES:
|
||||||
If conditional gets are on (MAGPIE_CONDITIONAL_GET_ON) fetch_rss will
|
If conditional gets are on (MAGPIE_CONDITIONAL_GET_ON) fetch_rss will
|
||||||
return a cached object, and touch the cache object upon recieving a
|
return a cached object, and touch the cache object upon recieving a
|
||||||
304.
|
304.
|
||||||
|
|
||||||
NOTES ON FAILED REQUESTS:
|
NOTES ON FAILED REQUESTS:
|
||||||
If there is an HTTP error while fetching an RSS object, the cached
|
If there is an HTTP error while fetching an RSS object, the cached
|
||||||
version will be return, if it exists (and if MAGPIE_CACHE_FRESH_ONLY is off)
|
version will be return, if it exists (and if MAGPIE_CACHE_FRESH_ONLY is off)
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
|
|
||||||
define('MAGPIE_VERSION', '0.7');
|
define('MAGPIE_VERSION', '0.72');
|
||||||
|
|
||||||
$MAGPIE_ERROR = "";
|
$MAGPIE_ERROR = "";
|
||||||
|
|
||||||
|
// LDR Added cachedir parameter to replace use of MAGPIE_CACHE_RSS and
|
||||||
|
// allow several call to different url with different a cache foreach of
|
||||||
|
// inside same PHP session.
|
||||||
function fetch_rss ($url) {
|
function fetch_rss ($url) {
|
||||||
// initialize constants
|
// initialize constants
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if ( !isset($url) ) {
|
if ( !isset($url) ) {
|
||||||
error("fetch_rss called without a url");
|
error("fetch_rss called without a url");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if cache is disabled
|
// if cache is disabled
|
||||||
if ( !MAGPIE_CACHE_ON ) {
|
if ( !MAGPIE_CACHE_ON ) {
|
||||||
// fetch file, and parse it
|
// fetch file, and parse it
|
||||||
$resp = _fetch_remote_file( $url );
|
$resp = _fetch_remote_file( $url );
|
||||||
if ( is_success( $resp->status ) ) {
|
if ( is_success( $resp->status ) ) {
|
||||||
return _response_to_rss( $resp );
|
return _response_to_rss( $resp );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
error("Failed to fetch $url and cache is off");
|
error("Failed to fetch $url and cache is off");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else cache is ON
|
// else cache is ON
|
||||||
else {
|
else {
|
||||||
// Flow
|
// Flow
|
||||||
// 1. check cache
|
// 1. check cache
|
||||||
// 2. if there is a hit, make sure its fresh
|
// 2. if there is a hit, make sure its fresh
|
||||||
// 3. if cached obj fails freshness check, fetch remote
|
// 3. if cached obj fails freshness check, fetch remote
|
||||||
// 4. if remote fails, return stale object, or error
|
// 4. if remote fails, return stale object, or error
|
||||||
|
|
||||||
$cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
|
$cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
|
||||||
|
|
||||||
if (MAGPIE_DEBUG and $cache->ERROR) {
|
if (MAGPIE_DEBUG and $cache->ERROR) {
|
||||||
debug($cache->ERROR, E_USER_WARNING);
|
debug($cache->ERROR, E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$cache_status = 0; // response of check_cache
|
$cache_status = 0; // response of check_cache
|
||||||
$request_headers = array(); // HTTP headers to send with fetch
|
$request_headers = array(); // HTTP headers to send with fetch
|
||||||
$rss = 0; // parsed RSS object
|
$rss = 0; // parsed RSS object
|
||||||
$errormsg = 0; // errors, if any
|
$errormsg = 0; // errors, if any
|
||||||
|
|
||||||
// store parsed XML by desired output encoding
|
// store parsed XML by desired output encoding
|
||||||
// as character munging happens at parse time
|
// as character munging happens at parse time
|
||||||
$cache_key = $url . MAGPIE_OUTPUT_ENCODING;
|
$cache_key = $url . MAGPIE_OUTPUT_ENCODING;
|
||||||
|
|
||||||
if (!$cache->ERROR) {
|
if (!$cache->ERROR) {
|
||||||
// return cache HIT, MISS, or STALE
|
// return cache HIT, MISS, or STALE
|
||||||
$cache_status = $cache->check_cache( $cache_key);
|
$cache_status = $cache->check_cache( $cache_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if object cached, and cache is fresh, return cached obj
|
// if object cached, and cache is fresh, return cached obj
|
||||||
if ( $cache_status == 'HIT' ) {
|
if ( $cache_status == 'HIT' ) {
|
||||||
$rss = $cache->get( $cache_key );
|
$rss = $cache->get( $cache_key );
|
||||||
if ( isset($rss) and $rss ) {
|
if ( isset($rss) and $rss ) {
|
||||||
// should be cache age
|
// should be cache age
|
||||||
$rss->from_cache = 1;
|
$rss->from_cache = 1;
|
||||||
if ( MAGPIE_DEBUG > 1) {
|
if ( MAGPIE_DEBUG > 1) {
|
||||||
debug("MagpieRSS: Cache HIT", E_USER_NOTICE);
|
debug("MagpieRSS: Cache HIT", E_USER_NOTICE);
|
||||||
}
|
}
|
||||||
return $rss;
|
return $rss;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// else attempt a conditional get
|
// else attempt a conditional get
|
||||||
|
|
||||||
// setup headers
|
// setup headers
|
||||||
if ( $cache_status == 'STALE' ) {
|
if ( $cache_status == 'STALE' ) {
|
||||||
$rss = $cache->get( $cache_key );
|
$rss = $cache->get( $cache_key );
|
||||||
if ( $rss and $rss->etag and $rss->last_modified ) {
|
if ( $rss and $rss->etag and $rss->last_modified ) {
|
||||||
$request_headers['If-None-Match'] = $rss->etag;
|
$request_headers['If-None-Match'] = $rss->etag;
|
||||||
$request_headers['If-Last-Modified'] = $rss->last_modified;
|
$request_headers['If-Last-Modified'] = $rss->last_modified;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$resp = _fetch_remote_file( $url, $request_headers );
|
$resp = _fetch_remote_file( $url, $request_headers );
|
||||||
|
|
||||||
if (isset($resp) and $resp) {
|
if (isset($resp) and $resp) {
|
||||||
if ($resp->status == '304' ) {
|
if ($resp->status == '304' ) {
|
||||||
// we have the most current copy
|
// we have the most current copy
|
||||||
if ( MAGPIE_DEBUG > 1) {
|
if ( MAGPIE_DEBUG > 1) {
|
||||||
debug("Got 304 for $url");
|
debug("Got 304 for $url");
|
||||||
}
|
}
|
||||||
// reset cache on 304 (at minutillo insistent prodding)
|
// reset cache on 304 (at minutillo insistent prodding)
|
||||||
$cache->set($cache_key, $rss);
|
$cache->set($cache_key, $rss);
|
||||||
return $rss;
|
return $rss;
|
||||||
}
|
}
|
||||||
elseif ( is_success( $resp->status ) ) {
|
elseif ( is_success( $resp->status ) ) {
|
||||||
$rss = _response_to_rss( $resp );
|
$rss = _response_to_rss( $resp );
|
||||||
if ( $rss ) {
|
if ( $rss ) {
|
||||||
if (MAGPIE_DEBUG > 1) {
|
if (MAGPIE_DEBUG > 1) {
|
||||||
debug("Fetch successful");
|
debug("Fetch successful");
|
||||||
}
|
}
|
||||||
// add object to cache
|
// add object to cache
|
||||||
$cache->set( $cache_key, $rss );
|
$cache->set( $cache_key, $rss );
|
||||||
return $rss;
|
return $rss;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$errormsg = "Failed to fetch $url ";
|
$errormsg = "Failed to fetch $url ";
|
||||||
if ( $resp->status == '-100' ) {
|
if ( $resp->status == '-100' ) {
|
||||||
$errormsg .= "(Request timed out after " . MAGPIE_FETCH_TIME_OUT . " seconds)";
|
$errormsg .= "(Request timed out after " . MAGPIE_FETCH_TIME_OUT . " seconds)";
|
||||||
}
|
}
|
||||||
elseif ( $resp->error ) {
|
elseif ( $resp->error ) {
|
||||||
# compensate for Snoopy's annoying habbit to tacking
|
# compensate for Snoopy's annoying habbit to tacking
|
||||||
# on '\n'
|
# on '\n'
|
||||||
$http_error = substr($resp->error, 0, -2);
|
$http_error = substr($resp->error, 0, -2);
|
||||||
|
$errormsg .= "(HTTP Error: $http_error)";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$errormsg .= "(HTTP Response: " . $resp->response_code .')';
|
||||||
|
}
|
||||||
|
|
||||||
// LDR FIX BUG (plus necessaire car corrigé par ligne du dessus)
|
// LDR FIX BUG If fails to get http url but cache file is read successfuly,
|
||||||
//$http_error = eregi_replace("\n","",$resp->error);
|
// we store error as a property of $rss->ERROR and date of last successful
|
||||||
|
// http access in $rss->date property.
|
||||||
$errormsg .= "(HTTP Error: $http_error)";
|
// This allows caller to trap error reasons and manage itself networks errors.
|
||||||
}
|
|
||||||
else {
|
|
||||||
$errormsg .= "(HTTP Response: " . $resp->response_code .')';
|
|
||||||
}
|
|
||||||
|
|
||||||
// LDR FIX BUG Si echec recup http mais cache bien lu,
|
|
||||||
// on stock erreur dans object rss
|
|
||||||
if ($rss)
|
if ($rss)
|
||||||
{
|
{
|
||||||
if ($cache && $cache_key) $rss->date=filemtime($cache->file_name($cache_key));
|
if ($cache && $cache_key) $rss->date=filemtime($cache->file_name($cache_key));
|
||||||
@ -213,50 +214,50 @@ function fetch_rss ($url) {
|
|||||||
$rss=$cache;
|
$rss=$cache;
|
||||||
}
|
}
|
||||||
$rss->ERROR=$errormsg;
|
$rss->ERROR=$errormsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$errormsg = "Unable to retrieve RSS file for unknown reasons.";
|
$errormsg = "Unable to retrieve RSS file for unknown reasons.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// else fetch failed
|
// else fetch failed
|
||||||
|
|
||||||
// attempt to return cached object
|
// attempt to return cached object
|
||||||
if ($rss) {
|
if ($rss) {
|
||||||
if ( MAGPIE_DEBUG ) {
|
if ( MAGPIE_DEBUG ) {
|
||||||
debug("Returning STALE object for $url");
|
debug("Returning STALE object for $url");
|
||||||
}
|
}
|
||||||
return $rss;
|
return $rss;
|
||||||
}
|
}
|
||||||
|
|
||||||
// else we totally failed
|
// else we totally failed
|
||||||
error( $errormsg );
|
error( $errormsg );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} // end if ( !MAGPIE_CACHE_ON ) {
|
} // end if ( !MAGPIE_CACHE_ON ) {
|
||||||
} // end fetch_rss()
|
} // end fetch_rss()
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: error
|
Function: error
|
||||||
Purpose: set MAGPIE_ERROR, and trigger error
|
Purpose: set MAGPIE_ERROR, and trigger error
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
|
|
||||||
function error ($errormsg, $lvl=E_USER_WARNING) {
|
function error ($errormsg, $lvl=E_USER_WARNING) {
|
||||||
global $MAGPIE_ERROR;
|
global $MAGPIE_ERROR;
|
||||||
|
|
||||||
// append PHP's error message if track_errors enabled
|
// append PHP's error message if track_errors enabled
|
||||||
if ( isset($php_errormsg) ) {
|
if ( isset($php_errormsg) ) {
|
||||||
$errormsg .= " ($php_errormsg)";
|
$errormsg .= " ($php_errormsg)";
|
||||||
}
|
}
|
||||||
if ( $errormsg ) {
|
if ( $errormsg ) {
|
||||||
$errormsg = "MagpieRSS: $errormsg";
|
$errormsg = "MagpieRSS: $errormsg";
|
||||||
$MAGPIE_ERROR = $errormsg;
|
$MAGPIE_ERROR = $errormsg;
|
||||||
// LDR BUG FIX On affiche erreur que si en mode debug
|
// LDR BUG FIX On affiche erreur que si en mode debug
|
||||||
if ( MAGPIE_DEBUG ) {
|
if ( MAGPIE_DEBUG ) {
|
||||||
trigger_error( $errormsg, $lvl);
|
trigger_error( $errormsg, $lvl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function debug ($debugmsg, $lvl=E_USER_NOTICE) {
|
function debug ($debugmsg, $lvl=E_USER_NOTICE) {
|
||||||
@ -267,132 +268,115 @@ function debug ($debugmsg, $lvl=E_USER_NOTICE) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: magpie_error
|
Function: magpie_error
|
||||||
Purpose: accessor for the magpie error variable
|
Purpose: accessor for the magpie error variable
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
function magpie_error ($errormsg="") {
|
function magpie_error ($errormsg="") {
|
||||||
global $MAGPIE_ERROR;
|
global $MAGPIE_ERROR;
|
||||||
|
|
||||||
if ( isset($errormsg) and $errormsg ) {
|
if ( isset($errormsg) and $errormsg ) {
|
||||||
$MAGPIE_ERROR = $errormsg;
|
$MAGPIE_ERROR = $errormsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $MAGPIE_ERROR;
|
return $MAGPIE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: _fetch_remote_file
|
Function: _fetch_remote_file
|
||||||
Purpose: retrieve an arbitrary remote file
|
Purpose: retrieve an arbitrary remote file
|
||||||
Input: url of the remote file
|
Input: url of the remote file
|
||||||
headers to send along with the request (optional)
|
headers to send along with the request (optional)
|
||||||
Output: an HTTP response object (see Snoopy.class.inc)
|
Output: an HTTP response object (see Snoopy.class.inc)
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
function _fetch_remote_file ($url, $headers = "" ) {
|
function _fetch_remote_file ($url, $headers = "" ) {
|
||||||
// Snoopy is an HTTP client in PHP
|
// Snoopy is an HTTP client in PHP
|
||||||
$client = new Snoopy();
|
$client = new Snoopy();
|
||||||
$client->agent = MAGPIE_USER_AGENT;
|
$client->agent = MAGPIE_USER_AGENT;
|
||||||
$client->read_timeout = MAGPIE_FETCH_TIME_OUT;
|
$client->read_timeout = MAGPIE_FETCH_TIME_OUT;
|
||||||
$client->use_gzip = MAGPIE_USE_GZIP;
|
$client->use_gzip = MAGPIE_USE_GZIP;
|
||||||
if (is_array($headers) ) {
|
if (is_array($headers) ) {
|
||||||
$client->rawheaders = $headers;
|
$client->rawheaders = $headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@$client->fetch($url);
|
@$client->fetch($url);
|
||||||
return $client;
|
return $client;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: _response_to_rss
|
Function: _response_to_rss
|
||||||
Purpose: parse an HTTP response object into an RSS object
|
Purpose: parse an HTTP response object into an RSS object
|
||||||
Input: an HTTP response object (see Snoopy)
|
Input: an HTTP response object (see Snoopy)
|
||||||
Output: parsed RSS object (see rss_parse)
|
Output: parsed RSS object (see rss_parse)
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
function _response_to_rss ($resp) {
|
function _response_to_rss ($resp) {
|
||||||
$rss = new MagpieRSS( $resp->results, MAGPIE_OUTPUT_ENCODING, MAGPIE_INPUT_ENCODING, MAGPIE_DETECT_ENCODING );
|
$rss = new MagpieRSS( $resp->results, MAGPIE_OUTPUT_ENCODING, MAGPIE_INPUT_ENCODING, MAGPIE_DETECT_ENCODING );
|
||||||
|
|
||||||
// if RSS parsed successfully
|
// if RSS parsed successfully
|
||||||
if ( $rss and !$rss->ERROR) {
|
if ( $rss and !$rss->ERROR) {
|
||||||
|
|
||||||
// find Etag, and Last-Modified
|
// find Etag, and Last-Modified
|
||||||
foreach($resp->headers as $h) {
|
foreach($resp->headers as $h) {
|
||||||
// 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
|
// 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
|
||||||
if (strpos($h, ": ")) {
|
if (strpos($h, ": ")) {
|
||||||
list($field, $val) = explode(": ", $h, 2);
|
list($field, $val) = explode(": ", $h, 2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$field = $h;
|
$field = $h;
|
||||||
$val = "";
|
$val = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $field == 'ETag' ) {
|
if ( $field == 'ETag' ) {
|
||||||
$rss->etag = $val;
|
$rss->etag = $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $field == 'Last-Modified' ) {
|
if ( $field == 'Last-Modified' ) {
|
||||||
$rss->last_modified = $val;
|
$rss->last_modified = $val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $rss;
|
return $rss;
|
||||||
} // else construct error message
|
} // else construct error message
|
||||||
else {
|
else {
|
||||||
$errormsg = "Failed to parse RSS file.";
|
$errormsg = "Failed to parse RSS file.";
|
||||||
|
|
||||||
if ($rss) {
|
if ($rss) {
|
||||||
$errormsg .= " (" . $rss->ERROR . ")";
|
$errormsg .= " (" . $rss->ERROR . ")";
|
||||||
}
|
}
|
||||||
error($errormsg);
|
error($errormsg);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} // end if ($rss and !$rss->error)
|
} // end if ($rss and !$rss->error)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: init
|
Function: init
|
||||||
Purpose: setup constants with default values
|
Purpose: setup constants with default values
|
||||||
check for user overrides
|
check for user overrides
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
function init () {
|
function init () {
|
||||||
if ( defined('MAGPIE_INITALIZED') ) {
|
if ( defined('MAGPIE_INITALIZED') ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
define('MAGPIE_INITALIZED', true);
|
define('MAGPIE_INITALIZED', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !defined('MAGPIE_CACHE_ON') ) {
|
if ( !defined('MAGPIE_CACHE_ON') ) {
|
||||||
define('MAGPIE_CACHE_ON', true);
|
define('MAGPIE_CACHE_ON', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !defined('MAGPIE_CACHE_DIR') ) {
|
if ( !defined('MAGPIE_CACHE_DIR') ) {
|
||||||
|
define('MAGPIE_CACHE_DIR', './cache');
|
||||||
|
}
|
||||||
|
|
||||||
// Le rep de cache est defini dans DOL_DATA_ROOT
|
if ( !defined('MAGPIE_CACHE_AGE') ) {
|
||||||
$ret=true;
|
define('MAGPIE_CACHE_AGE', 60*60); // one hour
|
||||||
if (! file_exists(DOL_DATA_ROOT)) {
|
}
|
||||||
$ret=mkdir(DOL_DATA_ROOT);
|
|
||||||
}
|
|
||||||
if ($ret && ! file_exists(DOL_DATA_ROOT.'/rsscache')) {
|
|
||||||
$ret=mkdir(DOL_DATA_ROOT.'/rsscache');
|
|
||||||
}
|
|
||||||
define('MAGPIE_CACHE_DIR', DOL_DATA_ROOT.'/rsscache');
|
|
||||||
|
|
||||||
// Si le rep de cache n'a pu etre trouvé ou créé, on utilise
|
if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) {
|
||||||
// l'ancien dans DOL_DOCUMENT_ROOT pour raison de compatibilite
|
define('MAGPIE_CACHE_FRESH_ONLY', false);
|
||||||
// avec anciennes versions
|
}
|
||||||
if (! $ret) {
|
|
||||||
define('MAGPIE_CACHE_DIR', DOL_DOCUMENT_ROOT.'/rsscache');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !defined('MAGPIE_CACHE_AGE') ) {
|
|
||||||
define('MAGPIE_CACHE_AGE', 60*60); // one hour
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) {
|
|
||||||
define('MAGPIE_CACHE_FRESH_ONLY', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !defined('MAGPIE_OUTPUT_ENCODING') ) {
|
if ( !defined('MAGPIE_OUTPUT_ENCODING') ) {
|
||||||
define('MAGPIE_OUTPUT_ENCODING', 'ISO-8859-1');
|
define('MAGPIE_OUTPUT_ENCODING', 'ISO-8859-1');
|
||||||
@ -406,93 +390,93 @@ function init () {
|
|||||||
define('MAGPIE_DETECT_ENCODING', true);
|
define('MAGPIE_DETECT_ENCODING', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !defined('MAGPIE_DEBUG') ) {
|
if ( !defined('MAGPIE_DEBUG') ) {
|
||||||
define('MAGPIE_DEBUG', 0);
|
define('MAGPIE_DEBUG', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !defined('MAGPIE_USER_AGENT') ) {
|
if ( !defined('MAGPIE_USER_AGENT') ) {
|
||||||
$ua = 'MagpieRSS/'. MAGPIE_VERSION . ' (+http://magpierss.sf.net';
|
$ua = 'MagpieRSS/'. MAGPIE_VERSION . ' (+http://magpierss.sf.net';
|
||||||
|
|
||||||
if ( MAGPIE_CACHE_ON ) {
|
if ( MAGPIE_CACHE_ON ) {
|
||||||
$ua = $ua . ')';
|
$ua = $ua . ')';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$ua = $ua . '; No cache)';
|
$ua = $ua . '; No cache)';
|
||||||
}
|
}
|
||||||
|
|
||||||
define('MAGPIE_USER_AGENT', $ua);
|
define('MAGPIE_USER_AGENT', $ua);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !defined('MAGPIE_FETCH_TIME_OUT') ) {
|
if ( !defined('MAGPIE_FETCH_TIME_OUT') ) {
|
||||||
define('MAGPIE_FETCH_TIME_OUT', 5); // 5 second timeout
|
define('MAGPIE_FETCH_TIME_OUT', 5); // 5 second timeout
|
||||||
}
|
}
|
||||||
|
|
||||||
// use gzip encoding to fetch rss files if supported?
|
// use gzip encoding to fetch rss files if supported?
|
||||||
if ( !defined('MAGPIE_USE_GZIP') ) {
|
if ( !defined('MAGPIE_USE_GZIP') ) {
|
||||||
define('MAGPIE_USE_GZIP', true);
|
define('MAGPIE_USE_GZIP', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: the following code should really be in Snoopy, or at least
|
// NOTE: the following code should really be in Snoopy, or at least
|
||||||
// somewhere other then rss_fetch!
|
// somewhere other then rss_fetch!
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
HTTP STATUS CODE PREDICATES
|
HTTP STATUS CODE PREDICATES
|
||||||
These functions attempt to classify an HTTP status code
|
These functions attempt to classify an HTTP status code
|
||||||
based on RFC 2616 and RFC 2518.
|
based on RFC 2616 and RFC 2518.
|
||||||
|
|
||||||
All of them take an HTTP status code as input, and return true or false
|
All of them take an HTTP status code as input, and return true or false
|
||||||
|
|
||||||
All this code is adapted from LWP's HTTP::Status.
|
All this code is adapted from LWP's HTTP::Status.
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
|
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: is_info
|
Function: is_info
|
||||||
Purpose: return true if Informational status code
|
Purpose: return true if Informational status code
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
function is_info ($sc) {
|
function is_info ($sc) {
|
||||||
return $sc >= 100 && $sc < 200;
|
return $sc >= 100 && $sc < 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: is_success
|
Function: is_success
|
||||||
Purpose: return true if Successful status code
|
Purpose: return true if Successful status code
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
function is_success ($sc) {
|
function is_success ($sc) {
|
||||||
return $sc >= 200 && $sc < 300;
|
return $sc >= 200 && $sc < 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: is_redirect
|
Function: is_redirect
|
||||||
Purpose: return true if Redirection status code
|
Purpose: return true if Redirection status code
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
function is_redirect ($sc) {
|
function is_redirect ($sc) {
|
||||||
return $sc >= 300 && $sc < 400;
|
return $sc >= 300 && $sc < 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: is_error
|
Function: is_error
|
||||||
Purpose: return true if Error status code
|
Purpose: return true if Error status code
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
function is_error ($sc) {
|
function is_error ($sc) {
|
||||||
return $sc >= 400 && $sc < 600;
|
return $sc >= 400 && $sc < 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: is_client_error
|
Function: is_client_error
|
||||||
Purpose: return true if Error status code, and its a client error
|
Purpose: return true if Error status code, and its a client error
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
function is_client_error ($sc) {
|
function is_client_error ($sc) {
|
||||||
return $sc >= 400 && $sc < 500;
|
return $sc >= 400 && $sc < 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=======================================================================*\
|
/*=======================================================================*\
|
||||||
Function: is_client_error
|
Function: is_client_error
|
||||||
Purpose: return true if Error status code, and its a server error
|
Purpose: return true if Error status code, and its a server error
|
||||||
\*=======================================================================*/
|
\*=======================================================================*/
|
||||||
function is_server_error ($sc) {
|
function is_server_error ($sc) {
|
||||||
return $sc >= 500 && $sc < 600;
|
return $sc >= 500 && $sc < 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -60,7 +60,6 @@ class MagpieRSS {
|
|||||||
var $incontent = false; // if in Atom <content mode="xml"> field
|
var $incontent = false; // if in Atom <content mode="xml"> field
|
||||||
var $intextinput = false;
|
var $intextinput = false;
|
||||||
var $inimage = false;
|
var $inimage = false;
|
||||||
var $current_field = '';
|
|
||||||
var $current_namespace = false;
|
var $current_namespace = false;
|
||||||
|
|
||||||
|
|
||||||
@ -259,7 +258,6 @@ class MagpieRSS {
|
|||||||
|
|
||||||
|
|
||||||
function feed_cdata ($p, $text) {
|
function feed_cdata ($p, $text) {
|
||||||
|
|
||||||
if ($this->feed_type == ATOM and $this->incontent)
|
if ($this->feed_type == ATOM and $this->incontent)
|
||||||
{
|
{
|
||||||
$this->append_content( $text );
|
$this->append_content( $text );
|
||||||
@ -391,7 +389,7 @@ class MagpieRSS {
|
|||||||
|
|
||||||
$atom_date = (isset($item['issued']) ) ? $item['issued'] : $item['modified'];
|
$atom_date = (isset($item['issued']) ) ? $item['issued'] : $item['modified'];
|
||||||
if ( $atom_date ) {
|
if ( $atom_date ) {
|
||||||
$epoch = @parse_w3cdtf($item['modified']);
|
$epoch = @parse_w3cdtf($atom_date);
|
||||||
if ($epoch and $epoch > 0) {
|
if ($epoch and $epoch > 0) {
|
||||||
$item['date_timestamp'] = $epoch;
|
$item['date_timestamp'] = $epoch;
|
||||||
}
|
}
|
||||||
@ -560,7 +558,7 @@ class MagpieRSS {
|
|||||||
|
|
||||||
function error ($errormsg, $lvl=E_USER_WARNING) {
|
function error ($errormsg, $lvl=E_USER_WARNING) {
|
||||||
// append PHP's error message if track_errors enabled
|
// append PHP's error message if track_errors enabled
|
||||||
if ( $php_errormsg ) {
|
if ( isset($php_errormsg) ) {
|
||||||
$errormsg .= " ($php_errormsg)";
|
$errormsg .= " ($php_errormsg)";
|
||||||
}
|
}
|
||||||
if ( MAGPIE_DEBUG ) {
|
if ( MAGPIE_DEBUG ) {
|
||||||
@ -585,5 +583,23 @@ function map_attrs($k, $v) {
|
|||||||
return "$k=\"$v\"";
|
return "$k=\"$v\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// patch to support medieval versions of PHP4.1.x,
|
||||||
|
// courtesy, Ryan Currie, ryan@digibliss.com
|
||||||
|
|
||||||
|
if (!function_exists('array_change_key_case')) {
|
||||||
|
define("CASE_UPPER",1);
|
||||||
|
define("CASE_LOWER",0);
|
||||||
|
|
||||||
|
|
||||||
|
function array_change_key_case($array,$case=CASE_LOWER) {
|
||||||
|
if ($case=CASE_LOWER) $cmd=strtolower;
|
||||||
|
elseif ($case=CASE_UPPER) $cmd=strtoupper;
|
||||||
|
foreach($array as $key=>$value) {
|
||||||
|
$output[$cmd($key)]=$value;
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -484,31 +484,30 @@ print '</td></tr></table>';
|
|||||||
*/
|
*/
|
||||||
include_once("./boxes.php");
|
include_once("./boxes.php");
|
||||||
$infobox=new InfoBox($db);
|
$infobox=new InfoBox($db);
|
||||||
$boxes=$infobox->listboxes("0"); // 0 = valeur pour la page accueil
|
$boxarray=$infobox->listboxes("0"); // 0 = valeur pour la page accueil
|
||||||
|
|
||||||
$NBCOLS=2; // Nombre de colonnes pour les boites
|
$NBCOLS=2; // Nombre de colonnes pour les boites
|
||||||
|
|
||||||
if (sizeof($boxes))
|
if (sizeof($boxarray))
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_fiche_titre($langs->trans("OtherInformationsBoxes"));
|
print_fiche_titre($langs->trans("OtherInformationsBoxes"));
|
||||||
print '<table width="100%" class="notopnoleftnoright">';
|
print '<table width="100%" class="notopnoleftnoright">';
|
||||||
}
|
}
|
||||||
for ($ii=0, $ni=sizeof($boxes); $ii<$ni; $ii++)
|
for ($ii=0, $ni=sizeof($boxarray); $ii<$ni; $ii++)
|
||||||
{
|
{
|
||||||
if ($ii % $NBCOLS == 0) print "<tr>\n";
|
if ($ii % $NBCOLS == 0) print "<tr>\n";
|
||||||
print '<td valign="top" width="50%">';
|
print '<td valign="top" width="50%">';
|
||||||
|
|
||||||
// Affichage boite ii
|
// Affichage boite ii
|
||||||
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/".$boxes[$ii].".php");
|
$box=$boxarray[$ii];
|
||||||
$box=new $boxes[$ii]();
|
$box->loadBox();
|
||||||
$box->loadBox();
|
$box->showBox();
|
||||||
$box->showBox();
|
|
||||||
|
|
||||||
print "</td>";
|
print "</td>";
|
||||||
if ($ii % $NBCOLS == ($NBCOLS-1)) print "</tr>\n";
|
if ($ii % $NBCOLS == ($NBCOLS-1)) print "</tr>\n";
|
||||||
}
|
}
|
||||||
if (sizeof($boxes))
|
if (sizeof($boxarray))
|
||||||
{
|
{
|
||||||
if ($ii % $NBCOLS == ($NBCOLS-1)) print "</tr>\n";
|
if ($ii % $NBCOLS == ($NBCOLS-1)) print "</tr>\n";
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
@ -269,7 +269,7 @@ VATReceivedOnly=Taux special non factur
|
|||||||
VATManagement=Gestion TVA
|
VATManagement=Gestion TVA
|
||||||
VATIsUsed=Assujéti à TVA
|
VATIsUsed=Assujéti à TVA
|
||||||
VATIsNotUsed=Non assujéti à TVA
|
VATIsNotUsed=Non assujéti à TVA
|
||||||
VATIsUsedDesc=Le taux de TVA proposé par défaut lors de la création de propale, facture, commande, etc répond à la règle standard suivante:<br>Si vendeur non assujeti à TVA, TVA par défaut=0. Fin de règle.<br>Si le (pays vendeur = pays acheteur) alors la TVA par défaut=TVA du produit vendu. Fin de règle.<br>Si vendeur et acheteur dans Communauté européenne et bien vendu = moyen de transports neuf (auto, bateau, avion), TVA par défaut=0 (La TVA doit être payé par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de règle.<br>Si vendeur et acheteur dans Communauté européenne et bien vendu autre que transport neuf alors la TVA par défaut=TVA du produit vendu. Fin de règle.<br>Sinon la TVA proposée par défaut=0. Fin de règle.
|
VATIsUsedDesc=Le taux de TVA proposé par défaut lors de la création de propale, facture, commande, etc répond à la règle standard suivante:<br>Si le (pays vendeur = pays acheteur) alors la TVA par défaut=TVA du produit vendu. Fin de règle.<br>Si vendeur et acheteur dans Communauté européenne et bien vendu = moyen de transports neuf (auto, bateau, avion), TVA par défaut=0 (La TVA doit être payé par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de règle.<br>Si vendeur et acheteur dans Communauté européenne et bien vendu autre que transport neuf alors la TVA par défaut=TVA du produit vendu. Fin de règle.<br>Sinon la TVA proposée par défaut=0. Fin de règle.
|
||||||
VATIsNotUsedDesc=Le taux de TVA proposé par défaut est 0. C'est le cas d'associations, particuliers ou certaines petites sociétés.
|
VATIsNotUsedDesc=Le taux de TVA proposé par défaut est 0. C'est le cas d'associations, particuliers ou certaines petites sociétés.
|
||||||
VATIsUsedExampleFR=En France, il s'agit des sociétés ou organismes ayant choisi un régime fiscale réel (Réel simplifié ou Réel normal), régime dans lequel la TVA est déclarée.
|
VATIsUsedExampleFR=En France, il s'agit des sociétés ou organismes ayant choisi un régime fiscale réel (Réel simplifié ou Réel normal), régime dans lequel la TVA est déclarée.
|
||||||
VATIsNotUsedExampleFR=En France, il s'agit des associations ne déclarant pas de TVA ou sociétés, organismes ou professions libérales ayant choisi le régime fiscal micro entreprise (TVA en franchise) et payant une TVA en franchise sans faire de déclaration de TVA. Ce choix fait de plus apparaitre la mention "TVA non applicable - art-293B du CGI" sur les factures.
|
VATIsNotUsedExampleFR=En France, il s'agit des associations ne déclarant pas de TVA ou sociétés, organismes ou professions libérales ayant choisi le régime fiscal micro entreprise (TVA en franchise) et payant une TVA en franchise sans faire de déclaration de TVA. Ce choix fait de plus apparaitre la mention "TVA non applicable - art-293B du CGI" sur les factures.
|
||||||
|
|||||||
@ -145,14 +145,17 @@ $langs->setPhpLang($conf->global->MAIN_LANG_DEFAULT);
|
|||||||
* Pour PHPlot: PHPLOT_PATH
|
* Pour PHPlot: PHPLOT_PATH
|
||||||
* Pour MagpieRss: MAGPIERSS_PATH
|
* Pour MagpieRss: MAGPIERSS_PATH
|
||||||
*/
|
*/
|
||||||
|
// Les path racines
|
||||||
if (! defined('FPDF_PATH')) { define('FPDF_PATH', DOL_DOCUMENT_ROOT .'/includes/fpdf/fpdf/'); }
|
if (! defined('FPDF_PATH')) { define('FPDF_PATH', DOL_DOCUMENT_ROOT .'/includes/fpdf/fpdf/'); }
|
||||||
if (! defined('PEAR_PATH')) { define('PEAR_PATH', DOL_DOCUMENT_ROOT .'/includes/pear/'); }
|
if (! defined('PEAR_PATH')) { define('PEAR_PATH', DOL_DOCUMENT_ROOT .'/includes/pear/'); }
|
||||||
if (! defined('PHP_WRITEEXCEL_PATH')) { define('PHP_WRITEEXCEL_PATH',DOL_DOCUMENT_ROOT .'/includes/php_writeexcel/'); }
|
if (! defined('PHP_WRITEEXCEL_PATH')) { define('PHP_WRITEEXCEL_PATH',DOL_DOCUMENT_ROOT .'/includes/php_writeexcel/'); }
|
||||||
if (! defined('PHPLOT_PATH')) { define('PHPLOT_PATH', DOL_DOCUMENT_ROOT .'/includes/phplot/'); }
|
if (! defined('PHPLOT_PATH')) { define('PHPLOT_PATH', DOL_DOCUMENT_ROOT .'/includes/phplot/'); }
|
||||||
if (! defined('MAGPIERSS_PATH')) { define('MAGPIERSS_PATH', DOL_DOCUMENT_ROOT .'/includes/magpierss/'); }
|
if (! defined('MAGPIERSS_PATH')) { define('MAGPIERSS_PATH', DOL_DOCUMENT_ROOT .'/includes/magpierss/'); }
|
||||||
if (! defined('JPGRAPH_PATH')) { define('JPGRAPH_PATH', DOL_DOCUMENT_ROOT .'/includes/jpgraph/'); }
|
if (! defined('JPGRAPH_PATH')) { define('JPGRAPH_PATH', DOL_DOCUMENT_ROOT .'/includes/jpgraph/'); }
|
||||||
define('FPDF_FONTPATH', FPDF_PATH . 'font/');
|
// Les autres path
|
||||||
define('MAGPIE_DIR', MAGPIERSS_PATH);
|
if (! defined('FPDF_FONTPATH')) { define('FPDF_FONTPATH', FPDF_PATH . 'font/'); }
|
||||||
|
if (! defined('MAGPIE_DIR')) { define('MAGPIE_DIR', MAGPIERSS_PATH); }
|
||||||
|
if (! defined('MAGPIE_CACHE_DIR')) { define('MAGPIE_CACHE_DIR', DOL_DATA_ROOT .'/rsscache'); }
|
||||||
|
|
||||||
// \todo Ajouter la ligne
|
// \todo Ajouter la ligne
|
||||||
// require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
|
// require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user