Fix: Restore stable version for 3.0

This commit is contained in:
Laurent Destailleur 2010-12-14 23:27:17 +00:00
parent c9e41e00f5
commit 2498426867
117 changed files with 11079 additions and 11181 deletions

View File

@ -84,8 +84,7 @@ $i = 0; // is a sequencer of modules found
$j = 0; // j is module number. Automatically affeted if module number not defined. $j = 0; // j is module number. Automatically affeted if module number not defined.
foreach ($conf->file->dol_document_root as $dirroot) foreach ($conf->file->dol_document_root as $dirroot)
{ {
if (preg_match('/custom$/i',$dirroot)) $dir = $dirroot . "/modules/"; $dir = $dirroot . "/includes/modules/";
else $dir = $dirroot . "/includes/modules/";
// Load modules attributes in arrays (name, numero, orders) from dir directory // Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>"; //print $dir."\n<br>";

View File

@ -569,7 +569,7 @@ if ($socid > 0)
print '<td align="right" width="80">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n"; print '<td align="right" width="80">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '<td align="right" nowrap="nowrap">'; print '<td align="right" nowrap="nowrap">';
$contrat->fetch_lines(); $contrat->fetch_lignes();
print $contrat->getLibStatut(4); print $contrat->getLibStatut(4);
print "</td>\n"; print "</td>\n";
print '</tr>'; print '</tr>';

View File

@ -17,7 +17,7 @@
*/ */
/** /**
* \file htdocs/comm/propal/class/actions_proposal.class.php * \file htdocs/comm/propal/actions_proposal.class.php
* \ingroup proposal * \ingroup proposal
* \brief Fichier de la classe des actions des propales * \brief Fichier de la classe des actions des propales
* \version $Id$ * \version $Id$
@ -44,18 +44,6 @@ class ActionsProposal extends ActionsCommonObject
$this->db = $DB; $this->db = $DB;
} }
/**
* \brief Load a proposal from database and its ligne array
* \param rowid id of object to load
* \param ref Ref of proposal
* \return int >0 if OK, <0 if KO
*/
function fetch($rowid,$ref='')
{
$this->object = new Propal($this->db);
return $this->object->fetch($rowid,$ref);
}
} }
?> ?>

View File

@ -1066,8 +1066,7 @@ class Commande extends CommonObject
$this->date_livraison = $this->db->jdate($obj->date_livraison); $this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->fk_delivery_address = $obj->fk_adresse_livraison; $this->fk_delivery_address = $obj->fk_adresse_livraison;
$this->propale_id = $obj->fk_source; $this->propale_id = $obj->fk_source;
$this->lignes = array();
$this->lines = array();
if ($this->statut == 0) $this->brouillon = 1; if ($this->statut == 0) $this->brouillon = 1;
@ -1197,6 +1196,7 @@ class Commande extends CommonObject
*/ */
function fetch_lines($only_product=0) function fetch_lines($only_product=0)
{ {
$this->lignes=array(); // deprecated
$this->lines=array(); $this->lines=array();
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.fk_commande, l.description, l.price, l.qty, l.tva_tx,'; $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.fk_commande, l.description, l.price, l.qty, l.tva_tx,';
@ -1257,8 +1257,8 @@ class Commande extends CommonObject
$line->date_start = $this->db->jdate($objp->date_start); $line->date_start = $this->db->jdate($objp->date_start);
$line->date_end = $this->db->jdate($objp->date_end); $line->date_end = $this->db->jdate($objp->date_end);
$this->lignes[$i] = $line; // For backward compatibility
$this->lines[$i] = $line; $this->lines[$i] = $line;
$i++; $i++;
} }
$this->db->free($result); $this->db->free($result);
@ -1281,9 +1281,9 @@ class Commande extends CommonObject
function getNbOfProductsLines() function getNbOfProductsLines()
{ {
$nb=0; $nb=0;
foreach($this->lines as $line) foreach($this->lines as $ligne)
{ {
if ($line->fk_product_type == 0) $nb++; if ($ligne->fk_product_type == 0) $nb++;
} }
return $nb; return $nb;
} }

View File

@ -695,7 +695,10 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$result=$srcobject->fetch($object->origin_id); $result=$srcobject->fetch($object->origin_id);
if ($result > 0) if ($result > 0)
{ {
$lines = $srcobject->lines; // TODO mutualiser
$lines = $srcobject->lignes;
if (sizeof($srcobject->lines)) $lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject,'fetch_lignes')) $lines = $srcobject->fetch_lignes();
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
for ($i = 0 ; $i < sizeof($lines) ; $i++) for ($i = 0 ; $i < sizeof($lines) ; $i++)
@ -729,11 +732,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$lines[$i]->fk_remise_except, $lines[$i]->fk_remise_except,
'HT', 'HT',
0, 0,
$product_type, $product_type
$lines[$i]->rang,
$lines[$i]->special_code,
$object->origin,
$lines[$i]->rowid
); );
if ($result < 0) if ($result < 0)
@ -1385,28 +1384,27 @@ if ($_GET['action'] == 'create')
{ {
$projectid=GETPOST('originid'); $projectid=GETPOST('originid');
} }
else else if (in_array($element,array('order','commande','propal','contrat','contract')))
{ {
// For compatibility // For compatibility
if ($element == 'commande') { $subelement = 'customerorder'; } if ($element == 'order') { $element = $subelement = 'commande'; }
if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'proposal'; } if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; }
if ($element == 'contrat') { $subelement = 'contract'; } if ($element == 'contract') { $element = $subelement = 'contrat'; }
require_once(DOL_DOCUMENT_ROOT.'/'.$element.'/class/actions_'.$subelement.'.class.php'); require_once(DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php');
$classname = 'Actions'.ucfirst($subelement); $classname = ucfirst($subelement);
$objectsrc = new $classname($db); $objectsrc = new $classname($db);
$objectsrc->fetch(GETPOST('originid')); $objectsrc->fetch(GETPOST('originid'));
if (empty($objectsrc->object->lines) && method_exists($objectsrc->object,'fetch_lines')) $objectsrc->object->fetch_lines(); $objectsrc->fetch_thirdparty();
$objectsrc->object->fetch_thirdparty();
$projectid = (!empty($objectsrc->object->fk_project)?$object->fk_project:''); $projectid = (!empty($objectsrc->fk_project)?$object->fk_project:'');
$ref_client = (!empty($objectsrc->object->ref_client)?$object->ref_client:''); $ref_client = (!empty($objectsrc->ref_client)?$object->ref_client:'');
$soc = $objectsrc->object->client; $soc = $objectsrc->client;
$cond_reglement_id = (!empty($objectsrc->object->cond_reglement_id)?$objectsrc->object->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1)); $cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
$mode_reglement_id = (!empty($objectsrc->object->mode_reglement_id)?$objectsrc->object->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); $mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$remise_percent = (!empty($objectsrc->object->remise_percent)?$objectsrc->object->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->object->remise_absolue)?$objectsrc->object->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
} }
} }
@ -1658,7 +1656,7 @@ if ($_GET['action'] == 'create')
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'; print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
if (is_object($objectsrc)) // Take value from source object if (is_object($objectsrc)) // Take value from source object
{ {
print $objectsrc->object->note_public; print $objectsrc->note_public;
} }
print '</textarea></td></tr>'; print '</textarea></td></tr>';
@ -1671,7 +1669,7 @@ if ($_GET['action'] == 'create')
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'; print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
if (is_object($objectsrc)) // Take value from source object if (is_object($objectsrc)) // Take value from source object
{ {
print $objectsrc->object->note; print $objectsrc->note;
} }
print '</textarea></td></tr>'; print '</textarea></td></tr>';
} }
@ -1682,35 +1680,35 @@ if ($_GET['action'] == 'create')
if ($_GET['origin'] == 'contrat') if ($_GET['origin'] == 'contrat')
{ {
// Calcul contrat->price (HT), contrat->total (TTC), contrat->tva // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva
$objectsrc->object->remise_absolue=$remise_absolue; $objectsrc->remise_absolue=$remise_absolue;
$objectsrc->object->remise_percent=$remise_percent; $objectsrc->remise_percent=$remise_percent;
$objectsrc->object->update_price(); $objectsrc->update_price();
} }
print "\n<!-- ".$classname." info -->"; print "\n<!-- ".$classname." info -->";
print "\n"; print "\n";
print '<input type="hidden" name="amount" value="'.$objectsrc->object->total_ht.'">'."\n"; print '<input type="hidden" name="amount" value="'.$objectsrc->total_ht.'">'."\n";
print '<input type="hidden" name="total" value="'.$objectsrc->object->total_ttc.'">'."\n"; print '<input type="hidden" name="total" value="'.$objectsrc->total_ttc.'">'."\n";
print '<input type="hidden" name="tva" value="'.$objectsrc->object->total_tva.'">'."\n"; print '<input type="hidden" name="tva" value="'.$objectsrc->total_tva.'">'."\n";
print '<input type="hidden" name="origin" value="'.$objectsrc->object->element.'">'; print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
print '<input type="hidden" name="originid" value="'.$objectsrc->object->id.'">'; print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
print '<tr><td>'.$langs->trans($classname).'</td><td colspan="2">'.$objectsrc->object->getNomUrl(1).'</td></tr>'; print '<tr><td>'.$langs->trans($classname).'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->object->total_ht).'</td></tr>'; print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->object->total_tva)."</td></tr>"; print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>";
if ($mysoc->pays_code=='ES') if ($mysoc->pays_code=='ES')
{ {
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{ {
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->object->total_localtax1)."</td></tr>"; print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>";
} }
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{ {
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->object->total_localtax2)."</td></tr>"; print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>";
} }
} }
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($objectsrc->object->total_ttc)."</td></tr>"; print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>";
} }
else else
{ {
@ -1776,18 +1774,155 @@ if ($_GET['action'] == 'create')
print "</form>\n"; print "</form>\n";
// Try to read line from origin
$sql='';
// View origin lines // TODO deplacer dans la classe
if (is_object($objectsrc)) if ($_GET['origin'] == 'propal')
{ {
//$objectsrc->printOriginLinesList();
$title=$langs->trans('ProductsAndServices'); $title=$langs->trans('ProductsAndServices');
$sql = 'SELECT pt.rowid, pt.description, pt.fk_remise_except,';
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.product_type, pt.info_bits,';
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
$sql.= ' WHERE pt.fk_propal = '.$objectsrc->id;
$sql.= ' ORDER BY pt.rang ASC, pt.rowid';
}
// TODO deplacer dans la classe
if ($_GET['origin'] == 'commande')
{
$title=$langs->trans('Products');
$sql = 'SELECT pt.rowid, pt.description, pt.fk_remise_except,';
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.product_type, pt.info_bits,';
$sql.= ' pt.date_start as date_debut_prevue, pt.date_end as date_fin_prevue,';
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as pt';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
$sql.= ' WHERE pt.fk_commande = '.$objectsrc->id;
$sql.= ' ORDER BY pt.rowid ASC';
}
// TODO deplacer dans la classe
if ($_GET['origin'] == 'contrat')
{
$title=$langs->trans('Services');
$sql = 'SELECT pt.rowid, pt.description,';
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
$sql.= ' pt.date_ouverture_prevue as date_debut_prevue, pt.date_ouverture as date_debut_reel,';
$sql.= ' pt.date_fin_validite as date_fin_prevue, pt.date_cloture as date_fin_reel,';
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'contratdet as pt';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
$sql.= ' WHERE pt.fk_contrat = '.$objectsrc->id;
$sql.= ' ORDER BY pt.rowid ASC';
}
if ($sql)
{
print '<br>'; print '<br>';
print_titre($title); print_titre($title);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>';
print '<td>'.$langs->trans('Description').'</td>';
print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('ReductionShort').'</td></tr>';
$objectsrc->printOriginTitleList(); // Lignes
$objectsrc->printOriginLinesList($object); $resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$var=!$var;
$date_start=$objp->date_debut_prevue;
if ($objp->date_debut_reel) $date_start=$objp->date_debut_reel;
$date_end=$objp->date_fin_prevue;
if ($objp->date_fin_reel) $date_end=$objp->date_fin_reel;
print '<tr '.$bc[$var].'><td>';
if (($objp->info_bits & 2) == 2)
{
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$propal->socid.'">';
print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount");
print '</a>';
}
else if ($objp->prodid)
{
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->prodid.'">';
print ($objp->fk_product_type == 1 ? img_object($langs->trans(''),'service') : img_object($langs->trans(''),'product'));
print ' '.$objp->ref.'</a>';
print $objp->product?' - '.$objp->product:'';
// Dates
if ($date_start || $date_end)
{
print_date_range($date_start,$date_end);
}
}
else
{
print ($objp->product_type == -1 ? '&nbsp;' : ($objp->product_type == 1 ? img_object($langs->trans(''),'service') : img_object($langs->trans(''),'product')));
// Dates
if ($date_start || $date_end)
{
print_date_range($date_start,$date_end);
}
}
print "</td>\n";
print '<td>';
if ($objp->description)
{
if ($objp->description == '(CREDIT_NOTE)')
{
$discount=new DiscountAbsolute($db);
$discount->fetch($objp->fk_remise_except);
print $langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
}
elseif ($obj->description == '(DEPOSIT)')
{
$discount=new DiscountAbsolute($db);
$discount->fetch($objp->fk_remise_except);
print $langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
}
else
{
print dol_trunc($objp->description,60);
}
}
else
{
print '&nbsp;';
}
print '</td>';
print '<td align="right">'.vatrate($objp->tva_tx).'%</td>';
print '<td align="right">'.price($objp->subprice).'</td>';
print '<td align="right">';
print (($objp->info_bits & 2) != 2) ? $objp->qty : '&nbsp;';
print '</td>';
print '<td align="right">';
print (($objp->info_bits & 2) != 2) ? $objp->remise_percent.'%' : '&nbsp;';
print '</td>';
print '</tr>';
$i++;
}
}
else
{
dol_print_error($db);
}
print '</table>'; print '</table>';
} }

View File

