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

This commit is contained in:
Christophe Battarel 2019-05-24 12:02:44 +02:00
commit d8a6db6e42
39 changed files with 1268 additions and 343 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

@ -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

@ -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

@ -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

@ -320,7 +320,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 +347,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 +363,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;
/**
@ -105,7 +105,7 @@ class BOM extends CommonObject
'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')),
'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;
@ -758,8 +758,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 +773,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');
}
}

View File

@ -0,0 +1,216 @@
<?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 $langs->trans('Lost'); ?></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="lost" id="lost" class="flat right" value="<?php echo (isset($_POST["lsot"])?GETPOST("lost", 'alpha', 2):$remise_percent); ?>"><span class="hideonsmartphone">%</span></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, #idprodfournprice").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('');
}
/* To set focus */
if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').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

@ -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

@ -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

@ -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,7 +3875,7 @@ 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'));
$dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
foreach($dirtpls as $reldir)
{
$tpl = dol_buildpath($reldir.'/objectline_create.tpl.php');

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

@ -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): ''));
}
/**

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

@ -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

@ -60,7 +60,7 @@ class MyObject extends CommonObject
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;
const STATUS_DISABLED = -1;
const STATUS_DISABLED = 9;
/**
@ -105,7 +105,7 @@ class MyObject extends CommonObject
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Canceled')),
'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', 9=>'Canceled')),
);
/**
@ -541,8 +541,9 @@ class MyObject extends CommonObject
{
global $langs;
//$langs->load("mymodule");
$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)
@ -555,28 +556,23 @@ class MyObject 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');
}
}

View File

@ -356,7 +356,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();

View File

@ -413,12 +413,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', 'price'))) $cssforfield.=($cssforfield?' ':'').'right';
$cssforfield=(empty($val['css'])?'':$val['css']);
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>';
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', 'price'))) $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';
@ -440,11 +446,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', 'price'))) $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', 'price'))) $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";
@ -485,14 +491,14 @@ 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='';
$cssforfield=(empty($val['css'])?'':$val['css']);
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
@ -503,13 +509,7 @@ while ($i < min($num, $limit))
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

@ -497,7 +497,7 @@ if (empty($reshook))
$originalId = $id;
if ($object->id > 0)
{
$object->ref = GETPOST('clone_ref');
$object->ref = GETPOST('clone_ref', 'alphanohtml');
$object->status = 0;
$object->status_buy = 0;
$object->id = null;
@ -505,7 +505,8 @@ if (empty($reshook))
if ($object->check())
{
$id = $object->create($user);
$object->context['createfromclone'] = 'createfromclone';
$id = $object->create($user);
if ($id > 0)
{
if (GETPOST('clone_composition'))
@ -546,7 +547,7 @@ if (empty($reshook))
$object->fetch($id);
}
else
{
{
$db->rollback();
if (count($object->errors))
{
@ -560,6 +561,8 @@ if (empty($reshook))
}
}
}
unset($object->context['createfromclone']);
}
}
else
@ -1966,7 +1969,7 @@ if (($action == 'delete' && (empty($conf->use_javascript_ajax) || ! empty($conf-
if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js
|| (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) // Always output when not jmobile nor js
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneProduct', $object->ref), 'confirm_clone', $formquestionclone, 'yes', 'action-clone', 260, 600);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneProduct', $object->ref), 'confirm_clone', $formquestionclone, 'yes', 'action-clone', 350, 600);
}

View File

@ -214,7 +214,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border centpercent tableforfield">';
// Nature
if ($object->type!=Product::TYPE_SERVICE)
@ -268,236 +268,223 @@ if ($id > 0 || ! empty($ref))
$nbofsubproducts=count($prodschild); // This include only first level of childs
// Number of parent virtual products
//print $form->textwithpicto($langs->trans("ParentProductsNumber").': '.count($prodsfather), $langs->trans('IfZeroItIsNotUsedByVirtualProduct'));
print '<div class="fichecenter">';
//if (count($prodsfather) > 0)
//{
print load_fiche_titre($langs->trans("ProductParentList"), '', '');
print '<table class="centpercent noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('ParentProducts').'</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td>'.$langs->trans('Qty').'</td>';
print '</td>';
if (count($prodsfather) > 0)
print load_fiche_titre($langs->trans("ProductParentList"), '', '');
print '<table class="liste">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('ParentProducts').'</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td>'.$langs->trans('Qty').'</td>';
print '</td>';
if (count($prodsfather) > 0)
{
foreach($prodsfather as $value)
{
$class='pair';
$idprod= $value["id"];
$productstatic->id=$idprod;// $value["id"];
$productstatic->type=$value["fk_product_type"];
$productstatic->ref=$value['ref'];
$productstatic->label=$value['label'];
$productstatic->entity=$value['entity'];
foreach($prodsfather as $value)
{
$idprod= $value["id"];
$productstatic->id=$idprod;// $value["id"];
$productstatic->type=$value["fk_product_type"];
$productstatic->ref=$value['ref'];
$productstatic->label=$value['label'];
$productstatic->entity=$value['entity'];
$class=($class=='impair')?'pair':'impair';
print '<tr class="'.$class.'">';
print '<td>'.$productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
print '<td>'.$value['qty'].'</td>';
print '</tr>';
}
}
else
{
print '<tr class="impair">';
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
print '<tr class="oddeven">';
print '<td>'.$productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
print '<td>'.$value['qty'].'</td>';
print '</tr>';
}
print '</table>';
//}
}
else
{
print '<tr class="oddeven">';
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
print '</tr>';
}
print '</table>';
print '</div>';
print '<br>'."\n";
// Number of subproducts
//print $form->textwithpicto($langs->trans("AssociatedProductsNumber").': '.(empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)?$nbofsubproducts:$nbofsubsubproducts), $langs->trans('IfZeroItIsNotAVirtualProduct'));
print '<div class="fichecenter">';
// List of subproducts
//if (count($prods_arbo) > 0)
//{
$atleastonenotdefined=0;
print load_fiche_titre($langs->trans("ProductAssociationList"), '', '');
$atleastonenotdefined=0;
print load_fiche_titre($langs->trans("ProductAssociationList"), '', '');
print '<form name="formComposedProduct" action="'.$_SERVER['PHP_SELF'].'" method="post">';
print '<input type="hidden" name="action" value="save_composed_product" />';
print '<input type="hidden" name="id" value="'.$id.'" />';
print '<form name="formComposedProduct" action="'.$_SERVER['PHP_SELF'].'" method="post">';
print '<input type="hidden" name="action" value="save_composed_product" />';
print '<input type="hidden" name="id" value="'.$id.'" />';
print '<table class="centpercent noborder">';
print '<table class="liste">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('ComposedProduct').'</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td class="right" colspan="2">'.$langs->trans('MinSupplierPrice').'</td>';
print '<td class="right" colspan="2">'.$langs->trans('MinCustomerPrice').'</td>';
if (! empty($conf->stock->enabled)) print '<td class="right">'.$langs->trans('Stock').'</td>';
print '<td class="center">'.$langs->trans('Qty').'</td>';
print '<td class="center">'.$langs->trans('ComposedProductIncDecStock').'</td>';
print '</tr>'."\n";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('ComposedProduct').'</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td class="right" colspan="2">'.$langs->trans('MinSupplierPrice').'</td>';
print '<td class="right" colspan="2">'.$langs->trans('MinCustomerPrice').'</td>';
if (! empty($conf->stock->enabled)) print '<td class="right">'.$langs->trans('Stock').'</td>';
print '<td class="center">'.$langs->trans('Qty').'</td>';
print '<td class="center">'.$langs->trans('ComposedProductIncDecStock').'</td>';
print '</tr>'."\n";
$class='pair';
$totalsell=0;
if (count($prods_arbo))
$totalsell=0;
if (count($prods_arbo))
{
foreach($prods_arbo as $value)
{
foreach($prods_arbo as $value)
$productstatic->fetch($value['id']);
if ($value['level'] <= 1)
{
$productstatic->fetch($value['id']);
print '<tr class="oddeven">';
if ($value['level'] <= 1)
$notdefined=0;
$nb_of_subproduct = $value['nb'];
print '<td>'.$productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
// Best buying price
print '<td class="right">';
if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0)
{
$class=($class=='impair')?'pair':'impair';
print '<tr class="'.$class.'">';
print $langs->trans("BuyingPriceMinShort").': ';
if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0, 0);
else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; }
}
print '</td>';
$notdefined=0;
$nb_of_subproduct = $value['nb'];
// For avoid a non-numeric value
$fourn_unitprice = (!empty($product_fourn->fourn_unitprice)?$product_fourn->fourn_unitprice:0);
$fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0);
$fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0);
print '<td>'.$productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
$totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT');
$total+=$totalline;
// Best buying price
print '<td class="right">';
if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0)
{
print $langs->trans("BuyingPriceMinShort").': ';
if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0, 0);
else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; }
}
print '</td>';
print '<td class="right">';
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// For avoid a non-numeric value
$fourn_unitprice = (!empty($product_fourn->fourn_unitprice)?$product_fourn->fourn_unitprice:0);
$fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0);
$fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0);
$totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT');
$total+=$totalline;
print '<td class="right">';
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// Best selling price
$pricesell=$productstatic->price;
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
$pricesell='Variable';
}
else
{
$totallinesell=price2num($value['nb'] * ($pricesell), 'MT');
$totalsell+=$totallinesell;
}
print '<td class="right" colspan="2">';
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : ''));
if (is_numeric($pricesell)) print price($pricesell, '', '', 0, 0, -1, $conf->currency);
else print $langs->trans($pricesell);
print '</td>';
// Stock
if (! empty($conf->stock->enabled)) print '<td class="right">'.$value['stock'].'</td>'; // Real stock
// Qty + IncDec
if ($user->rights->produit->creer || $user->rights->service->creer)
{
print '<td class="center"><input type="text" value="'.$nb_of_subproduct.'" name="TProduct['.$productstatic->id.'][qty]" size="4" /></td>';
print '<td class="center"><input type="checkbox" name="TProduct['.$productstatic->id.'][incdec]" value="1" '.($value['incdec']==1?'checked':'' ).' /></td>';
}
else{
print '<td>'.$nb_of_subproduct.'</td>';
print '<td>'.($value['incdec']==1?'x':'' ).'</td>';
}
print '</tr>'."\n";
// Best selling price
$pricesell=$productstatic->price;
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
$pricesell='Variable';
}
else
{
$hide='';
if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide=' hideobject'; // By default, we do not show this. It makes screen very difficult to understand
$class=($class=='impair')?'pair':'impair';
print '<tr class="'.$class.$hide.'" id="sub-'.$value['id_parent'].'">';
//$productstatic->ref=$value['label'];
$productstatic->ref=$value['ref'];
print '<td>';
for ($i=0; $i < $value['level']; $i++) print ' &nbsp; &nbsp; '; // Add indentation
print $productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
// Best buying price
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
// Best selling price
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
if (! empty($conf->stock->enabled)) print '<td></td>'; // Real stock
print '<td class="center">'.$value['nb'].'</td>';
print '<td>&nbsp;</td>';
print '</tr>'."\n";
$totallinesell=price2num($value['nb'] * ($pricesell), 'MT');
$totalsell+=$totallinesell;
}
print '<td class="right" colspan="2">';
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : ''));
if (is_numeric($pricesell)) print price($pricesell, '', '', 0, 0, -1, $conf->currency);
else print $langs->trans($pricesell);
print '</td>';
// Stock
if (! empty($conf->stock->enabled)) print '<td class="right">'.$value['stock'].'</td>'; // Real stock
// Qty + IncDec
if ($user->rights->produit->creer || $user->rights->service->creer)
{
print '<td class="center"><input type="text" value="'.$nb_of_subproduct.'" name="TProduct['.$productstatic->id.'][qty]" size="4" /></td>';
print '<td class="center"><input type="checkbox" name="TProduct['.$productstatic->id.'][incdec]" value="1" '.($value['incdec']==1?'checked':'' ).' /></td>';
}
else{
print '<td>'.$nb_of_subproduct.'</td>';
print '<td>'.($value['incdec']==1?'x':'' ).'</td>';
}
print '</tr>'."\n";
}
print '<tr class="liste_total">';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';
// Minimum buying price
print '<td class="liste_total right">';
print $langs->trans("TotalBuyingPriceMinShort");
print '</td>';
print '<td class="liste_total right">';
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
print ($atleastonenotdefined?'':price($total, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// Minimum selling price
print '<td class="liste_total right">';
print $langs->trans("TotalSellingPriceMinShort");
print '</td>';
print '<td class="liste_total right">';
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
print ($atleastonenotdefined?'':price($totalsell, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// Stock
if (! empty($conf->stock->enabled)) print '<td class="liste_total right">&nbsp;</td>';
print '<td class="right" colspan="2">';
if ($user->rights->produit->creer || $user->rights->service->creer)
else
{
print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
$hide='';
if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide=' hideobject'; // By default, we do not show this. It makes screen very difficult to understand
print '<tr class="oddeven'.$hide.'" id="sub-'.$value['id_parent'].'">';
//$productstatic->ref=$value['label'];
$productstatic->ref=$value['ref'];
print '<td>';
for ($i=0; $i < $value['level']; $i++) print ' &nbsp; &nbsp; '; // Add indentation
print $productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
// Best buying price
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
// Best selling price
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
if (! empty($conf->stock->enabled)) print '<td></td>'; // Real stock
print '<td class="center">'.$value['nb'].'</td>';
print '<td>&nbsp;</td>';
print '</tr>'."\n";
}
print '</td>';
print '</tr>'."\n";
}
else
print '<tr class="liste_total">';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';
// Minimum buying price
print '<td class="liste_total right">';
print $langs->trans("TotalBuyingPriceMinShort");
print '</td>';
print '<td class="liste_total right">';
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
print ($atleastonenotdefined?'':price($total, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// Minimum selling price
print '<td class="liste_total right">';
print $langs->trans("TotalSellingPriceMinShort");
print '</td>';
print '<td class="liste_total right">';
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
print ($atleastonenotdefined?'':price($totalsell, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// Stock
if (! empty($conf->stock->enabled)) print '<td class="liste_total right">&nbsp;</td>';
print '<td class="right" colspan="2">';
if ($user->rights->produit->creer || $user->rights->service->creer)
{
$colspan=8;
if (! empty($conf->stock->enabled)) $colspan++;
print '<tr class="impair">';
print '<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td>';
print '</tr>';
}
print '</table>';
/*if($user->rights->produit->creer || $user->rights->service->creer) {
print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
}*/
}
print '</td>';
print '</tr>'."\n";
}
else
{
$colspan=8;
if (! empty($conf->stock->enabled)) $colspan++;
print '<tr class="oddeven">';
print '<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td>';
print '</tr>';
}
print '</table>';
/*if($user->rights->produit->creer || $user->rights->service->creer) {
print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
}*/
print '</form>';
print '</div>';
print '</form>';
//}
// Form with product to add
if ((empty($action) || $action == 'view' || $action == 'edit' || $action == 'search' || $action == 're-edit') && ($user->rights->produit->creer || $user->rights->service->creer))

