Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop_menu

This commit is contained in:
Regis Houssin 2019-06-03 11:04:28 +02:00
commit 7b8b1a9052
133 changed files with 2580 additions and 1651 deletions

View File

@ -176,7 +176,8 @@ Following changes may create regressions for some external modules, but were nec
* Deprecated property ->fk_departement is now ->state_id everywhere.
* Removed the method 4 of GETPOST (to get $_COOKIE). It was not used and not recommanded to use in Dolibarr.
* Column llx_facture.facnumber change to llx_facture.ref
* Variable $dolibarr_main_cookie_cryptkey is no more created at install (it was not used by Dolibarr). A new variable
called $dolibarr_main_instance_unique_id is now generated at each installation. It will be used by some future features.
***** ChangeLog for 9.0.3 compared to 9.0.2 *****
FIX: #11013

View File

@ -75,10 +75,13 @@
<!-- Warning if action on same line than if -->
<!--
<rule ref="Generic.ControlStructures.InlineControlStructure">
<properties> <property name="error" value="false"/> </properties>
<properties>
<property name="error" value="false"/>
</properties>
</rule>
-->
<!-- PHP code MUST use only UTF-8 without BOM. -->
<rule ref="Generic.Files.ByteOrderMark"/>
@ -97,8 +100,11 @@
</properties>
</rule>
<!-- To disallow several statements on same line -->
<!-- <rule ref="Generic.Formatting.DisallowMultipleStatements" /> -->
<!-- Disallow several statements on same line -->
<!-- We want to allow 'if () { ...small code... }' on same line for better code compacity and readability -->
<rule ref="Generic.Formatting.DisallowMultipleStatements">
<severity>0</severity>
</rule>
<!-- Have 2 chars padding maximum and always show as errors -->
<!--
@ -112,13 +118,17 @@
<rule ref="Generic.Functions.CallTimePassByReference" />
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
<severity>0</severity>
</rule>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
<severity>0</severity>
</rule>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma"> <!-- We don't want this rule, we want to be able to align params on several similare functions on different lines -->
<!-- Disallow several spaces after comma -->
<!-- We want to allow this because we want to be able to align params on several similare functions on different lines -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma">
<severity>0</severity>
</rule>
@ -152,7 +162,10 @@
<rule ref="Generic.PHP.ForbiddenFunctions" />
<!-- Warning when using @ before functions -->
<!-- <rule ref="Generic.PHP.NoSilencedErrors" /> -->
<!-- We want this. Some features need this -->
<rule ref="Generic.PHP.NoSilencedErrors">
<severity>0</severity>
</rule>
<!-- Say if null, true, false must be uppercase (Rule 2.5 of PSR2 https://www.php-fig.org/psr/psr-2/) -->
<rule ref="Generic.PHP.LowerCaseConstant" />
@ -169,7 +182,16 @@
<!-- Check indent are done with spaces and with correct number -->
<!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<!-- TODO Enable this
<arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="true"/>
</properties>
</rule>
-->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
@ -310,22 +332,29 @@
<rule ref="PEAR.Commenting.InlineComment" />
<!-- <rule ref="PEAR.ControlStructures.ControlSignature" /> -->
<!-- Check position of { after a control structure like if (), while (), etc... -->
<!--
<rule ref="PEAR.ControlStructures.ControlSignature" />
-->
<!-- <rule ref="PEAR.ControlStructures.MultiLineCondition" /> -->
<!-- Test if () are removed for includes -->
<rule ref="PEAR.Files.IncludingFile" />
<!-- Disable some error messages that we do not want. -->
<rule ref="PEAR.Files.IncludingFile.UseInclude">
<severity>0</severity>
</rule>
<!-- TODO Enable this test. We should use require for include in prior of include when out of if -->
<rule ref="PEAR.Files.IncludingFile.UseIncludeOnce">
<severity>0</severity>
</rule>
<rule ref="PEAR.Files.IncludingFile.UseRequire">
<severity>0</severity>
</rule>
<!-- TODO Enable this test. We should use require for include in prior of include when out of if -->
<rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
<severity>0</severity>
</rule>
@ -334,12 +363,15 @@
<rule ref="PEAR.Functions.FunctionCallSignature" />
<!-- TODO Enable this test. -->
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
<severity>0</severity>
</rule>
<!-- TODO Enable this test. -->
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
<severity>0</severity>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
<severity>0</severity>
</rule>

View File

@ -9,7 +9,7 @@
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017 André Schild <a.schild@aarboard.ch>
*
* 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
@ -51,6 +51,7 @@ class AccountancyExport
public static $EXPORT_TYPE_AGIRIS = 9;
public static $EXPORT_TYPE_FEC = 11;
public static $EXPORT_TYPE_OPENCONCERTO = 12;
public static $EXPORT_TYPE_SAGE50_SWISS = 13;
/**
@ -106,6 +107,7 @@ class AccountancyExport
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_SAGE50_SWISS => $langs->trans('Modelcsv_Sage50_Swiss'),
);
}
@ -130,6 +132,7 @@ class AccountancyExport
self::$EXPORT_TYPE_AGIRIS => 'agiris',
self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto',
self::$EXPORT_TYPE_FEC => 'fec',
self::$EXPORT_TYPE_SAGE50_SWISS => 'sage50ch',
);
return $formatcode[$type];
@ -194,6 +197,10 @@ class AccountancyExport
'label' => $langs->trans('Modelcsv_openconcerto'),
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
),
self::$EXPORT_TYPE_SAGE50_SWISS => array(
'label' => $langs->trans('Modelcsv_Sage50_Swiss'),
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
),
),
'cr'=> array (
'1' => $langs->trans("Unix"),
@ -261,6 +268,9 @@ class AccountancyExport
case self::$EXPORT_TYPE_FEC :
$this->exportFEC($TData);
break;
case self::$EXPORT_TYPE_SAGE50_SWISS :
$this->exportSAGE50SWISS($TData);
break;
default:
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break;
@ -575,19 +585,19 @@ class AccountancyExport
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->piece_num . $separator;
print $line->label_operation . $separator;
print self::toAnsi($line->label_operation) . $separator;
print $date . $separator;
print $line->label_operation . $separator;
print self::toAnsi($line->label_operation) . $separator;
if (empty($line->subledger_account)) {
print length_accountg($line->numero_compte) . $separator;
print $line->label_compte . $separator;
print self::toAnsi($line->label_compte) . $separator;
} else {
print length_accounta($line->subledger_account) . $separator;
print $line->subledger_label . $separator;
print self::toAnsi($line->subledger_label) . $separator;
}
print $line->doc_ref . $separator;
print self::toAnsi($line->doc_ref) . $separator;
print price($line->debit) . $separator;
print price($line->credit) . $separator;
print price($line->montant) . $separator;
@ -757,6 +767,156 @@ class AccountancyExport
}
}
/**
* Export format : SAGE50SWISS
*
* https://onlinehelp.sageschweiz.ch/default.aspx?tabid=19984
* http://media.topal.ch/Public/Schnittstellen/TAF/Specification/Sage50-TAF-format.pdf
*
* @param array $objectLines data
*
* @return void
*/
public function exportSAGE50SWISS($objectLines)
{
// SAGE50SWISS
$this->separator = ',';
$this->end_line = "\r\n";
// Print header line
print "Blg,Datum,Kto,S/H,Grp,GKto,SId,SIdx,KIdx,BTyp,MTyp,Code,Netto,Steuer,FW-Betrag,Tx1,Tx2,PkKey,OpId,Flag";
print $this->end_line;
$thisPieceNum= "";
$thisPieceAccountNr= "";
$aSize= count($objectLines);
foreach ($objectLines as $aIndex=>$line)
{
$sammelBuchung= false;
if ($aIndex-2 >= 0 && $objectLines[$aIndex-2]->piece_num == $line->piece_num)
{
$sammelBuchung= true;
}
elseif ($aIndex+2 < $aSize && $objectLines[$aIndex+2]->piece_num == $line->piece_num)
{
$sammelBuchung= true;
}
elseif ($aIndex+1 < $aSize
&& $objectLines[$aIndex+1]->piece_num == $line->piece_num
&& $aIndex-1 < $aSize
&& $objectLines[$aIndex-1]->piece_num == $line->piece_num
)
{
$sammelBuchung= true;
}
//Blg
print $line->piece_num . $this->separator;
// Datum
$date = dol_print_date($line->doc_date, '%d.%m.%Y');
print $date . $this->separator;
// Kto
print length_accountg($line->numero_compte) . $this->separator;
// S/H
if ($line->sens == 'D')
{
print 'S' . $this->separator;
}
else
{
print 'H' . $this->separator;
}
//Grp
print self::trunc($line->code_journal, 1) . $this->separator;
// GKto
if (empty($line->code_tiers))
{
if ($line->piece_num == $thisPieceNum)
{
print length_accounta($thisPieceAccountNr) . $this->separator;
}
else
{
print "div" . $this->separator;
}
}
else
{
print length_accounta($line->code_tiers) . $this->separator;
}
//SId
print $this->separator;
//SIdx
print "0" . $this->separator;
//KIdx
print "0" . $this->separator;
//BTyp
print "0" . $this->separator;
//MTyp 1=Fibu Einzelbuchung 2=Sammebuchung
if ($sammelBuchung)
{
print "2" . $this->separator;
}
else
{
print "1" . $this->separator;
}
// Code
print '""' . $this->separator;
// Netto
if ($line->montant >= 0)
{
print $line->montant . $this->separator;
}
else
{
print $line->montant*-1 . $this->separator;
}
// Steuer
print "0.00" . $this->separator;
// FW-Betrag
print "0.00" . $this->separator;
// Tx1
$line1= self::toAnsi($line->label_compte, 29);
if ($line1 == "LIQ" || $line1 == "LIQ Beleg ok" || strlen($line1) <= 3)
{
$line1= "";
}
$line2= self::toAnsi($line->doc_ref, 29);
if (strlen($line1) == 0)
{
$line1= $line2;
$line2= "";
}
if (strlen($line1) > 0 && strlen($line2) > 0 && (strlen($line1) + strlen($line2)) < 27)
{
$line1= $line1 . ' / ' . $line2;
$line2= "";
}
print '"' . self::toAnsi($line1). '"' . $this->separator;
// Tx2
print '"' . self::toAnsi($line2). '"' . $this->separator;
//PkKey
print "0" . $this->separator;
//OpId
print $this->separator;
// Flag
print "0";
print $this->end_line;
if ($line->piece_num !== $thisPieceNum)
{
$thisPieceNum= $line->piece_num;
$thisPieceAccountNr= $line->numero_compte;
}
}
}
/**
*
* @param string $str data
@ -767,4 +927,20 @@ class AccountancyExport
{
return dol_trunc($str, $size, 'right', 'UTF-8', 1);
}
/**
*
* @param unknown $str Original string to encode and optionaly truncate
* @param integer $size truncate string after $size characters
* @return string String encoded in Windows-1251 charset
*/
public static function toAnsi($str, $size = -1)
{
$retVal= dol_string_nohtmltag($str, 1, 'Windows-1251');
if ($retVal >= 0 && $size >= 0)
{
$retVal= mb_substr($retVal, 0, $size, 'Windows-1251');
}
return $retVal;
}
}

View File

@ -83,13 +83,13 @@ class AccountancySystem
if ($rowid > 0 || $ref)
{
$sql = "SELECT a.pcg_version, a.label, a.active";
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
$sql .= " WHERE";
if ($rowid) {
$sql .= " a.rowid = '" . $rowid . "'";
} elseif ($ref) {
$sql .= " a.pcg_version = '" . $ref . "'";
$sql .= " a.pcg_version = '" . $this->db->escape($ref) . "'";
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);

View File

@ -151,12 +151,13 @@ class AccountingAccount extends CommonObject
/**
* Load record in memory
*
* @param int $rowid Id
* @param string $account_number Account number
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
* @return int <0 if KO, 0 if not found, Id of record if OK and found
* @param int $rowid Id
* @param string $account_number Account number
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account
* @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC'.
* @return int <0 if KO, 0 if not found, Id of record if OK and found
*/
public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0)
public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '')
{
global $conf;
@ -174,6 +175,9 @@ class AccountingAccount extends CommonObject
if (! empty($limittocurrentchart)) {
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')';
}
if (! empty($limittoachartaccount)) {
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -273,7 +273,7 @@ if (empty($reshook))
{
if (empty($login)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors');
}
}
// Create new object
@ -509,7 +509,7 @@ if (empty($reshook))
{
if (empty($login)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors');
}
else {
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'";

View File

@ -596,7 +596,7 @@ class Adherent extends CommonObject
{
while ($obj=$this->db->fetch_object($resql2))
{
$this->type=$obj->label;
$this->type=$obj->label;
}
}
}

View File

@ -411,7 +411,7 @@ class AdherentType extends CommonObject
}
}
/**
/**
* Return translated label by the nature of a adherent (physical or moral)
*
* @param string $morphy Nature of the adherent (physical or moral)

View File

@ -43,13 +43,13 @@ if (empty($sortorder)) { $sortorder="ASC"; }
if (empty($sortfield)) { $sortfield="d.login"; }
if (! isset($statut))
{
$statut = 1 ;
$statut = 1 ;
}
if (! isset($cotis))
{
// by default, members must be up to date of subscription
$cotis=1;
// by default, members must be up to date of subscription
$cotis=1;
}

View File

@ -235,7 +235,7 @@ else
print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbytown">'.$langs->trans("MembersStatisticsByTown").'</a><br>';
print '<br>';//+
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbyregion">'.$langs->trans("MembersStatisticsByRegion").'</a><br>';//+
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbyregion">'.$langs->trans("MembersStatisticsByRegion").'</a><br>';//+
}
print '<br>';
}

View File

@ -306,7 +306,7 @@ if (! empty($arrayfields['d.fk_type']['checked']))
{
print '<td class="liste_titre left">';
print '<input class="flat" type="text" name="search_type" value="'.dol_escape_htmltag($search_type).'" size="7">';
print'</td>';
print'</td>';
}
if (! empty($arrayfields['d.lastname']['checked']))

View File

@ -47,10 +47,10 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td class="center"></td>
<td class="center"><?php echo dol_print_date($objectlink->dateh, 'day'); ?></td>
<td class="right"><?php
if ($user->rights->adherent->lire) {
$total = $total + $objectlink->amount;
echo price($objectlink->amount);
} ?></td>
if ($user->rights->adherent->lire) {
$total = $total + $objectlink->amount;
echo price($objectlink->amount);
} ?></td>
<td class="right"></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr>

View File

@ -281,9 +281,9 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print '</td>';
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
print '<td class="center">';
if ($objp->morphy == 'phy') { print $langs->trans("Physical"); }
elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); }
else print $langs->trans("Physical & Morale");
if ($objp->morphy == 'phy') { print $langs->trans("Physical"); }
elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); }
else print $langs->trans("Physical & Morale");
print '</td>';
print '<td class="center">'.yn($objp->subscription).'</td>';
print '<td class="center">'.yn($objp->vote).'</td>';

View File

@ -987,7 +987,7 @@ else
print '</script>';
print "\n";
$s.='<a href="#" onClick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
$s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1);
$s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1);
}
else
{

View File

@ -268,8 +268,8 @@ print $langs->trans("DescWeather").'<br>';
if($action == 'edit') {
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoPercentageMod'));
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoStdMod'));
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod'));
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod'));
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
else $str_mode_enabled = $str_mode_percentage;
print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>';

View File

@ -439,7 +439,7 @@ while ($i < min($num, $limit))
$object->id = $obj->rowid;
foreach($object->fields as $key => $val)
{
if (isset($obj->$key)) $object->$key = $obj->$key;
if (property_exists($obj, $key)) $object->$key = $obj->$key;
}
// Show here line of result

View File

@ -406,7 +406,7 @@ while ($i < min($num, $limit))
$object->id = $obj->rowid;
foreach($object->fields as $key => $val)
{
if (isset($obj->$key)) $object->$key = $obj->$key;
if (property_exists($obj, $key)) $object->$key = $obj->$key;
}
// Show here line of result

View File

@ -177,13 +177,13 @@ if ($action == 'add')
}
if (! $error && ! $_POST['url'])
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("URL")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("URL")), null, 'errors');
$action = 'create';
$error++;
}
if (! $error && ! $_POST['titre'])
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Title")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Title")), null, 'errors');
$action = 'create';
$error++;
}

View File

@ -421,7 +421,7 @@ while ($i < min($num, $limit))
$object->id = $obj->rowid;
foreach($object->fields as $key => $val)
{
if (isset($obj->$key)) $object->$key = $obj->$key;
if (property_exists($obj, $key)) $object->$key = $obj->$key;
}
// Show here line of result

View File

@ -449,7 +449,7 @@ class BlockedLog
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array(
'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines'
'ref','ref_client','ref_supplier','date','datef','datev','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines'
))) continue; // Discard if not into a dedicated list
if ($key == 'lines')
{
@ -459,8 +459,8 @@ class BlockedLog
$lineid++;
foreach($tmpline as $keyline => $valueline)
{
if (! in_array($keyline, array(
'ref','multicurrency_code','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','qty','product_type','vat_src_code','tva_tx','info_bits','localtax1_tx','localtax2_tx','total_ht','total_tva','total_ttc','total_localtax1','total_localtax2'
if (! in_array($keyline, array(
'ref','multicurrency_code','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','qty','product_type','vat_src_code','tva_tx','info_bits','localtax1_tx','localtax2_tx','total_ht','total_tva','total_ttc','total_localtax1','total_localtax2'
))) continue; // Discard if not into a dedicated list
if (! is_object($this->object_data->invoiceline[$lineid])) $this->object_data->invoiceline[$lineid] = new stdClass();

View File

@ -110,8 +110,40 @@ if (empty($reshook))
$autocopy='MAIN_MAIL_AUTOCOPY_BOM_TO';
$trackid='bom'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}
// Add line
if ($action == 'addline' && $user->rights->bom->write)
{
$langs->load('errors');
$error = 0;
// Set if we used free entry or predefined product
$idprod=GETPOST('idprod', 'int');
$qty=GETPOST('qty', 'int');
$efficiency=GETPOST('efficiency', 'int');
if ($qty == '') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
if (! ($idprod > 0)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Product')), null, 'errors');
$error++;
}
$bomline = new BOMLine($db);
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
$bomline->qty = $qty;
$bomline->efficiency = $efficiency;
$result = $bomline->create($user);
if ($result <= 0)
{
setEventMessages($bomline->error, $bomline->errors, 'errors');
}
}
}
/*
@ -320,7 +352,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</div>';
print '</div>';
print '<div class="clearboth"></div><br>';
print '<div class="clearboth"></div>';
dol_fiche_end();
@ -347,7 +379,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
print '<div class="div-table-responsive-no-min">';
if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{
print '<table id="tablelines" class="noborder noshadow" width="100%">';
}
@ -363,14 +395,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action != 'editline')
{
// Add products/services form
// $object->formAddObjectLine(1, $mysoc, $soc);
$object->formAddObjectLine(1, $mysoc, $soc, '/bom/tpl');
$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
}
}
if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{
print '</table>';
}

View File

@ -372,12 +372,18 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
print '<tr class="liste_titre">';
foreach($object->fields as $key => $val)
{
$cssforfield='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
$cssforfield=(empty($val['css'])?'':$val['css']);
if ($key == 'status') $cssforfield='center';
elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 0, 0, 0, '', 'maxwidth75');
else print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
print '</td>';
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@ -399,11 +405,11 @@ print '</tr>'."\n";
print '<tr class="liste_titre">';
foreach($object->fields as $key => $val)
{
$cssforfield='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
$cssforfield=(empty($val['css'])?'':$val['css']);
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n";
@ -444,31 +450,23 @@ while ($i < min($num, $limit))
$object->id = $obj->rowid;
foreach($object->fields as $key => $val)
{
if (isset($obj->$key)) $object->$key = $obj->$key;
if (property_exists($obj, $key)) $object->$key = $obj->$key;
}
// Show here line of result
print '<tr class="oddeven">';
foreach($object->fields as $key => $val)
{
$cssforfield='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
$cssforfield=(empty($val['css'])?'':$val['css']);
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td';
if ($cssforfield || $val['css']) print ' class="';
print $cssforfield;
if ($cssforfield && $val['css']) print ' ';
print $val['css'];
if ($cssforfield || $val['css']) print '"';
print '>';
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') print $object->getLibStatut(5);
elseif (in_array($val['type'], array('date','datetime','timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
else print $object->showOutputField($val, $key, $obj->$key, '');

View File

@ -62,7 +62,7 @@ class BOM extends CommonObject
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;
const STATUS_DISABLED = -1;
const STATUS_CANCELED = 9;
/**
@ -94,18 +94,19 @@ class BOM extends CommonObject
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,),
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',),
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Enabled', '-1'=>'Disabled')),
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>161, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>162, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,),
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',),
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900, 'notnull'=>-1,),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'Disabled')),
);
public $rowid;
public $ref;
@ -121,6 +122,7 @@ class BOM extends CommonObject
public $status;
public $fk_product;
public $qty;
public $efficiency;
// END MODULEBUILDER PROPERTIES
@ -758,8 +760,9 @@ class BOM extends CommonObject
{
global $langs;
//$langs->load("mrp");
$this->labelstatus[1] = $langs->trans('Enabled');
$this->labelstatus[0] = $langs->trans('Disabled');
$this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft');
$this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
}
if ($mode == 0)
@ -772,28 +775,23 @@ class BOM extends CommonObject
}
elseif ($mode == 2)
{
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
}
elseif ($mode == 3)
{
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle');
}
elseif ($mode == 4)
{
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
}
elseif ($mode == 5)
{
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle');
}
elseif ($mode == 6)
{
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle');
}
}
@ -948,7 +946,7 @@ class BOMLine extends CommonObject
/**
* @var string String with name of icon for bomline. Must be the part after the 'object_' into object_bomline.png
*/
public $picto = 'bomline@bom';
public $picto = 'bomline';
/**
@ -976,20 +974,22 @@ class BOMLine extends CommonObject
*/
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1,),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',),
'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'isameasure'=>'1',),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'index'=>1,),
'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>-1, 'index'=>1,),
'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>40, 'notnull'=>1,),
);
public $rowid;
public $description;
public $import_key;
public $qty;
public $fk_product;
public $fk_bom;
public $fk_product;
public $description;
public $qty;
public $efficiency;
public $rank;
public $import_key;
// END MODULEBUILDER PROPERTIES