@ -66,6 +66,7 @@ class FactureRec extends Facture
var $rang; var $rang;
var $special_code; var $special_code;
var $lignes=array(); // TODO deprecated
var $lines=array(); var $lines=array();
@ -141,7 +142,7 @@ class FactureRec extends Facture
/* /*
* Lines * Lines
*/ */
for ($i = 0 ; $i < sizeof($facsrc->lines) ; $i++) for ($i = 0 ; $i < sizeof($facsrc->lignes) ; $i++)
{ {
$result_insert = $this->addline($this->id, $result_insert = $this->addline($this->id,
$facsrc->lines[$i]->desc, $facsrc->lines[$i]->desc,
@ -303,7 +304,7 @@ class FactureRec extends Facture
/** /**
* \brief Recupere les lignes de factures predefinies dans this->lines * \brief Recupere les lignes de factures predefinies dans this->lignes
* \return int 1 if OK, < 0 if KO * \return int 1 if OK, < 0 if KO
*/ */
function fetch_lines() function fetch_lines()
@ -358,6 +359,7 @@ class FactureRec extends Facture
$line->price = $objp->price; $line->price = $objp->price;
$line->remise = $objp->remise; $line->remise = $objp->remise;
$this->lignes[$i] = $line; // TODO deprecated
$this->lines[$i] = $line; $this->lines[$i] = $line;
$i++; $i++;

View File

@ -98,6 +98,7 @@ class Facture extends CommonObject
var $mode_reglement_code; // Code in llx_c_paiement var $mode_reglement_code; // Code in llx_c_paiement
var $modelpdf; var $modelpdf;
var $products=array(); // TODO deprecated var $products=array(); // TODO deprecated
var $lignes=array(); // TODO deprecated
var $lines=array(); var $lines=array();
var $line; var $line;
//! Pour board //! Pour board
@ -707,6 +708,7 @@ class Facture extends CommonObject
* Lines * Lines
*/ */
$this->lignes = array(); // deprecated
$this->lines = array(); $this->lines = array();
$result=$this->fetch_lines(); $result=$this->fetch_lines();
@ -735,7 +737,7 @@ class Facture extends CommonObject
/** /**
* \brief Recupere les lignes de factures dans this->lines * \brief Recupere les lignes de factures dans this->lignes
* \return int 1 if OK, < 0 if KO * \return int 1 if OK, < 0 if KO
*/ */
function fetch_lines() function fetch_lines()
@ -796,6 +798,7 @@ class Facture extends CommonObject
$line->price = $objp->price; $line->price = $objp->price;
$line->remise = $objp->remise; $line->remise = $objp->remise;
$this->lignes[$i] = $line; // TODO deprecated
$this->lines[$i] = $line; $this->lines[$i] = $line;
$i++; $i++;
@ -1499,14 +1502,14 @@ class Facture extends CommonObject
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
// Loop on each line // Loop on each line
for ($i = 0 ; $i < sizeof($this->lines) ; $i++) for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
{ {
if ($this->lines[$i]->fk_product > 0 && $this->lines[$i]->product_type == 0) if ($this->lignes[$i]->fk_product > 0 && $this->lignes[$i]->product_type == 0)
{ {
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We decrease stock for product // We decrease stock for product
$entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot $entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot
$result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice); $result=$mouvP->livraison($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
} }
} }
@ -1607,14 +1610,14 @@ class Facture extends CommonObject
{ {
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
for ($i = 0 ; $i < sizeof($this->lines) ; $i++) for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
{ {
if ($this->lines[$i]->fk_product && $this->lines[$i]->product_type == 0) if ($this->lignes[$i]->fk_product && $this->lignes[$i]->product_type == 0)
{ {
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We decrease stock for product // We decrease stock for product
$entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot $entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice); $result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice);
} }
} }
} }
@ -1665,7 +1668,7 @@ class Facture extends CommonObject
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*/ */
function addline($facid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $origin='', $origin_id=0) function addline($facid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=0, $rang=-1, $special_code=0)
{ {
dol_syslog("Facture::Addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type", LOG_DEBUG); dol_syslog("Facture::Addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type", LOG_DEBUG);
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
@ -1763,8 +1766,6 @@ class Facture extends CommonObject
$this->line->total_localtax2=($this->type==2?-1:1)*$total_localtax2; $this->line->total_localtax2=($this->type==2?-1:1)*$total_localtax2;
$this->line->total_ttc=($this->type==2?-1:1)*$total_ttc; $this->line->total_ttc=($this->type==2?-1:1)*$total_ttc;
$this->line->special_code=$special_code; $this->line->special_code=$special_code;
$this->line->origin=$origin;
$this->line->origin_id=$origin_id;
// \TODO Ne plus utiliser // \TODO Ne plus utiliser
$this->line->price=($this->type==2?-1:1)*$price; $this->line->price=($this->type==2?-1:1)*$price;
@ -1791,7 +1792,7 @@ class Facture extends CommonObject
} }
else else
{ {
$this->error=$this->line->error; $this->error=$ligne->error;
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@ -2535,9 +2536,9 @@ class Facture extends CommonObject
{ {
// On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees // On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees
$ventilExportCompta = 0 ; $ventilExportCompta = 0 ;
for ($i = 0 ; $i < sizeof($this->lines) ; $i++) for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
{ {
if ($this->lines[$i]->export_compta <> 0 && $this->lines[$i]->code_ventilation <> 0) if ($this->lignes[$i]->export_compta <> 0 && $this->lignes[$i]->code_ventilation <> 0)
{ {
$ventilExportCompta++; $ventilExportCompta++;
} }
@ -3061,9 +3062,6 @@ class FactureLigne
// 2: ecotaxe // 2: ecotaxe
// 3: ?? // 3: ??
var $origin;
var $origin_id;
//! Total HT de la ligne toute quantite et incluant la remise ligne //! Total HT de la ligne toute quantite et incluant la remise ligne
var $total_ht; var $total_ht;
//! Total TVA de la ligne toute quantite et incluant la remise ligne //! Total TVA de la ligne toute quantite et incluant la remise ligne

View File

@ -411,7 +411,7 @@ else
print '<td align="center">'.$langs->trans("ReductionShort").'</td>'; print '<td align="center">'.$langs->trans("ReductionShort").'</td>';
print '<td align="center">'.$langs->trans("Qty").'</td></tr>'; print '<td align="center">'.$langs->trans("Qty").'</td></tr>';
$num = sizeof($fac->lines); $num = sizeof($fac->lignes);
$i = 0; $i = 0;
$var=True; $var=True;
while ($i < $num) while ($i < $num)
@ -421,7 +421,7 @@ else
$product_static=new Product($db); $product_static=new Product($db);
// Show product and description // Show product and description
$type=$fac->lines[$i]->product_type?$fac->lines[$i]->product_type:$fac->lines[$i]->fk_product_type; $type=$fac->lignes[$i]->product_type?$fac->lignes[$i]->product_type:$fac->lignes[$i]->fk_product_type;
// Try to enhance type detection using date_start and date_end for free lines when type // Try to enhance type detection using date_start and date_end for free lines when type
// was not saved. // was not saved.
if (! empty($objp->date_start)) $type=1; if (! empty($objp->date_start)) $type=1;
@ -429,26 +429,26 @@ else
// Show line // Show line
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
if ($fac->lines[$i]->fk_product > 0) if ($fac->lignes[$i]->fk_product > 0)
{ {
print '<td>'; print '<td>';
print '<a name="'.$fac->lines[$i]->id.'"></a>'; // ancre pour retourner sur la ligne print '<a name="'.$fac->lignes[$i]->id.'"></a>'; // ancre pour retourner sur la ligne
// Show product and description // Show product and description
$product_static->type=$fac->lines[$i]->fk_product_type; $product_static->type=$fac->lignes[$i]->fk_product_type;
$product_static->id=$fac->lines[$i]->fk_product; $product_static->id=$fac->lignes[$i]->fk_product;
$product_static->ref=$fac->lines[$i]->product_ref; $product_static->ref=$fac->lignes[$i]->product_ref;
$product_static->libelle=$fac->lines[$i]->libelle; $product_static->libelle=$fac->lignes[$i]->libelle;
$text=$product_static->getNomUrl(1); $text=$product_static->getNomUrl(1);
$text.= ' - '.$fac->lines[$i]->libelle; $text.= ' - '.$fac->lignes[$i]->libelle;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($fac->lines[$i]->desc)); $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($fac->lignes[$i]->desc));
print $html->textwithtooltip($text,$description,3,'','',$i); print $html->textwithtooltip($text,$description,3,'','',$i);
// Show range // Show range
print_date_range($fac->lines[$i]->date_start,$fac->lines[$i]->date_end); print_date_range($fac->lignes[$i]->date_start,$fac->lignes[$i]->date_end);
// Add description in form // Add description in form
if ($conf->global->PRODUIT_DESC_IN_FORM) print ($fac->lines[$i]->desc && $fac->lines[$i]->desc!=$fac->lines[$i]->libelle)?'<br>'.dol_htmlentitiesbr($fac->lines[$i]->desc):''; if ($conf->global->PRODUIT_DESC_IN_FORM) print ($fac->lignes[$i]->desc && $fac->lignes[$i]->desc!=$fac->lignes[$i]->libelle)?'<br>'.dol_htmlentitiesbr($fac->lignes[$i]->desc):'';
print '</td>'; print '</td>';
} }
@ -458,16 +458,16 @@ else
if ($type==1) $text = img_object($langs->trans('Service'),'service'); if ($type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
print $text.' '.nl2br($fac->lines[$i]->desc); print $text.' '.nl2br($fac->lignes[$i]->desc);
// Show range // Show range
print_date_range($fac->lines[$i]->date_start,$fac->lines[$i]->date_end); print_date_range($fac->lignes[$i]->date_start,$fac->lignes[$i]->date_end);
print '</td>'; print '</td>';
} }
print "<td align=\"right\">".price($fac->lines[$i]->price)."</td>"; print "<td align=\"right\">".price($fac->lignes[$i]->price)."</td>";
print '<td align="center">'.$fac->lines[$i]->remise_percent.' %</td>'; print '<td align="center">'.$fac->lignes[$i]->remise_percent.' %</td>';
print "<td align=\"center\">".$fac->lines[$i]->qty."</td></tr>\n"; print "<td align=\"center\">".$fac->lignes[$i]->qty."</td></tr>\n";
$i++; $i++;
} }
print '</table>'; print '</table>';

View File

@ -96,20 +96,20 @@ class BonPrelevement extends CommonObject
function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number) function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number)
{ {
$result = 0; $result = 0;
$line_id = 0; $ligne_id = 0;
$result = $this->AddLigne($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number); $result = $this->AddLigne($ligne_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number);
if ($result == 0) if ($result == 0)
{ {
if ($line_id > 0) if ($ligne_id > 0)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture (";
$sql.= "fk_facture"; $sql.= "fk_facture";
$sql.= ",fk_prelevement_lignes"; $sql.= ",fk_prelevement_lignes";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= $facture_id; $sql.= $facture_id;
$sql.= ", ".$line_id; $sql.= ", ".$ligne_id;
$sql.= ")"; $sql.= ")";
if ($this->db->query($sql)) if ($this->db->query($sql))
@ -149,7 +149,7 @@ class BonPrelevement extends CommonObject
* @param number bank account number * @param number bank account number
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function AddLigne(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number) function AddLigne(&$ligne_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number)
{ {
$result = -1; $result = -1;
$concat = 0; $concat = 0;
@ -202,7 +202,7 @@ class BonPrelevement extends CommonObject
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes"); $ligne_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
$result = 0; $result = 0;
} }
else else

View File

@ -70,7 +70,7 @@ class Contrat extends CommonObject
var $fk_projet; var $fk_projet;
var $lines=array(); var $lignes=array();
/** /**
@ -192,10 +192,10 @@ class Contrat extends CommonObject
$this->db->begin(); $this->db->begin();
// Load lines // Load lines
$this->fetch_lines(); $this->fetch_lignes();
$ok=true; $ok=true;
foreach($this->lines as $contratline) foreach($this->lignes as $contratline)
{ {
// Close line not already closed // Close line not already closed
if ($contratline->statut != 5) if ($contratline->statut != 5)
@ -335,10 +335,10 @@ class Contrat extends CommonObject
} }
/** /**
* Load lignes array into this->lines * Load lignes array into this->lignes
* @return Array Return array of contract lines * @return Array Return array of contract lines
*/ */
function fetch_lines() function fetch_lignes()
{ {
$this->nbofserviceswait=0; $this->nbofserviceswait=0;
$this->nbofservicesopened=0; $this->nbofservicesopened=0;
@ -369,7 +369,7 @@ class Contrat extends CommonObject
$sql.= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = p.rowid"; $sql.= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = p.rowid";
$sql.= " ORDER by d.rowid ASC"; $sql.= " ORDER by d.rowid ASC";
dol_syslog("Contrat::fetch_lines sql=".$sql); dol_syslog("Contrat::fetch_lignes sql=".$sql);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
@ -378,60 +378,58 @@ class Contrat extends CommonObject
while ($i < $num) while ($i < $num)
{ {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$line = new ContratLigne($this->db); $ligne = new ContratLigne($this->db);
$line->id = $objp->rowid; $ligne->id = $objp->rowid;
$line->ref = $objp->rowid; $ligne->ref = $objp->rowid;
$line->fk_contrat = $objp->fk_contrat; $ligne->fk_contrat = $objp->fk_contrat;
$line->desc = $objp->description; // Description ligne $ligne->desc = $objp->description; // Description ligne
$line->qty = $objp->qty; $ligne->qty = $objp->qty;
$line->tva_tx = $objp->tva_tx; $ligne->tva_tx = $objp->tva_tx;
$line->localtax1_tx = $objp->localtax1_tx; $ligne->localtax1_tx = $objp->localtax1_tx;
$line->localtax2_tx = $objp->localtax2_tx; $ligne->localtax2_tx = $objp->localtax2_tx;
$line->subprice = $objp->subprice; $ligne->subprice = $objp->subprice;
$line->statut = $objp->statut; $ligne->statut = $objp->statut;
$line->remise_percent = $objp->remise_percent; $ligne->remise_percent = $objp->remise_percent;
$line->price_ht = $objp->price_ht; $ligne->price_ht = $objp->price_ht;
$line->price = $objp->price; // For backward compatibility $ligne->price = $objp->price; // For backward compatibility
$line->total_ht = $objp->total_ht; $ligne->total_ht = $objp->total_ht;
$line->total_tva = $objp->total_tva; $ligne->total_tva = $objp->total_tva;
$line->total_localtax1 = $objp->total_localtax1; $ligne->total_localtax1= $objp->total_localtax1;
$line->total_localtax2 = $objp->total_localtax2; $ligne->total_localtax2= $objp->total_localtax2;
$line->total_ttc = $objp->total_ttc; $ligne->total_ttc = $objp->total_ttc;
$line->fk_product = $objp->fk_product; $ligne->fk_product = $objp->fk_product;
$line->info_bits = $objp->info_bits; $ligne->info_bits = $objp->info_bits;
$line->fk_user_author = $objp->fk_user_author; $ligne->fk_user_author = $objp->fk_user_author;
$line->fk_user_ouverture= $objp->fk_user_ouverture; $ligne->fk_user_ouverture= $objp->fk_user_ouverture;
$line->fk_user_cloture = $objp->fk_user_cloture; $ligne->fk_user_cloture = $objp->fk_user_cloture;
$line->ref = $objp->ref; $ligne->ref = $objp->ref;
$line->libelle = $objp->label; // Label produit $ligne->libelle = $objp->label; // Label produit
$line->label = $objp->label; // For backward compatibility $ligne->label = $objp->label; // For backward compatibility
$line->product_desc = $objp->product_desc; // Description produit $ligne->product_desc = $objp->product_desc; // Description produit
$line->description = $objp->description; $ligne->description = $objp->description;
$line->date_ouverture_prevue = $this->db->jdate($objp->date_ouverture_prevue); $ligne->date_ouverture_prevue = $this->db->jdate($objp->date_ouverture_prevue);
$line->date_ouverture = $this->db->jdate($objp->date_ouverture); $ligne->date_ouverture = $this->db->jdate($objp->date_ouverture);
$line->date_fin_validite = $this->db->jdate($objp->date_fin_validite); $ligne->date_fin_validite = $this->db->jdate($objp->date_fin_validite);
$line->date_cloture = $this->db->jdate($objp->date_cloture); $ligne->date_cloture = $this->db->jdate($objp->date_cloture);
// For backward compatibility // For backward compatibility
$line->date_debut_prevue = $this->db->jdate($objp->date_ouverture_prevue); $ligne->date_debut_prevue = $this->db->jdate($objp->date_ouverture_prevue);
$line->date_debut_reel = $this->db->jdate($objp->date_ouverture); $ligne->date_debut_reel = $this->db->jdate($objp->date_ouverture);
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite); $ligne->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
$line->date_fin_reel = $this->db->jdate($objp->date_cloture); $ligne->date_fin_reel = $this->db->jdate($objp->date_cloture);
$this->lignes[] = $ligne;
//dol_syslog("1 ".$ligne->desc);
//dol_syslog("2 ".$ligne->product_desc);
$this->lines[] = $line; if ($ligne->statut == 0) $this->nbofserviceswait++;
if ($ligne->statut == 4 && (empty($ligne->date_fin_prevue) || $ligne->date_fin_prevue >= $now)) $this->nbofservicesopened++;
//dol_syslog("1 ".$line->desc); if ($ligne->statut == 4 && $ligne->date_fin_prevue < $now) $this->nbofservicesexpired++;
//dol_syslog("2 ".$line->product_desc); if ($ligne->statut == 5) $this->nbofservicesclosed++;
if ($line->statut == 0) $this->nbofserviceswait++;
if ($line->statut == 4 && (empty($line->date_fin_prevue) || $line->date_fin_prevue >= $now)) $this->nbofservicesopened++;
if ($line->statut == 4 && $line->date_fin_prevue < $now) $this->nbofservicesexpired++;
if ($line->statut == 5) $this->nbofservicesclosed++;
$total_ttc+=$objp->total_ttc; // TODO Not saved into database $total_ttc+=$objp->total_ttc; // TODO Not saved into database
$total_vat+=$objp->total_tva; $total_vat+=$objp->total_tva;
@ -474,51 +472,51 @@ class Contrat extends CommonObject
{ {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$line = new ContratLigne($this->db); $ligne = new ContratLigne($this->db);
$line->id = $objp->rowid; $ligne->id = $objp->rowid;
$line->fk_contrat = $objp->fk_contrat; $ligne->fk_contrat = $objp->fk_contrat;
$line->libelle = $objp->description; $ligne->libelle = $objp->description;
$line->desc = $objp->description; $ligne->desc = $objp->description;
$line->qty = $objp->qty; $ligne->qty = $objp->qty;
$line->statut = $objp->statut; $ligne->statut = $objp->statut;
$line->ref = $objp->ref; $ligne->ref = $objp->ref;
$line->tva_tx = $objp->tva_tx; $ligne->tva_tx = $objp->tva_tx;
$line->localtax1_tx = $objp->localtax1_tx; $ligne->localtax1_tx = $objp->localtax1_tx;
$line->localtax2_tx = $objp->localtax2_tx; $ligne->localtax2_tx = $objp->localtax2_tx;
$line->subprice = $objp->subprice; $ligne->subprice = $objp->subprice;
$line->remise_percent = $objp->remise_percent; $ligne->remise_percent = $objp->remise_percent;
$line->price_ht = $objp->price_ht; $ligne->price_ht = $objp->price_ht;
$line->price = $objp->price; // For backward compatibility $ligne->price = $objp->price; // For backward compatibility
$line->total_ht = $objp->total_ht; $ligne->total_ht = $objp->total_ht;
$line->total_tva = $objp->total_tva; $ligne->total_tva = $objp->total_tva;
$line->total_localtax1= $objp->total_localtax1; $ligne->total_localtax1= $objp->total_localtax1;
$line->total_localtax2= $objp->total_localtax2; $ligne->total_localtax2= $objp->total_localtax2;
$line->total_ttc = $objp->total_ttc; $ligne->total_ttc = $objp->total_ttc;
$line->fk_product = 0; $ligne->fk_product = 0;
$line->info_bits = $objp->info_bits; $ligne->info_bits = $objp->info_bits;
$line->fk_user_author = $objp->fk_user_author; $ligne->fk_user_author = $objp->fk_user_author;
$line->fk_user_ouverture= $objp->fk_user_ouverture; $ligne->fk_user_ouverture= $objp->fk_user_ouverture;
$line->fk_user_cloture = $objp->fk_user_cloture; $ligne->fk_user_cloture = $objp->fk_user_cloture;
$line->description = $objp->description; $ligne->description = $objp->description;
$line->date_ouverture_prevue = $this->db->jdate($objp->date_ouverture_prevue); $ligne->date_ouverture_prevue = $this->db->jdate($objp->date_ouverture_prevue);
$line->date_ouverture = $this->db->jdate($objp->date_ouverture); $ligne->date_ouverture = $this->db->jdate($objp->date_ouverture);
$line->date_fin_validite = $this->db->jdate($objp->date_fin_validite); $ligne->date_fin_validite = $this->db->jdate($objp->date_fin_validite);
$line->date_cloture = $this->db->jdate($objp->date_cloture); $ligne->date_cloture = $this->db->jdate($objp->date_cloture);
// For backward compatibility // For backward compatibility
$line->date_debut_prevue = $this->db->jdate($objp->date_ouverture_prevue); $ligne->date_debut_prevue = $this->db->jdate($objp->date_ouverture_prevue);
$line->date_debut_reel = $this->db->jdate($objp->date_ouverture); $ligne->date_debut_reel = $this->db->jdate($objp->date_ouverture);
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite); $ligne->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
$line->date_fin_reel = $this->db->jdate($objp->date_cloture); $ligne->date_fin_reel = $this->db->jdate($objp->date_cloture);
if ($line->statut == 0) $this->nbofserviceswait++; if ($ligne->statut == 0) $this->nbofserviceswait++;
if ($line->statut == 4 && (empty($line->date_fin_prevue) || $line->date_fin_prevue >= $now)) $this->nbofservicesopened++; if ($ligne->statut == 4 && (empty($ligne->date_fin_prevue) || $ligne->date_fin_prevue >= $now)) $this->nbofservicesopened++;
if ($line->statut == 4 && $line->date_fin_prevue < $now) $this->nbofservicesexpired++; if ($ligne->statut == 4 && $ligne->date_fin_prevue < $now) $this->nbofservicesexpired++;
if ($line->statut == 5) $this->nbofservicesclosed++; if ($ligne->statut == 5) $this->nbofservicesclosed++;
$this->lines[] = $line; $this->lignes[] = $ligne;
$total_ttc+=$objp->total_ttc; $total_ttc+=$objp->total_ttc;
$total_vat+=$objp->total_tva; $total_vat+=$objp->total_tva;
@ -536,12 +534,12 @@ class Contrat extends CommonObject
return -2; return -2;
} }
$this->nbofservices=sizeof($this->lines); $this->nbofservices=sizeof($this->lignes);
$this->total_ttc = price2num($total_ttc); // TODO For the moment value is false as value is not stored in database for line linked to products $this->total_ttc = price2num($total_ttc); // TODO For the moment value is false as value is not stored in database for line linked to products
$this->total_vat = price2num($total_vat); // TODO For the moment value is false as value is not stored in database for line linked to products $this->total_vat = price2num($total_vat); // TODO For the moment value is false as value is not stored in database for line linked to products
$this->total_ht = price2num($total_ht); // TODO For the moment value is false as value is not stored in database for line linked to products $this->total_ht = price2num($total_ht); // TODO For the moment value is false as value is not stored in database for line linked to products
return $this->lines; return $this->lignes;
} }
/** /**
@ -1026,11 +1024,11 @@ class Contrat extends CommonObject
// If draft, we keep it (should not happen) // If draft, we keep it (should not happen)
if ($this->statut == 0) return 1; if ($this->statut == 0) return 1;
// Load $this->lines array // Load $this->lignes array
// $this->fetch_lines(); // $this->fetch_lignes();
$newstatut=1; $newstatut=1;
foreach($this->lines as $key => $contractline) foreach($this->lignes as $key => $contractline)
{ {
// if ($contractline) // Loop on each service // if ($contractline) // Loop on each service
} }
@ -1420,19 +1418,19 @@ class Contrat extends CommonObject
$xnbp = 0; $xnbp = 0;
while ($xnbp < $nbp) while ($xnbp < $nbp)
{ {
$line=new ContratLigne($this->db); $ligne=new ContratLigne($this->db);
$line->desc=$langs->trans("Description")." ".$xnbp; $ligne->desc=$langs->trans("Description")." ".$xnbp;
$line->qty=1; $ligne->qty=1;
$line->subprice=100; $ligne->subprice=100;
$line->price=100; $ligne->price=100;
$line->tva_tx=19.6; $ligne->tva_tx=19.6;
$line->remise_percent=10; $ligne->remise_percent=10;
$line->total_ht=90; $ligne->total_ht=90;
$line->total_ttc=107.64; // 90 * 1.196 $ligne->total_ttc=107.64; // 90 * 1.196
$line->total_tva=17.64; $ligne->total_tva=17.64;
$prodid = rand(1, $num_prods); $prodid = rand(1, $num_prods);
$line->fk_product=$prodids[$prodid]; $ligne->fk_product=$prodids[$prodid];
$this->lines[$xnbp]=$line; $this->lignes[$xnbp]=$ligne;
$xnbp++; $xnbp++;
} }

View File

@ -645,7 +645,7 @@ else
if ($result > 0) if ($result > 0)
{ {
$id = $contrat->id; // if $_GET['ref'] $id = $contrat->id; // if $_GET['ref']
$result=$contrat->fetch_lines(); $result=$contrat->fetch_lignes();
} }
if ($result < 0) if ($result < 0)
{ {
@ -655,7 +655,7 @@ else
if ($mesg) print $mesg; if ($mesg) print $mesg;
$nbofservices=sizeof($contrat->lines); $nbofservices=sizeof($contrat->lignes);
$author = new User($db); $author = new User($db);
$author->fetch($contrat->user_author_id); $author->fetch($contrat->user_author_id);
@ -805,7 +805,7 @@ else
$sql.= " p.ref, p.label"; $sql.= " p.ref, p.label";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
$sql.= " WHERE cd.rowid = ".$contrat->lines[$cursorline-1]->id; $sql.= " WHERE cd.rowid = ".$contrat->lignes[$cursorline-1]->id;
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -982,7 +982,7 @@ else
/* /*
* Confirmation to delete service line of contract * Confirmation to delete service line of contract
*/ */
if ($_REQUEST["action"] == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $contrat->lines[$cursorline-1]->id == $_GET["rowid"]) if ($_REQUEST["action"] == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $contrat->lignes[$cursorline-1]->id == $_GET["rowid"])
{ {
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$contrat->id."&lineid=".$_GET["rowid"],$langs->trans("DeleteContractLine"),$langs->trans("ConfirmDeleteContractLine"),"confirm_deleteline",'',0,1); $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$contrat->id."&lineid=".$_GET["rowid"],$langs->trans("DeleteContractLine"),$langs->trans("ConfirmDeleteContractLine"),"confirm_deleteline",'',0,1);
if ($ret == 'html') print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>'; if ($ret == 'html') print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
@ -991,7 +991,7 @@ else
/* /*
* Confirmation to move service toward another contract * Confirmation to move service toward another contract
*/ */
if ($_REQUEST["action"] == 'move' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $contrat->lines[$cursorline-1]->id == $_GET["rowid"]) if ($_REQUEST["action"] == 'move' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $contrat->lignes[$cursorline-1]->id == $_GET["rowid"])
{ {
$arraycontractid=array(); $arraycontractid=array();
foreach($arrayothercontracts as $contractcursor) foreach($arrayothercontracts as $contractcursor)
@ -1011,7 +1011,7 @@ else
/* /*
* Confirmation de la validation activation * Confirmation de la validation activation
*/ */
if ($_REQUEST["action"] == 'active' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $contrat->lines[$cursorline-1]->id == $_GET["ligne"]) if ($_REQUEST["action"] == 'active' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $contrat->lignes[$cursorline-1]->id == $_GET["ligne"])
{ {
$dateactstart = dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $dateactstart = dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$dateactend = dol_mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); $dateactend = dol_mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
@ -1023,7 +1023,7 @@ else
/* /*
* Confirmation de la validation fermeture * Confirmation de la validation fermeture
*/ */
if ($_REQUEST["action"] == 'closeline' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $contrat->lines[$cursorline-1]->id == $_GET["ligne"]) if ($_REQUEST["action"] == 'closeline' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $contrat->lignes[$cursorline-1]->id == $_GET["ligne"])
{ {
$dateactstart = dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $dateactstart = dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$dateactend = dol_mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); $dateactend = dol_mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
@ -1039,7 +1039,7 @@ else
print '<table class="notopnoleft" width="100%">'; print '<table class="notopnoleft" width="100%">';
print '<tr '.$bc[false].'>'; print '<tr '.$bc[false].'>';
print '<td>'.$langs->trans("ServiceStatus").': '.$contrat->lines[$cursorline-1]->getLibStatut(4).'</td>'; print '<td>'.$langs->trans("ServiceStatus").': '.$contrat->lignes[$cursorline-1]->getLibStatut(4).'</td>';
print '<td width="30" align="right">'; print '<td width="30" align="right">';
if ($user->societe_id == 0) if ($user->societe_id == 0)
{ {
@ -1047,7 +1047,7 @@ else
{ {
$action='activateline'; $action='activateline';
if ($objp->statut == 4) $action='unactivateline'; if ($objp->statut == 4) $action='unactivateline';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$contrat->id.'&amp;ligne='.$contrat->lines[$cursorline-1]->id.'&amp;action='.$action.'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$contrat->id.'&amp;ligne='.$contrat->lignes[$cursorline-1]->id.'&amp;action='.$action.'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';
} }
@ -1086,7 +1086,7 @@ else
print '</table>'; print '</table>';
} }
if ($user->rights->contrat->activer && $_REQUEST["action"] == 'activateline' && $contrat->lines[$cursorline-1]->id == $_GET["ligne"]) if ($user->rights->contrat->activer && $_REQUEST["action"] == 'activateline' && $contrat->lignes[$cursorline-1]->id == $_GET["ligne"])
{ {
/** /**
* Activer la ligne de contrat * Activer la ligne de contrat
@ -1136,12 +1136,12 @@ else
print '</form>'; print '</form>';
} }
if ($user->rights->contrat->activer && $_REQUEST["action"] == 'unactivateline' && $contrat->lines[$cursorline-1]->id == $_GET["ligne"]) if ($user->rights->contrat->activer && $_REQUEST["action"] == 'unactivateline' && $contrat->lignes[$cursorline-1]->id == $_GET["ligne"])
{ {
/** /**
* Desactiver la ligne de contrat * Desactiver la ligne de contrat
*/ */
print '<form name="closeline" action="'.$_SERVER["PHP_SELF"].'?id='.$contrat->id.'&amp;ligne='.$contrat->lines[$cursorline-1]->id.'&amp;action=closeline" method="post">'; print '<form name="closeline" action="'.$_SERVER["PHP_SELF"].'?id='.$contrat->id.'&amp;ligne='.$contrat->lignes[$cursorline-1]->id.'&amp;action=closeline" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';

View File

@ -38,7 +38,7 @@ $var=true;
for ($i = 0 ; $i < $num ; $i++) for ($i = 0 ; $i < $num ; $i++)
{ {
$linkedObjectBlock->fetch($objectid[$i]); $linkedObjectBlock->fetch($objectid[$i]);
$linkedObjectBlock->fetch_lines(); $linkedObjectBlock->fetch_lignes();
$var=!$var; $var=!$var;
?> ?>
<tr <?php echo $bc[$var]; ?> ><td> <tr <?php echo $bc[$var]; ?> ><td>

View File

@ -1,176 +0,0 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/core/class/actions_commonobject.class.php
* \ingroup core
* \brief Fichier de la classe mere des classes metiers (facture, contrat, propal, commande, etc...)
* \version $Id$
*/
/**
* \class ActionsCommonObject
* \brief Classe mere pour heritage des classes metiers
*/
class ActionsCommonObject
{
var $db;
// Instantiate hook classe of thirdparty module
var $hooks=array();
/**
* Constructeur de la classe
* @param DB Handler acces base de donnees
*/
function AnctionsCommonObject($DB)
{
$this->db = $DB;
}
/**
* Return HTML table with origin title list
*/
function printOriginTitleList()
{
global $langs;
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>';
print '<td>'.$langs->trans('Description').'</td>';
print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('ReductionShort').'</td></tr>';
}
/**
* Return HTML with list of origin lines
*/
function printOriginLinesList($object)
{
$num = count($this->object->lines);
$var = true;
$i = 0;
foreach ($this->object->lines as $line)
{
$var=!$var;
if ($line->product_type == 9 && ! empty($line->special_code))
{
$object->hooks[$line->special_code]->printOriginObjectLine($line,$i);
}
else
{
$this->printOriginLine($line,$var);
}
$i++;
}
}
/**
* Return HTML with origin line
* @param element Element type
* @param id Element id
*/
function printOriginLine($line,$var)
{
global $langs,$bc;
//var_dump($line);
$var=!$var;
$date_start=$line->date_debut_prevue;
if ($line->date_debut_reel) $date_start=$line->date_debut_reel;
$date_end=$line->date_fin_prevue;
if ($line->date_fin_reel) $date_end=$line->date_fin_reel;
print '<tr '.$bc[$var].'><td>';
if (($line->info_bits & 2) == 2)
{
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid.'">';
print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount");
print '</a>';
}
else if ($line->fk_product)
{
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$line->fk_product.'">';
print ($line->fk_product_type == 1 ? img_object($langs->trans(''),'service') : img_object($langs->trans(''),'product'));
print ' '.$line->ref.'</a>';
print $line->label?' - '.$line->label:'';
// Dates
if ($date_start || $date_end)
{
print_date_range($date_start,$date_end);
}
}
else
{
print ($line->product_type == -1 ? '&nbsp;' : ($line->product_type == 1 ? img_object($langs->trans(''),'service') : img_object($langs->trans(''),'product')));
print ($line->label ? '&nbsp;'.$line->label : '');
// Dates
if ($date_start || $date_end)
{
print_date_range($date_start,$date_end);
}
}
print "</td>\n";
print '<td>';
if ($line->desc)
{
if ($line->desc == '(CREDIT_NOTE)')
{
$discount=new DiscountAbsolute($db);
$discount->fetch($line->fk_remise_except);
print $langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
}
elseif ($line->desc == '(DEPOSIT)')
{
$discount=new DiscountAbsolute($db);
$discount->fetch($line->fk_remise_except);
print $langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
}
else
{
print dol_trunc($line->desc,60);
}
}
else
{
print '&nbsp;';
}
print '</td>';
print '<td align="right">'.vatrate($line->tva_tx).'%</td>';
print '<td align="right">'.price($line->subprice).'</td>';
print '<td align="right">';
print (($line->info_bits & 2) != 2) ? $line->qty : '&nbsp;';
print '</td>';
print '<td align="right">';
print (($line->info_bits & 2) != 2) ? $line->remise_percent.'%' : '&nbsp;';
print '</td>';
print '</tr>';
}
}
?>

View File

@ -229,11 +229,11 @@ class Translate {
{ {
if ($usecachekey) $tabtranslatedomain=array(); // To save lang content in cache if ($usecachekey) $tabtranslatedomain=array(); // To save lang content in cache
while ($line = fgets($fp,4096)) // Ex: Need 225ms for all fgets on all lang file for Third party page. Same speed than file_get_contents while ($ligne = fgets($fp,4096)) // Ex: Need 225ms for all fgets on all lang file for Third party page. Same speed than file_get_contents
{ {
if ($line[0] != "\n" && $line[0] != " " && $line[0] != "#") if ($ligne[0] != "\n" && $ligne[0] != " " && $ligne[0] != "#")
{ {
$tab=explode('=',$line,2); $tab=explode('=',$ligne,2);
$key=trim($tab[0]); $key=trim($tab[0]);
//print "Domain=$domain, found a string for $tab[0] with value $tab[1]<br>"; //print "Domain=$domain, found a string for $tab[0] with value $tab[1]<br>";
if (empty($this->tab_translate[$key]) && isset($tab[1])) if (empty($this->tab_translate[$key]) && isset($tab[1]))

View File

@ -31,7 +31,7 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client);
<head> <head>
<meta name="robots" content="noindex,nofollow"> <meta name="robots" content="noindex,nofollow">
<title><?php echo $langs->trans('Login'); ?></title> <title><?php echo $langs->trans('Login'); ?></title>
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery-latest.min.js"></script> <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery-1.4.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $conf_css; ?>"> <link rel="stylesheet" type="text/css" href="<?php echo $conf_css; ?>">
<style type="text/css"> <style type="text/css">
<!-- <!--

View File

@ -50,6 +50,7 @@ class Expedition extends CommonObject
var $modelpdf; var $modelpdf;
var $origin; var $origin;
var $origin_id; var $origin_id;
var $lignes=array(); // TODO deprecated
var $lines=array(); var $lines=array();
var $expedition_method_id; var $expedition_method_id;
var $statut; var $statut;
@ -76,7 +77,7 @@ class Expedition extends CommonObject
function Expedition($DB) function Expedition($DB)
{ {
$this->db = $DB; $this->db = $DB;
$this->lines = array(); $this->lignes = array();
$this->products = array(); $this->products = array();
// List of long language codes for status // List of long language codes for status
@ -157,9 +158,9 @@ class Expedition extends CommonObject
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
// Insertion des lignes // Insertion des lignes
for ($i = 0 ; $i < sizeof($this->lines) ; $i++) for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
{ {
if (! $this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty) > 0) if (! $this->create_line($this->lignes[$i]->entrepot_id, $this->lignes[$i]->origin_line_id, $this->lignes[$i]->qty) > 0)
{ {
$error++; $error++;
} }
@ -409,9 +410,9 @@ class Expedition extends CommonObject
dol_syslog("Expedition::valid movement index ".$i); dol_syslog("Expedition::valid movement index ".$i);
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($this->lines[$i]->fk_product > 0 && $this->lines[$i]->product_type == 0) if ($this->lignes[$i]->fk_product > 0 && $this->lignes[$i]->product_type == 0)
{ {
//var_dump($this->lines[$i]); //var_dump($this->lignes[$i]);
$mouvS = new MouvementStock($this->db); $mouvS = new MouvementStock($this->db);
// We decrement stock of product (and sub-products) // We decrement stock of product (and sub-products)
// We use warehouse selected for each line // We use warehouse selected for each line
@ -528,14 +529,14 @@ class Expedition extends CommonObject
*/ */
function addline( $entrepot_id, $id, $qty ) function addline( $entrepot_id, $id, $qty )
{ {
$num = sizeof($this->lines); $num = sizeof($this->lignes);
$line = new ExpeditionLigne($this->db); $line = new ExpeditionLigne($this->db);
$line->entrepot_id = $entrepot_id; $line->entrepot_id = $entrepot_id;
$line->origin_line_id = $id; $line->origin_line_id = $id;
$line->qty = $qty; $line->qty = $qty;
$this->lines[$num] = $line; $this->lignes[$num] = $line;
} }
/** /**
@ -782,6 +783,7 @@ class Expedition extends CommonObject
$line->volume = $obj->volume; $line->volume = $obj->volume;
$line->volume_units = $obj->volume_units; $line->volume_units = $obj->volume_units;
$this->lignes[$i] = $line; // TODO deprecated
$this->lines[$i] = $line; $this->lines[$i] = $line;
$i++; $i++;
@ -918,15 +920,15 @@ class Expedition extends CommonObject
$xnbp = 0; $xnbp = 0;
while ($xnbp < $nbp) while ($xnbp < $nbp)
{ {
$line=new ExpeditionLigne($this->db); $ligne=new ExpeditionLigne($this->db);
$line->desc=$langs->trans("Description")." ".$xnbp; $ligne->desc=$langs->trans("Description")." ".$xnbp;
$line->libelle=$langs->trans("Description")." ".$xnbp; $ligne->libelle=$langs->trans("Description")." ".$xnbp;
$line->qty=10; $ligne->qty=10;
$line->qty_asked=5; $ligne->qty_asked=5;
$line->qty_shipped=4; $ligne->qty_shipped=4;
$line->fk_product=$this->commande->lines[$xnbp]->fk_product; $ligne->fk_product=$this->commande->lignes[$xnbp]->fk_product;
$this->lines[]=$line; $this->lignes[]=$ligne;
$xnbp++; $xnbp++;
} }

View File

@ -98,7 +98,7 @@ if ($_POST["action"] == 'add')
$expedition->tracking_number = $_POST["tracking_number"]; $expedition->tracking_number = $_POST["tracking_number"];
//var_dump($_POST);exit; //var_dump($_POST);exit;
for ($i = 0 ; $i < sizeof($object->lines) ; $i++) for ($i = 0 ; $i < sizeof($object->lignes) ; $i++)
{ {
$qty = "qtyl".$i; $qty = "qtyl".$i;
if ($_POST[$qty] > 0) if ($_POST[$qty] > 0)
@ -447,8 +447,8 @@ if ($_GET["action"] == 'create')
*/ */
print '<br><table class="nobordernopadding" width="100%">'; print '<br><table class="nobordernopadding" width="100%">';
//$lines = $object->fetch_lines(1); //$lignes = $object->fetch_lines(1);
$numAsked = sizeof($object->lines); $numAsked = sizeof($object->lignes);
/* Lecture des expeditions deja effectuees */ /* Lecture des expeditions deja effectuees */
$object->loadExpeditions(); $object->loadExpeditions();
@ -654,8 +654,8 @@ else
dol_print_error($db,$expedition->error); dol_print_error($db,$expedition->error);
exit -1; exit -1;
} }
$lines = $expedition->lines; $lignes = $expedition->lignes;
$num_prod = sizeof($lines); $num_prod = sizeof($lignes);
if ($expedition->id > 0) if ($expedition->id > 0)
{ {
@ -723,30 +723,30 @@ else
{ {
$weightUnit=0; $weightUnit=0;
$volumeUnit=0; $volumeUnit=0;
if (! empty($lines[$i]->weight_units)) $weightUnit = $lines[$i]->weight_units; if (! empty($lignes[$i]->weight_units)) $weightUnit = $lignes[$i]->weight_units;
if (! empty($lines[$i]->volume_units)) $volumeUnit = $lines[$i]->volume_units; if (! empty($lignes[$i]->volume_units)) $volumeUnit = $lignes[$i]->volume_units;
// TODO Use a function addvalueunits(val1,unit1,val2,unit2)=>(val,unit) // TODO Use a function addvalueunits(val1,unit1,val2,unit2)=>(val,unit)
if ($lines[$i]->weight_units < 50) if ($lignes[$i]->weight_units < 50)
{ {
$trueWeightUnit=pow(10,$weightUnit); $trueWeightUnit=pow(10,$weightUnit);
$totalWeight += $lines[$i]->weight*$lines[$i]->qty_shipped*$trueWeightUnit; $totalWeight += $lignes[$i]->weight*$lignes[$i]->qty_shipped*$trueWeightUnit;
} }
else else
{ {
$trueWeightUnit=$weightUnit; $trueWeightUnit=$weightUnit;
$totalWeight += $lines[$i]->weight*$lines[$i]->qty_shipped; $totalWeight += $lignes[$i]->weight*$lignes[$i]->qty_shipped;
} }
if ($lines[$i]->volume_units < 50) if ($lignes[$i]->volume_units < 50)
{ {
//print $lines[$i]->volume."x".$lines[$i]->volume_units."x".($lines[$i]->volume_units < 50)."x".$volumeUnit; //print $lignes[$i]->volume."x".$lignes[$i]->volume_units."x".($lignes[$i]->volume_units < 50)."x".$volumeUnit;
$trueVolumeUnit=pow(10,$volumeUnit); $trueVolumeUnit=pow(10,$volumeUnit);
//print $lines[$i]->volume; //print $lignes[$i]->volume;
$totalVolume += $lines[$i]->volume*$lines[$i]->qty_shipped*$trueVolumeUnit; $totalVolume += $lignes[$i]->volume*$lignes[$i]->qty_shipped*$trueVolumeUnit;
} }
else else
{ {
$trueVolumeUnit=$volumeUnit; $trueVolumeUnit=$volumeUnit;
$totalVolume += $lines[$i]->volume*$lines[$i]->qty_shipped; $totalVolume += $lignes[$i]->volume*$lignes[$i]->qty_shipped;
} }
} }
$totalVolume=$totalVolume; $totalVolume=$totalVolume;
@ -966,64 +966,64 @@ else
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
// Predefined product or service // Predefined product or service
if ($lines[$i]->fk_product > 0) if ($lignes[$i]->fk_product > 0)
{ {
print '<td>'; print '<td>';
// Affiche ligne produit // Affiche ligne produit
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$lines[$i]->fk_product.'">'; $text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$lignes[$i]->fk_product.'">';
if ($lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service'); if ($lignes[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
else $text.= img_object($langs->trans('ShowProduct'),'product'); else $text.= img_object($langs->trans('ShowProduct'),'product');
$text.= ' '.$lines[$i]->ref.'</a>'; $text.= ' '.$lignes[$i]->ref.'</a>';
$text.= ' - '.$lines[$i]->label; $text.= ' - '.$lignes[$i]->label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($lines[$i]->description)); $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($lignes[$i]->description));
//print $description; //print $description;
print $html->textwithtooltip($text,$description,3,'','',$i); print $html->textwithtooltip($text,$description,3,'','',$i);
print_date_range($lines[$i]->date_start,$lines[$i]->date_end); print_date_range($lignes[$i]->date_start,$lignes[$i]->date_end);
if ($conf->global->PRODUIT_DESC_IN_FORM) if ($conf->global->PRODUIT_DESC_IN_FORM)
{ {
print ($lines[$i]->description && $lines[$i]->description!=$lines[$i]->product)?'<br>'.dol_htmlentitiesbr($lines[$i]->description):''; print ($lignes[$i]->description && $lignes[$i]->description!=$lignes[$i]->product)?'<br>'.dol_htmlentitiesbr($lignes[$i]->description):'';
} }
} }
else else
{ {
print "<td>"; print "<td>";
if ($lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service'); if ($lignes[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
print $text.' '.nl2br($lines[$i]->description); print $text.' '.nl2br($lignes[$i]->description);
print_date_range($lines[$i]->date_start,$lines[$i]->date_end); print_date_range($lignes[$i]->date_start,$lignes[$i]->date_end);
print "</td>\n"; print "</td>\n";
} }
// Qte commande // Qte commande
print '<td align="center">'.$lines[$i]->qty_asked.'</td>'; print '<td align="center">'.$lignes[$i]->qty_asked.'</td>';
// Qte a expedier ou expedier // Qte a expedier ou expedier
print '<td align="center">'.$lines[$i]->qty_shipped.'</td>'; print '<td align="center">'.$lignes[$i]->qty_shipped.'</td>';
// Weight // Weight
print '<td align="center">'; print '<td align="center">';
if ($lines[$i]->fk_product_type == 0) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units,"weight"); if ($lignes[$i]->fk_product_type == 0) print $lignes[$i]->weight*$lignes[$i]->qty_shipped.' '.measuring_units_string($lignes[$i]->weight_units,"weight");
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
// Volume // Volume
print '<td align="center">'; print '<td align="center">';
if ($lines[$i]->fk_product_type == 0) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume"); if ($lignes[$i]->fk_product_type == 0) print $lignes[$i]->volume*$lignes[$i]->qty_shipped.' '.measuring_units_string($lignes[$i]->volume_units,"volume");
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
// Size // Size
//print '<td align="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume").'</td>'; //print '<td align="center">'.$lignes[$i]->volume*$lignes[$i]->qty_shipped.' '.measuring_units_string($lignes[$i]->volume_units,"volume").'</td>';
// Entrepot source // Entrepot source
if ($conf->stock->enabled) if ($conf->stock->enabled)
{ {
print '<td align="left">'; print '<td align="left">';
if ($lines[$i]->entrepot_id > 0) if ($lignes[$i]->entrepot_id > 0)
{ {
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
$entrepot->fetch($lines[$i]->entrepot_id); $entrepot->fetch($lignes[$i]->entrepot_id);
print $entrepot->getNomUrl(1); print $entrepot->getNomUrl(1);
} }
print '</td>'; print '</td>';

View File

@ -57,7 +57,7 @@ class Fichinter extends CommonObject
var $fk_project; var $fk_project;
var $modelpdf; var $modelpdf;
var $lines = array(); var $lignes = array();
/** /**
* \brief Constructeur de la classe * \brief Constructeur de la classe
@ -674,14 +674,14 @@ class Fichinter extends CommonObject
$this->db->begin(); $this->db->begin();
// Insertion ligne // Insertion ligne
$line=new FichinterLigne($this->db); $ligne=new FichinterLigne($this->db);
$line->fk_fichinter = $fichinterid; $ligne->fk_fichinter = $fichinterid;
$line->desc = $desc; $ligne->desc = $desc;
$line->datei = $date_intervention; $ligne->datei = $date_intervention;
$line->duration = $duration; $ligne->duration = $duration;
$result=$line->insert(); $result=$ligne->insert();
if ($result > 0) if ($result > 0)
{ {
$this->db->commit(); $this->db->commit();
@ -780,16 +780,18 @@ class Fichinter extends CommonObject
{ {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$line = new FichinterLigne($this->db); $fichinterligne = new FichinterLigne($this->db);
$line->id = $objp->rowid; $fichinterligne->id = $objp->rowid;
//... //...
$this->lines[$i] = $line; $this->lines[$i] = $fichinterligne;
$i++; $i++;
} }
$this->db->free($result); $this->db->free($result);
$this->lignes=$this->lines; // For backward compatibility
return 1; return 1;
} }
else else

View File

@ -74,6 +74,7 @@ class CommandeFournisseur extends Commande
{ {
$this->db = $DB; $this->db = $DB;
$this->products = array(); $this->products = array();
$this->lignes = array(); // TODO deprecated
$this->lines = array(); $this->lines = array();
// List of language codes for status // List of language codes for status
@ -186,6 +187,7 @@ class CommandeFournisseur extends Commande
$line->ref = $objp->ref; // Reference $line->ref = $objp->ref; // Reference
$line->ref_fourn = $objp->ref_fourn; // Reference supplier $line->ref_fourn = $objp->ref_fourn; // Reference supplier
$this->lignes[$i] = $line; // TODO deprecated
$this->lines[$i] = $line; $this->lines[$i] = $line;
$i++; $i++;
@ -525,15 +527,15 @@ class CommandeFournisseur extends Commande
{ {
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
for ($i = 0 ; $i < sizeof($this->lines) ; $i++) for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
{ {
// Product with reference // Product with reference
if (!empty($this->lines[$i]->fk_product)) if (!empty($this->lignes[$i]->fk_product))
{ {
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We decrement stock of product (and sub-products) // We decrement stock of product (and sub-products)
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot $entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice); $result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
} }
} }
@ -1195,10 +1197,10 @@ class CommandeFournisseur extends Commande
$this->lines = array(); $this->lines = array();
for ($i = 0 ; $i < sizeof($comclient->lines) ; $i++) for ($i = 0 ; $i < sizeof($comclient->lignes) ; $i++)
{ {
$prod = new Product($this->db, $comclient->lines[$i]->fk_product); $prod = new Product($this->db, $comclient->lignes[$i]->fk_product);
if ($prod->fetch($comclient->lines[$i]->fk_product) > 0) if ($prod->fetch($comclient->lignes[$i]->fk_product) > 0)
{ {
$libelle = $prod->libelle; $libelle = $prod->libelle;
$ref = $prod->ref; $ref = $prod->ref;
@ -1206,10 +1208,10 @@ class CommandeFournisseur extends Commande
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet";
$sql .= " (fk_commande,label,description,fk_product, price, qty, tva_tx, remise_percent, subprice, remise, ref)"; $sql .= " (fk_commande,label,description,fk_product, price, qty, tva_tx, remise_percent, subprice, remise, ref)";
$sql .= " VALUES (".$idc.", '" . addslashes($libelle) . "','" . addslashes($comclient->lines[$i]->desc) . "'"; $sql .= " VALUES (".$idc.", '" . addslashes($libelle) . "','" . addslashes($comclient->lignes[$i]->desc) . "'";
$sql .= ",".$comclient->lines[$i]->fk_product.",'".price2num($comclient->lines[$i]->price)."'"; $sql .= ",".$comclient->lignes[$i]->fk_product.",'".price2num($comclient->lignes[$i]->price)."'";
$sql .= ", '".$comclient->lines[$i]->qty."', ".$comclient->lines[$i]->tva_tx.", ".$comclient->lines[$i]->remise_percent; $sql .= ", '".$comclient->lignes[$i]->qty."', ".$comclient->lignes[$i]->tva_tx.", ".$comclient->lignes[$i]->remise_percent;
$sql .= ", '".price2num($comclient->lines[$i]->subprice)."','0','".$ref."') ;"; $sql .= ", '".price2num($comclient->lignes[$i]->subprice)."','0','".$ref."') ;";
if ( $this->db->query( $sql) ) if ( $this->db->query( $sql) )
{ {
$this->update_price(); $this->update_price();

View File

@ -973,7 +973,7 @@ if ($id > 0 || ! empty($ref))
*/ */
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
$num = sizeof($commande->lines); $num = sizeof($commande->lignes);
$i = 0; $total = 0; $i = 0; $total = 0;
if ($num) if ($num)
@ -991,7 +991,7 @@ if ($id > 0 || ! empty($ref))
$var=true; $var=true;
while ($i < $num) while ($i < $num)
{ {
$commandline = $commande->lines[$i]; $commandline = $commande->lignes[$i];
$var=!$var; $var=!$var;
// Show product and description // Show product and description

View File

@ -238,7 +238,7 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
if ($element == 'contract') { $element = $subelement = 'contrat'; } if ($element == 'contract') { $element = $subelement = 'contrat'; }
if ($element == 'order_supplier') { $element = 'fourn'; $subelement = 'fournisseur.commande'; } if ($element == 'order_supplier') { $element = 'fourn'; $subelement = 'fournisseur.commande'; }
$facfou->origin = $_POST['origin']; $facfou->origin = $_POST['origin'];
$facfou->origin_id = $_POST['originid']; $facfou->origin_id = $_POST['originid'];
$facid = $facfou->create($user); $facid = $facfou->create($user);
@ -254,7 +254,10 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
$result=$srcobject->fetch($_POST['originid']); $result=$srcobject->fetch($_POST['originid']);
if ($result > 0) if ($result > 0)
{ {
$lines = $srcobject->lines; // TODO mutualiser
$lines = $srcobject->lignes;
if (sizeof($srcobject->lines)) $lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject,'fetch_lignes')) $lines = $srcobject->fetch_lignes();
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
for ($i = 0 ; $i < sizeof($lines) ; $i++) for ($i = 0 ; $i < sizeof($lines) ; $i++)
@ -841,8 +844,6 @@ if ($_GET['action'] == 'create')
if (GETPOST('origin') && GETPOST('originid')) if (GETPOST('origin') && GETPOST('originid'))
{ {
// TODO Not finished...
// Parse element/subelement (ex: project_task) // Parse element/subelement (ex: project_task)
$element = $subelement = GETPOST('origin'); $element = $subelement = GETPOST('origin');
/*if (preg_match('/^([^_]+)_([^_]+)/i',$_GET['origin'],$regs)) /*if (preg_match('/^([^_]+)_([^_]+)/i',$_GET['origin'],$regs))
@ -1795,17 +1796,34 @@ else
$genallowed=$user->rights->fournisseur->facture->creer; $genallowed=$user->rights->fournisseur->facture->creer;
$delallowed=$user->rights->fournisseur->facture->supprimer; $delallowed=$user->rights->fournisseur->facture->supprimer;
$somethingshown=$formfile->show_documents('facture_fournisseur',$facfournref,$filedir,$urlsource,$genallowed,$delallowed,$facture->modelpdf); print '<br>';
$somethingshown=$formfile->show_documents('facture_fournisseur',$facfournref,$filedir,$urlsource,$genallowed,$delallowed,$fac->modelpdf);
$object=$fac;
/*
* Linked object block
*/
$object->load_object_linked($object->id,$object->element);
foreach($object->linked_object as $linked_object => $linked_objectid)
{
$tmpmodule=$linked_object;
if ($linked_object == 'invoice_supplier') $tmpmodule='fournisseur';
if ($linked_object == 'order_supplier') $tmpmodule='fournisseur';
if($conf->$tmpmodule->enabled && $linked_object != $object->element)
{
$somethingshown=$object->showLinkedObjectBlock($linked_object,$linked_objectid,$somethingshown);
}
}
print '</td><td valign="top" width="50%">'; print '</td><td valign="top" width="50%">';
print '<br>'; print '<br>';
// List of actions on element // List of actions on element
/*
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'); include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
$formactions=new FormActions($db); $formactions=new FormActions($db);
$somethingshown=$formactions->showactions($fac,'invoice_supplier',$socid); $somethingshown=$formactions->showactions($object,'invoice_supplier',$socid);
*/
print '</td></tr></table>'; print '</td></tr></table>';
} }

View File

@ -98,7 +98,7 @@ class box_contracts extends ModeleBoxes {
$contractstatic->statut=$objp->fk_statut; $contractstatic->statut=$objp->fk_statut;
$contractstatic->id=$objp->rowid; $contractstatic->id=$objp->rowid;
$result=$contractstatic->fetch_lines(); $result=$contractstatic->fetch_lignes();
// fin_validite is no more on contract but on services // fin_validite is no more on contract but on services
// if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } // if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); }

View File

@ -149,11 +149,11 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0); $pdf->SetAutoPageBreak(1,0);
$lines=$this->line_per_page; // There is no line in such PDF. $lignes=$this->line_per_page; // There is no line in such PDF.
$pages = intval($lines / $this->line_per_page); $pages = intval($lignes / $this->line_per_page);
if (($lines % $this->line_per_page)>0) if (($lignes % $this->line_per_page)>0)
{ {
$pages++; $pages++;
} }
@ -333,38 +333,38 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$page_hauteur=$this->page_hauteur; $page_hauteur=$this->page_hauteur;
// Line of free text // Line of free text
$line=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):""; $ligne=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):"";
$pdf->SetFont('','',7); $pdf->SetFont('','',7);
$pdf->SetDrawColor(224,224,224); $pdf->SetDrawColor(224,224,224);
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page // On positionne le debut du bas de page selon nbre de lignes de ce bas de page
$nbofline=dol_nboflines_bis($line,0,$outputlangs->charset_output); $nbofligne=dol_nboflines_bis($ligne,0,$outputlangs->charset_output);
//print 'e'.$line.'t'.dol_nboflines($line);exit; //print 'e'.$ligne.'t'.dol_nboflines($ligne);exit;
$posy=$marge_basse + ($nbofline*3) + ($line1?3:0) + ($line2?3:0); $posy=$marge_basse + ($nbofligne*3) + ($ligne1?3:0) + ($ligne2?3:0);
if ($line) // Free text if ($ligne) // Free text
{ {
$pdf->SetXY($marge_gauche,-$posy); $pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(20000, 3, $line, 0, 'L', 0); // Use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. $pdf->MultiCell(20000, 3, $ligne, 0, 'L', 0); // Use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
$posy-=($nbofline*3); // 6 of ligne + 3 of MultiCell $posy-=($nbofligne*3); // 6 of ligne + 3 of MultiCell
} }
$pdf->SetY(-$posy); $pdf->SetY(-$posy);
$pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy); $pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy);
$posy--; $posy--;
if ($line1) if ($ligne1)
{ {
$pdf->SetXY($marge_gauche,-$posy); $pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line1, 0, 'C', 0); $pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
} }
if ($line2) if ($ligne2)
{ {
$posy-=3; $posy-=3;
$pdf->SetXY($marge_gauche,-$posy); $pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line2, 0, 'C', 0); $pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
} }
$pdf->SetXY(-20,-$posy); $pdf->SetXY(-20,-$posy);

View File

@ -219,7 +219,7 @@ class pdf_edison extends ModelePDFCommandes
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs); $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs);
$pdf->SetXY (156, $curY); $pdf->SetXY (156, $curY);
$pdf->MultiCell(20, 3, $up_excl_tax, 0, 'R', 0); $pdf->MultiCell(18, 3, $up_excl_tax, 0, 'R', 0);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs); $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs);
$pdf->SetXY (174, $curY); $pdf->SetXY (174, $curY);

View File

@ -783,7 +783,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxup-1, $tab_top+2); $pdf->SetXY ($this->posxup-1, $tab_top+2);
$pdf->MultiCell(20,2, $outputlangs->transnoentities("PriceUHT"),'','C'); $pdf->MultiCell(18,2, $outputlangs->transnoentities("PriceUHT"),'','C');
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxqty-1, $tab_top+2); $pdf->SetXY ($this->posxqty-1, $tab_top+2);

View File

@ -78,6 +78,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
global $user,$conf,$langs,$mysoc; global $user,$conf,$langs,$mysoc;
$object->fetch_thirdparty(); $object->fetch_thirdparty();
if (empty($object->lines)) $object->lines=$object->lignes;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -352,7 +353,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$tab4_top = 60; $tab4_top = 60;
$tab4_hl = 6; $tab4_hl = 6;
$tab4_sl = 4; $tab4_sl = 4;
$line = 2; $ligne = 2;
//*********************LOGO**************************** //*********************LOGO****************************
$pdf->SetXY(11,7); $pdf->SetXY(11,7);

View File

@ -220,6 +220,8 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$object->fetch_thirdparty(); $object->fetch_thirdparty();
if (empty($object->lines)) $object->lines=$object->lignes;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1';

View File

@ -98,7 +98,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$nblines = sizeof($object->lines); $nblignes = sizeof($object->lignes);
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->expedition->dir_output."/receipt"; $dir = $conf->expedition->dir_output."/receipt";
@ -180,7 +180,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$curY = $tab_top + 7; $curY = $tab_top + 7;
$nexY = $tab_top + 7; $nexY = $tab_top + 7;
for ($i = 0 ; $i < $nblines ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
$curY = $nexY; $curY = $nexY;
@ -196,22 +196,22 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$pdf->SetXY (10, $curY ); $pdf->SetXY (10, $curY );
$pdf->MultiCell(20, 3, $outputlangs->convToOutputCharset($object->lines[$i]->ref), 0, 'C'); $pdf->MultiCell(20, 3, $outputlangs->convToOutputCharset($object->lignes[$i]->ref), 0, 'C');
// \TODO Field not yet saved in database // \TODO Field not yet saved in database
//$pdf->SetXY (133, $curY ); //$pdf->SetXY (133, $curY );
//$pdf->MultiCell(10, 5, $object->lines[$i]->tva_tx, 0, 'C'); //$pdf->MultiCell(10, 5, $object->lignes[$i]->tva_tx, 0, 'C');
$pdf->SetXY (145, $curY ); $pdf->SetXY (145, $curY );
$pdf->MultiCell(10, 3, $object->lines[$i]->qty_shipped, 0, 'C'); $pdf->MultiCell(10, 3, $object->lignes[$i]->qty_shipped, 0, 'C');
// \TODO Field not yet saved in database // \TODO Field not yet saved in database
//$pdf->SetXY (156, $curY ); //$pdf->SetXY (156, $curY );
//$pdf->MultiCell(20, 3, price($object->lines[$i]->price), 0, 'R', 0); //$pdf->MultiCell(20, 3, price($object->lignes[$i]->price), 0, 'R', 0);
// \TODO Field not yet saved in database // \TODO Field not yet saved in database
//$pdf->SetXY (174, $curY ); //$pdf->SetXY (174, $curY );
//$total = price($object->lines[$i]->price * $object->lines[$i]->qty_shipped); //$total = price($object->lignes[$i]->price * $object->lignes[$i]->qty_shipped);
//$pdf->MultiCell(26, 3, $total, 0, 'R', 0); //$pdf->MultiCell(26, 3, $total, 0, 'R', 0);
$pdf->line(10, $curY-1, 200, $curY-1); $pdf->line(10, $curY-1, 200, $curY-1);
@ -220,10 +220,10 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$nexY+=2; // Passe espace entre les lignes $nexY+=2; // Passe espace entre les lignes
// Cherche nombre de lignes a venir pour savoir si place suffisante // Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblines - 1)) // If it's not last line if ($i < ($nblignes - 1)) // If it's not last line
{ {
//on recupere la description du produit suivant //on recupere la description du produit suivant
$follow_descproduitservice = $object->lines[$i+1]->desc; $follow_descproduitservice = $object->lignes[$i+1]->desc;
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres) //on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4); $nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4);
} }

View File

@ -121,7 +121,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$nblines = sizeof($object->lines); $nblignes = sizeof($object->lignes);
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->expedition->dir_output."/receipt"; $dir = $conf->expedition->dir_output."/receipt";
@ -190,7 +190,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
// Positionne $this->atleastonediscount si on a au moins une remise // Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
if ($object->lines[$i]->remise_percent) if ($object->lignes[$i]->remise_percent)
{ {
$this->atleastonediscount++; $this->atleastonediscount++;
} }
@ -238,7 +238,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$nexY = $tab_top + 7; $nexY = $tab_top + 7;
// Boucle sur les lignes // Boucle sur les lignes
for ($i = 0 ; $i < $nblines ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
$curY = $nexY; $curY = $nexY;
@ -255,41 +255,41 @@ class pdf_typhon extends ModelePDFDeliveryOrder
/* /*
// TVA // TVA
$pdf->SetXY ($this->posxtva, $curY); $pdf->SetXY ($this->posxtva, $curY);
$pdf->MultiCell(10, 4, ($object->lines[$i]->tva_tx < 0 ? '*':'').abs($object->lines[$i]->tva_tx), 0, 'R'); $pdf->MultiCell(10, 4, ($object->lignes[$i]->tva_tx < 0 ? '*':'').abs($object->lignes[$i]->tva_tx), 0, 'R');
// Prix unitaire HT avant remise // Prix unitaire HT avant remise
$pdf->SetXY ($this->posxup, $curY); $pdf->SetXY ($this->posxup, $curY);
$pdf->MultiCell(20, 4, price($object->lines[$i]->subprice), 0, 'R', 0); $pdf->MultiCell(20, 4, price($object->lignes[$i]->subprice), 0, 'R', 0);
*/ */
// Quantity // Quantity
$pdf->SetXY ($this->posxqty, $curY); $pdf->SetXY ($this->posxqty, $curY);
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'R'); $pdf->MultiCell(30, 3, $object->lignes[$i]->qty_shipped, 0, 'R');
/* /*
// Remise sur ligne // Remise sur ligne
$pdf->SetXY ($this->posxdiscount, $curY); $pdf->SetXY ($this->posxdiscount, $curY);
if ($object->lines[$i]->remise_percent) if ($object->lignes[$i]->remise_percent)
{ {
$pdf->MultiCell(14, 3, $object->lines[$i]->remise_percent."%", 0, 'R'); $pdf->MultiCell(14, 3, $object->lignes[$i]->remise_percent."%", 0, 'R');
} }
// Total HT ligne // Total HT ligne
$pdf->SetXY ($this->postotalht, $curY); $pdf->SetXY ($this->postotalht, $curY);
$total = price($object->lines[$i]->price * $object->lines[$i]->qty); $total = price($object->lignes[$i]->price * $object->lignes[$i]->qty);
$pdf->MultiCell(23, 3, $total, 0, 'R', 0); $pdf->MultiCell(23, 3, $total, 0, 'R', 0);
// Collecte des totaux par valeur de tva // Collecte des totaux par valeur de tva
// dans le tableau tva["taux"]=total_tva // dans le tableau tva["taux"]=total_tva
$tvaligne=$object->lines[$i]->price * $object->lines[$i]->qty; $tvaligne=$object->lignes[$i]->price * $object->lignes[$i]->qty;
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
$this->tva[ (string)$object->lines[$i]->tva_tx ] += $tvaligne; $this->tva[ (string)$object->lignes[$i]->tva_tx ] += $tvaligne;
*/ */
$nexY+=2; // Passe espace entre les lignes $nexY+=2; // Passe espace entre les lignes
// Cherche nombre de lignes a venir pour savoir si place suffisante // Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblines - 1)) // If it's not last line if ($i < ($nblignes - 1)) // If it's not last line
{ {
//on recupere la description du produit suivant //on recupere la description du produit suivant
$follow_descproduitservice = $object->lines[$i+1]->desc; $follow_descproduitservice = $object->lignes[$i+1]->desc;
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres) //on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4); $nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4);
} }

View File

@ -141,11 +141,11 @@ class pdf_paiement
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$lines = $this->db->num_rows($result); $lignes = $this->db->num_rows($result);
$i = 0; $i = 0;
$var=True; $var=True;
while ($i < $lines) while ($i < $lignes)
{ {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$var=!$var; $var=!$var;
@ -167,9 +167,9 @@ class pdf_paiement
dol_print_error($this->db); dol_print_error($this->db);
} }
$pages = intval($lines / $this->line_per_page); $pages = intval($lignes / $this->line_per_page);
if (($lines % $this->line_per_page)>0) if (($lignes % $this->line_per_page)>0)
{ {
$pages++; $pages++;
} }

View File

@ -239,7 +239,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
// Unit price before discount // Unit price before discount
$pdf->SetXY ($this->posxup, $curY); $pdf->SetXY ($this->posxup, $curY);
$pdf->MultiCell(20, 3, price($object->lines[$i]->pu_ht), 0, 'R', 0); $pdf->MultiCell(18, 3, price($object->lines[$i]->pu_ht), 0, 'R', 0);
// Quantity // Quantity
$pdf->SetXY ($this->posxqty, $curY); $pdf->SetXY ($this->posxqty, $curY);
@ -529,7 +529,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxup-1, $tab_top+2); $pdf->SetXY ($this->posxup-1, $tab_top+2);
$pdf->MultiCell(20,2, $outputlangs->transnoentities("PriceUHT"),'','C'); $pdf->MultiCell(18,2, $outputlangs->transnoentities("PriceUHT"),'','C');
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxqty-1, $tab_top+2); $pdf->SetXY ($this->posxqty-1, $tab_top+2);

View File

@ -249,7 +249,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Unit price before discount // Unit price before discount
$pdf->SetXY ($this->posxup, $curY); $pdf->SetXY ($this->posxup, $curY);
$pdf->MultiCell(20, 3, price($object->lines[$i]->subprice), 0, 'R', 0); $pdf->MultiCell(18, 3, price($object->lines[$i]->subprice), 0, 'R', 0);
// Quantity // Quantity
$pdf->SetXY ($this->posxqty, $curY); $pdf->SetXY ($this->posxqty, $curY);
@ -540,7 +540,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxup-1, $tab_top+2); $pdf->SetXY ($this->posxup-1, $tab_top+2);
$pdf->MultiCell(20,2, $outputlangs->transnoentities("PriceUHT"),'','C'); $pdf->MultiCell(18,2, $outputlangs->transnoentities("PriceUHT"),'','C');
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxqty-1, $tab_top+2); $pdf->SetXY ($this->posxqty-1, $tab_top+2);

View File

@ -25,12 +25,8 @@ create table llx_user
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
datec datetime, datec datetime,
tms timestamp, tms timestamp,
login varchar(24) NOT NULL,
login varchar(30) NOT NULL, -- user reference number entity integer DEFAULT 1 NOT NULL, -- multi company id
entity integer DEFAULT 1 NOT NULL, -- multi company id
ref_ext varchar(30), -- reference into an external system (not used by dolibarr)
pass varchar(32), pass varchar(32),
pass_crypted varchar(128), pass_crypted varchar(128),
pass_temp varchar(32), -- temporary password when asked for forget password pass_temp varchar(32), -- temporary password when asked for forget password

View File

@ -372,7 +372,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
global $conf,$user; global $conf,$user;
$outputlangs->load("dict"); $outputlangs->load("dict");
$line=''; $ligne='';
// Line of free text // Line of free text
if (! empty($conf->global->$paramfreetext)) if (! empty($conf->global->$paramfreetext))
@ -387,92 +387,92 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
); );
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray,$outputlangs,$object); $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray,$outputlangs,$object);
$line.=$outputlangs->convToOutputCharset($newfreetext); $ligne.=$outputlangs->convToOutputCharset($newfreetext);
} }
// First line of company infos // First line of company infos
// Juridical status // Juridical status
$line1=""; $ligne1="";
if ($fromcompany->forme_juridique_code) if ($fromcompany->forme_juridique_code)
{ {
$line1.=($line1?" - ":"").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); $ligne1.=($ligne1?" - ":"").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
} }
// Capital // Capital
if ($fromcompany->capital) if ($fromcompany->capital)
{ {
$line1.=($line1?" - ":"").$outputlangs->transnoentities("CapitalOf",$fromcompany->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie); $ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$fromcompany->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
} }
// Prof Id 1 // Prof Id 1
if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2)) if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2))
{ {
$field=$outputlangs->transcountrynoentities("ProfId1",$fromcompany->pays_code); $field=$outputlangs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line1.=($line1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof1); $ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof1);
} }
// Prof Id 2 // Prof Id 2
if ($fromcompany->idprof2) if ($fromcompany->idprof2)
{ {
$field=$outputlangs->transcountrynoentities("ProfId2",$fromcompany->pays_code); $field=$outputlangs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line1.=($line1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof2); $ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof2);
} }
// Second line of company infos // Second line of company infos
$line2=""; $ligne2="";
// Prof Id 3 // Prof Id 3
if ($fromcompany->idprof3) if ($fromcompany->idprof3)
{ {
$field=$outputlangs->transcountrynoentities("ProfId3",$fromcompany->pays_code); $field=$outputlangs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof3); $ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof3);
} }
// Prof Id 4 // Prof Id 4
if ($fromcompany->idprof4) if ($fromcompany->idprof4)
{ {
$field=$outputlangs->transcountrynoentities("ProfId4",$fromcompany->pays_code); $field=$outputlangs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof4); $ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof4);
} }
// IntraCommunautary VAT // IntraCommunautary VAT
if ($fromcompany->tva_intra != '') if ($fromcompany->tva_intra != '')
{ {
$line2.=($line2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra); $ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra);
} }
$pdf->SetFont('','',7); $pdf->SetFont('','',7);
$pdf->SetDrawColor(224,224,224); $pdf->SetDrawColor(224,224,224);
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page // On positionne le debut du bas de page selon nbre de lignes de ce bas de page
$nbofline=dol_nboflines_bis($line,0,$outputlangs->charset_output); $nbofligne=dol_nboflines_bis($ligne,0,$outputlangs->charset_output);
//print 'nbofline='.$nbofline; exit; //print 'nbofligne='.$nbofligne; exit;
//print 'e'.$line.'t'.dol_nboflines($line);exit; //print 'e'.$ligne.'t'.dol_nboflines($ligne);exit;
$posy=$marge_basse + ($nbofline*3) + ($line1?3:0) + ($line2?3:0); $posy=$marge_basse + ($nbofligne*3) + ($ligne1?3:0) + ($ligne2?3:0);
if ($line) // Free text if ($ligne) // Free text
{ {
$pdf->SetXY($marge_gauche,-$posy); $pdf->SetXY($marge_gauche,-$posy);
$width=20000; $align='L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. $width=20000; $align='L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
if ($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT) { $width=200; $align='C'; } if ($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT) { $width=200; $align='C'; }
$pdf->MultiCell($width, 3, $line, 0, $align, 0); $pdf->MultiCell($width, 3, $ligne, 0, $align, 0);
$posy-=($nbofline*3); // 6 of ligne + 3 of MultiCell $posy-=($nbofligne*3); // 6 of ligne + 3 of MultiCell
} }
$pdf->SetY(-$posy); $pdf->SetY(-$posy);
$pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy); $pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy);
$posy--; $posy--;
if ($line1) if ($ligne1)
{ {
$pdf->SetXY($marge_gauche,-$posy); $pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line1, 0, 'C', 0); $pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
} }
if ($line2) if ($ligne2)
{ {
$posy-=3; $posy-=3;
$pdf->SetXY($marge_gauche,-$posy); $pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line2, 0, 'C', 0); $pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
} }
// Show page nb only on iso languages // Show page nb only on iso languages

