Merge branch '3.5' of github.com:Dolibarr/dolibarr into 3.5

This commit is contained in:
Maxime Kohlhaas 2014-08-14 14:26:01 +02:00
commit e760201a59
15 changed files with 57 additions and 51 deletions

View File

@ -18,6 +18,7 @@ Fix: Update impayees.php
Fix: Link product, In list view and label product Fix: Link product, In list view and label product
Fix: visible task into area "time" for "My task" must limit task to tasks i am assigned to. Fix: visible task into area "time" for "My task" must limit task to tasks i am assigned to.
Fix: When disabled, all fields to add time into task line must be disabled. Fix: When disabled, all fields to add time into task line must be disabled.
Fix: Missing include files.lib.php in some pages ti use dol_delete_recursive
***** ChangeLog for 3.5.4 compared to 3.5.3 ***** ***** ChangeLog for 3.5.4 compared to 3.5.3 *****
Fix: Hide title of event when agenda module disabled. Fix: Hide title of event when agenda module disabled.

View File

@ -328,6 +328,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
{ {
if (GETPOST('deletephoto')) if (GETPOST('deletephoto'))
{ {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileimg=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/'.$object->photo; $fileimg=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/'.$object->photo;
$dirthumbs=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/thumbs'; $dirthumbs=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/thumbs';
dol_delete_file($fileimg); dol_delete_file($fileimg);

View File

@ -23,7 +23,7 @@
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
include_once $dolibarr_main_document_root.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$langs->load("admin"); $langs->load("admin");
$langs->load("other"); $langs->load("other");

View File

@ -2006,15 +2006,7 @@ $now=dol_now();
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
print '
<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#linktoorder").click(function() {
jQuery("#commande").toggle();
});
});
</script>
';
/********************************************************************* /*********************************************************************
@ -3812,16 +3804,26 @@ else if ($id > 0 || ! empty($ref))
// Linked object block // Linked object block
$somethingshown=$object->showLinkedObjectBlock(); $somethingshown=$object->showLinkedObjectBlock();
if (empty($somethingshown) && $object->statut > 0) if (empty($somethingshown) && ! empty($conf->commande->enabled))
{ {
print '<br><a href="#" id="linktoorder">'.$langs->trans('LinkedOrder').'</a>'; print '<br><a href="#" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>';
print '
<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#linktoorder").click(function() {
jQuery("#commande").toggle();
});
});
</script>
';
print '<div id="commande" style="display:none">'; print '<div id="commande" style="display:none">';
$sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht"; $sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande as c"; $sql .= ", " . MAIN_DB_PREFIX . "commande as c";
$sql.= ' WHERE c.fk_soc = '.$soc->id.''; $sql .= ' WHERE c.fk_soc = s.rowid AND c.fk_soc = ' . $soc->id . '';
$resqlorderlist = $db->query($sql); $resqlorderlist = $db->query($sql);
if ($resqlorderlist) if ($resqlorderlist)

View File

@ -811,6 +811,7 @@ class Contrat extends CommonObject
function delete($user) function delete($user)
{ {
global $conf, $langs; global $conf, $langs;
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$error=0; $error=0;

View File

@ -427,7 +427,7 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
global $conf; global $conf;
// Add a background image on document // Add a background image on document
if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation beeing crazy and some content disappeared behin the image
{ {
$pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image $pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image
$pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_X:0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y:0), 0, $page_height); $pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_X:0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y:0), 0, $page_height);
@ -795,7 +795,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
if ($line) // Free text if ($line) // Free text
{ {
$pdf->SetXY($dims['lm'],-$posy); $pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell($width, 3, $line, 0, $align, 0); $pdf->MultiCell(0, 3, $line, 0, $align, 0);
$posy-=$freetextheight; $posy-=$freetextheight;
} }

View File

@ -446,9 +446,9 @@ if (! defined('NOLOGIN'))
$dol_authmode=$conf->authmode; // This properties is defined only when logged, to say what mode was successfully used $dol_authmode=$conf->authmode; // This properties is defined only when logged, to say what mode was successfully used
$dol_tz=$_POST["tz"]; $dol_tz=$_POST["tz"];
$dol_tz_string=$_POST["tz_string"]; $dol_tz_string=$_POST["tz_string"];
$dol_tz_string=preg_replace('\s*\(.+\)$','',$dol_tz_string); $dol_tz_string=preg_replace('/\s*\(.+\)$/','',$dol_tz_string);
$dol_tz_string=preg_replace(',','/',$dol_tz_string); $dol_tz_string=preg_replace('/,/','/',$dol_tz_string);
$dol_tz_string=preg_replace('\s','_',$dol_tz_string); $dol_tz_string=preg_replace('/\s/','_',$dol_tz_string);
$dol_dst=0; $dol_dst=0;
if (isset($_POST["dst_first"]) && isset($_POST["dst_second"])) if (isset($_POST["dst_first"]) && isset($_POST["dst_second"]))
{ {

View File

@ -594,6 +594,7 @@ class Product extends CommonObject
function delete($id=0) function delete($id=0)
{ {
global $conf,$user,$langs; global $conf,$user,$langs;
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$error=0; $error=0;

View File

@ -204,9 +204,9 @@ class Project extends CommonObject
$sql.= ", fk_soc = " . ($this->socid > 0 ? $this->socid : "null"); $sql.= ", fk_soc = " . ($this->socid > 0 ? $this->socid : "null");
$sql.= ", fk_statut = " . $this->statut; $sql.= ", fk_statut = " . $this->statut;
$sql.= ", public = " . ($this->public ? 1 : 0); $sql.= ", public = " . ($this->public ? 1 : 0);
$sql.= ", datec=" . ($this->date_c != '' ? $this->db->idate($this->date_c) : 'null'); $sql.= ", datec=" . ($this->date_c != '' ? "'".$this->db->idate($this->date_c)."'" : 'null');
$sql.= ", dateo=" . ($this->date_start != '' ? $this->db->idate($this->date_start) : 'null'); $sql.= ", dateo=" . ($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null');
$sql.= ", datee=" . ($this->date_end != '' ? $this->db->idate($this->date_end) : 'null'); $sql.= ", datee=" . ($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null');
$sql.= " WHERE rowid = " . $this->id; $sql.= " WHERE rowid = " . $this->id;
dol_syslog(get_class($this)."::Update sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this)."::Update sql=" . $sql, LOG_DEBUG);
@ -263,6 +263,7 @@ class Project extends CommonObject
else else
{ {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(get_class($this)."::Update error -2 " . $this->error, LOG_ERR); dol_syslog(get_class($this)."::Update error -2 " . $this->error, LOG_ERR);
$result = -2; $result = -2;
} }
@ -513,10 +514,9 @@ class Project extends CommonObject
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_extrafields"; $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_extrafields";
$sql.= " WHERE fk_object=" . $this->id; $sql.= " WHERE fk_object=" . $this->id;
dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) if (! $resql)
{ {
$this->errors[] = $this->db->lasterror(); $this->errors[] = $this->db->lasterror();
$error++; $error++;

View File

@ -354,6 +354,7 @@ class Task extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$error=0; $error=0;

View File

@ -1423,7 +1423,7 @@ else
print '<tr class="hideonsmartphone">'; print '<tr class="hideonsmartphone">';
print '<td>'.$langs->trans("Logo").'</td>'; print '<td>'.$langs->trans("Logo").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
if ($object->logo) print $form->showphoto('societe',$object,50); if ($object->logo) print $form->showphoto('societe',$object);
$caneditfield=1; $caneditfield=1;
if ($caneditfield) if ($caneditfield)
{ {
@ -1497,7 +1497,7 @@ else
print '</tr>'; print '</tr>';
// Logo+barcode // Logo+barcode
$rowspan=4; $rowspan=6;
if (! empty($conf->global->SOCIETE_USEPREFIX)) $rowspan++; if (! empty($conf->global->SOCIETE_USEPREFIX)) $rowspan++;
if (! empty($object->client)) $rowspan++; if (! empty($object->client)) $rowspan++;
if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) $rowspan++; if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) $rowspan++;
@ -1507,9 +1507,9 @@ else
if ($showlogo || $showbarcode) if ($showlogo || $showbarcode)
{ {
$htmllogobar.='<td rowspan="'.$rowspan.'" style="text-align: center;" width="25%">'; $htmllogobar.='<td rowspan="'.$rowspan.'" style="text-align: center;" width="25%">';
if ($showlogo) $htmllogobar.=$form->showphoto('societe',$object,50); if ($showlogo) $htmllogobar.=$form->showphoto('societe',$object);
if ($showlogo && $showbarcode) $htmllogobar.='<br><br>'; if ($showlogo && $showbarcode) $htmllogobar.='<br><br>';
if ($showbarcode) $htmllogobar.=$form->showbarcode($object,50); if ($showbarcode) $htmllogobar.=$form->showbarcode($object);
$htmllogobar.='</td>'; $htmllogobar.='</td>';
} }
@ -1588,12 +1588,12 @@ else
if (empty($conf->global->SOCIETE_DISABLE_STATE)) print '<tr><td>'.$langs->trans('State').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->state.'</td>'; if (empty($conf->global->SOCIETE_DISABLE_STATE)) print '<tr><td>'.$langs->trans('State').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->state.'</td>';
// EMail // EMail
print '<tr><td>'.$langs->trans('EMail').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('EMail').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">';
print dol_print_email($object->email,0,$object->id,'AC_EMAIL'); print dol_print_email($object->email,0,$object->id,'AC_EMAIL');
print '</td></tr>'; print '</td></tr>';
// Web // Web
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Web').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">';
print dol_print_url($object->url); print dol_print_url($object->url);
print '</td></tr>'; print '</td></tr>';
@ -1937,7 +1937,6 @@ else
if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC))
{ {
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
//print '<table width="100%"><tr><td valign="top" width="50%">';
print '<a name="builddoc"></a>'; // ancre print '<a name="builddoc"></a>'; // ancre
/* /*

View File

@ -28,7 +28,7 @@
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
$theme_bordercolor = array(235,235,224); $theme_bordercolor = array(235,235,224);
$theme_datacolor = array(array(190,190,220), array(200,160,180), array(125,135,150), array(170,140,190), array(190,190,170)); $theme_datacolor = array(array(190,190,220), array(200,160,180), array(125,135,150), array(170,140,190), array(190,190,170), array(190,170,190), array(170,190,190), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150));
$theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4'));
$theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); $theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC'));

View File

@ -681,7 +681,7 @@ div.mainmenu.click2dial {
} }
div.mainmenu.companies { div.mainmenu.companies {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/members.png',1) ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/company.png',1) ?>);
} }
div.mainmenu.commercial { div.mainmenu.commercial {

View File

@ -2192,8 +2192,8 @@ class User extends CommonObject
// Load array[child]=parent // Load array[child]=parent
$sql = "SELECT fk_user as id_parent, rowid as id_son"; $sql = "SELECT fk_user as id_parent, rowid as id_son";
$sql.= " FROM ".MAIN_DB_PREFIX."user"; $sql.= " FROM ".MAIN_DB_PREFIX."user";
$sql.= " WHERE fk_user != 0"; $sql.= " WHERE fk_user <> 0";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity IN (".getEntity('user',1).")";
dol_syslog(get_class($this)."::load_parentof sql=".$sql); dol_syslog(get_class($this)."::load_parentof sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -2222,10 +2222,10 @@ class User extends CommonObject
* fullname = nom avec chemin complet du user * fullname = nom avec chemin complet du user
* fullpath = chemin complet compose des id * fullpath = chemin complet compose des id
* *
* @param int $markafterid Removed all users including the leaf $markafterid in user tree. * @param int $deleteafterid Removed all users including the leaf $deleteafterid (and all its child) in user tree.
* @return array Array of users. this->users and this->parentof are set. * @return array Array of users. this->users and this->parentof are set.
*/ */
function get_full_tree($markafterid=0) function get_full_tree($deleteafterid=0)
{ {
global $conf,$user; global $conf,$user;
@ -2276,14 +2276,14 @@ class User extends CommonObject
$this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent) $this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent)
} }
// Exclude leaf including $markafterid from tree // Exclude leaf including $deleteafterid from tree
if ($markafterid) if ($deleteafterid)
{ {
//print "Look to discard user ".$markafterid."\n"; //print "Look to discard user ".$deleteafterid."\n";
$keyfilter1='^'.$markafterid.'$'; $keyfilter1='^'.$deleteafterid.'$';
$keyfilter2='_'.$markafterid.'$'; $keyfilter2='_'.$deleteafterid.'$';
$keyfilter3='^'.$markafterid.'_'; $keyfilter3='^'.$deleteafterid.'_';
$keyfilter4='_'.$markafterid.'_'; $keyfilter4='_'.$deleteafterid.'_';
foreach($this->users as $key => $val) foreach($this->users as $key => $val)
{ {
if (preg_match('/'.$keyfilter1.'/',$val['fullpath']) || preg_match('/'.$keyfilter2.'/',$val['fullpath']) if (preg_match('/'.$keyfilter1.'/',$val['fullpath']) || preg_match('/'.$keyfilter2.'/',$val['fullpath'])
@ -2322,13 +2322,13 @@ class User extends CommonObject
// Define fullpath and fullname // Define fullpath and fullname
$this->users[$id_user]['fullpath'] = '_'.$id_user; $this->users[$id_user]['fullpath'] = '_'.$id_user;
$this->users[$id_user]['fullname'] = $this->users[$id_user]['label']; $this->users[$id_user]['fullname'] = $this->users[$id_user]['lastname'];
$i=0; $cursor_user=$id_user; $i=0; $cursor_user=$id_user;
while ((empty($protection) || $i < $protection) && ! empty($this->parentof[$cursor_user])) while ((empty($protection) || $i < $protection) && ! empty($this->parentof[$cursor_user]))
{ {
$this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath']; $this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath'];
$this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['label'].' >> '.$this->users[$id_user]['fullname']; $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['lastname'].' >> '.$this->users[$id_user]['fullname'];
$i++; $cursor_user=$this->parentof[$cursor_user]; $i++; $cursor_user=$this->parentof[$cursor_user];
} }