2
0
forked from Wavyzz/dolibarr

fix merge

This commit is contained in:
Philippe GRAND
2018-09-18 16:38:14 +02:00
71 changed files with 33846 additions and 33852 deletions

View File

@@ -86,7 +86,7 @@ class box_factures_imp extends ModeleBoxes
if ($user->rights->facture->lire)
{
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql = "SELECT s.nom as name, s.rowid as socid, s.email,";
$sql.= " s.code_client,";
$sql.= " s.logo,";
$sql.= " f.facnumber, f.date_lim_reglement as datelimite,";
@@ -134,9 +134,11 @@ class box_factures_imp extends ModeleBoxes
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->statut = $objp->fk_statut;
$facturestatic->date_lim_reglement = $db->jdate($objp->datelimite);
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
$societestatic->client = 1;
$societestatic->email = $objp->email;
$societestatic->code_client = $objp->code_client;
$societestatic->logo = $objp->logo;

View File

@@ -431,11 +431,11 @@ abstract class CommonInvoice extends CommonObject
{
global $langs;
if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard");
if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement");
if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir");
if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit");
if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used.
if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation");
elseif ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement");
elseif ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir");
elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit");
elseif ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used.
elseif ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation");
return $langs->trans("Unknown");
}
@@ -475,10 +475,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye)
{
if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
if ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid');
return $langs->trans('Bill'.$prefix.'StatusStarted');
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
elseif ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid');
else return $langs->trans('Bill'.$prefix.'StatusStarted');
}
else
{
@@ -493,10 +493,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye)
{
if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusCanceled');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
if ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid');
return $langs->trans('Bill'.$prefix.'StatusStarted');
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusCanceled');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
elseif ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid');
else return $langs->trans('Bill'.$prefix.'StatusStarted');
}
else
{
@@ -511,10 +511,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye)
{
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid');
return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted');
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid');
else return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted');
}
else
{
@@ -529,10 +529,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye)
{
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9');
if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1');
return img_picto($langs->trans('BillStatusStarted'),'statut3');
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9');
elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1');
else return img_picto($langs->trans('BillStatusStarted'),'statut3');
}
else
{
@@ -547,10 +547,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye)
{
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('BillStatusNotPaid');
return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted');
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('BillStatusNotPaid');
else return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted');
}
else
{
@@ -566,14 +566,14 @@ abstract class CommonInvoice extends CommonObject
if (! $paye)
{
if ($status == 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusDraft').' </span>'.img_picto($langs->trans('BillStatusDraft'),'statut0');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusCanceled').' </span>'.img_picto($langs->trans('BillStatusCanceled'),'statut5');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' </span>'.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9');
if ($alreadypaid <= 0)
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusCanceled').' </span>'.img_picto($langs->trans('BillStatusCanceled'),'statut5');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' </span>'.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9');
elseif ($alreadypaid <= 0)
{
if ($type == self::TYPE_CREDIT_NOTE) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' </span>'.img_picto($langs->trans('StatusNotRefunded'),'statut1');
return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotPaid').' </span>'.img_picto($langs->trans('BillStatusNotPaid'),'statut1');
}
return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusStarted').' </span>'.img_picto($langs->trans('BillStatusStarted'),'statut3');
else return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusStarted').' </span>'.img_picto($langs->trans('BillStatusStarted'),'statut3');
}
else
{
@@ -598,7 +598,9 @@ abstract class CommonInvoice extends CommonObject
if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code;
if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id;
$cdr_nbjour=0; $cdr_type=0; $cdr_decalage=0;
$cdr_nbjour=0;
$cdr_type=0;
$cdr_decalage=0;
$sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage';
$sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c';

View File

@@ -7324,7 +7324,7 @@ abstract class CommonObject
$comment = new Comment($this->db);
$result=$comment->fetchAllFor($this->element, $this->id);
if ($result<0) {
$this->errors=array_merge($this->errors,$comment->errors);
$this->errors=array_merge($this->errors, $comment->errors);
return -1;
} else {
$this->comments = $comment->comments;
@@ -7341,4 +7341,20 @@ abstract class CommonObject
{
return count($this->comments);
}
/**
* Trim object parameters
* @param string[] $parameters array of parameters to trim
*
* @return void
*/
public function trimParameters($parameters)
{
if (!is_array($parameters)) return;
foreach ($parameters as $parameter) {
if (isset($this->$parameter)) {
$this->$parameter = trim($this->$parameter);
}
}
}
}

View File

@@ -1149,8 +1149,8 @@ class FormOther
if ($nbboxactivated)
{
$langs->load("boxes");
$langs->load("projects");
// Load translation files required by the page
$langs->loadLangs(array("boxes","projects"));
$emptybox=new ModeleBoxes($db);

View File

@@ -101,9 +101,8 @@ class FormSms
if (! is_object($form)) $form=new Form($this->db);
$langs->load("other");
$langs->load("mails");
$langs->load("sms");
// Load translation files required by the page
$langs->loadLangs(array('other', 'mails', 'sms'));
$soc=new Societe($this->db);
if (!empty($this->withtosocid) && $this->withtosocid > 0)

View File

@@ -66,18 +66,19 @@ else
}
// Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8)
$tradTemp=array($langs->trans("January"),
$langs->trans("February"),
$langs->trans("March"),
$langs->trans("April"),
$langs->trans("May"),
$langs->trans("June"),
$langs->trans("July"),
$langs->trans("August"),
$langs->trans("September"),
$langs->trans("October"),
$langs->trans("November"),
$langs->trans("December")
$tradTemp=array(
$langs->trans("January"),
$langs->trans("February"),
$langs->trans("March"),
$langs->trans("April"),
$langs->trans("May"),
$langs->trans("June"),
$langs->trans("July"),
$langs->trans("August"),
$langs->trans("September"),
$langs->trans("October"),
$langs->trans("November"),
$langs->trans("December")
);
print '<script type="text/javascript">';
print 'var tradMonths = [';
@@ -96,25 +97,22 @@ $qualified=true;
if (! isset($_GET["sd"])) $_GET["sd"]="00000000";
if (! isset($_GET["m"])) $qualified=false;
if (! isset($_GET["y"])) $qualified=false;
if (! isset($_GET["m"]) || ! isset($_GET["y"])) $qualified=false;
if (isset($_GET["m"]) && isset($_GET["y"]))
{
if ($_GET["m"] < 1) $qualified=false;
if ($_GET["m"] > 12) $qualified=false;
if ($_GET["y"] < 0) $qualified=false;
if ($_GET["y"] > 9999) $qualified=false;
if ($_GET["m"] < 1 || $_GET["m"] > 12) $qualified=false;
if ($_GET["y"] < 0 || $_GET["y"] > 9999) $qualified=false;
}
// If parameters provided, we show calendar
if ($qualified)
{
//print $_GET["cm"].",".$_GET["sd"].",".$_GET["m"].",".$_GET["y"];exit;
displayBox(GETPOST("sd",'alpha'),GETPOST("m",'int'),GETPOST("y",'int'));
displayBox(GETPOST("sd",'alpha'), GETPOST("m",'int'), GETPOST("y",'int'));
}
else
{
dol_print_error('','ErrorBadParameters');
dol_print_error('', 'ErrorBadParameters');
}
@@ -195,9 +193,7 @@ function displayBox($selectedDate,$month,$year)
{
echo '<td width="', (int) (($i+1)*100/7) - (int) ($i*100/7), '%">', $langs->trans($day_names[($i + $startday) % 7]), '</td>', "\n";
}
?>
</tr>
<?php
print '</tr>';
//print "x ".$thedate." y"; // $thedate = first day of month
$firstdate=dol_getdate($thedate);
//var_dump($firstdateofweek);
@@ -210,7 +206,7 @@ function displayBox($selectedDate,$month,$year)
//print_r($mydate);
if ($mydate < $firstdate) // At first run
{
echo "<TR class=\"dpWeek\">";
echo "<tr class=\"dpWeek\">";
//echo $conf->global->MAIN_START_WEEK.' '.$firstdate["wday"].' '.$startday;
$cols=0;
for ($i = 0; $i < 7; $i++)
@@ -221,7 +217,7 @@ function displayBox($selectedDate,$month,$year)
$mydate = $firstdate;
break;
}
echo "<TD>&nbsp;</TD>";
echo "<td>&nbsp;</td>";
$cols++;
}
}
@@ -229,7 +225,7 @@ function displayBox($selectedDate,$month,$year)
{
if ($mydate["wday"] == $startday)
{
echo "<TR class=\"dpWeek\">";
echo "<tr class=\"dpWeek\">";
$cols=0;
}
}
@@ -245,17 +241,17 @@ function displayBox($selectedDate,$month,$year)
}
// Sur click dans calendrier, appelle fonction dpClickDay
echo "<TD class=\"".$dayclass."\"";
echo "<td class=\"".$dayclass."\"";
echo " onMouseOver=\"dpHighlightDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",tradMonths)\"";
echo " onClick=\"dpClickDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",'".$langs->trans("FormatDateShortJavaInput")."')\"";
echo ">".sprintf("%02s",$mydate["mday"])."</TD>";
echo ">".sprintf("%02s",$mydate["mday"])."</td>";
$cols++;
if (($mydate["wday"] + 1) % 7 == $startday) echo "</TR>\n";
//$thedate=strtotime("tomorrow",$thedate);
$day++;
$thedate=dol_mktime(12,0,0,$month,$day,$year);
$thedate=dol_mktime(12, 0, 0, $month, $day, $year);
if ($thedate == '')
{
$stoploop=1;
@@ -269,8 +265,8 @@ function displayBox($selectedDate,$month,$year)
if ($cols < 7)
{
for($i=6; $i>=$cols; $i--) echo "<TD>&nbsp;</TD>";
echo "</TR>\n";
for($i=6; $i>=$cols; $i--) echo "<td>&nbsp;</td>";
echo "</tr>\n";
}
?>
<tr>

View File

@@ -124,9 +124,10 @@ function versiondolibarrarray()
* @param string $okerror Family of errors we accept ('default', 'none')
* @param int $linelengthlimit Limit for length of each line (Use 0 if unknown, may be faster if defined)
* @param int $nocommentremoval Do no try to remove comments (in such a case, we consider that each line is a request, so use also $linelengthlimit=0)
* @param int $offsetforchartofaccount Offset to use to load chart of account table to update sql on the fly to add offset to rowid and account_parent value
* @return int <=0 if KO, >0 if OK
*/
function run_sql($sqlfile, $silent=1, $entity='', $usesavepoint=1, $handler='', $okerror='default', $linelengthlimit=32768, $nocommentremoval=0)
function run_sql($sqlfile, $silent=1, $entity='', $usesavepoint=1, $handler='', $okerror='default', $linelengthlimit=32768, $nocommentremoval=0, $offsetforchartofaccount=0)
{
global $db, $conf, $langs, $user;
@@ -265,6 +266,18 @@ function run_sql($sqlfile, $silent=1, $entity='', $usesavepoint=1, $handler='',
$arraysql[$i]=$newsql;
}
if ($offsetforchartofaccount > 0)
{
// Replace lines
// 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1401, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);'
// with
// 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1401 + 200100000, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);'
$newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql);
$newsql = preg_replace('/([,\s])0 \+ '.$offsetforchartofaccount.'/ims', '\1 0', $newsql);
//var_dump($newsql);
$arraysql[$i] = $newsql;
}
}
// Loop on each request to execute request