View File

@ -53,13 +53,13 @@ function viewCsvFileContent($file_to_include='',$max_rows=0)
$count = 0; $count = 0;
print '<table border="1">'; print '<table border="1">';
for ($line = fgetcsv($fic, 1024); (!feof($fic) && (($max_rows > 0)?($count<=$max_rows):1==1)); $line = fgetcsv($fic, 1024)) for ($ligne = fgetcsv($fic, 1024); (!feof($fic) && (($max_rows > 0)?($count<=$max_rows):1==1)); $ligne = fgetcsv($fic, 1024))
{ {
print '<tr>'; print '<tr>';
$j = sizeof($line); $j = sizeof($ligne);
for ($i = 0; $i < $j; $i++) for ($i = 0; $i < $j; $i++)
{ {
print '<td>'.$line[$i].'</td>'; print '<td>'.$ligne[$i].'</td>';
} }
print '</tr>'; print '</tr>';
$count++; $count++;

View File

@ -65,6 +65,7 @@ class Livraison extends CommonObject
function Livraison($DB) function Livraison($DB)
{ {
$this->db = $DB; $this->db = $DB;
$this->lignes = array(); // TODO deprecated
$this->lines = array(); $this->lines = array();
$this->products = array(); $this->products = array();
@ -136,19 +137,19 @@ class Livraison extends CommonObject
{ {
$commande = new Commande($this->db); $commande = new Commande($this->db);
$commande->id = $this->commande_id; $commande->id = $this->commande_id;
$this->lines = $commande->fetch_lines(); $this->lignes = $commande->fetch_lines();
} }
/* /*
* Insertion des produits dans la base * Insertion des produits dans la base
*/ */
for ($i = 0 ; $i < sizeof($this->lines) ; $i++) for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
{ {
$origin_id=$this->lines[$i]->origin_line_id; $origin_id=$this->lignes[$i]->origin_line_id;
if (! $origin_id) $origin_id=$this->lines[$i]->commande_ligne_id; // For backward compatibility if (! $origin_id) $origin_id=$this->lignes[$i]->commande_ligne_id; // For backward compatibility
if (! $this->create_line(0, $origin_id, $this->lines[$i]->qty, $this->lines[$i]->fk_product, $this->lines[$i]->description)) if (! $this->create_line(0, $origin_id, $this->lignes[$i]->qty, $this->lignes[$i]->fk_product, $this->lignes[$i]->description))
{ {
$error++; $error++;
} }
@ -285,7 +286,7 @@ class Livraison extends CommonObject
/* /*
* Lignes * Lignes
*/ */
$result=$this->fetch_lines(); $result=$this->fetch_lignes();
if ($result < 0) if ($result < 0)
{ {
return -3; return -3;
@ -490,19 +491,18 @@ class Livraison extends CommonObject
$expedition = new Expedition($this->db); $expedition = new Expedition($this->db);
$result=$expedition->fetch($sending_id); $result=$expedition->fetch($sending_id);
$this->lines = array(); $this->lignes = array();
for ($i = 0 ; $i < sizeof($expedition->lines) ; $i++) for ($i = 0 ; $i < sizeof($expedition->lignes) ; $i++)
{ {
$line = new LivraisonLigne($this->db); $LivraisonLigne = new LivraisonLigne($this->db);
$line->origin_line_id = $expedition->lines[$i]->origin_line_id; $LivraisonLigne->origin_line_id = $expedition->lignes[$i]->origin_line_id;
$line->libelle = $expedition->lines[$i]->libelle; $LivraisonLigne->libelle = $expedition->lignes[$i]->libelle;
$line->description = $expedition->lines[$i]->description; $LivraisonLigne->description = $expedition->lignes[$i]->description;
$line->qty = $expedition->lines[$i]->qty_shipped; $LivraisonLigne->qty = $expedition->lignes[$i]->qty_shipped;
$line->fk_product = $expedition->lines[$i]->fk_product; $LivraisonLigne->fk_product = $expedition->lignes[$i]->fk_product;
$line->ref = $expedition->lines[$i]->ref; $LivraisonLigne->ref = $expedition->lignes[$i]->ref;
$this->lignes[$i] = $LivraisonLigne;
$this->lines[$i] = $line;
} }
$this->origin = $expedition->element; $this->origin = $expedition->element;
@ -524,13 +524,13 @@ class Livraison extends CommonObject
*/ */
function addline( $id, $qty ) function addline( $id, $qty )
{ {
$num = sizeof($this->lines); $num = sizeof($this->lignes);
$line = new LivraisonLigne($this->db); $ligne = new LivraisonLigne($this->db);
$line->commande_ligne_id = $id; $ligne->commande_ligne_id = $id;
$line->qty = $qty; $ligne->qty = $qty;
$this->lines[$num] = $line; $this->lignes[$num] = $ligne;
} }
/** /**
@ -657,9 +657,9 @@ class Livraison extends CommonObject
* *
* *
*/ */
function fetch_lines() function fetch_lignes()
{ {
$this->lines = array(); $this->lignes = array();
$sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped,"; $sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped,";
$sql.= " cd.qty as qty_asked,"; $sql.= " cd.qty as qty_asked,";
@ -669,7 +669,7 @@ class Livraison extends CommonObject
$sql.= " WHERE ld.fk_origin_line = cd.rowid"; $sql.= " WHERE ld.fk_origin_line = cd.rowid";
$sql.= " AND ld.fk_livraison = ".$this->id; $sql.= " AND ld.fk_livraison = ".$this->id;
dol_syslog("Livraison::fetch_lines sql=".$sql); dol_syslog("Livraison::fetch_lignes sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -695,6 +695,7 @@ class Livraison extends CommonObject
$line->price = $obj->price; $line->price = $obj->price;
$line->total_ht = $obj->total_ht; $line->total_ht = $obj->total_ht;
$this->lignes[$i] = $line; // TODO deprecated
$this->lines[$i] = $line; $this->lines[$i] = $line;
$i++; $i++;
@ -702,7 +703,7 @@ class Livraison extends CommonObject
$this->db->free($resql); $this->db->free($resql);
} }
return $this->lines; return $this->lignes;
} }
@ -781,17 +782,16 @@ class Livraison extends CommonObject
$this->note_public='SPECIMEN'; $this->note_public='SPECIMEN';
$i=0; $i=0;
$line=new LivraisonLigne($this->db); $ligne=new LivraisonLigne($this->db);
$line->fk_product = $prodids[0]; $ligne->fk_product = $prodids[0];
$line->qty_asked = 10; $ligne->qty_asked = 10;
$line->qty_shipped = 9; $ligne->qty_shipped = 9;
$line->ref = 'REFPROD'; $ligne->ref = 'REFPROD';
$line->label = 'Specimen'; $ligne->label = 'Specimen';
$line->description = 'Description'; $ligne->description = 'Description';
$line->price = 100; $ligne->price = 100;
$line->total_ht = 100; $ligne->total_ht = 100;
$this->lignes[$i] = $ligne;
$this->lines[$i] = $line;
} }
/** /**

View File

@ -268,12 +268,12 @@ if ($_GET["action"] == 'create')
*/ */
print '<br><table class="noborder" width="100%">'; print '<br><table class="noborder" width="100%">';
$lines = $commande->fetch_lines(1); $lignes = $commande->fetch_lines(1);
// Lecture des livraisons deja effectuees // Lecture des livraisons deja effectuees
$commande->livraison_array(); $commande->livraison_array();
$num = sizeof($commande->lines); $num = sizeof($commande->lignes);
$i = 0; $i = 0;
if ($num) if ($num)
@ -294,34 +294,34 @@ if ($_GET["action"] == 'create')
{ {
$product = new Product($db); $product = new Product($db);
$line = $commande->lines[$i]; $ligne = $commande->lignes[$i];
$var=!$var; $var=!$var;
print "<tr $bc[$var]>\n"; print "<tr $bc[$var]>\n";
if ($line->fk_product > 0) if ($ligne->fk_product > 0)
{ {
$product->fetch($line->fk_product); $product->fetch($ligne->fk_product);
$product->load_stock(); $product->load_stock();
print '<td>'; print '<td>';
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$line->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle; print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
if ($line->description) print nl2br($line->description); if ($ligne->description) print nl2br($ligne->description);
print '</td>'; print '</td>';
} }
else else
{ {
print "<td>".nl2br($line->description)."</td>\n"; print "<td>".nl2br($ligne->description)."</td>\n";
} }
print '<td align="center">'.$line->qty.'</td>'; print '<td align="center">'.$ligne->qty.'</td>';
/* /*
* *
*/ */
print '<td align="center">'; print '<td align="center">';
$quantite_livree = $commande->livraisons[$line->id]; $quantite_livree = $commande->livraisons[$ligne->id];
print $quantite_livree;; print $quantite_livree;;
print '</td>'; print '</td>';
$quantite_commandee = $line->qty; $quantite_commandee = $ligne->qty;
$quantite_a_livrer = $quantite_commandee - $quantite_livree; $quantite_a_livrer = $quantite_commandee - $quantite_livree;
if ($conf->stock->enabled) if ($conf->stock->enabled)
@ -331,7 +331,7 @@ if ($_GET["action"] == 'create')
// Quantite a livrer // Quantite a livrer
print '<td align="center">'; print '<td align="center">';
print '<input name="idl'.$i.'" type="hidden" value="'.$line->id.'">'; print '<input name="idl'.$i.'" type="hidden" value="'.$ligne->id.'">';
print '<input name="qtyl'.$i.'" type="text" size="6" value="'.min($quantite_a_livrer, $stock).'">'; print '<input name="qtyl'.$i.'" type="text" size="6" value="'.min($quantite_a_livrer, $stock).'">';
print '</td>'; print '</td>';
@ -349,7 +349,7 @@ if ($_GET["action"] == 'create')
{ {
// Quantite a livrer // Quantite a livrer
print '<td align="center">'; print '<td align="center">';
print '<input name="idl'.$i.'" type="hidden" value="'.$line->id.'">'; print '<input name="idl'.$i.'" type="hidden" value="'.$ligne->id.'">';
print '<input name="qtyl'.$i.'" type="text" size="6" value="'.$quantite_a_livrer.'">'; print '<input name="qtyl'.$i.'" type="text" size="6" value="'.$quantite_a_livrer.'">';
print '</td>'; print '</td>';
} }
@ -498,7 +498,7 @@ else
* Lignes produits * Lignes produits
*/ */
$num_prod = sizeof($delivery->lines); $num_prod = sizeof($delivery->lignes);
$i = 0; $total = 0; $i = 0; $total = 0;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -519,40 +519,40 @@ else
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
if ($delivery->lines[$i]->fk_product > 0) if ($delivery->lignes[$i]->fk_product > 0)
{ {
$product = new Product($db); $product = new Product($db);
$product->fetch($delivery->lines[$i]->fk_product); $product->fetch($delivery->lignes[$i]->fk_product);
print '<td>'; print '<td>';
// Affiche ligne produit // Affiche ligne produit
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$delivery->lines[$i]->fk_product.'">'; $text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$delivery->lignes[$i]->fk_product.'">';
if ($delivery->lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service'); if ($delivery->lignes[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
else $text.= img_object($langs->trans('ShowProduct'),'product'); else $text.= img_object($langs->trans('ShowProduct'),'product');
$text.= ' '.$delivery->lines[$i]->ref.'</a>'; $text.= ' '.$delivery->lignes[$i]->ref.'</a>';
$text.= ' - '.$delivery->lines[$i]->label; $text.= ' - '.$delivery->lignes[$i]->label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($delivery->lines[$i]->description)); $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($delivery->lignes[$i]->description));
//print $description; //print $description;
print $html->textwithtooltip($text,$description,3,'','',$i); print $html->textwithtooltip($text,$description,3,'','',$i);
print_date_range($delivery->lines[$i]->date_start,$delivery->lines[$i]->date_end); print_date_range($delivery->lignes[$i]->date_start,$delivery->lignes[$i]->date_end);
if ($conf->global->PRODUIT_DESC_IN_FORM) if ($conf->global->PRODUIT_DESC_IN_FORM)
{ {
print ($delivery->lines[$i]->description && $delivery->lines[$i]->description!=$delivery->lines[$i]->label)?'<br>'.dol_htmlentitiesbr($delivery->lines[$i]->description):''; print ($delivery->lignes[$i]->description && $delivery->lignes[$i]->description!=$delivery->lignes[$i]->label)?'<br>'.dol_htmlentitiesbr($delivery->lignes[$i]->description):'';
} }
} }
else else
{ {
print "<td>"; print "<td>";
if ($delivery->lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service'); if ($delivery->lignes[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
print $text.' '.nl2br($delivery->lines[$i]->description); print $text.' '.nl2br($delivery->lignes[$i]->description);
print_date_range($objp->date_start,$objp->date_end); print_date_range($objp->date_start,$objp->date_end);
print "</td>\n"; print "</td>\n";
} }
print '<td align="center">'.$delivery->lines[$i]->qty_asked.'</td>'; print '<td align="center">'.$delivery->lignes[$i]->qty_asked.'</td>';
print '<td align="center">'.$delivery->lines[$i]->qty_shipped.'</td>'; print '<td align="center">'.$delivery->lignes[$i]->qty_shipped.'</td>';
print "</tr>"; print "</tr>";

View File

@ -116,16 +116,16 @@ function analyse_sql_and_script(&$var,$get)
analyse_sql_and_script($_GET,1); analyse_sql_and_script($_GET,1);
analyse_sql_and_script($_POST,0); analyse_sql_and_script($_POST,0);
// This is to make Dolibarr working with Plesk. Does not work with IIS. // This is to make Dolibarr working with Plesk
set_include_path((isset($_SERVER["DOCUMENT_ROOT"])?$_SERVER["DOCUMENT_ROOT"]:'.').'/htdocs'); set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
// Add real path in session name // Add real path in session name
$realpath=''; $realpath='';
if ( preg_match('/^([^.]+)\/htdocs\//i', realpath($_SERVER["SCRIPT_FILENAME"]), $regs)) $realpath = isset($regs[1])?$regs[1]:''; if ( preg_match('/^([^.]+)\/htdocs\//i', realpath($_SERVER["SCRIPT_FILENAME"]), $regs)) $realpath = isset($regs[1])?$regs[1]:'';
// Init session. Name of session is specific to Dolibarr instance. // Init session. Name of session is specific to Dolibarr instance.
$sessionname='DOLSESSID_'.md5($_SERVER["SERVER_NAME"].(isset($_SERVER["DOCUMENT_ROOT"])?$_SERVER["DOCUMENT_ROOT"]:'').$realpath); $sessionname='DOLSESSID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath);
$sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].(isset($_SERVER["DOCUMENT_ROOT"])?$_SERVER["DOCUMENT_ROOT"]:'').$realpath); $sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath);
if (! empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime',$_COOKIE[$sessiontimeout]); if (! empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime',$_COOKIE[$sessiontimeout]);
session_name($sessionname); session_name($sessionname);
session_start(); session_start();

View File

@ -101,10 +101,9 @@ if (empty($dolibarr_main_data_root))
} }
// Define some constants // Define some constants
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs) define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem pages php (htdocs)
define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents) define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem donnes (documents)
define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir
define('DOL_CUSTOM_PATH', $dolibarr_main_document_root.'/custom'); // Filesystem path to custom dir
// If dolibarr_main_url_root = auto (Hidden feature for developers only), we try to forge it. // If dolibarr_main_url_root = auto (Hidden feature for developers only), we try to forge it.
if ($dolibarr_main_url_root == 'auto' && ! empty($_SERVER["SCRIPT_URL"]) && ! empty($_SERVER["SCRIPT_URI"])) if ($dolibarr_main_url_root == 'auto' && ! empty($_SERVER["SCRIPT_URL"]) && ! empty($_SERVER["SCRIPT_URI"]))
{ {
@ -188,7 +187,7 @@ $conf->file->character_set_client=strtoupper($force_charset_do_notuse);
$conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey; $conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey;
// Define array of document root directories // Define array of document root directories
$conf->file->dol_document_root=array(DOL_DOCUMENT_ROOT, DOL_CUSTOM_PATH); $conf->file->dol_document_root=array(DOL_DOCUMENT_ROOT);
if (! empty($dolibarr_main_document_root_alt)) if (! empty($dolibarr_main_document_root_alt))
{ {
// dolibarr_main_document_root_alt contains several directories // dolibarr_main_document_root_alt contains several directories

View File

@ -242,58 +242,58 @@ function html_print_paybox_footer($fromcompany,$langs)
global $conf; global $conf;
// Juridical status // Juridical status
$line1=""; $ligne1="";
if ($fromcompany->forme_juridique_code) if ($fromcompany->forme_juridique_code)
{ {
$line1.=($line1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); $ligne1.=($ligne1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
} }
// Capital // Capital
if ($fromcompany->capital) if ($fromcompany->capital)
{ {
$line1.=($line1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->monnaie); $ligne1.=($ligne1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->monnaie);
} }
// Prof Id 1 // Prof Id 1
if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2)) if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2))
{ {
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1); $ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1);
} }
// Prof Id 2 // Prof Id 2
if ($fromcompany->idprof2) if ($fromcompany->idprof2)
{ {
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2); $ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2);
} }
// Second line of company infos // Second line of company infos
$line2=""; $ligne2="";
// Prof Id 3 // Prof Id 3
if ($fromcompany->idprof3) if ($fromcompany->idprof3)
{ {
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3); $ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3);
} }
// Prof Id 4 // Prof Id 4
if ($fromcompany->idprof4) if ($fromcompany->idprof4)
{ {
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4); $ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4);
} }
// IntraCommunautary VAT // IntraCommunautary VAT
if ($fromcompany->tva_intra != '') if ($fromcompany->tva_intra != '')
{ {
$line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra); $ligne2.=($ligne2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra);
} }
print '<br><br><hr>'."\n"; print '<br><br><hr>'."\n";
print '<center><font style="font-size: 10px;">'."\n"; print '<center><font style="font-size: 10px;">'."\n";
print $fromcompany->nom.'<br>'; print $fromcompany->nom.'<br>';
print $line1.'<br>'; print $ligne1.'<br>';
print $line2; print $ligne2;
print '</font></center>'."\n"; print '</font></center>'."\n";
} }

