Merge branch '3.2' of git+ssh://git@github.com/Dolibarr/dolibarr.git
into 3.2.1
This commit is contained in:
commit
9b1047eea7
@ -121,7 +121,7 @@ if ($action=='delete_action')
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
@ -51,7 +51,7 @@ $propalstatic=new Propal($db);
|
||||
$companystatic=new Societe($db);
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$help_url="EN:Module_Commercial_Proposals|FR:Module_Propositions_commerciales|ES:Módulo Presupuestos";
|
||||
$help_url="EN:Module_Commercial_Proposals|FR:Module_Propositions_commerciales|ES:Módulo_Presupuestos";
|
||||
|
||||
llxHeader("",$langs->trans("ProspectionArea"),$help_url);
|
||||
|
||||
|
||||
@ -28,8 +28,7 @@ include_once DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.commande.class.php";
|
||||
|
||||
|
||||
/**
|
||||
* \class CommandeStats
|
||||
* \brief Classe permettant la gestion des stats des commandes
|
||||
* Class to manage order statistics
|
||||
*/
|
||||
class CommandeStats extends Stats
|
||||
{
|
||||
@ -66,7 +65,7 @@ class CommandeStats extends Stats
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
|
||||
$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$this->field='total_ht';
|
||||
$this->where.= " c.fk_statut > 0";
|
||||
$this->where.= " c.fk_statut > 0"; // Not draft and not cancelled
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
@ -74,7 +73,7 @@ class CommandeStats extends Stats
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
|
||||
$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$this->field='total_ht';
|
||||
$this->where.= " c.fk_statut > 0";
|
||||
$this->where.= " c.fk_statut > 0"; // Not draft and not cancelled
|
||||
}
|
||||
$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
|
||||
|
||||
@ -97,10 +96,10 @@ class CommandeStats extends Stats
|
||||
global $conf;
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%m') as dm, count(*) nb";
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, count(*) nb";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'";
|
||||
$sql.= " WHERE date_format(c.date_commande,'%Y') = '".$year."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm','DESC');
|
||||
@ -119,7 +118,7 @@ class CommandeStats extends Stats
|
||||
global $conf;
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%Y') as dm, count(*), sum(c.".$this->field.")";
|
||||
$sql = "SELECT date_format(c.date_commande,'%Y') as dm, count(*), sum(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
@ -140,10 +139,10 @@ class CommandeStats extends Stats
|
||||
global $conf;
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%m') as dm, sum(c.".$this->field.")";
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, sum(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'";
|
||||
$sql.= " WHERE date_format(c.date_commande,'%Y') = '".$year."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm','DESC');
|
||||
@ -162,10 +161,10 @@ class CommandeStats extends Stats
|
||||
global $conf;
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%m') as dm, avg(c.".$this->field.")";
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, avg(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'";
|
||||
$sql.= " WHERE date_format(c.date_commande,'%Y') = '".$year."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm','DESC');
|
||||
@ -182,7 +181,7 @@ class CommandeStats extends Stats
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%Y') as year, count(*) as nb, sum(c.".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
$sql = "SELECT date_format(c.date_commande,'%Y') as year, count(*) as nb, sum(c.".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
|
||||
@ -49,7 +49,7 @@ if ($user->societe_id > 0)
|
||||
$commandestatic=new Commande($db);
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo Pedidos de clientes";
|
||||
$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
|
||||
|
||||
llxHeader("",$langs->trans("Orders"),$help_url);
|
||||
|
||||
|
||||
@ -3249,7 +3249,7 @@ function dol_nboflines($s,$maxchar=0)
|
||||
|
||||
|
||||
/**
|
||||
* Return nb of lines of a formated text with \n and <br>
|
||||
* Return nb of lines of a formated text with \n and <br> (we can't have both \n and br)
|
||||
*
|
||||
* @param string $text Text
|
||||
* @param int $maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut)
|
||||
@ -3258,12 +3258,14 @@ function dol_nboflines($s,$maxchar=0)
|
||||
*/
|
||||
function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
|
||||
{
|
||||
//print $text;
|
||||
$repTable = array("\t" => " ", "\n" => "<br>", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
||||
if (dol_textishtml($text)) $repTable = array("\t" => " ", "\n" => " ", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
||||
|
||||
$text = strtr($text, $repTable);
|
||||
if ($charset == 'UTF-8') { $pattern = '/(<[^>]+>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
|
||||
else $pattern = '/(<[^>]+>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
|
||||
if ($charset == 'UTF-8') { $pattern = '/(<br[^>]*>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
|
||||
else $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
|
||||
$a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
$nblines = floor((count($a)+1)/2);
|
||||
// count possible auto line breaks
|
||||
if($maxlinesize)
|
||||
|
||||
@ -378,6 +378,7 @@ function clean_url($url,$http=1)
|
||||
|
||||
return $CleanUrl;
|
||||
}
|
||||
else return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -214,18 +214,21 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
if ($sourcecompany->state_id && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id);
|
||||
if ($targetcompany->state_id && empty($targetcompany->departement)) $targetcompany->departement=getState($targetcompany->state_id);
|
||||
|
||||
if ($mode == 'source' || ! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS))
|
||||
if ($mode == 'source')
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany))."\n";
|
||||
|
||||
// Tel
|
||||
if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel);
|
||||
// Fax
|
||||
if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
|
||||
// EMail
|
||||
if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email);
|
||||
// Web
|
||||
if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url);
|
||||
if (! empty($conf->global->MAIN_PDF_ADDALSOSOURCEDETAILS))
|
||||
{
|
||||
// Tel
|
||||
if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel);
|
||||
// Fax
|
||||
if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
|
||||
// EMail
|
||||
if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email);
|
||||
// Web
|
||||
if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url);
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'target')
|
||||
@ -236,12 +239,36 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n";
|
||||
// Country
|
||||
if ($targetcontact->country_code && $targetcontact->country_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->pays_code))."\n";
|
||||
|
||||
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS))
|
||||
{
|
||||
// Tel
|
||||
if ($targetcontact->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->tel);
|
||||
// Fax
|
||||
if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
|
||||
// EMail
|
||||
if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
|
||||
// Web
|
||||
if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
|
||||
// Country
|
||||
if ($targetcompany->country_code && $targetcompany->country_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->pays_code))."\n";
|
||||
|
||||
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS))
|
||||
{
|
||||
// Tel
|
||||
if ($targetcompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->tel);
|
||||
// Fax
|
||||
if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
|
||||
// EMail
|
||||
if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
|
||||
// Web
|
||||
if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
|
||||
}
|
||||
}
|
||||
|
||||
// Intra VAT
|
||||
|
||||
@ -90,7 +90,7 @@ function dol_hash($chain,$type=0)
|
||||
* @param User $user User to check
|
||||
* @param string $features Features to check (in most cases, it's module name. Examples: 'societe', 'contact', 'produit|service', ...)
|
||||
* @param int $objectid Object ID if we want to check permission on a particular record (optionnal)
|
||||
* @param string $dbtablename Table name where object is stored. Not used if objectid is null (optionnal)
|
||||
* @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored, SharedElement is key to define where to check entity. Not used if objectid is null (optionnal)
|
||||
* @param string $feature2 Feature to check, second level of permission (optionnal)
|
||||
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc (optionnal)
|
||||
* @param string $dbt_select Field name for select if not rowid (optionnal)
|
||||
|
||||
@ -227,7 +227,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY);
|
||||
|
||||
$pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also.
|
||||
$pdf->MultiCell(0, 2, ''); // Set interline to 3. Then writeMultiCell must use 3 also.
|
||||
|
||||
$nblines = count($object->lines);
|
||||
|
||||
@ -244,14 +244,27 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
$pdf->SetFont('','B', $default_font_size - 1);
|
||||
$pdf->SetXY($this->marge_gauche, $curY);
|
||||
$txt=dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output);
|
||||
|
||||
$curYold=$nexYold=$nexY;
|
||||
$pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY, $txt, 0, 1, 0);
|
||||
$curY = $pdf->GetY();
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$nexY+=3;
|
||||
|
||||
$pdf->SetXY($this->marge_gauche, $curY + 3);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
|
||||
$pdf->SetXY($this->marge_gauche, $nexY);
|
||||
$desc = dol_htmlentitiesbr($objectligne->desc,1);
|
||||
$pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY + 3, $desc, 0, 1, 0);
|
||||
$nexY+=dol_nboflines_bis($objectligne->desc,52,$outputlangs->charset_output)*3;
|
||||
|
||||
$curYold = $pdf->GetY();
|
||||
$nexYold = $curYold;
|
||||
|
||||
$pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY, $desc, 0, 1, 0);
|
||||
|
||||
$stringheight=$pdf->getStringHeight('A', $txt);
|
||||
$curY = $pdf->GetY();
|
||||
|
||||
$nexY+=(dol_nboflines_bis($objectligne->desc,0,$outputlangs->charset_output)*$stringheight);
|
||||
//print $curYold."-".$nexYold." +".dol_nboflines_bis($objectligne->desc,52,$outputlangs->charset_output)."*".$stringheight."= ".$curY."-".$nexY."<br>";
|
||||
|
||||
$nexY+=2; // Passe espace entre les lignes
|
||||
|
||||
|
||||
@ -450,14 +450,14 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Remove file in doc form
|
||||
else if ($action == 'remove_file')
|
||||
{
|
||||
if ($object->fetch($socid))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->societe->dir_output;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
|
||||
@ -34,11 +34,12 @@ $id=GETPOST('id','int');
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
|
||||
if ($user->id == $_GET["id"]) // A user can always read its own card
|
||||
if ($user->id == $id) // A user can always read its own card
|
||||
{
|
||||
$feature2='';
|
||||
}
|
||||
$result = restrictedArea($user, 'user', $_GET["id"], '', $feature2);
|
||||
$result = restrictedArea($user, $feature, $id, '&user', $feature2);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
Loading…
Reference in New Issue
Block a user