View File

@ -0,0 +1,189 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Need to have following variables defined:
* $object (invoice, order, ...)
* $conf
* $langs
* $dateSelector
* $forceall (0 by default, 1 for supplier invoices/orders)
* $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders)
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
*/
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object)) {
print "Error: this template page cannot be called directly as an URL";
exit;
}
if (! isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine)
global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax;
if (! isset($dateSelector)) $dateSelector=1; // For backward compatibility
elseif (empty($dateSelector)) $dateSelector=0;
if (empty($forceall)) $forceall=0;
if (empty($senderissupplier)) $senderissupplier=0;
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
// Define colspan for the button 'Add'
$colspan = 3; // Columns: total ht + col edit + col delete
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan++;//Add column for Total (currency) if required
if (in_array($object->element, array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
//print $object->element;
// Lines for extrafield
$objectline = new BOMLine($this->db);
?>
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->
<?php
$nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines);
if ($nolinesbefore) {
?>
<tr class="liste_titre<?php echo ($nolinesbefore?'':' liste_titre_add_') ?> nodrag nodrop">
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum center"></td>
<?php } ?>
<td class="linecoldescription minwidth500imp">
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?>
</td>
<td class="linecolqty right"><?php echo $langs->trans('Qty'); ?></td>
<?php
if ($conf->global->PRODUCT_USE_UNITS)
{
print '<td class="linecoluseunit left">';
print '<span id="title_units">';
print $langs->trans('Unit');
print '</span></td>';
}
?>
<td class="linecollost right"><?php echo $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')); ?></td>
<td class="linecoledit" colspan="<?php echo $colspan; ?>">&nbsp;</td>
</tr>
<?php
}
?>
<tr class="pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element=='contrat')?'':' liste_titre_create'; ?>">
<?php
$coldisplay=0;
// Adds a line numbering column
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$coldisplay++;
echo '<td class="nobottom linecolnum center"></td>';
}
$coldisplay++;
?>
<td class="nobottom linecoldescription minwidth500imp">
<?php
// Predefined product/service
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
if ($forceall >= 0 && $freelines) echo '<br>';
echo '<span class="prod_entry_mode_predef">';
$filtertype='';
if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1';
if (! empty($conf->global->ENTREPOT_EXTRA_STATUS))
{
// hide products in closed warehouse, but show products for internal transfer
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array'));
}
else
{
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array'));
}
echo '</span>';
}
$coldisplay++;
?>
<td class="nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="<?php echo (isset($_POST["qty"])?GETPOST("qty", 'alpha', 2):1); ?>">
</td>
<?php
if($conf->global->PRODUCT_USE_UNITS)
{
$coldisplay++;
print '<td class="nobottom linecoluseunit left">';
print $form->selectUnits($line->fk_unit, "units");
print '</td>';
}
$remise_percent = $buyer->remise_percent;
if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier')
{
$remise_percent = $seller->remise_supplier_percent;
}
$coldisplay++;
?>
<td class="nobottom nowrap linecollost right"><input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="<?php echo (GETPOSTISSET("efficiency")?GETPOST("efficiency", 'alpha'):1); ?>"></td>
<?php
$coldisplay+=$colspan;
?>
<td class="nobottom linecoledit center valignmiddle" colspan="<?php echo $colspan; ?>">
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline">
</td>
</tr>
<?php
if (is_object($objectline)) {
print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
}
?>
<script>
/* JQuery for product free or predefined select */
jQuery(document).ready(function() {
/* When changing predefined product, we reload list of supplier prices required for margin combo */
$("#idprod").change(function()
{
console.log("#idprod change triggered");
/* To set focus */
if (jQuery('#idprod').val() > 0)
{
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
jQuery('#dp_desc').focus();
/* focus if CKEDITOR */
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
{
var editor = CKEDITOR.instances['dp_desc'];
if (editor) { editor.focus(); }
}
}
});
});
</script>
<!-- END PHP TEMPLATE objectline_create.tpl.php -->

View File