View File

@ -72,58 +72,58 @@ function html_print_paypal_footer($fromcompany,$langs)
global $conf; global $conf;
// Juridical status // Juridical status
$line1=""; $ligne1="";
if ($fromcompany->forme_juridique_code) if ($fromcompany->forme_juridique_code)
{ {
$line1.=($line1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); $ligne1.=($ligne1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
} }
// Capital // Capital
if ($fromcompany->capital) if ($fromcompany->capital)
{ {
$line1.=($line1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->monnaie); $ligne1.=($ligne1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->monnaie);
} }
// Prof Id 1 // Prof Id 1
if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2)) if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2))
{ {
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1); $ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1);
} }
// Prof Id 2 // Prof Id 2
if ($fromcompany->idprof2) if ($fromcompany->idprof2)
{ {
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2); $ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2);
} }
// Second line of company infos // Second line of company infos
$line2=""; $ligne2="";
// Prof Id 3 // Prof Id 3
if ($fromcompany->idprof3) if ($fromcompany->idprof3)
{ {
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3); $ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3);
} }
// Prof Id 4 // Prof Id 4
if ($fromcompany->idprof4) if ($fromcompany->idprof4)
{ {
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4); $ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4);
} }
// IntraCommunautary VAT // IntraCommunautary VAT
if ($fromcompany->tva_intra != '') if ($fromcompany->tva_intra != '')
{ {
$line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra); $ligne2.=($ligne2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra);
} }
print '<br><br><hr>'."\n"; print '<br><br><hr>'."\n";
print '<center><font style="font-size: 10px;">'."\n"; print '<center><font style="font-size: 10px;">'."\n";
print $fromcompany->nom.'<br>'; print $fromcompany->nom.'<br>';
print $line1.'<br>'; print $ligne1.'<br>';
print $line2; print $ligne2;
print '</font></center>'."\n"; print '</font></center>'."\n";
} }