View File

@@ -7,7 +7,7 @@
* Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
@@ -1244,12 +1244,12 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
print "</tr>\n";
}
}
else
{
//else
//{
//print '<tr class="oddeven">';
//print '<td>'.$langs->trans("NoAddressYetDefined").'</td>';
//print "</tr>\n";
}
//}
print "\n</table>\n";
print "<br>\n";
@@ -1323,30 +1323,30 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
$sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
if (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref";
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
if (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";
$sql.= " WHERE a.entity IN (".getEntity('agenda').")";
if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
if (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
if (is_object($filterobj) && get_class($filterobj) == 'Adherent')
elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent')
{
$sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
}
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur')
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur')
{
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
}
if (is_object($filterobj) && get_class($filterobj) == 'Product')
elseif (is_object($filterobj) && get_class($filterobj) == 'Product')
{
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
@@ -1362,7 +1362,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
else
{
if ($actioncode == 'AC_OTH') $sql.= " AND c.type != 'systemauto'";
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'";
elseif ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'";
}
}
else
@@ -1373,7 +1373,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
}
}
if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']);
$sql.= $db->order($sortfield, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
@@ -1388,7 +1388,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$obj = $db->fetch_object($resql);
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
//elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone='';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) $tododone='todo';

View File

@@ -95,10 +95,10 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
*/
function info($langs)
{
global $conf,$langs;
global $conf, $langs;
$langs->load("companies");
$langs->load("errors");
// Load translation files required by the page
$langs->loadLangs(array('companies', 'errors'));
$form = new Form($this->db);

View File

@@ -93,10 +93,10 @@ class doc_generic_user_odt extends ModelePDFUser
*/
function info($langs)
{
global $conf,$langs;
global $conf, $langs;
$langs->load("companies");
$langs->load("errors");
// Load translation files required by the page
$langs->loadLangs(array('companies', 'errors'));
$form = new Form($this->db);

View File

@@ -37,10 +37,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
*/
class doc_generic_usergroup_odt extends ModelePDFUserGroup
{
var $emetteur; // Objet societe qui emet
public $emetteur; // Objet societe qui emet
var $phpmin = array(5,2,0); // Minimum version of PHP required by module
var $version = 'dolibarr';
public $phpmin = array(5,4,0); // Minimum version of PHP required by module
public $version = 'dolibarr';
/**
@@ -50,10 +50,10 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
*/
function __construct($db)
{
global $conf,$langs,$mysoc;
global $conf, $langs, $mysoc;
$langs->load("main");
$langs->load("companies");
// Load translation files required by the page
$langs->loadLangs(array('companies', 'main'));
$this->db = $db;
$this->name = "ODT templates";