@ -0,0 +1,325 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Need to have following variables defined:
* $object (invoice, order, ...)
* $conf
* $langs
* $seller, $buyer
* $dateSelector
* $forceall (0 by default, 1 for supplier invoices/orders)
* $senderissupplier (0 by default, 1 for supplier invoices/orders)
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
*/
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
global $forceall, $senderissupplier, $inputalsopricewithtax;
if (empty($dateSelector)) $dateSelector=0;
if (empty($forceall)) $forceall=0;
if (empty($senderissupplier)) $senderissupplier=0;
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
// Define colspan for the button 'Add'
$colspan = 3; // Col total ht + col edit + col delete
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
if (in_array($object->element, array('propal','supplier_proposal','facture','facturerec','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2;
?>
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->
<?php
$coldisplay=0;
?>
<tr class="oddeven tredited">
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
<?php }
$coldisplay++;
?>
<td>
<div id="line_<?php echo $line->id; ?>"></div>
<input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
<input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
<input type="hidden" id="product_id" name="productid" value="<?php echo (! empty($line->fk_product)?$line->fk_product:0); ?>" />
<input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>">
<input type="hidden" id="fk_parent_line" name="fk_parent_line" value="<?php echo $line->fk_parent_line; ?>">
<?php if ($line->fk_product > 0) { ?>
<?php
if ($line->fk_parent_line > 0) echo img_picto('', 'rightarrow');
?>
<a href="<?php echo DOL_URL_ROOT.'/product/card.php?id='.$line->fk_product; ?>">
<?php
if ($line->product_type==1) echo img_object($langs->trans('ShowService'), 'service');
else print img_object($langs->trans('ShowProduct'), 'product');
echo ' '.$line->ref;
?>
</a>
<?php
echo ' - '.nl2br($line->product_label);
?>
<br><br>
<?php } ?>
<?php
if (is_object($hookmanager))
{
$fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line);
$parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer);
$reshook=$hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
}
?>
</td>
<?php
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{
$coldisplay++;
?>
<td class="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); ?>"></td>
<?php
}
$coldisplay++;
if ($line->fk_prev_id == null) {
print '<td class="right">' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . '</td>';
} else {
print '<td class="right"><input size="1" type="text" class="flat right" name="tva_tx" value="' . price($line->tva_tx) . '" readonly />%</td>';
}
$coldisplay++;
print '<td class="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht, 0, '', 0):price($line->subprice, 0, '', 0)) . '"';
if ($line->fk_prev_id != null) print ' readonly';
print '></td>';
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
$coldisplay++;
print '<td class="right"><input rel="'.$object->multicurrency_tx.'" type="text" class="flat right" size="5" id="multicurrency_subprice" name="multicurrency_subprice" value="'.price($line->multicurrency_subprice).'" /></td>';
}
if ($inputalsopricewithtax)
{
$coldisplay++;
print '<td class="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc, 0, '', 0):'').'"';
if ($line->fk_prev_id != null) print ' readonly';
print '></td>';
}
?>
<td class="right"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) != 2) {
// I comment this because it shows info even when not required
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
// must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '"';
if ($line->fk_prev_id != null ) print ' readonly';
print '>';
} else { ?>
&nbsp;
<?php } ?>
</td>
<?php
if($conf->global->PRODUCT_USE_UNITS)
{
$coldisplay++;
print '<td class="left">';
print $form->selectUnits($line->fk_unit, "units");
print '</td>';
}
?>
<td class="nowrap right"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) != 2) {
print '<input size="1" type="text" class="flat right" name="remise_percent" id="remise_percent" value="' . $line->remise_percent . '"';
if ($line->fk_prev_id != null ) print ' readonly';
print '>%';
} else { ?>
&nbsp;
<?php } ?>
</td>
<!-- colspan for this td because it replace total_ht+3 td for buttons+... -->
<td class="center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay+=$colspan; ?>
<input type="submit" class="button" id="savelinebutton" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
<input type="submit" class="button" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
</td>
</tr>
<?php
//Line extrafield
if (!empty($extrafieldsline))
{
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var],'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
}
?>
<?php if (! empty($conf->service->enabled) && $line->product_type == 1 && $dateSelector) { ?>
<tr id="service_duration_area" class="treditedlinefordate">
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum center"></td>
<?php } ?>
<td colspan="<?php echo $coldisplay-(empty($conf->global->MAIN_VIEW_LINE_NUMBER)?0:1) ?>"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
<?php
$hourmin=(isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:'');
print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start?0:1, "updateline", 1, 0);
print ' '.$langs->trans('to').' ';
print $form->selectDate($line->date_end, 'date_end', $hourmin, $hourmin, $line->date_end?0:1, "updateline", 1, 0);
print '<script type="text/javascript">';
if (!$line->date_start) {
if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) {
print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");';
}
if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) {
print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");';
}
}
if (!$line->date_end) {
if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) {
print 'jQuery("#date_endhour").val("'.$conf->global->MAIN_DEFAULT_DATE_END_HOUR.'");';
}
if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) {
print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");';
}
}
print '</script>'
?>
</td>
</tr>
<?php }
?>
<script type="text/javascript">
jQuery(document).ready(function()
{
jQuery("#price_ht").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
jQuery("#price_ttc").val('');
jQuery("#multicurrency_subprice").val('');
}
});
jQuery("#price_ttc").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#multicurrency_subprice").val('');
}
});
jQuery("#multicurrency_subprice").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#price_ttc").val('');
}
});
<?php
if (! empty($conf->margin->enabled))
{
?>
/* Add rule to clear margin when we change some data, so when we change sell or buy price, margin will be recalculated after submitting form */
jQuery("#tva_tx").click(function() { /* somtimes field is a text, sometimes a combo */
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
jQuery("#tva_tx").keyup(function() { /* somtimes field is a text, sometimes a combo */
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
jQuery("#price_ht").keyup(function() {
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
jQuery("#qty").keyup(function() {
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
jQuery("#remise_percent").keyup(function() {
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
jQuery("#buying_price").keyup(function() {
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
/* Init field buying_price and fournprice */
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product?$line->fk_product:0; ?>}, function(data) {
if (data && data.length > 0) {
var options = '';
var trouve=false;
$(data).each(function() {
options += '<option value="'+this.id+'" price="'+this.price+'"';
<?php if ($line->fk_fournprice > 0) { ?>
if (this.id == <?php echo $line->fk_fournprice; ?>) {
options += ' selected';
$("#buying_price").val(this.price);
trouve = true;
}
<?php } ?>
options += '>'+this.label+'</option>';
});
options += '<option value=null'+(trouve?'':' selected')+'><?php echo $langs->trans("InputPrice"); ?></option>';
$("#fournprice").html(options);
if (trouve) {
$("#buying_price").hide();
$("#fournprice").show();
} else {
$("#buying_price").show();
}
$("#fournprice").change(function() {
var selval = $(this).find('option:selected').attr("price");
if (selval)
$("#buying_price").val(selval).hide();
else
$('#buying_price').show();
});
} else {
$("#fournprice").hide();
$('#buying_price').show();
}
}, 'json');
<?php
}
?>
});
</script>
<!-- END PHP TEMPLATE objectline_edit.tpl.php -->

View File

@ -0,0 +1,330 @@
<?php
/* Copyright (C) 2010-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Need to have following variables defined:
* $object (invoice, order, ...)
* $conf
* $langs
* $dateSelector
* $forceall (0 by default, 1 for supplier invoices/orders)
* $element (used to test $user->rights->$element->creer)
* $permtoedit (used to replace test $user->rights->$element->creer)
* $senderissupplier (0 by default, 1 for supplier invoices/orders)
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
* $object_rights->creer initialized from = $object->getRights()
* $disableedit, $disablemove, $disableremove
*
* $type, $text, $description, $line
*/
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
if (empty($dateSelector)) $dateSelector=0;
if (empty($forceall)) $forceall=0;
if (empty($senderissupplier)) $senderissupplier=0;
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
// add html5 elements
$domData = ' data-element="'.$line->element.'"';
$domData .= ' data-id="'.$line->id.'"';
$domData .= ' data-qty="'.$line->qty.'"';
$domData .= ' data-product_type="'.$line->product_type.'"';
?>
<?php $coldisplay=0; ?>
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
<tr id="row-<?php echo $line->id?>" class="drag drop oddeven" <?php echo $domData; ?> >
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
<?php } ?>
<td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div>
<?php
if (($line->info_bits & 2) == 2) {
?>
<a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid; ?>">
<?php
$txt='';
print img_object($langs->trans("ShowReduc"), 'reduc').' ';
if ($line->description == '(DEPOSIT)') $txt=$langs->trans("Deposit");
elseif ($line->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived");
elseif ($line->description == '(EXCESS PAID)') $txt=$langs->trans("ExcessPaid");
//else $txt=$langs->trans("Discount");
print $txt;
?>
</a>
<?php
if ($line->description)
{
if ($line->description == '(CREDIT_NOTE)' && $line->fk_remise_except > 0)
{
$discount=new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0));
}
elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0)
{
$discount=new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0));
// Add date of deposit
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE))
echo ' ('.dol_print_date($discount->datec).')';
}
elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0)
{
$discount=new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0));
}
elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0)
{
$discount=new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0));
}
else
{
echo ($txt?' - ':'').dol_htmlentitiesbr($line->description);
}
}
}
else
{
$format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE?'dayhour':'day';
if ($line->fk_product > 0)
{
echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):''));
}
else
{
if ($type==1) $text = img_object($langs->trans('Service'), 'service');
else $text = img_object($langs->trans('Product'), 'product');
if (! empty($line->label)) {
$text.= ' <strong>'.$line->label.'</strong>';
echo $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):''));
} else {
if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow');
echo $text.' '.dol_htmlentitiesbr($line->description);
}
}
// Show date range
if ($line->element == 'facturedetrec') {
if ($line->date_start_fill || $line->date_end_fill) echo '<br><div class="clearboth nowraponall">';
if ($line->date_start_fill) echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill);
if ($line->date_start_fill && $line->date_end_fill) echo ' - ';
if ($line->date_end_fill) echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill);
if ($line->date_start_fill || $line->date_end_fill) echo '</div>';
}
else {
if ($line->date_start || $line->date_end) echo '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
//echo get_date_range($line->date_start, $line->date_end, $format);
}
// Add description in form
if ($line->fk_product > 0 && ! empty($conf->global->PRODUIT_DESC_IN_FORM))
{
print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
}
}
if (! empty($conf->accounting->enabled) && $line->fk_accounting_account > 0)
{
$accountingaccount=new AccountingAccount($this->db);
$accountingaccount->fetch($line->fk_accounting_account);
echo '<div class="clearboth"></div><br><span class="opacitymedium">' . $langs->trans('AccountingAffectation') . ' : </span>' . $accountingaccount->getNomUrl(0, 1, 1);
}
?>
</td>
<?php
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{
?>
<td class="linecolrefsupplier"><?php
echo ($line->ref_fourn?$line->ref_fourn:$line->ref_supplier);
?></td>
<?php
}
// VAT Rate
?>
<td class="linecolvat nowrap right"><?php $coldisplay++; ?><?php
$positiverates='';
if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx);
if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx);
if (price2num($line->total_localtax2)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx);
if (empty($positiverates)) $positiverates='0';
echo vatrate($positiverates.($line->vat_src_code?' ('.$line->vat_src_code.')':''), '%', $line->info_bits);
//echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits);
?></td>
<td class="linecoluht nowrap right"><?php $coldisplay++; ?><?php echo price($line->subprice); ?></td>
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?>
<td class="linecoluht_currency nowrap right"><?php $coldisplay++; ?><?php echo price($line->multicurrency_subprice); ?></td>
<?php } ?>
<?php if ($inputalsopricewithtax) { ?>
<td class="linecoluttc nowrap right"><?php $coldisplay++; ?><?php echo (isset($line->pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?></td>
<?php } ?>
<td class="linecolqty nowrap right"><?php $coldisplay++; ?>
<?php
if ((($line->info_bits & 2) != 2) && $line->special_code != 3) {
// I comment this because it shows info even when not required
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
// must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
} else echo '&nbsp;';
?>
</td>
<?php
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td class="linecoluseunit nowrap left">';
$label = $line->getLabelOfUnit('short');
if ($label !== '') {
print $langs->trans($label);
}
print '</td>';
}
?>
<?php if (!empty($line->remise_percent) && $line->special_code != 3) { ?>
<td class="linecoldiscount right"><?php
$coldisplay++;
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
echo dol_print_reduction($line->remise_percent, $langs);
?></td>
<?php } else { ?>
<td class="linecoldiscount"><?php $coldisplay++; ?>&nbsp;</td>
<?php }
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
?>
<?php if ($line->special_code == 3) { ?>
<td class="linecoloption nowrap right"><?php $coldisplay++; ?><?php echo $langs->trans('Option'); ?></td>
<?php } else { ?>
<td class="linecolht nowrap right"><?php
$coldisplay++;
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
print '<span class="classfortooltip" title="';
print $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht);
print '<br>'.$langs->transcountry("TotalVAT", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_tva);
if (price2num($line->total_localtax1)) print '<br>'.$langs->transcountry("TotalLT1", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_localtax1);
if (price2num($line->total_localtax2)) print '<br>'.$langs->transcountry("TotalLT2", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_localtax2);
print '<br>'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc);
print '">';
}
print price($line->total_ht);
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
print '</span>';
}
?>
</td>
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?>
<td class="linecolutotalht_currency nowrap right"><?php $coldisplay++; ?><?php echo price($line->multicurrency_total_ht); ?></td>
<?php } ?>
<?php } ?>
<?php if ($outputalsopricetotalwithtax) { ?>
<td class="linecolht nowrap right"><?php $coldisplay++; ?><?php echo price($line->total_ttc); ?></td>
<?php } ?>
<?php
if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines' ) { ?>
<td class="linecoledit center"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { ?>
<?php } else { ?>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id; ?>">
<?php echo img_edit(); ?>
</a>
<?php } ?>
</td>
<td class="linecoldelete center"><?php $coldisplay++; ?>
<?php
if (($line->fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&amp;action=ask_deleteline&amp;lineid=' . $line->id . '">';
print img_delete();
print '</a>';
}
?>
</td>
<?php
if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { ?>
<td class="linecolmove tdlineupdown center"><?php $coldisplay++; ?>
<?php if ($i > 0) { ?>
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id; ?>">
<?php echo img_up('default', 0, 'imgupforline'); ?>
</a>
<?php } ?>
<?php if ($i < $num-1) { ?>
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=down&amp;rowid='.$line->id; ?>">
<?php echo img_down('default', 0, 'imgdownforline'); ?>
</a>
<?php } ?>
</td>
<?php } else { ?>
<td <?php echo (($conf->browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>><?php $coldisplay++; ?></td>
<?php } ?>
<?php
} else {
?>
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>
<?php
}
if($action == 'selectlines'){ ?>
<td class="linecolcheck center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td>
<?php } ?>
</tr>
<?php
//Line extrafield
if (!empty($extrafieldsline))
{
print $line->showOptionals($extrafieldsline, 'view', array('style'=>'class="drag drop oddeven"','colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
}
?>
<!-- END PHP TEMPLATE objectline_view.tpl.php -->

View File

@ -267,7 +267,7 @@ if ($action == 'savefilter' || $action == 'createfilter') {
$error = 0;
if ($action == 'createfilter' && empty($template_name)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->trans('AdvTgtOrCreateNewFilter')), null, 'errors');
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('AdvTgtOrCreateNewFilter')), null, 'errors');
$error ++;
}

View File

@ -424,7 +424,7 @@ if (empty($reshook))
$object->sendto = $_POST["sendto"];
if (! $object->sendto)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("MailTo")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTo")), null, 'errors');
$error++;
}
@ -870,7 +870,7 @@ else
}
$text.=$langs->trans('ConfirmSendingEmailing').'<br>';
$text.=$langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', $formquestion, '', 1, 300);
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', $formquestion, '', 1, 330, 600);
}
}

View File

@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
</td>
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" ><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td class="linkedcol-date center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td class="linkedcol-amount right"><?php
if ($user->rights->propale->lire) {
$total = $total + $objectlink->total_ht;
@ -80,8 +80,8 @@ if (count($linkedObjectBlock) > 1)
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
<td><?php echo $langs->trans("Total"); ?></td>
<td></td>
<td align="center"></td>
<td align="center"></td>
<td class="center"></td>
<td class="center"></td>
<td class="right"><?php echo price($total); ?></td>
<td class="right"></td>
<td class="right"></td>

View File

@ -161,7 +161,7 @@ if ($action == 'setremise' && $user->rights->societe->creer)
$error=0;
if (empty($desc))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("ReasonDiscount")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReasonDiscount")), null, 'errors');
$error++;
}
@ -193,7 +193,7 @@ if ($action == 'setremise' && $user->rights->societe->creer)
}
else
{
setEventMessages($langs->trans("ErrorFieldFormat", $langs->trans("NewGlobalDiscount")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldFormat", $langs->transnoentitiesnoconv("NewGlobalDiscount")), null, 'errors');
}
}

View File

@ -816,7 +816,7 @@ class Commande extends CommonOrder
}
if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0)
{
$this->error=$langs->trans("ErrorFieldRequired", $langs->trans("Source"));
$this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Source"));
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
return -1;
}
@ -4053,6 +4053,33 @@ class OrderLine extends CommonOrderLine
$error=0;
// check if order line is not in a shipment line before deleting
$sqlCheckShipmentLine = "SELECT";
$sqlCheckShipmentLine .= " ed.rowid";
$sqlCheckShipmentLine .= " FROM " . MAIN_DB_PREFIX . "expeditiondet ed";
$sqlCheckShipmentLine .= " WHERE ed.fk_origin_line = " . $this->rowid;
$resqlCheckShipmentLine = $this->db->query($sqlCheckShipmentLine);
if (!$resqlCheckShipmentLine) {
$error++;
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
} else {
$langs->load('errors');
$num = $this->db->num_rows($resqlCheckShipmentLine);
if ($num > 0) {
$error++;
$objCheckShipmentLine = $this->db->fetch_object($resqlCheckShipmentLine);
$this->error = $langs->trans('ErrorRecordAlreadyExists') . ' : ' . $langs->trans('ShipmentLine') . ' ' . $objCheckShipmentLine->rowid;
$this->errors[] = $this->error;
}
$this->db->free($resqlCheckShipmentLine);
}
if ($error) {
dol_syslog(__METHOD__ . 'Error ; ' . $this->error, LOG_ERR);
return -1;
}
$this->db->begin();
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid=".$this->rowid;

View File

@ -877,12 +877,12 @@ if ($resql)
}
if (! empty($arrayfields['bu.label']['checked']))
{
print '<td class="liste_titre"><input type="text" class="flat" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'" size="10"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>';
}
if (! empty($arrayfields['ba.ref']['checked']))
{
print '<td class="liste_titre right">';
$form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''));
print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''), 0, 'maxwidth100');
print '</td>';
}
if (! empty($arrayfields['b.debit']['checked']))
@ -940,7 +940,7 @@ if ($resql)
if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], 'bu.label', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['balancebefore']['checked'])) print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
@ -961,6 +961,7 @@ if ($resql)
$balancebefore = 0; // For balance
$balancecalculated = false;
$posconciliatecol = 0;
$cachebankaccount = array();
// Loop on each record
$sign = 1;
@ -1337,7 +1338,7 @@ if ($resql)
// Bank account
if (! empty($arrayfields['ba.ref']['checked']))
{
print '<td class="nowrap right">';
print '<td class="nowrap">';
print $bankaccount->getNomUrl(1);
print "</td>\n";
if (! $i) $totalarray['nbfield']++;

View File

@ -44,7 +44,7 @@ class PaymentVarious extends CommonObject
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'bill';
public $picto = 'payment';
/**
* @var int ID
@ -63,6 +63,7 @@ class PaymentVarious extends CommonObject
public $amount;
public $type_payment;
public $num_payment;
public $category_transaction;
/**
* @var string various payments label
@ -414,13 +415,13 @@ class PaymentVarious extends CommonObject
$sign=1;
if ($this->sens == '0') $sign=-1;
$bank_line_id = $acc->addline(
$bank_line_id = $acc->addline(
$this->datep,
$this->type_payment,
$this->label,
$sign * abs($this->amount),
$this->num_payment,
'',
($this->category_transaction > 0 ? $this->category_transaction : 0),
$user
);

View File

@ -37,7 +37,7 @@ if (! empty($conf->projet->enabled))
}
// Load translation files required by the page
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy"));
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy", "categories"));
// Get parameters
$id = GETPOST('id', 'int');
@ -45,14 +45,15 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$accountid=GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0;
$label=GETPOST("label", "alpha");
$sens=GETPOST("sens", "int");
$amount=GETPOST("amount", "alpha");
$paymenttype=GETPOST("paymenttype", "int");
$accountancy_code=GETPOST("accountancy_code", "alpha");
$subledger_account=GETPOST("subledger_account", "alpha");
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
$accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0;
$label = GETPOST("label", "alpha");
$sens = GETPOST("sens", "int");
$amount = GETPOST("amount", "alpha");
$paymenttype = GETPOST("paymenttype", "int");
$accountancy_code = GETPOST("accountancy_code", "alpha");
$subledger_account = GETPOST("subledger_account", "alpha");
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
$category_transaction = GETPOST("category_transaction", 'alpha');
// Security check
$socid = GETPOST("socid", "int");
@ -64,8 +65,6 @@ $object = new PaymentVarious($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('variouscard','globalcard'));
/**
* Actions
*/
@ -113,6 +112,7 @@ if (empty($reshook))
$object->type_payment=GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0;
$object->num_payment=GETPOST("num_payment", 'alpha');
$object->fk_user_author=$user->id;
$object->category_transaction=GETPOST("category_transaction", 'alpha');
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : "";
$object->subledger_account=GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : "";
@ -144,6 +144,7 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
$error++;
}
// TODO Remove this and allow instead to edit a various payment to enter accounting code
if (! empty($conf->accounting->enabled) && ! $object->accountancy_code)
{
$langs->load('errors');
@ -240,6 +241,16 @@ if ($id)
}
}
$options = array();
// Load bank groups
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
$bankcateg = new BankCateg($db);
foreach ($bankcateg->fetchAll() as $bankcategory) {
$options[$bankcategory->id] = $bankcategory->label;
}
/* ************************************************************************** */
/* */
/* Create mode */
@ -259,7 +270,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// Date payment
print '<tr><td>';
print '<tr><td class="titlefieldcreate">';
print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).'</td><td>';
print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1);
print '</td></tr>';
@ -314,17 +325,48 @@ if ($action == 'create')
print '<td><input name="num_payment" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
}
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
// Associated project
$langs->load("projects");
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
print '</td></tr>';
}
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</td></tr>';
// Category
if (is_array($options) && count($options) && $conf->categorie->enabled)
{
print '<tr><td>'.$langs->trans("RubriquesTransactions").'</td><td>';
print Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1);
print '</td></tr>';
}
// Accountancy account
if (! empty($conf->accounting->enabled))
{
print '<tr><td class="fieldrequired">'.$langs->trans("AccountAccounting").'</td>';
// TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("AccountAccounting").'</td>';
print '<td>';
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
print '</td></tr>';
}
else // For external software
{
print '<tr><td>'.$langs->trans("AccountAccounting").'</td>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountAccounting").'</td>';
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code" value="'.$accountancy_code.'">';
print '</td></tr>';
}
@ -351,26 +393,6 @@ if ($action == 'create')
print '</td></tr>';
}
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
// Associated project
$langs->load("projects");
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
print '</td></tr>';
}
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>';
dol_fiche_end();
@ -395,7 +417,7 @@ if ($id)
{
$head=various_payment_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, 'payment');
dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);
$morehtmlref='<div class="refidno">';
// Project
@ -479,7 +501,7 @@ if ($id)
print '</td><td>';
print $object->subledger_account;
print '</td></tr>';
if (! empty($conf->banque->enabled))
{
if ($object->fk_account > 0)
@ -502,7 +524,6 @@ if ($id)
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
@ -514,7 +535,12 @@ if ($id)
* Action buttons
*/
print '<div class="tabsAction">'."\n";
if ($object->rappro == 0)
// TODO
// Add button modify
// Delete
if (empty($object->rappro))
{
if (! empty($user->rights->banque->modifier))
{
@ -529,6 +555,7 @@ if ($id)
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a>';
}
print "</div>";
}

View File

@ -82,7 +82,7 @@ if ($object->id)
{
$head=various_payment_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), -1, 'payment');
dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), -1, $object->picto);
$morehtmlref='<div class="refidno">';
// Project