View File

@ -344,8 +344,8 @@ function llxHeaderVierge($title, $head = "")
print "<title>".$title."</title>\n"; print "<title>".$title."</title>\n";
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php?lang='.$langs->defaultlang.'">'."\n"; print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php?lang='.$langs->defaultlang.'">'."\n";
print '<!-- Includes for JQuery -->'."\n"; print '<!-- Includes for JQuery -->'."\n";
print '<script type="text/javascript" src="/includes/jquery/js/jquery-latest.min.js"></script>'."\n"; print '<script type="text/javascript" src="/includes/jquery/js/jquery-1.4.3.min.js"></script>'."\n";
print '<script type="text/javascript" src="/includes/jquery/js/jquery-ui-latest.custom.min.js"></script>'."\n"; print '<script type="text/javascript" src="/includes/jquery/js/jquery-ui-1.8.5.custom.min.js"></script>'."\n";
print '<script type="text/javascript" src="/includes/jquery/js/jquery.tablednd_0_5.js"></script>'."\n"; print '<script type="text/javascript" src="/includes/jquery/js/jquery.tablednd_0_5.js"></script>'."\n";
if ($head) print $head."\n"; if ($head) print $head."\n";
print '<style type="text/css">'; print '<style type="text/css">';

View File

@ -1797,66 +1797,6 @@ class Societe extends CommonObject
if (dol_strlen($chaine) != 14) return -1; if (dol_strlen($chaine) != 14) return -1;
} }
//Verify CIF/NIF/NIE if pays ES
//Returns: 1 if NIF ok, 2 if CIF ok, 3 if NIE ok, -1 if NIF bad, -2 if CIF bad, -3 if NIE bad, 0 if unexpected bad
if ($idprof == 1 && $soc->pays_code == 'ES')
{
$string=trim($this->siren);
$string=preg_replace('/(\s)/','',$string);
$string = strtoupper($string);
for ($i = 0; $i < 9; $i ++)
$num[$i] = substr($string, $i, 1);
//Check format
if (!preg_match('/((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)/', $string))
return 0;
//Check NIF
if (preg_match('/(^[0-9]{8}[A-Z]{1}$)/', $string))
if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($string, 0, 8) % 23, 1))
return 1;
else
return -1;
//algorithm checking type code CIF
$sum = $num[2] + $num[4] + $num[6];
for ($i = 1; $i < 8; $i += 2)
$sum += substr((2 * $num[$i]),0,1) + substr((2 * $num[$i]),1,1);
$n = 10 - substr($sum, strlen($sum) - 1, 1);
//Chek special NIF
if (preg_match('/^[KLM]{1}/', $string))
if ($num[8] == chr(64 + $n) || $num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($string, 1, 8) % 23, 1))
return 1;
else
return -1;
//Check CIF
if (preg_match('/^[ABCDEFGHJNPQRSUVW]{1}/', $string))
if ($num[8] == chr(64 + $n) || $num[8] == substr($n, strlen($n) - 1, 1))
return 2;
else
return -2;
//Check NIE T
if (preg_match('/^[T]{1}/', $string))
if ($num[8] == preg_match('/^[T]{1}[A-Z0-9]{8}$/', $string))
return 3;
else
return -3;
//Check NIE XYZ
if (preg_match('/^[XYZ]{1}/', $string))
if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr(str_replace(array('X','Y','Z'), array('0','1','2'), $string), 0, 8) % 23, 1))
return 3;
else
return -3;
//Can not be verified
return -4;
}
return $ok; return $ok;
} }
@ -1874,7 +1814,7 @@ class Societe extends CommonObject
$url=''; $url='';
if ($idprof == 1 && $soc->pays_code == 'FR') $url='http://www.societe.com/cgi-bin/recherche?rncs='.$soc->siren; if ($idprof == 1 && $soc->pays_code == 'FR') $url='http://www.societe.com/cgi-bin/recherche?rncs='.$soc->siren;
if ($idprof == 1 && $soc->pays_code == 'GB') $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/'; if ($idprof == 1 && $soc->pays_code == 'GB') $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/';
if ($idprof == 1 && $soc->pays_code == 'ES') $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$soc->siren;
if ($url) return '<a target="_blank" href="'.$url.'">['.$langs->trans("Check").']</a>'; if ($url) return '<a target="_blank" href="'.$url.'">['.$langs->trans("Check").']</a>';
return ''; return '';
} }
@ -2126,14 +2066,6 @@ class Societe extends CommonObject
if ($idprof==3) $formlength=5; // 4 chiffres et 1 lettre depuis janvier if ($idprof==3) $formlength=5; // 4 chiffres et 1 lettre depuis janvier
if ($idprof==4) $formlength=32; // No maximum as we need to include a town name in this id if ($idprof==4) $formlength=32; // No maximum as we need to include a town name in this id
} }
if ($this->pays_code == 'ES')
{
if ($idprof==1) $formlength=9; //CIF/NIF/NIE 9 digits
if ($idprof==2) $formlength=12; //NASS 12 digits without /
if ($idprof==3) $formlength=5; //CNAE 5 digits
if ($idprof==4) $formlength=32; //depend of college
}
$selected=$preselected; $selected=$preselected;
if (! $selected && $idprof==1) $selected=$this->siren; if (! $selected && $idprof==1) $selected=$this->siren;
if (! $selected && $idprof==2) $selected=$this->siret; if (! $selected && $idprof==2) $selected=$this->siret;

