Change to uniformize code of PDF generators
This commit is contained in:
parent
5d2d005e13
commit
5de23dcc59
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
@ -323,10 +323,10 @@ if(is_dir($dir))
|
|||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&module='.$name.'&moduleid='.$module->id.'">'.$langs->trans("Default").'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&module='.$name.'&moduleid='.$module->id.'">'.$langs->trans("Default").'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2071,6 +2071,7 @@ class Commande extends CommonObject
|
|||||||
$ligne->total_tva=19.6;
|
$ligne->total_tva=19.6;
|
||||||
$prodid = rand(1, $num_prods);
|
$prodid = rand(1, $num_prods);
|
||||||
$ligne->produit_id=$prodids[$prodid];
|
$ligne->produit_id=$prodids[$prodid];
|
||||||
|
$ligne->fk_product=$prodids[$prodid];
|
||||||
$this->lignes[$xnbp]=$ligne;
|
$this->lignes[$xnbp]=$ligne;
|
||||||
$xnbp++;
|
$xnbp++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,8 +48,9 @@ class Expedition extends CommonObject
|
|||||||
var $modelpdf;
|
var $modelpdf;
|
||||||
var $origin;
|
var $origin;
|
||||||
var $origin_id;
|
var $origin_id;
|
||||||
|
var $lignes;
|
||||||
var $meths;
|
var $meths;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialisation
|
* Initialisation
|
||||||
*
|
*
|
||||||
@ -76,7 +77,7 @@ class Expedition extends CommonObject
|
|||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT ."/product/stock/mouvementstock.class.php";
|
require_once DOL_DOCUMENT_ROOT ."/product/stock/mouvementstock.class.php";
|
||||||
$error = 0;
|
$error = 0;
|
||||||
/* On positionne en mode brouillon l'expedition */
|
/* On positionne en mode brouillon l'expedition */
|
||||||
@ -145,7 +146,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -238,7 +239,7 @@ class Expedition extends CommonObject
|
|||||||
if ($this->db->num_rows($result))
|
if ($this->db->num_rows($result))
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->ref;
|
$this->ref = $obj->ref;
|
||||||
$this->socid = $obj->socid;
|
$this->socid = $obj->socid;
|
||||||
@ -262,10 +263,10 @@ class Expedition extends CommonObject
|
|||||||
$this->trueDepth = $obj->size;
|
$this->trueDepth = $obj->size;
|
||||||
$this->depth_units = $obj->size_units;
|
$this->depth_units = $obj->size_units;
|
||||||
|
|
||||||
// A denormalized value
|
// A denormalized value
|
||||||
$this->trueSize = $obj->size."x".$obj->width."x".$obj->height;
|
$this->trueSize = $obj->size."x".$obj->width."x".$obj->height;
|
||||||
$this->size_units = $obj->size_units;
|
$this->size_units = $obj->size_units;
|
||||||
|
|
||||||
if ($conf->commande->enabled)
|
if ($conf->commande->enabled)
|
||||||
{
|
{
|
||||||
$this->origin = "commande";
|
$this->origin = "commande";
|
||||||
@ -274,16 +275,16 @@ class Expedition extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->origin = "propal";
|
$this->origin = "propal";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
|
|
||||||
if ($this->statut == 0) $this->brouillon = 1;
|
if ($this->statut == 0) $this->brouillon = 1;
|
||||||
|
|
||||||
$this->lignes = array();
|
$this->lignes = array();
|
||||||
|
|
||||||
$file = $conf->expedition->dir_output . "/" .get_exdir($expedition->id,2) . "/" . $this->id.".pdf";
|
$file = $conf->expedition->dir_output . "/" .get_exdir($expedition->id,2) . "/" . $this->id.".pdf";
|
||||||
$this->pdf_filename = $file;
|
$this->pdf_filename = $file;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lignes
|
* Lignes
|
||||||
*/
|
*/
|
||||||
@ -292,7 +293,7 @@ class Expedition extends CommonObject
|
|||||||
{
|
{
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -399,7 +400,7 @@ class Expedition extends CommonObject
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// On efface le répertoire de pdf provisoire
|
// On efface le répertoire de pdf provisoire
|
||||||
$expeditionref = sanitizeFileName($provref);
|
$expeditionref = sanitizeFileName($provref);
|
||||||
if ($conf->expedition->dir_output)
|
if ($conf->expedition->dir_output)
|
||||||
@ -421,7 +422,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -530,7 +531,7 @@ class Expedition extends CommonObject
|
|||||||
if ( $this->db->query($sql) )
|
if ( $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
// On efface le répertoire de pdf provisoire
|
// On efface le répertoire de pdf provisoire
|
||||||
$expref = sanitizeFileName($this->ref);
|
$expref = sanitizeFileName($this->ref);
|
||||||
if ($conf->expedition->dir_output)
|
if ($conf->expedition->dir_output)
|
||||||
@ -748,10 +749,12 @@ class Expedition extends CommonObject
|
|||||||
$ligne->qty=10;
|
$ligne->qty=10;
|
||||||
$ligne->qty_asked=5;
|
$ligne->qty_asked=5;
|
||||||
$ligne->qty_shipped=4;
|
$ligne->qty_shipped=4;
|
||||||
$prodid = rand(1, $num_prods);
|
$ligne->fk_product=$this->commande->lignes[$xnbp]->fk_product;
|
||||||
$ligne->fk_product=$prodids[$prodid];
|
|
||||||
|
$this->lignes[]=$ligne;
|
||||||
$xnbp++;
|
$xnbp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Fetch deliveries method and return an array
|
Fetch deliveries method and return an array
|
||||||
@ -773,7 +776,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get id of default expedition method
|
Get id of default expedition method
|
||||||
*/
|
*/
|
||||||
@ -794,7 +797,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get tracking url status
|
Get tracking url status
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -181,7 +181,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
|
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
|
||||||
$pdf->SetTextColor(0,0,0);
|
$pdf->SetTextColor(0,0,0);
|
||||||
|
|
||||||
//Initialisation des coordonn<EFBFBD>es
|
//Initialisation des coordonnees
|
||||||
$tab_top = 53;
|
$tab_top = 53;
|
||||||
$tab_height = 70;
|
$tab_height = 70;
|
||||||
$pdf->SetFillColor(240,240,240);
|
$pdf->SetFillColor(240,240,240);
|
||||||
@ -193,30 +193,33 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
//Generation du tableau
|
//Generation du tableau
|
||||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
||||||
|
|
||||||
//Recuperation des produits de la commande.
|
//Recuperation des produits de la commande.
|
||||||
$this->expe->commande->fetch_lines(1);
|
if ($this->expe->ref != 'SPECIMEN') $this->expe->commande->fetch_lines(1);
|
||||||
|
|
||||||
$Produits = $this->expe->commande->lignes;
|
$Produits = $this->expe->commande->lignes;
|
||||||
$nblignes = sizeof($Produits);
|
$nblignes = sizeof($Produits);
|
||||||
|
|
||||||
for ($i = 0 ; $i < $nblignes ; $i++){
|
for ($i = 0 ; $i < $nblignes ; $i++){
|
||||||
//Generation du produit
|
//Generation du produit
|
||||||
$Prod = new Product($this->db);
|
$Prod = new Product($this->db);
|
||||||
$Prod->fetch($Produits[$i]->fk_product);
|
$Prod->fetch($Produits[$i]->fk_product);
|
||||||
//Creation des cases <EFBFBD> cocher
|
//Creation des cases a cocher
|
||||||
$pdf->rect(10+3, $curY+1, 3, 3);
|
$pdf->rect(10+3, $curY+1, 3, 3);
|
||||||
$pdf->rect(20+3, $curY+1, 3, 3);
|
$pdf->rect(20+3, $curY+1, 3, 3);
|
||||||
//Insertion de la reference du produit
|
//Insertion de la reference du produit
|
||||||
$pdf->SetXY (30, $curY );
|
$pdf->SetXY (30, $curY );
|
||||||
$pdf->SetFont('Arial','B', 7);
|
$pdf->SetFont('Arial','B', 7);
|
||||||
$pdf->MultiCell(20, 5, $Prod->ref, 0, 'L', 0);
|
$pdf->MultiCell(24, 5, $outputlangs->convToOutputCharset($Prod->ref), 0, 'L', 0);
|
||||||
//Insertion du libelle
|
//Insertion du libelle
|
||||||
$pdf->SetFont('Arial','', 7);
|
$pdf->SetFont('Arial','', 7);
|
||||||
$pdf->SetXY (50, $curY );
|
$pdf->SetXY (50, $curY );
|
||||||
$pdf->MultiCell(90, 5, $Prod->libelle, 0, 'L', 0);
|
$pdf->MultiCell(90, 5, $outputlangs->convToOutputCharset($Prod->libelle), 0, 'L', 0);
|
||||||
//Insertion de la quantite command<EFBFBD>e
|
//Insertion de la quantite commandee
|
||||||
$pdf->SetFont('Arial','', 7);
|
$pdf->SetFont('Arial','', 7);
|
||||||
$pdf->SetXY (140, $curY );
|
$pdf->SetXY (140, $curY );
|
||||||
$pdf->MultiCell(30, 5, $this->expe->lignes[$i]->qty_asked, 0, 'C', 0);
|
$pdf->MultiCell(30, 5, $this->expe->lignes[$i]->qty_asked, 0, 'C', 0);
|
||||||
//Insertion de la quantite <EFBFBD> envoyer
|
//Insertion de la quantite a envoyer
|
||||||
$pdf->SetFont('Arial','', 7);
|
$pdf->SetFont('Arial','', 7);
|
||||||
$pdf->SetXY (170, $curY );
|
$pdf->SetXY (170, $curY );
|
||||||
$pdf->MultiCell(30, 5, $this->expe->lignes[$i]->qty_shipped, 0, 'C', 0);
|
$pdf->MultiCell(30, 5, $this->expe->lignes[$i]->qty_shipped, 0, 'C', 0);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -66,7 +66,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
|||||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* \param pdf Objet PDF
|
* \param pdf Objet PDF
|
||||||
* \param exp Objet expedition
|
* \param exp Objet expedition
|
||||||
* \param showadress 0=non, 1=oui
|
* \param showadress 0=non, 1=oui
|
||||||
@ -189,7 +189,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
|||||||
// New page
|
// New page
|
||||||
$pdf->AddPage();
|
$pdf->AddPage();
|
||||||
$pagenb++;
|
$pagenb++;
|
||||||
$this->_pagehead($pdf, $this->exp, $outputlangs);
|
$this->_pagehead($pdf, $this->exp, 1, $outputlangs);
|
||||||
$pdf->SetFont('Arial','', 9);
|
$pdf->SetFont('Arial','', 9);
|
||||||
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
|
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
|
||||||
$pdf->SetTextColor(0,0,0);
|
$pdf->SetTextColor(0,0,0);
|
||||||
@ -216,7 +216,8 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
|||||||
$curY = $this->tableau_top + 4;
|
$curY = $this->tableau_top + 4;
|
||||||
$pdf->writeHTMLCell(30, 3, 170, $curY, $outputlangs->trans("QtyToShip"), 0, 0);
|
$pdf->writeHTMLCell(30, 3, 170, $curY, $outputlangs->trans("QtyToShip"), 0, 0);
|
||||||
|
|
||||||
$this->expe->fetch_lines();
|
if ($this->expe->ref != 'SPECIMEN') $this->expe->fetch_lines();
|
||||||
|
|
||||||
for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++)
|
for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++)
|
||||||
{
|
{
|
||||||
$curY = $this->tableau_top + 14 + ($i * 7);
|
$curY = $this->tableau_top + 14 + ($i * 7);
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class InterfaceLdapsynchro
|
|||||||
var $db;
|
var $db;
|
||||||
var $error;
|
var $error;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur.
|
* \brief Constructeur.
|
||||||
* \param DB Handler d'accès base
|
* \param DB Handler d'accès base
|
||||||
@ -44,13 +44,13 @@ class InterfaceLdapsynchro
|
|||||||
function InterfaceLdapsynchro($DB)
|
function InterfaceLdapsynchro($DB)
|
||||||
{
|
{
|
||||||
$this->db = $DB ;
|
$this->db = $DB ;
|
||||||
|
|
||||||
$this->name = eregi_replace('Interface','',get_class($this));
|
$this->name = eregi_replace('Interface','',get_class($this));
|
||||||
$this->family = "ldap";
|
$this->family = "ldap";
|
||||||
$this->description = "Triggers of this module allows to synchronize Dolibarr toward a LDAP database.";
|
$this->description = "Triggers of this module allows to synchronize Dolibarr toward a LDAP database.";
|
||||||
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
|
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoi nom du lot de triggers
|
* \brief Renvoi nom du lot de triggers
|
||||||
* \return string Nom du lot de triggers
|
* \return string Nom du lot de triggers
|
||||||
@ -59,7 +59,7 @@ class InterfaceLdapsynchro
|
|||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoi descriptif du lot de triggers
|
* \brief Renvoi descriptif du lot de triggers
|
||||||
* \return string Descriptif du lot de triggers
|
* \return string Descriptif du lot de triggers
|
||||||
@ -83,7 +83,7 @@ class InterfaceLdapsynchro
|
|||||||
elseif ($this->version) return $this->version;
|
elseif ($this->version) return $this->version;
|
||||||
else return $langs->trans("Unknown");
|
else return $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Fonction appelée lors du déclenchement d'un évènement Dolibarr.
|
* \brief Fonction appelée lors du déclenchement d'un évènement Dolibarr.
|
||||||
* D'autres fonctions run_trigger peuvent etre présentes dans includes/triggers
|
* D'autres fonctions run_trigger peuvent etre présentes dans includes/triggers
|
||||||
@ -98,15 +98,15 @@ class InterfaceLdapsynchro
|
|||||||
{
|
{
|
||||||
// Mettre ici le code à exécuter en réaction de l'action
|
// Mettre ici le code à exécuter en réaction de l'action
|
||||||
// Les données de l'action sont stockées dans $object
|
// Les données de l'action sont stockées dans $object
|
||||||
|
|
||||||
if (! $conf->ldap->enabled) return 0; // Module non actif
|
if (! $conf->ldap->enabled) return 0; // Module non actif
|
||||||
|
|
||||||
if (! function_exists('ldap_connect'))
|
if (! function_exists('ldap_connect'))
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Warning, module LDAP is enabled but LDAP functions not available in this PHP", LOG_WARNING);
|
dolibarr_syslog("Warning, module LDAP is enabled but LDAP functions not available in this PHP", LOG_WARNING);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Users
|
// Users
|
||||||
if ($action == 'USER_CREATE')
|
if ($action == 'USER_CREATE')
|
||||||
{
|
{
|
||||||
@ -118,9 +118,12 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->add($dn,$info,$user);
|
$result=$ldap->add($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,9 +137,12 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,9 +164,12 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->delete($dn,$info,$user);
|
$result=$ldap->delete($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,9 +184,12 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->add($dn,$info,$user);
|
$result=$ldap->add($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,9 +202,12 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,13 +220,16 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->delete($dn,$info,$user);
|
$result=$ldap->delete($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Contacts
|
// Contacts
|
||||||
elseif ($action == 'CONTACT_CREATE')
|
elseif ($action == 'CONTACT_CREATE')
|
||||||
{
|
{
|
||||||
@ -223,9 +241,12 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->add($dn,$info,$user);
|
$result=$ldap->add($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,9 +260,12 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,13 +276,16 @@ class InterfaceLdapsynchro
|
|||||||
{
|
{
|
||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$ldap->connect_bind();
|
$ldap->connect_bind();
|
||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->delete($dn,$info,$user);
|
$result=$ldap->delete($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
return $result;
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,13 +297,16 @@ class InterfaceLdapsynchro
|
|||||||
{
|
{
|
||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$ldap->connect_bind();
|
$ldap->connect_bind();
|
||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->add($dn,$info,$user);
|
$result=$ldap->add($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
return $result;
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($action == 'MEMBER_VALIDATE')
|
elseif ($action == 'MEMBER_VALIDATE')
|
||||||
@ -292,10 +322,13 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
return $result;
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -316,10 +349,13 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
return $result;
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -333,10 +369,13 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
return $result;
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($action == 'MEMBER_NEW_PASSWORD')
|
elseif ($action == 'MEMBER_NEW_PASSWORD')
|
||||||
@ -352,10 +391,13 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
return $result;
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -372,10 +414,13 @@ class InterfaceLdapsynchro
|
|||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
return $result;
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -391,7 +436,10 @@ class InterfaceLdapsynchro
|
|||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->delete($dn,$info,$user);
|
$result=$ldap->delete($dn,$info,$user);
|
||||||
if ($result < 0) $this->error=$langs->trans("ErrorLDAP")." ".$ldap->error;
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -505,12 +505,13 @@ class Ldap
|
|||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Ldap::add successfull");
|
dolibarr_syslog("Ldap::add successfull", LOG_DEBUG);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Ldap::add failed");
|
$this->error=@ldap_error($this->connection);
|
||||||
|
dolibarr_syslog("Ldap::add failed: ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -723,7 +724,7 @@ class Ldap
|
|||||||
{
|
{
|
||||||
$keyattributelower=strtolower($attributeArray[$j]);
|
$keyattributelower=strtolower($attributeArray[$j]);
|
||||||
//print " Param ".$attributeArray[$j]."=".$info[$i][$keyattributelower][0]."<br>\n";
|
//print " Param ".$attributeArray[$j]."=".$info[$i][$keyattributelower][0]."<br>\n";
|
||||||
|
|
||||||
//permet de récupérer le SID avec Active Directory
|
//permet de récupérer le SID avec Active Directory
|
||||||
if ($this->serverType == "activedirectory" && $keyattributelower == "objectsid")
|
if ($this->serverType == "activedirectory" && $keyattributelower == "objectsid")
|
||||||
{
|
{
|
||||||
@ -763,7 +764,7 @@ class Ldap
|
|||||||
{
|
{
|
||||||
$criteria = '('.$this->getUserIdentifier().'='.$ldapUser.')';
|
$criteria = '('.$this->getUserIdentifier().'='.$ldapUser.')';
|
||||||
$justthese = array("objectsid");
|
$justthese = array("objectsid");
|
||||||
|
|
||||||
// if the directory is AD, then bind first with the search user first
|
// if the directory is AD, then bind first with the search user first
|
||||||
if ($this->serverType == "activedirectory")
|
if ($this->serverType == "activedirectory")
|
||||||
{
|
{
|
||||||
@ -776,7 +777,7 @@ class Ldap
|
|||||||
while ($i <= 2)
|
while ($i <= 2)
|
||||||
{
|
{
|
||||||
$ldapSearchResult = @ldap_search($this->connection, $searchDN, $criteria, $justthese);
|
$ldapSearchResult = @ldap_search($this->connection, $searchDN, $criteria, $justthese);
|
||||||
|
|
||||||
if (!$ldapSearchResult)
|
if (!$ldapSearchResult)
|
||||||
{
|
{
|
||||||
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
|
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
|
||||||
@ -810,7 +811,7 @@ class Ldap
|
|||||||
return '?';
|
return '?';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the textual SID
|
* Returns the textual SID
|
||||||
* Indispensable pour Active Directory
|
* Indispensable pour Active Directory
|
||||||
@ -827,7 +828,7 @@ class Ldap
|
|||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Fonction de recherche avec filtre
|
* \brief Fonction de recherche avec filtre
|
||||||
@ -892,7 +893,7 @@ class Ldap
|
|||||||
while ($i <= 2)
|
while ($i <= 2)
|
||||||
{
|
{
|
||||||
$this->result = @ldap_search($this->connection, $searchDN, $filter);
|
$this->result = @ldap_search($this->connection, $searchDN, $filter);
|
||||||
|
|
||||||
if ($this->result)
|
if ($this->result)
|
||||||
{
|
{
|
||||||
$result = @ldap_get_entries($this->connection, $this->result);
|
$result = @ldap_get_entries($this->connection, $this->result);
|
||||||
@ -903,7 +904,7 @@ class Ldap
|
|||||||
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
|
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
// Si pas de résultat on cherche dans le domaine
|
// Si pas de résultat on cherche dans le domaine
|
||||||
@ -943,7 +944,7 @@ class Ldap
|
|||||||
}
|
}
|
||||||
if (!$this->name && !$this->login) $this->pwdlastset = -1;
|
if (!$this->name && !$this->login) $this->pwdlastset = -1;
|
||||||
$this->badpwdtime = $this->convert_time($this->convToOutputCharset($result[0]["badpasswordtime"][0],$this->ldapcharset));
|
$this->badpwdtime = $this->convert_time($this->convToOutputCharset($result[0]["badpasswordtime"][0],$this->ldapcharset));
|
||||||
|
|
||||||
// FQDN domain
|
// FQDN domain
|
||||||
$domain = eregi_replace('dc=','',$this->domain);
|
$domain = eregi_replace('dc=','',$this->domain);
|
||||||
$domain = eregi_replace(',','.',$domain);
|
$domain = eregi_replace(',','.',$domain);
|
||||||
@ -1098,7 +1099,7 @@ class Ldap
|
|||||||
return $unixTimeStamp;
|
return $unixTimeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Convert a string into output/memory charset
|
* \brief Convert a string into output/memory charset
|
||||||
* \param str String to convert
|
* \param str String to convert
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 <EFBFBD>ric Seigne <erics@rycks.com>
|
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
|
* Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
|
||||||
@ -74,17 +74,6 @@ function llxHeader($head = "")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->compta->enabled) || $conf->comptaexpert->enabled)
|
|
||||||
{
|
|
||||||
$langs->load("compta");
|
|
||||||
$menu->add(DOL_URL_ROOT."/compta/index.php", $langs->trans("MenuFinancial"));
|
|
||||||
|
|
||||||
if ($user->rights->facture->lire) {
|
|
||||||
$langs->load("bills");
|
|
||||||
$menu->add_submenu(DOL_URL_ROOT."/compta/facture.php", $langs->trans("Bills"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
|
if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
|
||||||
{
|
{
|
||||||
$langs->trans("interventions");
|
$langs->trans("interventions");
|
||||||
|
|||||||
@ -46,6 +46,7 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $error;
|
var $error;
|
||||||
|
var $errors=array();
|
||||||
var $element='user';
|
var $element='user';
|
||||||
var $table_element='user';
|
var $table_element='user';
|
||||||
|
|
||||||
|
|||||||
@ -176,7 +176,7 @@ if ($_POST["action"] == 'add' && $canadduser)
|
|||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
$message='<div class="error">'.$langs->trans($edituser->error).'</div>';
|
$message='<div class="error">'.join('<br>',$edituser->errors).'</div>';
|
||||||
$action="create"; // Go back to create page
|
$action="create"; // Go back to create page
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user