View File

@ -50,7 +50,7 @@ $object->info($id);
$head = various_payment_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, 'payment');
dol_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, $object->picto);
$morehtmlref='<div class="refidno">';

View File

@ -57,7 +57,7 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="v.datep";
if (! $sortfield) $sortfield="v.datep,v.rowid";
if (! $sortorder) $sortorder="DESC";
$filtre=GETPOST("filtre", 'alpha');
@ -110,13 +110,13 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row
$sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
// Search criteria
if ($search_ref) $sql.=" AND v.rowid=".$search_ref;
if ($search_ref) $sql.=" AND v.rowid=".$db->escape($search_ref);
if ($search_label) $sql.=natural_search(array('v.label'), $search_label);
if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1);
if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1);
if ($search_account > 0) $sql.=" AND b.fk_account=".$search_account;
if ($search_date) $sql.=" AND v.datep=".$search_date;
if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$search_accountancy_code;
if ($search_account > 0) $sql.=" AND b.fk_account=".$db->escape($search_account);
if ($search_date) $sql.=" AND v.datep = '".$db->idate($search_date)."'";
if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$db->escape($search_accountancy_code);
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
if ($filtre) {
$filtre=str_replace(":", "=", $filtre);
@ -234,7 +234,7 @@ if ($result)
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "v.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left ');
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left ');
if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');

View File

@ -458,7 +458,7 @@ while ($i < min($num, $limit))
$object->id = $obj->rowid;
foreach($object->fields as $key => $val)
{
if (isset($obj->$key)) $object->$key = $obj->$key;
if (property_exists($obj, $key)) $object->$key = $obj->$key;
}
// Show here line of result

View File

@ -939,7 +939,7 @@ if (empty($reshook))
if (empty($dateinvoice))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
@ -1566,7 +1566,7 @@ if (empty($reshook))
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture)) {
$error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->trans("Date"));
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
setEventMessages($mesg, null, 'errors');
}
@ -1574,7 +1574,7 @@ if (empty($reshook))
if (!($_POST['situations'] > 0)) {
$error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation"));
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
setEventMessages($mesg, null, 'errors');
}

View File

@ -2284,7 +2284,7 @@ class Facture extends CommonInvoice
// Controle que facture source connue
if ($this->fk_facture_source <= 0)
{
$this->error=$langs->trans("ErrorFieldRequired", $langs->trans("InvoiceReplacement"));
$this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceReplacement"));
$this->db->rollback();
return -10;
}
@ -3133,7 +3133,13 @@ class Facture extends CommonInvoice
// phpcs:enable
global $mysoc,$user;
include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
// Progress should never be changed for discount lines
if (($line->info_bits & 2) == 2)
{
return;
}
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Cap percentages to 100
if ($percent > 100) $percent = 100;
@ -3149,7 +3155,6 @@ class Facture extends CommonInvoice
$line->multicurrency_total_ttc = $tabprice[18];
$line->update($user);
$this->update_price(1);
$this->db->commit();
}
/**
@ -4597,6 +4602,7 @@ class FactureLigne extends CommonInvoiceLine
if ($result <= 0)
{
$this->error='ErrorProductIdDoesNotExists';
dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
return -1;
}
}

View File

@ -47,10 +47,31 @@ foreach($linkedObjectBlock as $key => $objectlink)
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?>
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
<td class="linkedcol-element"><?php echo $langs->trans("CustomerInvoice"); ?></td>
<td class="linkedcol-element"><?php
switch ($objectlink->type) {
case Facture::TYPE_REPLACEMENT:
echo $langs->trans("InvoiceReplacement");
break;
case Facture::TYPE_CREDIT_NOTE:
echo $langs->trans("InvoiceAvoir");
break;
case Facture::TYPE_DEPOSIT:
echo $langs->trans("InvoiceDeposit");
break;
case Facture::TYPE_PROFORMA:
echo $langs->trans("InvoiceProForma");
break;
case Facture::TYPE_SITUATION:
echo $langs->trans("InvoiceSituation");
break;
default:
echo $langs->trans("CustomerInvoice");
break;
}
?></td>
<td class="linkedcol-name"><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td class="linkedcol-ref left"><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td class="linkedcol-amount right"><?php
if ($user->rights->facture->lire) {
$sign = 1;
@ -76,8 +97,8 @@ if (count($linkedObjectBlock) > 1)
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
<td><?php echo $langs->trans("Total"); ?></td>
<td></td>
<td align="center"></td>
<td align="center"></td>
<td class="center"></td>
<td class="center"></td>
<td class="right"><?php echo price($total); ?></td>
<td class="right"></td>
<td class="right"></td>

View File

@ -59,7 +59,7 @@ if ($action == 'confirm_rejet')
if (empty($daterej))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
}
elseif ($daterej > dol_now())

View File

@ -602,6 +602,8 @@ if ($id > 0)
$num = $db->num_rows($resql);
$i = 0; $total = 0;
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder paymenttable">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("RefPayment").'</td>';
@ -668,6 +670,8 @@ if ($id > 0)
print '<td class="right'.($resteapayer?' amountremaintopay':(' '.$cssforamountpaymentcomplete)).'">'.price($resteapayer)."</td></tr>\n";
print "</table>";
print '</div>';
$db->free($resql);
}
else

View File

@ -146,11 +146,20 @@ $dolibarr_main_db_character_set='utf8';
// Database character set used to sort data (forced during database creation. value of database is then used).
// Default value: depends on database driver
// Examples:
// dolibarr_main_db_collation='utf8_unicode_ci';
// $dolibarr_main_db_collation='utf8_unicode_ci';
//
$dolibarr_main_db_collation='utf8_unicode_ci';
// dolibarr_main_instance_unique_id
// An ID that is unique for each installation.
// Default value: randomly defined during installation
// Examples:
// $dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62';
//
$dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62';
//##################
// Login
@ -159,18 +168,18 @@ $dolibarr_main_db_collation='utf8_unicode_ci';
// dolibarr_main_authentication
// This parameter contains the way authentication is done.
// If value "ldap" is used, you must also set parameters dolibarr_main_auth_ldap_*
// Default value: dolibarr
// Default value: 'dolibarr'
// Possible values: Any values found in files in htdocs/core/login directory after
// the "function_" string and before the ".php" string. You can also separate several
// values using a ",". In this case, Dolibarr will check login/pass for each value in
// order defined into value. However, note that this can't work with all values.
// Examples:
// $dolibarr_main_authentication='http';
// $dolibarr_main_authentication='dolibarr';
// $dolibarr_main_authentication='ldap';
// $dolibarr_main_authentication='openid,dolibarr';
// $dolibarr_main_authentication='forceuser'; // Add also $dolibarr_auto_user='loginforuser';
// $dolibarr_main_authentication='dolibarr'; // Use the password defined into application on user record.
// $dolibarr_main_authentication='http'; // Use the HTTP Basic authentication
// $dolibarr_main_authentication='ldap'; // Check the password into a LDAP server
// $dolibarr_main_authentication='ldap,dolibarr'; // You can set several mode using a comma as a separator.
// $dolibarr_main_authentication='forceuser'; // This need to add also $dolibarr_auto_user='loginforuser';
// $dolibarr_main_authentication='twofactor'; // To use Google Authenticator. This need the non official external module "Two Factor" available on www.dolistore.com
//
$dolibarr_main_authentication='dolibarr';

View File

@ -376,21 +376,24 @@ if (empty($reshook))
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) $error++;
$result = $object->update($contactid, $user);
if ($result > 0) {
// Categories association
$categories = GETPOST('contcats', 'array');
$object->setCategories($categories);
$object->old_lastname='';
$object->old_firstname='';
$action = 'view';
}
else
if (! $error)
{
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
$result = $object->update($contactid, $user);
if ($result > 0) {
// Categories association
$categories = GETPOST('contcats', 'array');
$object->setCategories($categories);
$object->old_lastname='';
$object->old_firstname='';
$action = 'view';
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
}
}
}
@ -505,7 +508,7 @@ else
$linkback='';
print load_fiche_titre($title, $linkback, 'title_companies.png');
// Affiche les erreurs
// Show errors
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
if ($conf->use_javascript_ajax)
@ -800,8 +803,8 @@ else
$objsoc = new Societe($db);
$objsoc->fetch($object->socid);
// Affiche les erreurs
dol_htmloutput_errors($error, $errors);
// Show errors
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
if ($conf->use_javascript_ajax)
{
@ -1122,11 +1125,10 @@ else
{
$objsoc = new Societe($db);
/*
* Fiche en mode visualisation
*/
// View mode
dol_htmloutput_errors($error, $errors);
// Show errors
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
dol_fiche_head($head, 'card', $title, -1, 'contact');

View File

@ -2139,22 +2139,22 @@ else
{
if ($user->rights->contrat->activer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=activate">'.$langs->trans("ActivateAllContracts").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" id="btnactivateall" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=activate">'.$langs->trans("ActivateAllContracts").'</a></div>';
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("ActivateAllContracts").'</a></div>';
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" id="btnactivateall" href="#">'.$langs->trans("ActivateAllContracts").'</a></div>';
}
}
if ($object->nbofservicesclosed < $nbofservices)
{
if ($user->rights->contrat->desactiver)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=close">'.$langs->trans("CloseAllContracts").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" id="btncloseall" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=close">'.$langs->trans("CloseAllContracts").'</a></div>';
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CloseAllContracts").'</a></div>';
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" id="btncloseall" href="#">'.$langs->trans("CloseAllContracts").'</a></div>';
}
//if (! $numactive)

View File

@ -878,14 +878,14 @@ class Contrat extends CommonObject
if ($this->commercial_signature_id <= 0)
{
$langs->load("commercial");
$this->error.=$langs->trans("ErrorFieldRequired", $langs->trans("SalesRepresentativeSignature"));
$this->error.=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SalesRepresentativeSignature"));
$paramsok=0;
}
if ($this->commercial_suivi_id <= 0)
{
$langs->load("commercial");
$this->error.=($this->error?"<br>":'');
$this->error.=$langs->trans("ErrorFieldRequired", $langs->trans("SalesRepresentativeFollowUp"));
$this->error.=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SalesRepresentativeFollowUp"));
$paramsok=0;
}
if (! $paramsok) return -1;

View File