View File

@ -130,7 +130,7 @@ if ($socid > 0)
// Construit liste des fichiers // Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
$totalsize=0; $totalsize=0;
foreach($filearray as $key => $file) foreach($filearray as $key => $file)
{ {

View File

@ -34,7 +34,7 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client);
<link rel="apple-touch-icon" href="<?php echo DOL_URL_ROOT.'/theme/phones/smartphone/theme/'.$this->theme.'/thumbs/homescreen.png'; ?>" /> <link rel="apple-touch-icon" href="<?php echo DOL_URL_ROOT.'/theme/phones/smartphone/theme/'.$this->theme.'/thumbs/homescreen.png'; ?>" />
<link rel="stylesheet" href="<?php echo DOL_URL_ROOT.'/includes/jquery/mobile/jquery.mobile-latest.min.css'; ?>" /> <link rel="stylesheet" href="<?php echo DOL_URL_ROOT.'/includes/jquery/mobile/jquery.mobile-latest.min.css'; ?>" />
<link rel="stylesheet" href="<?php echo DOL_URL_ROOT.'/theme/phones/smartphone/theme/default/default.css.php'; ?>" /> <link rel="stylesheet" href="<?php echo DOL_URL_ROOT.'/theme/phones/smartphone/theme/default/default.css.php'; ?>" />
<script src="<?php echo DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min.js'; ?>"></script> <script src="<?php echo DOL_URL_ROOT.'/includes/jquery/js/jquery-1.4.3.min.js'; ?>"></script>
<script src="<?php echo DOL_URL_ROOT.'/includes/jquery/mobile/jquery.mobile-latest.js'; ?>"></script> <script src="<?php echo DOL_URL_ROOT.'/includes/jquery/mobile/jquery.mobile-latest.js'; ?>"></script>
<!-- <!--
<script src="<?php echo DOL_URL_ROOT.'/includes/jquery/mobile/jquery.mobile-latest.min.js'; ?>"></script> <script src="<?php echo DOL_URL_ROOT.'/includes/jquery/mobile/jquery.mobile-latest.min.js'; ?>"></script>

View File

@ -1195,8 +1195,8 @@ class User extends CommonObject
if (! $password) if (! $password)
{ {
// TODO Mettre appel au module de generation de mot de passe // TODO Mettre appel au module de generation de mot de passe
$password=create_random_psw_1(''); $password=creer_pass_aleatoire_1('');
//$password=create_random_psw_2(''); //$password=creer_pass_aleatoire_2('');
} }
// Crypte avec md5 // Crypte avec md5
@ -1890,11 +1890,11 @@ class User extends CommonObject
* \param sel Donnee aleatoire * \param sel Donnee aleatoire
* \return string Mot de passe * \return string Mot de passe
*/ */
function create_random_psw_1($sel = "") function creer_pass_aleatoire_1($sel = "")
{ {
$length = 8; $longueur = 8;
return strtolower(substr(md5(uniqid(mt_rand())),0,$length)); return strtolower(substr(md5(uniqid(mt_rand())),0,$longueur));
} }
@ -1905,14 +1905,14 @@ function create_random_psw_1($sel = "")
* \param sel Donnee aleatoire * \param sel Donnee aleatoire
* \return string Mot de passe * \return string Mot de passe
*/ */
function create_random_psw_2($sel = "") function creer_pass_aleatoire_2($sel = "")
{ {
$length=8; $longueur=8;
$seed = (double) (microtime() + 1) * time(); $seed = (double) (microtime() + 1) * time();
srand($seed); srand($seed);
for ($i = 0; $i < $length; $i++) for ($i = 0; $i < $longueur; $i++)
{ {
if (!$s) if (!$s)
{ {