View File

@ -430,7 +430,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

@ -1367,10 +1367,13 @@ else
if (! empty($conf->use_javascript_ajax))
{
$widthpopup = 600;
if (! empty($conf->dol_use_jmobile)) $widthpopup = 350;
$heightpopup = 400;
print "\n";
print '<script language="JavaScript" type="text/javascript">';
print "function CheckVAT(a) {\n";
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."', 540, 350);\n";
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."', ".$widthpopup.", ".$heightpopup.");\n";
print "}\n";
print '</script>';
print "\n";
@ -2028,10 +2031,13 @@ else
if ($conf->use_javascript_ajax)
{
print "\n";
$widthpopup = 600;
if (! empty($conf->dol_use_jmobile)) $widthpopup = 350;
$heightpopup = 400;
print "\n";
print '<script language="JavaScript" type="text/javascript">';
print "function CheckVAT(a) {\n";
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,285);\n";
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."', ".$widthpopup.", ".$heightpopup.");\n";
print "}\n";
print '</script>';
print "\n";
@ -2437,10 +2443,13 @@ else
if ($conf->use_javascript_ajax)
{
$widthpopup = 600;
if (! empty($conf->dol_use_jmobile)) $widthpopup = 350;
$heightpopup = 400;
print "\n";
print '<script language="JavaScript" type="text/javascript">';
print "function CheckVAT(a) {\n";
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,285);\n";
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."', ".$widthpopup.", ".$heightpopup.");\n";
print "}\n";
print '</script>';
print "\n";

View File

@ -54,6 +54,7 @@ if (! $vatNumber)
else
{
$vatNumber = preg_replace('/\^\w/', '', $vatNumber);
$vatNumber = str_replace(array(' ', '.'), '', $vatNumber);
$countryCode=substr($vatNumber, 0, 2);
$vatNumber=substr($vatNumber, 2);

View File

@ -35,6 +35,7 @@ require_once '../main.inc.php';
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
@ -373,7 +374,7 @@ $sql.= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,";
$sql.= " s2.nom as name2,";
$sql.= " typent.code as typent_code,";
$sql.= " staff.code as staff_code,";
$sql.= " country.code as country_code,";
$sql.= " country.code as country_code, country.label as country_label,";
$sql.= " state.code_departement as state_code, state.nom as state_name,";
$sql.= " region.code_region as region_code, region.nom as region_name";
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
@ -989,6 +990,8 @@ while ($i < min($num, $limit))
$companystatic->fournisseur=$obj->fournisseur;
$companystatic->code_client=$obj->code_client;
$companystatic->code_fournisseur=$obj->code_fournisseur;
$companystatic->tva_intra=$obj->tva_intra;
$companystatic->country_code=$obj->country_code;
$companystatic->code_compta_client=$obj->code_compta;
$companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur;
@ -1091,8 +1094,8 @@ while ($i < min($num, $limit))
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td class="center">';
$tmparray=getCountry($obj->fk_pays, 'all');
print $tmparray['label'];
$labelcountry=($obj->country_code && ($langs->trans("Country".$obj->country_code)!="Country".$obj->country_code))?$langs->trans("Country".$obj->country_code):$obj->country_label;
print $labelcountry;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
@ -1166,7 +1169,13 @@ while ($i < min($num, $limit))
}
if (! empty($arrayfields['s.tva_intra']['checked']))
{
print "<td>".$obj->tva_intra."</td>\n";
print "<td>";
print $obj->tva_intra;
if ($obj->tva_intra && ! isValidVATID($companystatic))
{
print img_warning("BadVATNumber", '', '');
}
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Type

View File

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

View File

@ -1172,6 +1172,9 @@ div.secondcolumn div.box {
width: auto;
padding-bottom: 6px;
}
div.fichetwothirdright div.ficheaddleft {
padding-left: 0;
}
div.fichehalfleft {
float: none;
width: auto;

View File

@ -1361,6 +1361,9 @@ div.fichetwothirdright {
<?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?>
<?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?>
}
div.fichetwothirdright div.ficheaddleft {
padding-left: 20px;
}
div.fichehalfleft {
<?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?>
<?php if ($conf->browser->layout != 'phone') { print "width: calc(50% - 10px);\n"; } ?>
@ -1404,6 +1407,9 @@ div.secondcolumn div.box {
width: auto;
padding-bottom: 6px;
}
div.fichetwothirdright div.ficheaddleft {
padding-left: 0;
}
div.fichehalfleft {
float: none;
width: auto;

View File

@ -608,7 +608,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;
}
$langs->load("ticket");

View File

@ -274,7 +274,6 @@ function getActionComm($authentication, $id)
$result=$actioncomm->fetch($id);
if ($result > 0)
{
$actioncomm_result_fields=array(
'id' => $actioncomm->id,
'ref'=> $actioncomm->ref,
@ -299,19 +298,20 @@ function getActionComm($authentication, $id)
'contactid'=> $actioncomm->contactid,
'projectid'=> $actioncomm->fk_project,
'fk_element'=> $actioncomm->fk_element,
'elementtype'=> $actioncomm->elementtype);
'elementtype'=> $actioncomm->elementtype
);
//Retreive all extrafield for actioncomm
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('actioncomm', true);
//Get extrafield values
$actioncomm->fetch_optionals();
// Retreive all extrafield for actioncomm
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('actioncomm', true);
//Get extrafield values
$actioncomm->fetch_optionals();
foreach($extrafields->attribute_label as $key=>$label)
{
$actioncomm_result_fields=array_merge($actioncomm_result_fields, array('options_'.$key => $actioncomm->array_options['options_'.$key]));
}
foreach($extrafields->attribute_label as $key=>$label)
{
$actioncomm_result_fields=array_merge($actioncomm_result_fields, array('options_'.$key => $actioncomm->array_options['options_'.$key]));
}
// Create
$objectresp = array(