Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
4be46d35b0
@ -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);
|
||||
|
||||
@ -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 $limittochartaccount '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);
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'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
|
||||
|
||||
|
||||
@ -944,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';
|
||||
|
||||
|
||||
/**
|
||||
@ -972,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
|
||||
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ if ($nolinesbefore) {
|
||||
print '</span></td>';
|
||||
}
|
||||
?>
|
||||
<td class="linecollost right"><?php echo $langs->trans('Lost'); ?></td>
|
||||
<td class="linecollost right"><?php echo $langs->trans('ManufacturingEfficiency'); ?></td>
|
||||
<td class="linecoledit" colspan="<?php echo $colspan; ?>"> </td>
|
||||
</tr>
|
||||
<?php
|
||||
@ -144,7 +144,7 @@ if ($nolinesbefore) {
|
||||
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom nowrap linecollost right"><input type="text" size="1" name="lost" id="lost" class="flat right" value="<?php echo (isset($_POST["lsot"])?GETPOST("lost", 'alpha', 2):$remise_percent); ?>"><span class="hideonsmartphone">%</span></td>
|
||||
<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;
|
||||
@ -165,39 +165,12 @@ if (is_object($objectline)) {
|
||||
/* 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, #idprodfournprice").change(function()
|
||||
$("#idprod").change(function()
|
||||
{
|
||||
console.log("#idprod, #idprodfournprice change triggered");
|
||||
|
||||
setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva
|
||||
|
||||
jQuery('#trlinefordates').show();
|
||||
|
||||
/* To process customer price per quantity */
|
||||
var pbq = parseInt($('option:selected', this).attr('data-pbq'));
|
||||
var pbqqty = parseFloat($('option:selected', this).attr('data-pbqqty'));
|
||||
var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent'));
|
||||
|
||||
if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && typeof pbq !== "undefined")
|
||||
{
|
||||
console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent);
|
||||
jQuery("#pbq").val(pbq);
|
||||
if (jQuery("#qty").val() < pbqqty)
|
||||
{
|
||||
jQuery("#qty").val(pbqqty);
|
||||
}
|
||||
if (jQuery("#remise_percent").val() < pbqpercent)
|
||||
{
|
||||
jQuery("#remise_percent").val(pbqpercent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#pbq").val('');
|
||||
}
|
||||
console.log("#idprod change triggered");
|
||||
|
||||
/* To set focus */
|
||||
if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0)
|
||||
if (jQuery('#idprod').val() > 0)
|
||||
{
|
||||
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
|
||||
jQuery('#dp_desc').focus();
|
||||
|
||||
@ -3139,7 +3139,7 @@ class Facture extends CommonInvoice
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php');
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Cap percentages to 100
|
||||
if ($percent > 100) $percent = 100;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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>';
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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];
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
|
||||
@ -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;
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -699,7 +699,7 @@ div.fiche {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.thumbstat {
|
||||
min-width: 150px;
|
||||
min-width: 148px;
|
||||
}
|
||||
.thumbstat150 {
|
||||
min-width: 168px;
|
||||
@ -3076,7 +3076,8 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
|
||||
}
|
||||
.boxstats, .boxstats130 {
|
||||
display: inline-block;
|
||||
margin: 8px;
|
||||
margin-left: 8px;
|
||||
margin-right: 8px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
text-align: center;
|
||||
@ -3093,7 +3094,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.boxstats130 {
|
||||
width: 158px;
|
||||
width: 100%;
|
||||
height: 59px;
|
||||
/* padding: 3px; */
|
||||
}
|
||||
@ -3102,7 +3103,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
|
||||
padding-right: 3px;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
width: 121px;
|
||||
width: 118px;
|
||||
}
|
||||
.tabBar .fichehalfright .boxstats {
|
||||
padding-top: 8px;
|
||||
@ -3130,8 +3131,6 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
|
||||
{
|
||||
.boxstats, .boxstats130 {
|
||||
margin: 3px;
|
||||
/*border: 1px solid #ccc;
|
||||
box-shadow: none; */
|
||||
}
|
||||
.boxstats130 {
|
||||
text-align: <?php echo $left; ?>
|
||||
@ -3139,19 +3138,19 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
|
||||
.thumbstat {
|
||||
flex: 1 1 110px;
|
||||
margin-bottom: 8px;
|
||||
min-width: <?php echo isset($_SESSION['dol_screenwidth'])?min(160, round($_SESSION['dol_screenwidth']/2 - 20)):150; ?>px; /* on screen < 320, we guaranty to have 2 columns */
|
||||
}
|
||||
.thumbstat150 {
|
||||
flex: 1 1 110px;
|
||||
margin-bottom: 8px;
|
||||
width: 160px;
|
||||
min-width: <?php echo isset($_SESSION['dol_screenwidth'])?min(160, round($_SESSION['dol_screenwidth']/2 - 20)):160; ?>px; /* on screen < 320, we guaranty to have 2 columns */
|
||||
max-width: <?php echo isset($_SESSION['dol_screenwidth'])?min(161, round($_SESSION['dol_screenwidth']/2 - 20)):161; ?>px; /* on screen < 320, we guaranty to have 2 columns */
|
||||
/* width: ...px; If I use with, there is trouble on size of flex boxes solved with min + (max that is a little bit higer than min) */
|
||||
}
|
||||
.dashboardlineindicator {
|
||||
float: left;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.boxstats130 {
|
||||
width: 148px;
|
||||
}
|
||||
.boxstats {
|
||||
width: 111px;
|
||||
}
|
||||
|
||||
@ -3361,7 +3361,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
|
||||
}
|
||||
.boxstats130 {
|
||||
width: 135px;
|
||||
height: 48px;
|
||||
height: 54px;
|
||||
padding: 3px;
|
||||
}
|
||||
@media only screen and (max-width: 767px)
|
||||
|
||||
@ -259,7 +259,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
/*
|
||||
* Last tickets
|
||||
* Latest tickets
|
||||
*/
|
||||
|
||||
$max = 10;
|
||||
@ -302,13 +302,8 @@ if ($result) {
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th>' . $transRecordedType . '</th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print '<th class="right"><a href="'.DOL_URL_ROOT.'/ticket/list.php">'.$langs->trans("FullList").'</th>';
|
||||
print '<th></th>';
|
||||
print '<tr class="liste_titre"><th colspan="5">' . $transRecordedType . '</th>';
|
||||
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/ticket/list.php">'.$langs->trans("FullList").'</th>';
|
||||
print '</tr>';
|
||||
if ($num > 0) {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user