@ -506,7 +506,7 @@ class CMailFile
}
$sendingmode = $this->sendmode;
if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail')
if ($this->context == 'emailing' && ! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail')
{
// List of sending methods
$listofmethods=array();

View File

@ -3860,9 +3860,10 @@ abstract class CommonObject
* @param int $dateSelector 1=Show also date range input fields
* @param Societe $seller Object thirdparty who sell
* @param Societe $buyer Object thirdparty who buy
* @param string $defaulttpldir Directory where to find the template
* @return void
*/
public function formAddObjectLine($dateSelector, $seller, $buyer)
public function formAddObjectLine($dateSelector, $seller, $buyer, $defaulttpldir = '/core/tpl')
{
global $conf,$user,$langs,$object,$hookmanager;
global $form,$bcnd,$var;
@ -3874,10 +3875,17 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach($dirtpls as $reldir)
$dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
foreach($dirtpls as $module => $reldir)
{
$tpl = dol_buildpath($reldir.'/objectline_create.tpl.php');
if (!empty($module))
{
$tpl = dol_buildpath($reldir.'/objectline_create.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_create.tpl.php';
}
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
@ -4130,9 +4138,16 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach($dirtpls as $reldir)
foreach($dirtpls as $module => $reldir)
{
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php');
if (!empty($module))
{
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_view.tpl.php';
}
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
@ -4153,9 +4168,16 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach($dirtpls as $reldir)
foreach($dirtpls as $module => $reldir)
{
$tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php');
if (!empty($module))
{
$tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_edit.tpl.php';
}
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
@ -4355,9 +4377,16 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach($dirtpls as $reldir)
foreach($dirtpls as $module => $reldir)
{
$tpl = dol_buildpath($reldir.'/originproductline.tpl.php');
if (!empty($module))
{
$tpl = dol_buildpath($reldir.'/originproductline.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/originproductline.tpl.php';
}
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {

View File

@ -1970,7 +1970,7 @@ class ExtraFields
public function setOptionalsFromPost($extralabels, &$object, $onlykey = '')
{
global $_POST, $langs;
$nofillrequired='';// For error when required field left blank
$nofillrequired=0;// For error when required field left blank
$error_field_required = array();
if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label'];
@ -2001,7 +2001,8 @@ class ExtraFields
if ($this->attributes[$object->table_element]['required'][$key]) // Value is required
{
// Check if empty without using GETPOST, value can be alpha, int, array, etc...
if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0')
if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0')
|| (! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select')
|| (is_array($_POST["options_".$key]) && empty($_POST["options_".$key])))
{
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];

View File

@ -1914,6 +1914,16 @@ class Form
$selected_input_value=$producttmpselect->ref;
unset($producttmpselect);
}
// handle case where product or service module is disabled + no filter specified
if ($filtertype == '')
{
if (empty($conf->product->enabled)) { // when product module is disabled, show services only
$filtertype = 1;
}
elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only
$filtertype = 0;
}
}
// mode=1 means customers products
$urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
//Price by customer
@ -2165,7 +2175,14 @@ class Form
{
$sql.= " AND p.tosell = ".$status;
}
if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype;
// Filter by product type
if (strval($filtertype) != '') $sql.= " AND p.fk_product_type = ".$filtertype;
elseif (empty($conf->product->enabled)) { // when product module is disabled, show services only
$sql.= " AND p.fk_product_type = 1";
}
elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only
$sql.= " AND p.fk_product_type = 0";
}
// Add criteria on ref/label
if ($filterkey != '')
{
@ -3649,9 +3666,10 @@ class Form
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @param string $moreattrib To add more attribute on select
* @param int $showcurrency Show currency in label
* @param string $morecss More CSS
* @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...)
*/
public function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0)
public function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '')
{
// phpcs:enable
global $langs, $conf;
@ -3674,7 +3692,7 @@ class Form
$i = 0;
if ($num)
{
print '<select id="select'.$htmlname.'" class="flat selectbankaccount" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
print '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
if ($useempty == 1 || ($useempty == 2 && $num > 1))
{
print '<option value="-1">&nbsp;</option>';

View File

@ -688,7 +688,9 @@ class FormFile
$out.= '<tr class="liste_titre">';
$addcolumforpicto=($delallowed || $printer || $morepicto);
$out.= '<th colspan="'.(3+($addcolumforpicto?1:0)).'" class="formdoc liste_titre maxwidthonsmartphone center">';
$colspan = (3+($addcolumforpicto?1:0)); $colspanmore = 0;
$out.= '<th colspan="'.$colspan.'" class="formdoc liste_titre maxwidthonsmartphone center">';
// Model
if (! empty($modellist))
@ -745,13 +747,17 @@ class FormFile
{
foreach($hookmanager->hooks['formfile'] as $module)
{
if (method_exists($module, 'formBuilddocLineOptions')) $out .= '<th></th>';
if (method_exists($module, 'formBuilddocLineOptions'))
{
$colspanmore++;
$out .= '<th></th>';
}
}
}
$out.= '</tr>';
// Execute hooks
$parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart);
$parameters=array('colspan'=>($colspan+$colspanmore), 'socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''), 'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'modulepart'=>$modulepart);
if (is_object($hookmanager))
{
$reshook = $hookmanager->executeHooks('formBuilddocOptions', $parameters, $GLOBALS['object']);
@ -801,9 +807,10 @@ class FormFile
// Show file name with link to download
$out.= '<td class="minwidth200">';
$out.= '<a class="documentdownload paddingright" href="'.$documenturl.'?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).($param?'&'.$param:'').'"';
$mime=dol_mimetype($relativepath, '', 0);
if (preg_match('/text/', $mime)) $out.= ' target="_blank"';
$out.= ' target="_blank">';
$out.= '>';
$out.= img_mime($file["name"], $langs->trans("File").': '.$file["name"]);
$out.= dol_trunc($file["name"], 150);
$out.= '</a>'."\n";
@ -847,14 +854,17 @@ class FormFile
if (is_object($hookmanager))
{
$parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart,'relativepath'=>$relativepath);
$parameters=array('colspan'=>($colspan+$colspanmore), 'socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart,'relativepath'=>$relativepath);
$res = $hookmanager->executeHooks('formBuilddocLineOptions', $parameters, $file);
if (empty($res))
{
$out.= $hookmanager->resPrint; // Complete line
$out.= '</tr>';
}
else $out = $hookmanager->resPrint; // Replace line
else
{
$out = $hookmanager->resPrint; // Replace all $out
}
}
}

View File

@ -196,6 +196,7 @@ class Translate
$modulename = '';
// Search if a module directory name is provided into lang file name
$regs=array();
if (preg_match('/^([^@]+)@([^@]+)$/i', $domain, $regs))
{
$newdomain = $regs[1];
@ -223,7 +224,7 @@ class Translate
return -1;
}
foreach($this->dir as $keydir => $searchdir)
foreach($this->dir as $searchdir)
{
// Directory of translation files
$file_lang = $searchdir.($modulename?'/'.$modulename:'')."/langs/".$langofdir."/".$newdomain.".lang";

View File

@ -284,7 +284,7 @@ abstract class DoliDB implements Database
if ($string==0 || $string=="0000-00-00 00:00:00") return '';
$string=preg_replace('/([^0-9])/i', '', $string);
$tmp=$string.'000000';
$date=dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), $gm);
$date=dol_mktime((int) substr($tmp, 8, 2), (int) substr($tmp, 10, 2), (int) substr($tmp, 12, 2), (int) substr($tmp, 4, 2), (int) substr($tmp, 6, 2), (int) substr($tmp, 0, 4), $gm);
return $date;
}

View File

@ -841,10 +841,11 @@ function copyToClipboard(text,text2)
* @return boolean False
* @see document_preview
*/
function newpopup(url,title) {
function newpopup(url, title) {
var argv = newpopup.arguments;
var argc = newpopup.arguments.length;
tmp=url;
console.log("newpopup "+argv[2]+" "+argv[3]);
var l = (argc > 2) ? argv[2] : 600;
var h = (argc > 3) ? argv[3] : 400;
var left = (screen.width - l)/2;

View File

@ -649,7 +649,7 @@ function dol_include_once($relpath, $classname = '')
* @param int $returnemptyifnotfound 0:If $type==0 and if file was not found into alternate dir, return default path into main dir (no test on it)
* 1:If $type==0 and if file was not found into alternate dir, return empty string
* 2:If $type==0 and if file was not found into alternate dir, test into main dir, return default path if found, empty string if not found
* @return string Full filesystem path (if path=0), Full url path (if mode=1)
* @return string Full filesystem path (if path=0) or '' if file not found, Full url path (if mode=1)
*/
function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
{
@ -1982,7 +1982,7 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = false, $
//var_dump($localtz);
//var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute);
$dt = new DateTime(null, $localtz);
$dt->setDate($year, $month, $day);
$dt->setDate((int) $year, (int) $month, (int) $day);
$dt->setTime((int) $hour, (int) $minute, (int) $second);
$date=$dt->getTimestamp(); // should include daylight saving time
//var_dump($date);
@ -3441,16 +3441,17 @@ function img_info($titlealt = 'default')
*
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"'). If 1, add float: right. Can't be "class" attribute.
* @param string $morecss Add more CSS
* @return string Return img tag
*/
function img_warning($titlealt = 'default', $moreatt = '')
function img_warning($titlealt = 'default', $moreatt = '', $morecss = 'pictowarning')
{
global $conf, $langs;
if ($titlealt == 'default') $titlealt = $langs->trans('Warning');
//return '<div class="imglatecoin">'.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'</div>';
return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): ''));
return img_picto($titlealt, 'warning.png', 'class="valignmiddle'.($morecss?' '.$morecss:'').'"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): ''));
}
/**
@ -3626,7 +3627,7 @@ function img_mime($file, $titlealt = '', $morecss = '')
if (empty($titlealt)) $titlealt = 'Mime type: '.$mimetype;
//return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"');
return '<i class="fa fa-'.$mimefa.' paddingright"></i>';
return '<i class="fa fa-'.$mimefa.' paddingright"'.($titlealt ? ' title="'.$titlealt.'"' : '').'></i>';
}
@ -8274,7 +8275,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
*/
function isAFileWithExecutableContent($filename)
{
if (preg_match('/\.(htm|html|js|php|phtml|pl|py|cgi|ksh|sh|bash)$/i', $filename))
if (preg_match('/\.(htm|html|js|php|phtml|pl|py|cgi|ksh|sh|bash|bat|cmd|wpk|exe|dmg)$/i', $filename))
{
return true;
}

View File

@ -568,7 +568,7 @@ function isValidUrl($url, $http = 0, $pass = 0, $port = 0, $path = 0, $query = 0
* Check if VAT numero is valid (check done on syntax only, no database or remote access)
*
* @param Societe $company VAT number
* @return int 1=Check is OK, 0=Check is KO
* @return int 1=Check is OK, 0=Check is KO
*/
function isValidVATID($company)
{
@ -577,7 +577,7 @@ function isValidVATID($company)
$vatprefix = $company->country_code;
if ($vatprefix == 'GR') $vatprefix = '(EL|GR)';
else $vatprefix = preg_quote($vatprefix, '/');
if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,12}$/', $company->tva_intra))
if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,14}$/i', str_replace(' ', '', $company->tva_intra)))
{
return 0;
}

View File

@ -172,14 +172,18 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
* For example: https://www.abc.mydomain.com/dir/page.html return 'mydomain'
*
* @param string $url Full URL.
* @param int $mode 0=return 'mydomain', 1=return 'mydomain.com'
* @return string Returns domaine name
*/
function getDomainFromURL($url)
function getDomainFromURL($url, $mode = 0)
{
$tmpdomain = preg_replace('/^https?:\/\//i', '', $url); // Remove http(s)://
$tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after domain
$tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...)
$tmpdomain = preg_replace('/^[^\.]+\./', '', $tmpdomain); // Remove part www. before domain name
$tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)$/', '\1.\2', $tmpdomain); // Remove part www.abc before domain name
if (empty($mode))
{
$tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...)
}
return $tmpdomain;
}

View File

@ -76,7 +76,7 @@ class ExportExcel extends ModeleExports
$this->db = $db;
$this->id='excel'; // Same value then xxx in file name export_xxx.modules.php
$this->label='Excel 95'; // Label of driver
$this->label='Excel 95 (old library)'; // Label of driver
$this->desc = $langs->trans('Excel95FormatDesc');
$this->extension='xls'; // Extension for generated file by this driver
$this->picto='mime/xls'; // Picto

View File

@ -76,7 +76,7 @@ class ExportExcel2007 extends ExportExcel
$this->db = $db;
$this->id='excel2007'; // Same value then xxx in file name export_xxx.modules.php
$this->label='Excel 2007'; // Label of driver
$this->label='Excel 2007 (old library)'; // Label of driver
$this->desc = $langs->trans('Excel2007FormatDesc');
$this->extension='xlsx'; // Extension for generated file by this driver
$this->picto='mime/xls'; // Picto

View File

@ -78,7 +78,7 @@ class ExportExcel2007new extends ModeleExports
$this->db = $db;
$this->id='excel2007new'; // Same value then xxx in file name export_xxx.modules.php
$this->label='Excel 2007 by PHPSpreadSheet'; // Label of driver
$this->label='Excel 2007'; // Label of driver
$this->desc = $langs->trans('Excel2007FormatDesc');
$this->extension='xlsx'; // Extension for generated file by this driver
$this->picto='mime/xls'; // Picto

View File

@ -1238,23 +1238,6 @@ class pdf_crabe extends ModelePDFFactures
//}
// VAT
// Situations totals migth be wrong on huge amounts
if ($object->situation_cycle_ref && $object->situation_counter > 1) {
$sum_pdf_tva = 0;
foreach($this->tva as $tvakey => $tvaval){
$sum_pdf_tva+=$tvaval; // sum VAT amounts to compare to object
}
if($sum_pdf_tva!=$object->total_tva) { // apply coef to recover the VAT object amount (the good one)
$coef_fix_tva = $object->total_tva / $sum_pdf_tva;
foreach($this->tva as $tvakey => $tvaval) {
$this->tva[$tvakey]=$tvaval * $coef_fix_tva;
}
}
}
foreach($this->tva as $tvakey => $tvaval)
{
if ($tvakey != 0) // On affiche pas taux 0

View File

@ -137,7 +137,7 @@ class ImportCsv extends ModeleImports
*
* @param Translate $outputlangs Output language
* @param array $headerlinefields Array of fields name
* @return string
* @return string$limittoachartaccount
*/
public function write_title_example($outputlangs, $headerlinefields)
{
@ -443,11 +443,29 @@ class ImportCsv extends ModeleImports
}
$classinstance=new $class($this->db);
// Try the fetch from code or ref
call_user_func_array(array($classinstance, $method), array('', $newval));
$param_array = array('', $newval);
if ($class == 'AccountingAccount')
{
//var_dump($arrayrecord[0]['val']);
/*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php';
$tmpchartofaccount = new AccountancySystem($this->db);
$tmpchartofaccount->fetch($conf->global->CHARTOFACCOUNTS);
var_dump($tmpchartofaccount->ref.' - '.$arrayrecord[0]['val']);
if ((! ($conf->global->CHARTOFACCOUNTS > 0)) || $tmpchartofaccount->ref != $arrayrecord[0]['val'])
{
$this->errors[$error]['lib']=$langs->trans('ErrorImportOfChartLimitedToCurrentChart', $tmpchartofaccount->ref);
$this->errors[$error]['type']='RESTRICTONCURRENCTCHART';
$errorforthistable++;
$error++;
}*/
$param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart.
}
call_user_func_array(array($classinstance, $method), $param_array);
// If not found, try the fetch from label
if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel')
{
call_user_func_array(array($classinstance, $method), array('', '', $newval));
$param_array = array('', '', $newval);
call_user_func_array(array($classinstance, $method), $param_array);
}
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id;
//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
@ -459,7 +477,7 @@ class ImportCsv extends ModeleImports
{
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element']));
else $this->errors[$error]['lib']='ErrorFieldValueNotIn';
else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile';
$this->errors[$error]['type']='FOREIGNKEY';
$errorforthistable++;
$error++;

View File

@ -470,11 +470,29 @@ class ImportXlsx extends ModeleImports
}
$classinstance=new $class($this->db);
// Try the fetch from code or ref
call_user_func_array(array($classinstance, $method), array('', $newval));
$param_array = array('', $newval);
if ($class == 'AccountingAccount')
{
//var_dump($arrayrecord[0]['val']);
/*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php';
$tmpchartofaccount = new AccountancySystem($this->db);
$tmpchartofaccount->fetch($conf->global->CHARTOFACCOUNTS);
var_dump($tmpchartofaccount->ref.' - '.$arrayrecord[0]['val']);
if ((! ($conf->global->CHARTOFACCOUNTS > 0)) || $tmpchartofaccount->ref != $arrayrecord[0]['val'])
{
$this->errors[$error]['lib']=$langs->trans('ErrorImportOfChartLimitedToCurrentChart', $tmpchartofaccount->ref);
$this->errors[$error]['type']='RESTRICTONCURRENCTCHART';
$errorforthistable++;
$error++;
}*/
$param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart.
}
call_user_func_array(array($classinstance, $method), $param_array);
// If not found, try the fetch from label
if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel')
{
call_user_func_array(array($classinstance, $method), array('', '', $newval));
$param_array = array('', '', $newval);
call_user_func_array(array($classinstance, $method), $param_array);
}
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id;
//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
@ -486,7 +504,7 @@ class ImportXlsx extends ModeleImports
{
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element']));
else $this->errors[$error]['lib']='ErrorFieldValueNotIn';
else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile';
$this->errors[$error]['type']='FOREIGNKEY';
$errorforthistable++;
$error++;

View File

@ -301,11 +301,12 @@ class modAccounting extends DolibarrModules
$this->import_tables_array[$r]=array('aa'=>MAIN_DB_PREFIX.'accounting_account');
$this->import_tables_creator_array[$r]=array('aa'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r]=array('aa.fk_pcg_version'=>"Chartofaccounts*",'aa.account_number'=>"AccountAccounting*",'aa.label'=>"Label*",'aa.account_parent'=>"Accountparent","aa.fk_accounting_category"=>"AccountingCategory","aa.pcg_type"=>"Pcgtype*",'aa.pcg_subtype'=>'Pcgsubtype*','aa.active'=>'Status*','aa.datec'=>"DateCreation");
$this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^\d{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^\d{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$');
$this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^.{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^.{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$');
$this->import_convertvalue_array[$r]=array(
'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'),
'aa.account_parent'=>array('rule'=>'zeroifnull'),
'aa.account_parent'=>array('rule'=>'fetchidfromref','classfile'=>'/accountancy/class/accountingaccount.class.php','class'=>'AccountingAccount','method'=>'fetch','element'=>'AccountingAccount'),
'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'),
);
$this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28");
$this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"ref:7 or id:1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28");
$this->import_updatekeys_array[$r]=array('aa.fk_pcg_version'=>'Chartofaccounts','aa.account_number'=>'AccountAccounting');
}
}

View File

@ -1,174 +0,0 @@
<?php
require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
/**
* Class to manage logging to ChromPHP
*/
class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
{
public $code = 'chromephp';
/**
* Return name of logger
*
* @return string Name of logger
*/
public function getName()
{
return 'ChromePHP';
}
/**
* Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development')
*
* @return string
*/
public function getVersion()
{
return 'dolibarr';
}
/**
* Content of the info tooltip.
*
* @return string
*/
public function getInfo()
{
return '';
}
/**
* Return warning if something is wrong with logger
*
* @return string
*/
public function getWarning()
{
global $langs;
return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', 'ChromePhp.class.php');
}
/**
* Is the module active ?
*
* @return int -1 if not active, 0 if active but lib/path not found, 1 if OK
*/
public function isActive()
{
global $conf;
try
{
if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) {
$conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/';
}
set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
$res = @include_once 'ChromePhp.php';
if (! $res) $res=@include_once 'ChromePhp.class.php';
restore_include_path();
if ($res)
{
return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler
}
else
{
return 0;
}
}
catch(Exception $e)
{
print '<!-- ChromePHP not available into PHP -->'."\n";
}
return -1;
}
/**
* Return array of configuration data
*
* @return array Return array of configuration data
*/
public function configure()
{
global $langs;
return array(
array(
'name' => $langs->trans('IncludePath', 'SYSLOG_CHROMEPHP_INCLUDEPATH'),
'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH',
'default' => DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/',
'attr' => 'size="60"',
'example' =>'/usr/share/php, '.DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/'
)
);
}
/**
* Return if configuration is valid
*
* @return array Array of errors. Empty array if ok.
*/
public function checkConfiguration()
{
global $langs,$conf;
$errors = array();
if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php'))
{
$conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP = 1; // avoid infinite loop
if (is_object($langs)) // $langs may not be defined yet.
{
$errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php');
}
else
{
$errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php";
}
}
return $errors;
}
/**
* Output log content. We also start output buffering at first log write.
*
* @param array $content Content to log
* @return null|false
*/
public function export($content)
{
global $conf;
if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler
//We check the configuration to avoid showing PHP warnings
if (count($this->checkConfiguration()) > 0) return false;
try
{
// Warning ChromePHP must be into PHP include path. It is not possible to use into require_once a constant from
// database or config file because we must be able to log data before database or config file read.
$oldinclude=get_include_path();
set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
$res = @include_once 'ChromePhp.php';
if (! $res) $res=@include_once 'ChromePhp.class.php';
set_include_path($oldinclude);
ob_start(); // To be sure headers are not flushed until all page is completely processed
if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']);
elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']);
elseif ($content['level'] == LOG_INFO) ChromePhp::log($content['message']);
else ChromePhp::log($content['message']);
}
catch (Exception $e)
{
// Do not use dol_syslog here to avoid infinite loop
}
}
}

View File

@ -1,175 +0,0 @@
<?php
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
/**
* Class to manage logging to a FirePHP
*/
class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
{
public $code = 'firephp';
private static $firephp_include_path = '/includes/firephp/firephp-core/lib/';
private static $firephp_class_path = 'FirePHPCore/FirePHP.class.php';
/**
* Return name of logger
*
* @return string Name of logger
*/
public function getName()
{
return 'FirePHP';
}
/**
* Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development')
*
* @return string
*/
public function getVersion()
{
return 'dolibarr';
}
/**
* Content of the info tooltip.
*
* @return false|string
*/
public function getInfo()
{
global $langs;
return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path);
}
/**
* Is the module active ?
*
* @return int
*/
public function isActive()
{
global $conf;
try
{
if (empty($conf->global->SYSLOG_FIREPHP_INCLUDEPATH)) {
$conf->global->SYSLOG_FIREPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . self::$firephp_include_path;
}
set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH);
$res = @include_once self::$firephp_class_path;
restore_include_path();
if ($res) {
return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_FIREPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_FIREPHP to 1 to disable this loghandler
} else {
return 0;
}
}
catch(Exception $e)
{
print '<!-- FirePHP not available into PHP -->'."\n";
}
return -1;
}
/**
* Return array of configuration data
*
* @return array Return array of configuration data
*/
public function configure()
{
global $langs;
return array(
array(
'name' => $langs->trans('IncludePath', 'SYSLOG_FIREPHP_INCLUDEPATH'),
'constant' => 'SYSLOG_FIREPHP_INCLUDEPATH',
'default' => DOL_DOCUMENT_ROOT . self::$firephp_include_path,
'attr' => 'size="60"',
'example' => '/usr/share/php, ' . DOL_DOCUMENT_ROOT . self::$firephp_include_path
)
);
}
/**
* Return if configuration is valid
*
* @return array Array of errors. Empty array if ok.
*/
public function checkConfiguration()
{
global $conf, $langs;
$errors = array();
if (!file_exists($conf->global->SYSLOG_FIREPHP_INCLUDEPATH . self::$firephp_class_path))
{
$conf->global->MAIN_SYSLOG_DISABLE_FIREPHP = 1; // avoid infinite loop
if (is_object($langs)) // $langs may not be defined yet.
{
$errors[] = $langs->trans("ErrorFailedToOpenFile", self::$firephp_class_path);
}
else
{
$errors[] = "ErrorFailedToOpenFile " . self::$firephp_class_path;
}
}
return $errors;
}
/**
* Output log content
*
* @param array $content Content to log
* @return null|false
*/
public function export($content)
{
global $conf;
if (! empty($conf->global->MAIN_SYSLOG_DISABLE_FIREPHP)) return; // Global option to disable output of this handler
//We check the configuration to avoid showing PHP warnings
if (count($this->checkConfiguration())) return false;
try
{
// Warning FirePHPCore must be into PHP include path. It is not possible to use into require_once a constant from
// database or config file because we must be able to log data before database or config file read.
$oldinclude=get_include_path();
set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH);
include_once self::$firephp_class_path;
set_include_path($oldinclude);
ob_start(); // To be sure headers are not flushed until all page is completely processed
$firephp = FirePHP::getInstance(true);
if ($content['level'] == LOG_ERR) $firephp->error($content['message']);
elseif ($content['level'] == LOG_WARNING) $firephp->warn($content['message']);
elseif ($content['level'] == LOG_INFO) $firephp->log($content['message']);
else $firephp->log($content['message']);
}
catch (Exception $e)
{
// Do not use dol_syslog here to avoid infinite loop
return false;
}
}
}

View File

@ -488,7 +488,7 @@ jQuery(document).ready(function() {
console.log("We click on submitcrop");
var idClicked = e.target.id;
if (parseInt(jQuery(\'#w\').val())) return true;
alert(\''.dol_escape_js($langs->trans("ErrorFieldRequired", $langs->trans("Dimension"))).'\');
alert(\''.dol_escape_js($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Dimension"))).'\');
return false;
});
});

View File

@ -90,10 +90,10 @@ foreach($object->fields as $key => $val)
print '<tr><td';
print ' class="titlefield fieldname_'.$key;
if ($val['notnull'] > 0) print ' fieldrequired';
//if ($val['notnull'] > 0) print ' fieldrequired'; // No fieldrequired inthe view output
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
print '">';
if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']);
if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
else print $langs->trans($val['label']);
print '</td>';
print '<td>';

View File

@ -129,7 +129,7 @@ if ($permission) {
<?php $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
</div>
<div class="tagtd maxwidthonsmartphone noborderbottom">
<?php $nbofcontacts=$form->select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 0, 'minwidth100imp'); ?>
<?php $nbofcontacts=$form->select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp'); ?>
</div>
<div class="tagtd maxwidthonsmartphone noborderbottom">
<?php

View File

@ -31,6 +31,7 @@ if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text
if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string
$sql .= natural_search($extrafieldsobjectprefix.$tmpkey, $crit, $mode_search);
}

View File

@ -159,11 +159,11 @@ class Cronjob extends CommonObject
// Check parameters
// Put here code to add a control on parameters values
if (dol_strlen($this->datestart)==0) {
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronDtStart'));
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronDtStart'));
$error++;
}
if (empty($this->label)) {
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronLabel'));
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronLabel'));
$error++;
}
if ((dol_strlen($this->datestart)!=0) && (dol_strlen($this->dateend)!=0) && ($this->dateend<$this->datestart)) {
@ -171,28 +171,27 @@ class Cronjob extends CommonObject
$error++;
}
if (empty($this->unitfrequency)) {
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronFrequency'));
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronFrequency'));
$error++;
}
if (($this->jobtype=='command') && (empty($this->command))) {
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronCommand'));
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronCommand'));
$error++;
}
if (($this->jobtype=='method') && (empty($this->classesname))) {
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronClass'));
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronClass'));
$error++;
}
if (($this->jobtype=='method' || $this->jobtype == 'function') && (empty($this->methodename))) {
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronMethod'));
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronMethod'));
$error++;
}
if (($this->jobtype=='method') && (empty($this->objectname))) {
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronObject'));
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronObject'));
$error++;
}
if (($this->jobtype=='function') && (empty($this->libname))) {
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronLib'));
$this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronLib'));
$error++;
}

View File

@ -55,7 +55,7 @@ $pagenext = $page + 1;
if (! $sortfield) $sortfield='t.status,t.priority';
if (! $sortorder) $sortorder='DESC,ASC';
$search_status=GETPOST('search_status', 'int')?GETPOST('search_status', 'int'):GETPOST('status', 'int');
$search_status=(GETPOSTISSET('search_status')?GETPOST('search_status', 'int'):GETPOST('status', 'int'));
//Search criteria
$search_label=GETPOST("search_label", 'alpha');
@ -251,7 +251,7 @@ $sql.= " t.libname,";
$sql.= " t.test";
$sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t";
$sql.= " WHERE entity IN (0,".$conf->entity.")";
if ($search_status >= 0 && $search_status < 2) $sql.= " AND t.status = ".(empty($search_status)?'0':'1');
if ($search_status >= 0 && $search_status < 2 && $search_status != '') $sql.= " AND t.status = ".(empty($search_status)?'0':'1');
//Manage filter
if (is_array($filter) && count($filter)>0) {
foreach($filter as $key => $value) {
@ -337,12 +337,9 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="search_status" value="'.$search_status.'" >';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
// Line with explanation and button new job
$newcardbutton='';
$newcardbutton.= dolGetButtonTitle($langs->trans('New'), $langs->trans('CronCreateJob'), 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter, '', $user->rights->cron->create);
// Line with explanation and button new
$newcardbutton = dolGetButtonTitle($langs->trans('New'), $langs->trans('CronCreateJob'), 'fa fa-plus-circle', DOL_URL_ROOT.'/cron/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->cron->create);
print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_setup', 0, $newcardbutton, '', $limit);

View File

@ -84,14 +84,14 @@ if ($action == 'update')
if (empty($donation_date))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = "create";
$error++;
}
if (empty($amount))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$action = "create";
$error++;
}
@ -140,14 +140,14 @@ if ($action == 'add')
if (empty($donation_date))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = "create";
$error++;
}
if (empty($amount))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$action = "create";
$error++;
}

View File

@ -271,32 +271,32 @@ class Don extends CommonObject
{
if ((dol_strlen(trim($this->lastname)) + dol_strlen(trim($this->firstname))) == 0)
{
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Company').'/'.$langs->trans('Firstname').'-'.$langs->trans('Lastname'));
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Company').'/'.$langs->transnoentitiesnoconv('Firstname').'-'.$langs->transnoentitiesnoconv('Lastname'));
$err++;
}
}
if (dol_strlen(trim($this->address)) == 0)
{
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Address'));
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Address'));
$err++;
}
if (dol_strlen(trim($this->zip)) == 0)
{
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Zip'));
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Zip'));
$err++;
}
if (dol_strlen(trim($this->town)) == 0)
{
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Town'));
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Town'));
$err++;
}
if (dol_strlen(trim($this->email)) == 0)
{
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('EMail'));
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('EMail'));
$err++;
}
@ -308,7 +308,7 @@ class Don extends CommonObject
{
if (!isset($map[substr($this->amount, $i, 1)]))
{
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Amount'));
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Amount'));
$err++;
$amount_invalid = 1;
break;
@ -319,14 +319,14 @@ class Don extends CommonObject
{
if ($this->amount == 0)
{
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Amount'));
$error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Amount'));
$err++;
}
else
{
if ($this->amount < $minimum && $minimum > 0)
{
$error_string[] = $langs->trans('MinimumAmount', $langs->trans('$minimum'));
$error_string[] = $langs->trans('MinimumAmount', $langs->transnoentitiesnoconv('$minimum'));
$err++;
}
}

View File

@ -2076,17 +2076,13 @@ else
if ($action != 'editline' || $line->rowid != GETPOST('rowid', 'int'))
{
print '<tr class="oddeven">';
// Num
print '<td class="center">';
print $numline;
print '</td>';
/*print '<td class="center">';
print img_picto($langs->trans("Document"), "object_generic");
print ' <span>'.$piece_comptable.'</span>';
print '</td>';*/
// Date
print '<td class="center">'.dol_print_date($db->jdate($line->date), 'day').'</td>';
// Project
if (! empty($conf->projet->enabled))
{
print '<td>';
@ -2094,21 +2090,26 @@ else
{
$projecttmp->id=$line->fk_project;
$projecttmp->ref=$line->projet_ref;
$projecttmp->title=$line->projet_title;
print $projecttmp->getNomUrl(1);
}
print '</td>';
}
// IK
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
{
print '<td class="fk_c_exp_tax_cat">';
print dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label');
print '</td>';
}
// Type of fee
print '<td class="center">';
$labeltype = ($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans($line->type_fees_code));
print $labeltype;
print '</td>';
// Comment
print '<td class="left">'.dol_nl2br($line->comments).'</td>';
// VAT rate
print '<td class="right">'.vatrate($line->vatrate, true).'</td>';
// Unit price HT
print '<td class="right">';
@ -2716,9 +2717,6 @@ if ($action != 'create' && $action != 'edit')
print '</div>';
//$conf->global->DOL_URL_ROOT_DOCUMENT_PHP=dol_buildpath('/expensereport/documentwrapper.php',1);
// Select mail models is same action as presend
if (GETPOST('modelselected', 'alpha')) {
$action = 'presend';

View File

@ -1009,7 +1009,7 @@ if ($step == 4 && $datatoexport)
print '<td class="right" width="100">';
print $value.' ';
print '</td><td class="center" width="20">';
print '</td><td class="center nowraponall" width="40">';
if ($value < count($array_selected)) print '<a href="'.$_SERVER["PHP_SELF"].'?step='.$step.'&datatoexport='.$datatoexport.'&action=downfield&field='.$code.'">'.img_down().'</a>';
if ($value > 1) print '<a href="'.$_SERVER["PHP_SELF"].'?step='.$step.'&datatoexport='.$datatoexport.'&action=upfield&field='.$code.'">'.img_up().'</a>';
print '</td>';

View File

@ -427,7 +427,7 @@ if (empty($reshook))
}
else
{
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->trans("ThirdParty")).'</div>';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")).'</div>';
$action = 'create';
}
}

View File

@ -1540,7 +1540,7 @@ class CommandeFournisseur extends CommonOrder
// Check parameters
if ($qty < 1 && ! $fk_product)
{
$this->error=$langs->trans("ErrorFieldRequired", $langs->trans("Product"));
$this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product"));
return -1;
}
if ($type < 0) return -1;

View File

@ -71,6 +71,11 @@ $error = 0;
* Actions
*/
if (GETPOST('cancel', 'alpha'))
{
$action = '';
}
// If create a request
if ($action == 'create')
{
@ -193,7 +198,35 @@ if ($action == 'create')
}
}
if ($action == 'update')
if ($action == 'update' && GETPOSTISSET('savevalidator') && ! empty($user->rights->holiday->approve))
{
$object = new Holiday($db);
$object->fetch($id);
$object->oldcopy = dol_clone($object);
$object->fk_validator = GETPOST('valideur', 'int');
if ($object->fk_validator != $object->oldcopy->fk_validator)
{
$verif = $object->update($user);
if ($verif <= 0)
{
setEventMessages($object->error, $object->errors, 'warnings');
$action='editvalidator';
}
else
{
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
}
}
$action = '';
}
if ($action == 'update' && ! GETPOSTISSET('savevalidator'))
{
$date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'));
$date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'));
@ -1087,9 +1120,10 @@ else
{
$head=holiday_prepare_head($object);
if ($action == 'edit' && $object->statut == 1)
if (($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) || ($action == 'editvalidator'))
{
$edit = true;
if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) $edit = true;
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'."\n";
print '<input type="hidden" name="action" value="update"/>'."\n";
print '<input type="hidden" name="id" value="'.$object->id.'" />'."\n";
@ -1129,7 +1163,7 @@ else
$starthalfday=($object->halfday == -1 || $object->halfday == 2)?'afternoon':'morning';
$endhalfday=($object->halfday == 1 || $object->halfday == 2)?'morning':'afternoon';
if(!$edit)
if (!$edit)
{
print '<tr>';
print '<td class="nowrap">'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
@ -1178,7 +1212,7 @@ else
print '<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).'</td>';
print '</tr>';
if ($object->statut == 5)
if ($object->statut == Holiday::STATUS_REFUSED)
{
print '<tr>';
print '<td>'.$langs->trans('DetailRefusCP').'</td>';
@ -1228,25 +1262,40 @@ else
}
// Validator
if (!$edit) {
if (!$edit && $action != 'editvalidator') {
print '<tr>';
print '<td class="titlefield">';
if ($object->statut == 3 || $object->statut == 4) print $langs->trans('ApprovedBy');
if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) print $langs->trans('ApprovedBy');
else print $langs->trans('ReviewedByCP');
print '</td>';
print '<td>'.$valideur->getNomUrl(-1).'</td>';
print '<td>'.$valideur->getNomUrl(-1);
$include_users = $object->fetch_users_approver_holiday();
if (is_array($include_users) && in_array($user->id, $include_users) && $object->statut == Holiday::STATUS_VALIDATED)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editvalidator">'.img_edit($langs->trans("Edit")).'</a>';
}
print '</td>';
print '</tr>';
} else {
print '<tr>';
print '<td class="titlefield">'.$langs->trans('ReviewedByCP').'</td>';
print '<td>';
$include_users = $object->fetch_users_approver_holiday();
if (! in_array($object->fk_validator, $include_users)) // Add the current validator to the list to not lose it when editing.
{
$include_users[]=$object->fk_validator;
}
if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays");
else
{
$s=$form->select_dolusers($object->fk_validator, "valideur", 1, ($user->admin ? '' : array($user->id)), 0, $include_users);
$s=$form->select_dolusers($object->fk_validator, "valideur", (($action == 'editvalidator') ? 0 : 1), ($user->admin ? '' : array($user->id)), 0, $include_users);
print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
}
if ($action == 'editvalidator')
{
print '<input type="submit" class="button" name="savevalidator" value="'.$langs->trans("Save").'">';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</td>';
print '</tr>';
}
@ -1255,19 +1304,19 @@ else
print '<td>'.$langs->trans('DateCreateCP').'</td>';
print '<td>'.dol_print_date($object->date_create, 'dayhour').'</td>';
print '</tr>';
if ($object->statut == 3 || $object->statut == 4) {
if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) {
print '<tr>';
print '<td>'.$langs->trans('DateValidCP').'</td>';
print '<td>'.dol_print_date($object->date_valid, 'dayhour').'</td>'; // warning: date_valid is approval date on holiday module
print '</tr>';
}
if ($object->statut == 4) {
if ($object->statut == Holiday::STATUS_CANCELED) {
print '<tr>';
print '<td>'.$langs->trans('DateCancelCP').'</td>';
print '<td>'.dol_print_date($object->date_cancel, 'dayhour').'</td>';
print '</tr>';
}
if ($object->statut == 5) {
if ($object->statut == Holiday::STATUS_REFUSED) {
print '<tr>';
print '<td>'.$langs->trans('DateRefusCP').'</td>';
print '<td>'.dol_print_date($object->date_refuse, 'dayhour').'</td>';
@ -1325,20 +1374,21 @@ else
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleSetToDraft"), $langs->trans("ConfirmSetToDraft"), "confirm_draft", '', 1, 1);
}
if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT)
if (($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) || ($action == 'editvalidator'))
{
print '<div class="center">';
if ($cancreate && $object->statut == Holiday::STATUS_DRAFT)
if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT)
{
print '<input type="submit" value="'.$langs->trans("Save").'" class="button">';
print '<div class="center">';
if ($cancreate && $object->statut == Holiday::STATUS_DRAFT)
{
print '<input type="submit" value="'.$langs->trans("Save").'" class="button">';
}
print '</div>';
}
print '</div>';
print '</form>';
}
if (! $edit)
{
print '<div class="tabsAction">';

View File

@ -127,7 +127,7 @@ elseif ($action == 'update')
$name = GETPOST('name', 'alpha');
if (empty($name)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->trans('Name')), null, 'errors');
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Name')), null, 'errors');
$error ++;
}
@ -291,7 +291,7 @@ if (($id || $ref) && $action == 'edit')
print '<tr><td>'.$form->editfieldkey('Name', 'name', '', $object, 0, 'string', '', 1).'</td><td>';
print '<input name="name" id="name" class="flat" size="32" value="'.$object->name.'">';
print '</td></tr>';
// Parent
print '<tr><td>'.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).'</td>';
print '<td class="maxwidthonsmartphone">';
@ -380,7 +380,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td class="titlefield">'.$langs->trans("Name").'</td>';
print '<td>'.$object->name.'</td>';
print '</tr>';
// Parent
print '<tr>';
print '<td class="titlefield">'.$langs->trans("Parent").'</td>';

View File

@ -1,446 +0,0 @@
<?php
/**
* Copyright 2010-2013 Craig Campbell
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Server Side Chrome PHP debugger class
*
* @package ChromePhp
* @author Craig Campbell <iamcraigcampbell@gmail.com>
*/
class ChromePhp
{
/**
* @var string
*/
const VERSION = '4.1.0';
/**
* @var string
*/
const HEADER_NAME = 'X-ChromeLogger-Data';
/**
* @var string
*/
const BACKTRACE_LEVEL = 'backtrace_level';
/**
* @var string
*/
const LOG = 'log';
/**
* @var string
*/
const WARN = 'warn';
/**
* @var string
*/
const ERROR = 'error';
/**
* @var string
*/
const GROUP = 'group';
/**
* @var string
*/
const INFO = 'info';
/**
* @var string
*/
const GROUP_END = 'groupEnd';
/**
* @var string
*/
const GROUP_COLLAPSED = 'groupCollapsed';
/**
* @var string
*/
const TABLE = 'table';
/**
* @var string
*/
protected $_php_version;
/**
* @var int
*/
protected $_timestamp;
/**
* @var array
*/
protected $_json = array(
'version' => self::VERSION,
'columns' => array('log', 'backtrace', 'type'),
'rows' => array()
);
/**
* @var array
*/
protected $_backtraces = array();
/**
* @var bool
*/
protected $_error_triggered = false;
/**
* @var array
*/
protected $_settings = array(
self::BACKTRACE_LEVEL => 1
);
/**
* @var ChromePhp
*/
protected static $_instance;
/**
* Prevent recursion when working with objects referring to each other
*
* @var array
*/
protected $_processed = array();
/**
* constructor
*/
private function __construct()
{
$this->_php_version = phpversion();
$this->_timestamp = $this->_php_version >= 5.1 ? $_SERVER['REQUEST_TIME'] : time();
$this->_json['request_uri'] = $_SERVER['REQUEST_URI'];
}
/**
* gets instance of this class
*
* @return ChromePhp
*/
public static function getInstance()
{
if (self::$_instance === null) {
self::$_instance = new self();
}
return self::$_instance;
}
/**
* logs a variable to the console
*
* @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
* @return void
*/
public static function log()
{
$args = func_get_args();
return self::_log('', $args);
}
/**
* logs a warning to the console
*
* @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
* @return void
*/
public static function warn()
{
$args = func_get_args();
return self::_log(self::WARN, $args);
}
/**
* logs an error to the console
*
* @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
* @return void
*/
public static function error()
{
$args = func_get_args();
return self::_log(self::ERROR, $args);
}
/**
* sends a group log
*
* @param string value
*/
public static function group()
{
$args = func_get_args();
return self::_log(self::GROUP, $args);
}
/**
* sends an info log
*
* @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
* @return void
*/
public static function info()
{
$args = func_get_args();
return self::_log(self::INFO, $args);
}
/**
* sends a collapsed group log
*
* @param string value
*/
public static function groupCollapsed()
{
$args = func_get_args();
return self::_log(self::GROUP_COLLAPSED, $args);
}
/**
* ends a group log
*
* @param string value
*/
public static function groupEnd()
{
$args = func_get_args();
return self::_log(self::GROUP_END, $args);
}
/**
* sends a table log
*
* @param string value
*/
public static function table()
{
$args = func_get_args();
return self::_log(self::TABLE, $args);
}
/**
* internal logging call
*
* @param string $type
* @return void
*/
protected static function _log($type, array $args)
{
// nothing passed in, don't do anything
if (count($args) == 0 && $type != self::GROUP_END) {
return;
}
$logger = self::getInstance();
$logger->_processed = array();
$logs = array();
foreach ($args as $arg) {
$logs[] = $logger->_convert($arg);
}
$backtrace = debug_backtrace(false);
$level = $logger->getSetting(self::BACKTRACE_LEVEL);
$backtrace_message = 'unknown';
if (isset($backtrace[$level]['file']) && isset($backtrace[$level]['line'])) {
$backtrace_message = $backtrace[$level]['file'] . ' : ' . $backtrace[$level]['line'];
}
$logger->_addRow($logs, $backtrace_message, $type);
}
/**
* converts an object to a better format for logging
*
* @param Object
* @return array
*/
protected function _convert($object)
{
// if this isn't an object then just return it
if (!is_object($object)) {
return $object;
}
//Mark this object as processed so we don't convert it twice and it
//Also avoid recursion when objects refer to each other
$this->_processed[] = $object;
$object_as_array = array();
// first add the class name
$object_as_array['___class_name'] = get_class($object);
// loop through object vars
$object_vars = get_object_vars($object);
foreach ($object_vars as $key => $value) {
// same instance as parent object
if ($value === $object || in_array($value, $this->_processed, true)) {
$value = 'recursion - parent object [' . get_class($value) . ']';
}
$object_as_array[$key] = $this->_convert($value);
}
$reflection = new ReflectionClass($object);
// loop through the properties and add those
foreach ($reflection->getProperties() as $property) {
// if one of these properties was already added above then ignore it
if (array_key_exists($property->getName(), $object_vars)) {
continue;
}
$type = $this->_getPropertyKey($property);
if ($this->_php_version >= 5.3) {
$property->setAccessible(true);
}
try {
$value = $property->getValue($object);
} catch (ReflectionException $e) {
$value = 'only PHP 5.3 can access private/protected properties';
}
// same instance as parent object
if ($value === $object || in_array($value, $this->_processed, true)) {
$value = 'recursion - parent object [' . get_class($value) . ']';
}
$object_as_array[$type] = $this->_convert($value);
}
return $object_as_array;
}
/**
* takes a reflection property and returns a nicely formatted key of the property name
*
* @param ReflectionProperty
* @return string
*/
protected function _getPropertyKey(ReflectionProperty $property)
{
$static = $property->isStatic() ? ' static' : '';
if ($property->isPublic()) {
return 'public' . $static . ' ' . $property->getName();
}
if ($property->isProtected()) {
return 'protected' . $static . ' ' . $property->getName();
}
if ($property->isPrivate()) {
return 'private' . $static . ' ' . $property->getName();
}
}
/**
* adds a value to the data array
*
* @var mixed
* @return void
*/
protected function _addRow(array $logs, $backtrace, $type)
{
// if this is logged on the same line for example in a loop, set it to null to save space
if (in_array($backtrace, $this->_backtraces)) {
$backtrace = null;
}
// for group, groupEnd, and groupCollapsed
// take out the backtrace since it is not useful
if ($type == self::GROUP || $type == self::GROUP_END || $type == self::GROUP_COLLAPSED) {
$backtrace = null;
}
if ($backtrace !== null) {
$this->_backtraces[] = $backtrace;
}
$row = array($logs, $backtrace, $type);
$this->_json['rows'][] = $row;
$this->_writeHeader($this->_json);
}
protected function _writeHeader($data)
{
header(self::HEADER_NAME . ': ' . $this->_encode($data));
}
/**
* encodes the data to be sent along with the request
*
* @param array $data
* @return string
*/
protected function _encode($data)
{
return base64_encode(utf8_encode(json_encode($data)));
}
/**
* adds a setting
*
* @param string key
* @param mixed value
* @return void
*/
public function addSetting($key, $value)
{
$this->_settings[$key] = $value;
}
/**
* add ability to set multiple settings in one call
*
* @param array $settings
* @return void
*/
public function addSettings(array $settings)
{
foreach ($settings as $key => $value) {
$this->addSetting($key, $value);
}
}
/**
* gets a setting
*
* @param string key
* @return mixed
*/
public function getSetting($key)
{
if (!isset($this->_settings[$key])) {
return null;
}
return $this->_settings[$key];
}
}

View File

@ -1,23 +0,0 @@
## Overview
ChromePhp is a PHP library for the Chrome Logger Google Chrome extension.
This library allows you to log variables to the Chrome console.
## Requirements
- PHP 5 or later
## Installation
1. Install the Chrome extension from: https://chrome.google.com/extensions/detail/noaneddfkdjfnfdakjjmocngnfkfehhd
2. Click the extension icon in the browser to enable it for the current tab's domain
3. Put ChromePhp.php somewhere in your PHP include path
4. Log some data
```php
include 'ChromePhp.php';
ChromePhp::log('Hello console!');
ChromePhp::log($_SERVER);
ChromePhp::warn('something went wrong!');
```
More information can be found here:
http://www.chromelogger.com

View File

@ -1,24 +0,0 @@
{
"name": "ccampbell/chromephp",
"type": "library",
"description": "Log variables to the Chrome console (via Chrome Logger Google Chrome extension).",
"keywords": ["log","logging"],
"homepage": "http://github.com/ccampbell/chromephp",
"license": "Apache-2.0",
"authors": [
{
"name": "Craig Campbell",
"email": "iamcraigcampbell@gmail.com",
"homepage": "http://craig.is",
"role": "Developer"
}
],
"require": {
"php": ">=5.0.0"
},
"autoload": {
"psr-0": {
"ChromePhp": ""
}
}
}

View File

@ -129,3 +129,6 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE
-- Description of chart of account DZ NSCF
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 13, 'NSCF', 'Nouveau système comptable financier', 1);
-- Description of chart of account NL NL-VERKORT
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 17, 'NL-VERKORT', 'Verkort rekeningschema', 1);

View File

@ -0,0 +1,117 @@
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
-- Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
--
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
-- de l'install et tous les sigles '--' sont supprimés.
--
-- Description of the accounts in NL-VERKORT
-- ID 0100-9999
-- ADD 7006000 to rowid # Do no remove this comment --
--
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1000, 'NL_VERKORT', 'BALANS', 'XXXXXX', '0050', '', 'Bedrijfspand en woning', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1001, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0055', '', 'Afschrijving bedrijfspand en woning', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1002, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0100', '', 'Inventaris', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1003, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0105', '', 'Afschrijving inventaris', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1004, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0150', '', 'Kantoor-inventaris', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1005, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0155', '', 'Afschrijving kantoor-inventaris', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1006, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0200', '', 'Transportmiddelen', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1007, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0205', '', 'Afschrijving transportmiddelen', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1008, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1100', '', 'Kas', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1009, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1200', '', 'Bank', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1010, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1300', '', 'Debiteuren', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1011, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1310', '', 'Oninbare debiteuren', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1012, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1500', '', 'Privé', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1013, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1520', '', 'Privé IB/ZORGVERZ', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1014, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1600', '', 'Crediteuren', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1015, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1700', '', 'Ingehouden loonbelasing', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1016, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1710', '', 'Afdracht loonbelasting', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1017, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1720', '', 'Ingehouden pensioenlasten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1018, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1730', '', 'Reservering vakantiegeld', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1019, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1820', '', 'BTW te betalen hoog', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1020, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1825', '', 'BTW te betalen laag', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1021, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1828', '', 'BTW te betalen auto privé', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1022, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1829', '', 'BTW te betalen telefoon privé', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1023, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1830', '', 'BTW te vorderen hoog', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1024, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1835', '', 'BTW te vorderen laag', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1025, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1890', '', 'Betaalde BTW', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1026, 'NL-VERKORT', 'BALANS', 'XXXXXX', '2200', '', 'Te betalen netto lonen', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1027, 'NL-VERKORT', 'BALANS', 'XXXXXX', '2500', '', 'Kruisposten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1028, 'NL-VERKORT', 'BALANS', 'XXXXXX', '2900', '', 'Vraagposten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1029, 'NL-VERKORT', 'BALANS', 'XXXXXX', '3000', '', 'Voorraad', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1030, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4000', '', 'Kantoorbenodigdheden', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1031, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4010', '', 'Porti', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1032, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4020', '', 'Telefoon/Internet', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1033, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4030', '', 'Onderhoud gebouwen', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1034, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4040', '', 'Overige huisvestingskosten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1035, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4050', '', 'Belastingen en heffingen onroerend goed', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1036, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4060', '', 'Onderhoud inventaris e.d.', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1037, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4070', '', 'Kleine aanschaffingen < 500', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1038, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4080', '', 'Kosten automatisering', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1039, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4090', '', 'Abonnementen en contributies', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1040, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4100', '', 'Autokosten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1041, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4110', '', 'Boetes', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1042, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4120', '', 'Auto brandstof', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1043, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4130', '', 'Auto belasting en verzekering', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1044, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4140', '', 'BTW privé gebruik', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1045, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4150', '', 'Bijtelling auto', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1046, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4200', '', 'Reiskosten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1047, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4210', '', 'Reiskosten/eten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1048, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4220', '', 'Representatiekosten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1049, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4230', '', 'Werkkleding', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1050, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4300', '', 'Magazijnkosten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1051, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4310', '', 'Stroom, gas en water', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1052, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4320', '', 'Huur', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1053, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4330', '', 'Reclamekosten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1054, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4340', '', 'Sponsoring', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1055, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4350', '', 'Vertegenwoordigers/provisie', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1056, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4400', '', 'Bruto lonen', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1057, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4410', '', 'Sociale lasten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1058, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4500', '', 'Afschr. kosten gebouwen', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1059, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4510', '', 'Afschr. kosten bedrijfsinventaris', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1060, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4520', '', 'Afschr. kosten kantoorinventaris', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1061, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4530', '', 'Afschr. kosten transportmiddelen', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1062, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4600', '', 'Administratiekosten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1063, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4610', '', 'Kantinekosten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1064, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4620', '', 'Provisie ass. tussenpersoon', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1065, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4630', '', 'Vraagposten (V&W)', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1066, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4640', '', 'Diverse verzekeringen', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1067, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4700', '', 'Overige kosten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1068, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4750', '', 'Nog te verdelen posten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1069, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4800', '', 'Rente hypotheek', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1070, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4810', '', 'Rente overige leningen', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1071, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4820', '', 'Rente en kosten RC', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1072, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7000', '', 'Inkoop hoog', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1073, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7010', '', 'Inkoop laag', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1074, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7020', '', 'Inkoop nul BTW', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1075, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7030', '', 'Inkoop binnen EU', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1076, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7040', '', 'Inkoop buiten EU', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1077, 'NL-VERKORT', 'INCOME', 'XXXXXX', '8000', '', 'Omzet hoog', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1078, 'NL-VERKORT', 'INCOME', 'XXXXXX', '8010', '', 'Omzet laag', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1079, 'NL-VERKORT', 'INCOME', 'XXXXXX', '8020', '', 'Omzet nul BTW', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1080, 'NL-VERKORT', 'INCOME', 'XXXXXX', '8090', '', 'Onderhanden omzet', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1081, 'NL-VERKORT', 'INCOME', 'XXXXXX', '9000', '', 'Bijzondere baten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1082, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '9010', '', 'Bijzondere lasten', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1083, 'NL-VERKORT', 'BALANS', 'XXXXXX', '9900', '', 'Kapitaal', 1);

View File

@ -270,8 +270,8 @@ CREATE TABLE llx_pos_cash_fence(
-- Withdrawals / Prelevements
UPDATE llx_const set name = 'PRELEVEMENT_END_TO_END' where name = 'END_TO_END';
UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD';
UPDATE llx_const set name = __ENCRYPT('PRELEVEMENT_END_TO_END')__ where name = __ENCRYPT('END_TO_END')__;
UPDATE llx_const set name = __ENCRYPT('PRELEVEMENT_USTRD')__ where name = __ENCRYPT('USTRD')__;
-- Delete duplicate accounting account, but only if not used

View File

@ -212,19 +212,22 @@ CREATE TABLE llx_bom_bom(
description text,
note_public text,
note_private text,
fk_product integer,
qty double(24,8),
efficiency double(8,4),
date_creation datetime NOT NULL,
tms timestamp NOT NULL,
tms timestamp,
date_valid datetime,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
fk_user_valid integer,
import_key varchar(14),
status integer NOT NULL,
fk_product integer,
qty double(24,8)
status integer NOT NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;
ALTER TABLE llx_bom_bom ADD COLUMN efficiency double(8,4) DEFAULT 1;
create table llx_bom_bom_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
@ -236,15 +239,21 @@ create table llx_bom_bom_extrafields
CREATE TABLE llx_bom_bomline(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_bom integer NOT NULL,
fk_product integer NOT NULL,
fk_bom_child integer NULL,
description text,
import_key varchar(14),
qty double(24,8),
fk_product integer,
fk_bom integer,
qty double(24,8) NOT NULL,
efficiency double(8,4) NOT NULL DEFAULT 1,
rank integer NOT NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;
ALTER TABLE llx_bom_bomline ADD COLUMN efficiency double(8,4) DEFAULT 1;
ALTER TABLE llx_bom_bomline ADD COLUMN fk_bom_child integer NULL;
create table llx_bom_bomline_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
@ -295,8 +304,8 @@ ALTER TABLE llx_actioncomm ADD COLUMN calling_duration integer;
ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN datelastok datetime;
ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN maxemailpercollect integer DEFAULT 100;
DELETE FROM llx_const WHERE name = 'THEME_ELDY_USE_HOVER' AND value = '0';
DELETE FROM llx_const WHERE name = 'THEME_ELDY_USE_CHECKED' AND value = '0';
DELETE FROM llx_const WHERE name = __ENCRYPT('THEME_ELDY_USE_HOVER')__ AND value = __ENCRYPT('0')__;
DELETE FROM llx_const WHERE name = __ENCRYPT('THEME_ELDY_USE_CHECKED')__ AND value = __ENCRYPT('0')__;
ALTER TABLE llx_inventorydet DROP COLUMN pmp;
ALTER TABLE llx_inventorydet DROP COLUMN pa;

View File

@ -23,6 +23,9 @@ CREATE TABLE llx_bom_bom(
description text,
note_public text,
note_private text,
fk_product integer,
qty double(24,8),
efficiency double(8,4) DEFAULT 1,
date_creation datetime NOT NULL,
tms timestamp,
date_valid datetime,
@ -30,8 +33,6 @@ CREATE TABLE llx_bom_bom(
fk_user_modif integer,
fk_user_valid integer,
import_key varchar(14),
status integer NOT NULL,
fk_product integer,
qty double(24,8)
status integer NOT NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;

View File

@ -13,15 +13,16 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see http://www.gnu.org/licenses/.
CREATE TABLE llx_bom_bomline(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_bom integer NOT NULL,
fk_product integer NOT NULL,
fk_bom_child integer NULL,
description text,
import_key varchar(14),
qty double(24,8),
fk_product integer,
fk_bom integer,
qty double(24,8) NOT NULL,
efficiency double(8,4) NOT NULL DEFAULT 1,
rank integer NOT NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;
) ENGINE=innodb;

View File

@ -67,17 +67,17 @@ $actiondone=1;
print '<h3>'.$langs->trans("Repair").'</h3>';
print 'Option standard (0 or \'confirmed\') is '.(GETPOST('standard', 'alpha')?GETPOST('standard', 'alpha'):'0').'<br>'."\n";
print 'Option restore_thirdparties_logos (0 or \'confirmed\') is '.(GETPOST('restore_thirdparties_logos', 'alpha')?GETPOST('restore_thirdparties_logos', 'alpha'):'0').'<br>'."\n";
print 'Option clean_linked_elements (0 or \'confirmed\') is '.(GETPOST('clean_linked_elements', 'alpha')?GETPOST('clean_linked_elements', 'alpha'):'0').'<br>'."\n";
print 'Option clean_menus (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_menus', 'alpha')?GETPOST('clean_menus', 'alpha'):'0').'<br>'."\n";
print 'Option clean_orphelin_dir (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir', 'alpha')?GETPOST('clean_orphelin_dir', 'alpha'):'0').'<br>'."\n";
print 'Option clean_product_stock_batch (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch', 'alpha')?GETPOST('clean_product_stock_batch', 'alpha'):'0').'<br>'."\n";
print 'Option set_empty_time_spent_amount (0 or \'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount', 'alpha')?GETPOST('set_empty_time_spent_amount', 'alpha'):'0').'<br>'."\n";
print 'Option rebuild_product_thumbs (0 or \'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs', 'alpha')?GETPOST('rebuild_product_thumbs', 'alpha'):'0').'<br>'."\n";
print 'Option force_disable_of_modules_not_found (0 or \'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'0').'<br>'."\n";
print 'Option clean_perm_table (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha')?GETPOST('clean_perm_table', 'alpha'):'0').'<br>'."\n";
print 'Option force_utf8_on_tables, for mysql/mariadb only (0 or \'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'0').'<br>'."\n";
print 'Option standard (\'test\' or \'confirmed\') is '.(GETPOST('standard', 'alpha')?GETPOST('standard', 'alpha'):'undefined').'<br>'."\n";
print 'Option restore_thirdparties_logos (\'test\' or \'confirmed\') is '.(GETPOST('restore_thirdparties_logos', 'alpha')?GETPOST('restore_thirdparties_logos', 'alpha'):'undefined').'<br>'."\n";
print 'Option clean_linked_elements (\'test\' or \'confirmed\') is '.(GETPOST('clean_linked_elements', 'alpha')?GETPOST('clean_linked_elements', 'alpha'):'undefined').'<br>'."\n";
print 'Option clean_menus (\'test\' or \'confirmed\') is '.(GETPOST('clean_menus', 'alpha')?GETPOST('clean_menus', 'alpha'):'undefined').'<br>'."\n";
print 'Option clean_orphelin_dir (\'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir', 'alpha')?GETPOST('clean_orphelin_dir', 'alpha'):'undefined').'<br>'."\n";
print 'Option clean_product_stock_batch (\'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch', 'alpha')?GETPOST('clean_product_stock_batch', 'alpha'):'undefined').'<br>'."\n";
print 'Option set_empty_time_spent_amount (\'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount', 'alpha')?GETPOST('set_empty_time_spent_amount', 'alpha'):'undefined').'<br>'."\n";
print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs', 'alpha')?GETPOST('rebuild_product_thumbs', 'alpha'):'undefined').'<br>'."\n";
print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'undefined').'<br>'."\n";
print 'Option clean_perm_table (\'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha')?GETPOST('clean_perm_table', 'alpha'):'undefined').'<br>'."\n";
print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'undefined').'<br>'."\n";
print '<br>';
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
@ -302,14 +302,23 @@ if ($ok && GETPOST('standard', 'alpha'))
);
//var_dump($field_desc);exit;
$result=$db->DDLAddField($tableextra, $code, $field_desc, "");
if ($result < 0)
$result = 0;
if (GETPOST('standard', 'alpha') == 'confirmed')
{
print "KO ".$db->lasterror."<br>\n";
$result=$db->DDLAddField($tableextra, $code, $field_desc, "");
if ($result < 0)
{
print "KO ".$db->lasterror."<br>\n";
}
else
{
print "OK<br>\n";
}
}
else
{
print "OK<br>\n";
print ' - Mode test, no column added.';
}
}
}
@ -324,7 +333,6 @@ if ($ok && GETPOST('standard', 'alpha'))
}
// clean_data_ecm_dir: Clean data into ecm_directories table
if ($ok && GETPOST('standard', 'alpha'))
{
@ -332,10 +340,76 @@ if ($ok && GETPOST('standard', 'alpha'))
}
// clean declaration constants
if ($ok && GETPOST('standard', 'alpha'))
{
print '<tr><td colspan="2"><br>*** Clean module_parts entries of modules not enabled</td></tr>';
$sql ="SELECT name, entity, value";
$sql.=" FROM ".MAIN_DB_PREFIX."const as c";
$sql.=" WHERE name LIKE 'MAIN_MODULE_%_TPL' OR name LIKE 'MAIN_MODULE_%_CSS' OR name LIKE 'MAIN_MODULE_%_JS' OR name LIKE 'MAIN_MODULE_%_HOOKS'";
$sql.=" OR name LIKE 'MAIN_MODULE_%_TRIGGERS' OR name LIKE 'MAIN_MODULE_%_THEME' OR name LIKE 'MAIN_MODULE_%_SUBSTITUTIONS' OR name LIKE 'MAIN_MODULE_%_MODELS'";
$sql.=" OR name LIKE 'MAIN_MODULE_%_MENUS' OR name LIKE 'MAIN_MODULE_%_LOGIN' OR name LIKE 'MAIN_MODULE_%_BARCODE'";
$sql.=" ORDER BY name, entity";
/* From here, actions need a parameter */
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
if ($num)
{
$db->begin();
$i = 0;
while ($i < $num)
{
$obj=$db->fetch_object($resql);
$reg = array();
if (preg_match('/MAIN_MODULE_(.*)_(.*)/i', $obj->name, $reg))
{
$name=$reg[1];
$type=$reg[2];
$sql2 ="SELECT COUNT(*) as nb";
$sql2.=" FROM ".MAIN_DB_PREFIX."const as c";
$sql2.=" WHERE name LIKE 'MAIN_MODULE_".$name."'";
$sql2.=" AND entity = ".$obj->entity;
$resql2 = $db->query($sql2);
if ($resql2)
{
$obj2 = $db->fetch_object($resql2);
if ($obj2 && $obj2->nb == 0)
{
// Module not found, so we canremove entry
$sqldelete = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$db->escape($obj->name)."' AND entity = ".$obj->entity;
if (GETPOST('standard', 'alpha') == 'confirmed')
{
$db->query($sqldelete);
print '<tr><td>Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module not enabled in entity '.$obj->entity.', we delete record</td></tr>';
}
else
{
print '<tr><td>Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module not enabled in entity '.$obj->entity.', we should delete record (not done, mode test)</td></tr>';
}
}
else
{
//print '<tr><td>Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module found in entity '.$obj->entity.', we keep record</td></tr>';
}
}
}
$i++;
}
$db->commit();
}
}
}
// restore_thirdparties_logos: Move logos to correct new directory.
@ -903,7 +977,7 @@ if ($ok && GETPOST('set_empty_time_spent_amount', 'alpha'))
// force_disable_of_modules_not_found
if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha'))
{
print '<tr><td colspan="2"><br>*** Force modules not found to be disabled (only modules adding js, css or hooks can be detected as removed)</td></tr>';
print '<tr><td colspan="2"><br>*** Force modules not found physicaly to be disabled (only modules adding js, css or hooks can be detected as removed physicaly)</td></tr>';
$arraylistofkey=array('hooks','js','css');
@ -931,12 +1005,16 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha'))
$db->begin();
$reg = array();
if (preg_match('/MAIN_MODULE_(.*)_'.strtoupper($key).'/i', $constantname, $reg))
{
$name=strtolower($reg[1]);
if ($name) // And entry for key $key and module $name was found in database.
if ($name) // An entry for key $key and module $name was found in database.
{
$reloffile = '';
$result = 'found';
if ($key == 'hooks') $reloffile=$name.'/class/actions_'.$name.'.class.php';
if ($key == 'js')
{
@ -953,13 +1031,17 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha'))
$reloffile=preg_replace('/^\//', '', $valuearray[0]);
}
//var_dump($key.' - '.$value.' - '.$reloffile);
try {
$result = dol_buildpath($reloffile, 0, 2);
}
catch(Exception $e)
if ($reloffile)
{
// No catch yet
//var_dump($key.' - '.$value.' - '.$reloffile);
try {
$result = dol_buildpath($reloffile, 0, 2);
}
catch(Exception $e)
{
// No catch yet
$result = 'found'; // If error, we force lke if we found to avoid any deletion
}
}
if (! $result)
@ -967,7 +1049,7 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha'))
print ' - File of '.$key.' ('.$reloffile.') NOT found, we disable the module.';
if (GETPOST('force_disable_of_modules_not_found') == 'confirmed')
{
$sql2 ="DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'MAIN_MODULE_".strtoupper($name)."_".strtoupper($key)."'";
$sql2 ="DELETE FROM ".MAIN_DB_PREFIX."const WHERE name 'MAIN_MODULE_".strtoupper($name)."_".strtoupper($key)."'";
$resql2=$db->query($sql2);
if (! $resql2)
{

View File

@ -366,7 +366,7 @@ if (! $error && $db->connected && $action == "set")
print "<tr><td>";
print $langs->trans("ErrorDirDoesNotExists", $main_dir).'<br>';
print $langs->trans("ErrorWrongValueForParameter", $langs->trans("WebPagesDirectory")).'<br>';
print $langs->trans("ErrorWrongValueForParameter", $langs->transnoentitiesnoconv("WebPagesDirectory")).'<br>';
print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
print '</td><td>';
print $langs->trans("Error");

View File

@ -292,6 +292,7 @@ Modelcsv_agiris=Export for Agiris
Modelcsv_openconcerto=Export for OpenConcerto (Test)
Modelcsv_configurable=Export CSV Configurable
Modelcsv_FEC=Export FEC (Art. L47 A)
Modelcsv_Sage50_Swiss=Export for Sage 50 Switzerland
ChartofaccountsId=Chart of accounts Id
## Tools - Init accounting account on product / service

View File

@ -1889,4 +1889,5 @@ IFTTT_SERVICE_KEY=IFTTT Service key
IFTTT_DOLIBARR_ENDPOINT_SECUREKEY=Security key to secure the endpoint URL used by IFTTT to send messages to your Dolibarr.
IFTTTDesc=This module is designed to trigger events on IFTTT and/or to execute some action on external IFTTT triggers.
UrlForIFTTT=URL endpoint for IFTTT
YouWillFindItOnYourIFTTTAccount=You will find it on your IFTTT account
YouWillFindItOnYourIFTTTAccount=You will find it on your IFTTT account
EndPointFor=End point for %s : %s

View File

@ -971,3 +971,5 @@ ShowMoreInfos=Show More Infos
NoFilesUploadedYet=Please upload a document first
SeePrivateNote=See private note
PaymentInformation=Payment information
ValidFrom=Valid from
ValidUntil=Valid until

View File

@ -11,3 +11,5 @@ BOMsModelModule=BOMS document templates
FreeLegalTextOnBOMs=Free text on document of BOM
WatermarkOnDraftBOMs=Watermark on draft BOM
ConfirmCloneBillOfMaterials=Are you sure you want to clone this bill of material ?
ManufacturingEfficiency=Manufacturing efficiency
ValueOfMeansLoss=Value of 0.95 means an average of 5%% of loss during the production

View File

@ -37,3 +37,4 @@ PAYBOX_PAYONLINE_SENDEMAIL=Email notification after payment attempt (success or
PAYBOX_PBX_SITE=Value for PBX SITE
PAYBOX_PBX_RANG=Value for PBX Rang
PAYBOX_PBX_IDENTIFIANT=Value for PBX ID
PAYBOX_HMAC_KEY=HMAC key

View File

@ -268,7 +268,8 @@ TicketPublicInterfaceForbidden=The public interface for the tickets was not enab
ErrorEmailOrTrackingInvalid=Bad value for tracking ID or email
OldUser=Old user
NewUser=New user
NumberOfTicketsByMonth=Number of tickets per month
NbOfTickets=Number of tickets
# notifications
TicketNotificationEmailSubject=Ticket %s updated
TicketNotificationEmailBody=This is an automatic message to notify you that ticket %s has just been updated

View File

@ -97,4 +97,7 @@ ThisPageHasTranslationPages=This page/container has translation
NoWebSiteCreateOneFirst=No website has been created yet. Create one first.
GoTo=Go to
DynamicPHPCodeContainsAForbiddenInstruction=You add dynamic PHP code that contains the PHP instruction '<strong>%s</strong>' that is forbidden by default as dynamic content (see hidden options WEBSITE_PHP_ALLOW_xxx to increase list of allowed commands).
NotAllowedToAddDynamicContent=You don't have permission to add or edit PHP dynamic content in websites. Ask permission or just keep code into php tags unmodified.
NotAllowedToAddDynamicContent=You don't have permission to add or edit PHP dynamic content in websites. Ask permission or just keep code into php tags unmodified.
ReplaceWebsiteContent=Replace website content
DeleteAlsoJs=Delete also all javascript files specific to this website?
DeleteAlsoMedias=Delete also all medias files specific to this website?

View File

@ -302,7 +302,7 @@ if ($action == 'create')
// Rate
print '<tr><td class="fieldrequired">'.$langs->trans("Rate").'</td><td><input name="rate" size="5" value="' . dol_escape_htmltag(GETPOST("rate")) . '"> %</td></tr>';
// insurance amount
// Insurance amount
print '<tr><td>'.$langs->trans("Insurance").'</td><td><input name="insurance_amount" size="10" value="' . dol_escape_htmltag(GETPOST("insurance_amount")) . '" placeholder="'.$langs->trans('Amount').'"></td></tr>';
// Project
@ -707,7 +707,9 @@ if ($id > 0)
$total_insurance = 0;
$total_interest = 0;
$total_capital = 0;
print '<table class="noborder">';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder paymenttable">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("RefPayment").'</td>';
print '<td>'.$langs->trans("Date").'</td>';
@ -748,6 +750,8 @@ if ($id > 0)
print '</td></tr>';
}
print "</table>";
print '</div>';
$db->free($resql);
}
else

Some files were not shown because too many files have changed in this diff Show More