Merge remote-tracking branch 'Dolibarr/11.0' into 11

This commit is contained in:
Francis Appels 2020-01-26 12:17:46 +01:00
commit 3318263840
49 changed files with 420 additions and 151 deletions

View File

@ -70,7 +70,6 @@ llxHeader('', $langs->trans("OrdersSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
print "<br>\n";
$head = order_admin_prepare_head();

View File

@ -71,7 +71,6 @@ llxHeader('', $langs->trans("OrdersSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
print "<br>\n";
$head = order_admin_prepare_head();

View File

@ -47,7 +47,7 @@ class BOM extends CommonObject
public $ismultientitymanaged = 1;
/**
* @var int Does bom support extrafields ? 0=No, 1=Yes
* @var int Does object support extrafields ? 0=No, 1=Yes
*/
public $isextrafieldmanaged = 1;

View File

@ -722,6 +722,7 @@ class Propal extends CommonObject
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
// Clean vat code
$reg = array();
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
@ -757,7 +758,7 @@ class Propal extends CommonObject
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new PropaleLigne($this->db);
$line->fetch($rowid);
$line->fetch_optionals(); // Fetch extrafields for oldcopy
$line->fetch_optionals();
$staticline = clone $line;
@ -808,7 +809,10 @@ class Propal extends CommonObject
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
// We replace values in this->line->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$this->line->array_options[$key] = $array_options[$key];
}
}
// Multicurrency

View File

@ -3074,6 +3074,7 @@ class Commande extends CommonOrder
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new OrderLine($this->db);
$line->fetch($rowid);
$line->fetch_optionals();
if (!empty($line->fk_product))
{
@ -3146,7 +3147,10 @@ class Commande extends CommonOrder
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
// We replace values in this->line->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$this->line->array_options[$key] = $array_options[$key];
}
}
$result = $this->line->update($user, $notrigger);

View File

@ -56,7 +56,7 @@ if (!$sortfield) $sortfield = 'rowid';
if (!$sortorder) $sortorder = 'ASC';
// Security check
if (!$user->rights->cashdesk->use && !$user->rights->takepos->use)
if (!$user->rights->cashdesk->run && !$user->rights->takepos->run)
{
accessforbidden();
}
@ -82,8 +82,8 @@ $hookmanager->initHooks(array('cashcontrolcard', 'globalcard'));
* Actions
*/
$permissiontoadd = ($user->rights->cashdesk->use || $user->rights->takepos->use);
$permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use) || ($permissiontoadd && $object->status == 0);
$permissiontoadd = ($user->rights->cashdesk->run || $user->rights->takepos->run);
$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run) || ($permissiontoadd && $object->status == 0);
if (empty($backtopage)) $backtopage = dol_buildpath('/compta/cashcontrol/cashcontrol_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
$backurlforlist = dol_buildpath('/compta/cashcontrol/cashcontrol_list.php', 1);
$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record
@ -544,14 +544,16 @@ if (empty($action) || $action == "view")
print $object->posmodule;
print "</td></tr>";
print '<tr><td valign="middle">'.$langs->trans("CashDesk").' ID</td><td>';
print '<tr><td valign="middle">'.$langs->trans("Terminal").'</td><td>';
print $object->posnumber;
print "</td></tr>";
print '<tr><td class="nowrap">';
print $langs->trans("Period");
print '</td><td>';
print $object->year_close."-".$object->month_close."-".$object->day_close;
print $object->year_close;
print ($object->month_close ? "-" : "").$object->month_close;
print ($object->day_close ? "-" : "").$object->day_close;
print '</td></tr>';
print '</table>';
@ -570,7 +572,6 @@ if (empty($action) || $action == "view")
print '<tr><td valign="middle">'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td><td>';
print price($object->opening, 0, $langs, 1, -1, -1, $conf->currency);
print "</td></tr>";
foreach ($arrayofpaymentmode as $key => $val)
{
print '<tr><td valign="middle">'.$langs->trans($val).'</td><td>';

View File

@ -168,8 +168,8 @@ if (empty($reshook))
// Mass actions
$objectclass = 'CashControl';
$objectlabel = 'CashControl';
$permissiontoread = ($user->rights->cashdesk->use || $user->rights->takepos->use);
$permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use);
$permissiontoread = ($user->rights->cashdesk->run || $user->rights->takepos->run);
$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run);
//$uploaddir = '';
//include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';

View File

@ -59,7 +59,7 @@ class CashControl extends CommonObject
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>15),
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>18),
'posmodule' =>array('type'=>'varchar(30)', 'label'=>'Module', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>19),
'posnumber' =>array('type'=>'varchar(30)', 'label'=>'CashDesk', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>20),
'posnumber' =>array('type'=>'varchar(30)', 'label'=>'Terminal', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>20, 'css'=>'center'),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>0, 'position'=>24),
'opening' =>array('type'=>'price', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25),
'cash' =>array('type'=>'price', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30),

View File

@ -33,11 +33,13 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
$langs->load("bills");
$id = GETPOST('id', 'int');
$_GET['optioncss']="print";
include_once 'class/cashcontrol.class.php';
$cashcontrol= new CashControl($db);
$cashcontrol->fetch($id);
@ -50,7 +52,8 @@ $arrayfields=array(
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
'b.num_chq'=>array('label'=>$langs->trans("Number"), 'checked'=>1),
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1),
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
'cp.code'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1),
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
);
@ -128,7 +131,6 @@ if ($resql)
$invoicetmp = new Facture($db);
print "<div style='text-align: right'><h2>";
print $langs->trans("InitialBankBalance").' - '.$langs->trans("Cash")." : ".price($cashcontrol->opening);
print "</h2></div>";
@ -136,13 +138,16 @@ if ($resql)
print '<div class="div-table-responsive">';
print '<table class="tagtable liste">'."\n";
$param = '';
// Fields title
print '<tr class="liste_titre">';
print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, 'class="left"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, '"', $sortfield, $sortorder, 'center ');
print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre($arrayfields['cp.code']['label'], $_SERVER['PHP_SELF'], 'cp.code', '', $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, 'right ');
print "</tr>\n";
$posconciliatecol = 0;
@ -151,7 +156,9 @@ if ($resql)
$sign = 1;
$cash=$bank=$cheque=$other=0;
$totalarray=array();
$totalarray = array();
$cachebankaccount = array();
$amountpertype = array();
while ($i < $num)
{
$objp = $db->fetch_object($resql);
@ -168,7 +175,9 @@ if ($resql)
$bankaccount = $cachebankaccount[$objp->bankid];
}
/*if ($first == "yes")
$invoicetmp->fetch($objp->facid);
/*if ($first == "yes")
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td>';
@ -181,12 +190,10 @@ if ($resql)
// Ref
print '<td class="nowrap left">';
$invoicetmp->fetch($objp->facid);
print $invoicetmp->getNomUrl(1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
// Date ope
print '<td class="nowrap left">';
print '<span id="dateoperation_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->do), "day")."</span>";
@ -197,26 +204,38 @@ if ($resql)
print '<td class="nowrap right">';
print $bankaccount->getNomUrl(1);
if ($cashcontrol->posmodule=="takepos"){
if ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber}==$bankaccount->id) $cash+=$objp->amount;
elseif ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$cashcontrol->posnumber}==$bankaccount->id) $bank+=$objp->amount;
elseif ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$cashcontrol->posnumber}==$bankaccount->id) $cheque+=$objp->amount;
else $other+=$objp->amount;
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber;
}
else{
if ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH==$bankaccount->id) $cash+=$objp->amount;
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CB==$bankaccount->id) $bank+=$objp->amount;
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE==$bankaccount->id) $cheque+=$objp->amount;
else $other+=$objp->amount;
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH';
}
if ($objp->code == 'CHQ') {
$cheque += $objp->amount;
} elseif ($objp->code == 'CB') {
$bank += $objp->amount;
} else {
if ($conf->global->$var1 == $bankaccount->id) $cash += $objp->amount;
//elseif ($conf->global->$var2 == $bankaccount->id) $bank+=$objp->amount;
//elseif ($conf->global->$var3 == $bankaccount->id) $cheque+=$objp->amount;
else $other += $objp->amount;
}
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
// Debit
// Type
print '<td class="right">';
print $objp->code;
if (empty($amountpertype[$objp->code])) $amountpertype[$objp->code] = 0;
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
// Debit
print '<td class="right">';
if ($objp->amount < 0)
{
print price($objp->amount * -1);
$totalarray['val']['totaldebfield'] += $objp->amount;
$amountpertype[$objp->code] += $objp->amount;
}
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
@ -228,6 +247,7 @@ if ($resql)
{
print price($objp->amount);
$totalarray['val']['totalcredfield'] += $objp->amount;
$amountpertype[$objp->code] -= $objp->amount;
}
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
@ -243,12 +263,34 @@ if ($resql)
print "</table>";
$cash=$cash+$cashcontrol->opening;
//$cash = $amountpertype['LIQ'] + $cashcontrol->opening;
$cash = $cash + $cashcontrol->opening;
print "<div style='text-align: right'><h2>";
print $langs->trans("Cash").": ".price($cash)."<br><br>";
print $langs->trans("PaymentTypeCB").": ".price($bank)."<br><br>";
print $langs->trans("PaymentTypeCHQ").": ".price($cheque)."<br><br>";
if ($other) print $langs->trans("Other").": ".price($other)."<br><br>";
print $langs->trans("Cash").": ".price($cash);
if ($cash != $cashcontrol->cash) {
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->cash).'</span>';
}
print "<br><br>";
//print '<br>';
print $langs->trans("PaymentTypeCHQ").": ".price($cheque);
if ($cheque != $cashcontrol->cheque) {
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->cheque).'</span>';
}
print "<br><br>";
//print '<br>';
print $langs->trans("PaymentTypeCB").": ".price($bank);
if ($bank != $cashcontrol->card) {
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->card).'</span>';
}
print "<br><br>";
// print '<br>';
if ($other) {
print '<br>'.$langs->trans("Other").": ".price($other)."<br><br>";
}
print "</h2></div>";
//save totals to DB

View File

@ -3105,6 +3105,7 @@ class Facture extends CommonInvoice
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new FactureLigne($this->db);
$line->fetch($rowid);
$line->fetch_optionals();
if (!empty($line->fk_product))
{
@ -3173,7 +3174,10 @@ class Facture extends CommonInvoice
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
// We replace values in this->line->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$this->line->array_options[$key] = $array_options[$key];
}
}
$result = $this->line->update($user, $notrigger);

View File

@ -155,23 +155,7 @@ if (empty($reshook))
}
}
// Si ajout champ produit libre
if (GETPOST('mode') == 'libre')
{
$date_start_sl = '';
$date_end_sl = '';
if (GETPOST('date_start_slmonth') && GETPOST('date_start_slday') && GETPOST('date_start_slyear'))
{
$date_start_sl = dol_mktime(GETPOST('date_start_slhour'), GETPOST('date_start_slmin'), 0, GETPOST('date_start_slmonth'), GETPOST('date_start_slday'), GETPOST('date_start_slyear'));
}
if (GETPOST('date_end_slmonth') && GETPOST('date_end_slday') && GETPOST('date_end_slyear'))
{
$date_end_sl = dol_mktime(GETPOST('date_end_slhour'), GETPOST('date_end_slmin'), 0, GETPOST('date_end_slmonth'), GETPOST('date_end_slday'), GETPOST('date_end_slyear'));
}
}
// Param dates
$date_contrat = '';
$date_start_update = '';
$date_end_update = '';
$date_start_real_update = '';
@ -665,11 +649,12 @@ if (empty($reshook))
if (!$error)
{
$objectline = new ContratLigne($db);
if ($objectline->fetch(GETPOST('elrowid')) < 0)
if ($objectline->fetch(GETPOST('elrowid', 'int')) < 0)
{
setEventMessages($objectline->error, $objectline->errors, 'errors');
$error++;
}
$objectline->fetch_optionals();
}
$db->begin();
@ -693,6 +678,7 @@ if (empty($reshook))
$txtva = $vat_rate;
// Clean vat code
$reg = array();
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
@ -735,7 +721,13 @@ if (empty($reshook))
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($objectline->table_element);
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
$objectline->array_options = $array_options;
if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$objectline->array_options[$key] = $array_options[$key];
}
}
// TODO verifier price_min si fk_product et multiprix

View File

@ -189,6 +189,36 @@ class Contrat extends CommonObject
protected $lines_id_index_mapper = array();
public $fields=array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>15),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>20),
'ref_supplier' =>array('type'=>'varchar(50)', 'label'=>'Ref supplier', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
'mise_en_service' =>array('type'=>'datetime', 'label'=>'Mise en service', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'fin_validite' =>array('type'=>'datetime', 'label'=>'Fin validite', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'date_cloture' =>array('type'=>'datetime', 'label'=>'Date cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial suivi', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
'fk_user_mise_en_service' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user mise en service', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'Ref customer', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
);
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;
const STATUS_CLOSED = 2;
@ -1739,8 +1769,14 @@ class Contrat extends CommonObject
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
{
$contractline = new ContratLigne($this->db);
$contractline->array_options = $array_options;
$contractline->id = $rowid;
$contractline->fetch($rowid);
$contractline->fetch_optionals();
// We replace values in $contractline->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$contractline->array_options[$key] = $array_options[$key];
}
$result = $contractline->insertExtraFields();
if ($result < 0)
{

View File

@ -5187,7 +5187,6 @@ abstract class CommonObject
$attributeRequired = $extrafields->attributes[$this->table_element]['required'][$attributeKey];
$attrfieldcomputed = $extrafields->attributes[$this->table_element]['computed'][$attributeKey];
if ($attributeRequired)
{
$mandatorypb = false;
@ -5218,7 +5217,6 @@ abstract class CommonObject
}
}
switch ($attributeType)
{
case 'int':

View File

@ -2147,23 +2147,27 @@ class ExtraFields
if (in_array($key_type, array('date', 'datetime')))
{
if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)."year") continue; // Value was not provided, we should not set it.
// Clean parameters
$value_key = dol_mktime($_POST[$keysuffix."options_".$key.$keyprefix."hour"], $_POST[$keysuffix."options_".$key.$keyprefix."min"], 0, $_POST[$keysuffix."options_".$key.$keyprefix."month"], $_POST[$keysuffix."options_".$key.$keyprefix."day"], $_POST[$keysuffix."options_".$key.$keyprefix."year"]);
$value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int'));
}
elseif (in_array($key_type, array('checkbox', 'chkbxlst')))
{
if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
// Make sure we get an array even if there's only one checkbox
$value_arr = (array) $value_arr;
$value_key = implode(',', $value_arr);
}
elseif (in_array($key_type, array('price', 'double')))
elseif (in_array($key_type, array('price', 'double', 'int')))
{
if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
$value_key = price2num($value_arr);
}
else
{
if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
$value_key = GETPOST($keysuffix."options_".$key.$keyprefix);
}

View File

@ -1712,8 +1712,8 @@ class FormFile
if (count($filearray) == 0)
{
print '<tr class="oddeven"><td colspan="5">';
if (empty($textifempty)) print $langs->trans("NoFileFound");
else print $textifempty;
if (empty($textifempty)) print '<span class="opacitymedium">'.$langs->trans("NoFileFound").'</span>';
else print '<span class="opacitymedium">'.$textifempty.'</span>';
print '</td></tr>';
}
print "</table>";

View File

@ -1140,7 +1140,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
{
$limittitle = 30;
$out .= '<a class="tabTitle">';
if ($picto) $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath).' ';
if ($picto) $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle').' ';
$out .= '<span class="tabTitleText">'.dol_trunc($title, $limittitle).'</span>';
$out .= '</a>';
}

View File

@ -283,7 +283,7 @@ if (! function_exists('dol_loginfunction'))
// Set jquery theme
$dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
$favicon = DOL_URL_ROOT.'/theme/common/dolibarr_logo_256x256.png';
$favicon = DOL_URL_ROOT.'/theme/dolibarr_logo_256x256.png';
if (! empty($mysoc->logo_squarred_mini)) $favicon = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini);
if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;

View File

@ -1474,7 +1474,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Cash Control
if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled))
{
$permtomakecashfence = ($user->rights->cashdesk->use || $user->rights->takepos->use);
$permtomakecashfence = ($user->rights->cashdesk->run || $user->rights->takepos->run);
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol');
$newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence);
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence);

View File

@ -85,10 +85,10 @@ class modCashDesk extends DolibarrModules
$r++;
$this->rights[$r][0] = 50101;
$this->rights[$r][1] = 'Use point of sale';
$this->rights[$r][1] = 'Use Point of sale';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'use';
$this->rights[$r][4] = 'run';
// Main menu entries
$this->menus = array(); // List of menus to add
@ -103,7 +103,7 @@ class modCashDesk extends DolibarrModules
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>900,
'enabled'=>'$conf->cashdesk->enabled',
'perms'=>'$user->rights->cashdesk->use', // Use 'perms'=>'1' if you want your menu with no permission rules
'perms'=>'$user->rights->cashdesk->run', // Use 'perms'=>'1' if you want your menu with no permission rules
'target'=>'pointofsale',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both

View File

@ -199,10 +199,10 @@ class modTakePos extends DolibarrModules
$r++;
$this->rights[$r][0] = 50151;
$this->rights[$r][1] = 'Use point of sale';
$this->rights[$r][1] = 'Use Point Of Sale';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'use';
$this->rights[$r][4] = 'run';
// Main menu entries
@ -221,7 +221,7 @@ class modTakePos extends DolibarrModules
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000+$r,
'enabled'=>'$conf->takepos->enabled', // Define condition to show or hide menu entry. Use '$conf->takepos->enabled' if entry must be visible if module is enabled.
'perms'=>'1', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules
'perms'=>'$user->rights->takepos->run', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules
'target'=>'takepos',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both

View File

@ -105,7 +105,7 @@ $coldisplay++;
// Do not allow editing during a situation cycle
if ($line->fk_prev_id == null)
{
// editeur wysiwyg
// editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$nbrows = ROWS_2;
if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;

View File

@ -1287,12 +1287,12 @@ class Cronjob extends CommonObject
/**
* Return label of status of user (active, inactive)
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode, $this->processing);
return $this->LibStatut($this->status, $mode, $this->processing, $this->lastresult);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -1300,13 +1300,17 @@ class Cronjob extends CommonObject
* Renvoi le libelle d'un statut donne
*
* @param int $status Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @param int $processing 0=Not running, 1=Running
* @param int $lastresult Value of last result (0=no error, error otherwise)
* @return string Label of status
*/
public function LibStatut($status, $mode = 0, $processing = 0)
public function LibStatut($status, $mode = 0, $processing = 0, $lastresult = 0)
{
// phpcs:enable
$this->labelStatus = array(); // Force reset o array because label depends on other fields
$this->labelStatusShort = array();
if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
global $langs;
@ -1314,6 +1318,7 @@ class Cronjob extends CommonObject
$moretext = '';
if ($processing) $moretext = ' ('.$langs->trans("Running").')';
elseif ($lastresult) $moretext .= ' ('.$langs->trans("Error").')';
$this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Draft').$moretext;
$this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled').$moretext;
@ -1324,6 +1329,7 @@ class Cronjob extends CommonObject
$statusType = 'status4';
if ($status == 1 && $processing) $statusType = 'status1';
if ($status == 0) $statusType = 'status5';
if ($this->lastresult) $statusType = 'status8';
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}

View File

@ -425,6 +425,7 @@ if ($num > 0)
$object->status = $obj->status;
$object->priority = $obj->priority;
$object->processing = $obj->processing;
$object->lastresult = $obj->lastresult;
$datelastrun = $db->jdate($obj->datelastrun);
$datelastresult = $db->jdate($obj->datelastresult);
@ -541,7 +542,7 @@ if ($num > 0)
// Status
print '<td class="center">';
print $object->getLibStatut(3);
print $object->getLibStatut(5);
print '</td>';
print '<td class="nowraponall right">';

View File

@ -42,6 +42,9 @@ class ExpenseReportStats extends Stats
public $field;
public $where;
private $datetouse = 'date_valid';
/**
* Constructor
*
@ -91,7 +94,7 @@ class ExpenseReportStats extends Stats
*/
public function getNbByYear()
{
$sql = "SELECT YEAR(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').") as dm, count(*)";
$sql = "SELECT YEAR(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).") as dm, count(*)";
$sql.= " FROM ".$this->from;
$sql.= " GROUP BY dm DESC";
$sql.= " WHERE ".$this->where;
@ -109,9 +112,9 @@ class ExpenseReportStats extends Stats
*/
public function getNbByMonth($year, $format = 0)
{
$sql = "SELECT MONTH(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').") as dm, count(*)";
$sql = "SELECT MONTH(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).") as dm, count(*)";
$sql.= " FROM ".$this->from;
$sql.= " WHERE YEAR(e.date_valid) = ".$year;
$sql.= " WHERE YEAR(e.".$this->datetouse.") = ".$year;
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm', 'DESC');
@ -131,9 +134,9 @@ class ExpenseReportStats extends Stats
*/
public function getAmountByMonth($year, $format = 0)
{
$sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%m') as dm, sum(".$this->field.")";
$sql = "SELECT date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%m') as dm, sum(".$this->field.")";
$sql.= " FROM ".$this->from;
$sql.= " WHERE date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%Y') = '".$year."'";
$sql.= " WHERE date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%Y') = '".$year."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm', 'DESC');
@ -151,9 +154,9 @@ class ExpenseReportStats extends Stats
*/
public function getAverageByMonth($year)
{
$sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%m') as dm, avg(".$this->field.")";
$sql = "SELECT date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%m') as dm, avg(".$this->field.")";
$sql.= " FROM ".$this->from;
$sql.= " WHERE date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%Y') = '".$year."'";
$sql.= " WHERE date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%Y') = '".$year."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm', 'DESC');
@ -168,7 +171,7 @@ class ExpenseReportStats extends Stats
*/
public function getAllByYear()
{
$sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
$sql = "SELECT date_format(".$this->db->ifsql('e.'.$this->datetouse.' IS NULL', 'e.date_create', 'e.'.$this->datetouse).",'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
$sql.= " FROM ".$this->from;
$sql.= " WHERE ".$this->where;
$sql.= " GROUP BY year";

View File

@ -232,7 +232,9 @@ $liststatus = $tmpexpensereport->statuts;
print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'int'), -4, 0, 0, '', 1);
print '</td></tr>';
// Year
print '<tr><td>'.$langs->trans("Year").'</td><td>';
print '<tr><td>';
print $form->textwithpicto($langs->trans("Year"), $langs->trans("DateValidation"));
print '</td><td>';
if (!in_array($year, $arrayyears)) $arrayyears[$year] = $year;
arsort($arrayyears);
print $form->selectarray('year', $arrayyears, $year, 0);

View File

@ -2572,6 +2572,8 @@ class CommandeFournisseur extends CommonOrder
//Fetch current line from the database and then clone the object and set it in $oldline property
$this->line = new CommandeFournisseurLigne($this->db);
$this->line->fetch($rowid);
$this->line->fetch_optionals();
$oldline = clone $this->line;
$this->line->oldline = $oldline;
@ -2620,7 +2622,10 @@ class CommandeFournisseur extends CommonOrder
$this->line->remise_percent = $remise_percent;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
// We replace values in this->line->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$this->line->array_options[$key] = $array_options[$key];
}
}
$result = $this->line->update($notrigger);

View File

@ -1913,11 +1913,15 @@ class FactureFournisseur extends CommonInvoice
$product_type = $type;
}
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new SupplierInvoiceLine($this->db);
$line->fetch($id);
$line->fetch_optionals();
if ($line->fetch($id) < 1) {
return -1;
}
$staticline = clone $line;
$line->oldline = $staticline;
$line->context = $this->context;
$line->description = $desc;
$line->subprice = $pu_ht;
@ -1945,9 +1949,15 @@ class FactureFournisseur extends CommonInvoice
$line->product_type = $product_type;
$line->info_bits = $info_bits;
$line->fk_unit = $fk_unit;
$line->array_options = $array_options;
// Multicurrency
if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$this->line->array_options[$key] = $array_options[$key];
}
}
// Multicurrency
$line->multicurrency_subprice = $pu_ht_devise;
$line->multicurrency_total_ht = $multicurrency_total_ht;
$line->multicurrency_total_tva = $multicurrency_total_tva;

View File

@ -1014,3 +1014,4 @@ ContactDefault_ticketsup=Ticket
ContactAddedAutomatically=Contact added from contact thirdparty roles
More=More
ShowDetails=Show details
CustomReports=Custom reports

View File

@ -64,3 +64,5 @@ ConfirmProductionDesc=By clicking on '%s', you will validate the consumption and
ProductionForRef=Production of %s
AutoCloseMO=Close automatically the Manufacturing Order if quantities to consume and to produce are reached
NoStockChangeOnServices=No stock change on services
ProductQtyToConsumeByMO=Product quantity still to consume by open MO
ProductQtyToProduceByMO=Product quentity still to produce by open MO

View File

@ -24,7 +24,7 @@ MessageOK=Message on the return page for a validated payment
MessageKO=Message on the return page for a canceled payment
ContentOfDirectoryIsNotEmpty=Content of this directory is not empty.
DeleteAlsoContentRecursively=Check to delete all content recursively
PoweredBy=Powered by
YearOfInvoice=Year of invoice date
PreviousYearOfInvoice=Previous year of invoice date
NextYearOfInvoice=Following year of invoice date

View File

@ -1224,7 +1224,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
print '<meta name="author" content="Dolibarr Development Team">'."\n";
// Favicon
$favicon = DOL_URL_ROOT.'/theme/common/dolibarr_logo_256x256.png';
$favicon = DOL_URL_ROOT.'/theme/dolibarr_logo_256x256.png';
if (!empty($mysoc->logo_squarred_mini)) $favicon = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini);
if (!empty($conf->global->MAIN_FAVICON_URL)) $favicon = $conf->global->MAIN_FAVICON_URL;
if (empty($conf->dol_use_jmobile)) print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n"; // Not required into an Android webview

View File

@ -692,7 +692,7 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text'),
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text'),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>'LinkToThirparty'),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>'LinkToThirparty'),
'description' =>array('type'=>'text', 'label'=>'Descrption', 'enabled'=>1, 'visible'=>0, 'position'=>60),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
@ -716,6 +716,12 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
// type
$type = $obj->Type;
if ($type == 'int(11)') $type='integer';
if ($obj->Field == 'fk_soc') $type = 'integer:Societe:societe/class/societe.class.php';
if (preg_match('/^fk_proj/', $obj->Field)) $type = 'integer:Project:projet/class/project.class.php:1:fk_statut=1';
if (preg_match('/^fk_prod/', $obj->Field)) $type = 'integer:Product:product/class/product.class.php:1';
if ($obj->Field == 'fk_warehouse') $type = 'integer:Entrepot:product/stock/class/entrepot.class.php';
if (preg_match('/^(fk_user|fk_commercial)/', $obj->Field)) $type = 'integer:User:user/class/user.class.php';
// notnull
$notnull = ($obj->Null == 'YES'?0:1);
if ($fieldname == 'fk_user_modif') $notnull = -1;

View File

@ -48,7 +48,7 @@ class MyObject extends CommonObject
public $ismultientitymanaged = 0;
/**
* @var int Does myobject support extrafields ? 0=No, 1=Yes
* @var int Does object support extrafields ? 0=No, 1=Yes
*/
public $isextrafieldmanaged = 1;

View File

@ -318,6 +318,9 @@ class Product extends CommonObject
public $stats_contrat = array();
public $stats_facture = array();
public $stats_commande_fournisseur = array();
public $stats_reception = array();
public $stats_mrptoconsume = array();
public $stats_mrptoproduce = array();
public $multilangs = array();
@ -2806,6 +2809,93 @@ class Product extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge tableau des stats commande client pour le produit/service
*
* @param int $socid Id societe pour filtrer sur une societe
* @param string $filtrestatut Id statut pour filtrer sur un statut
* @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
* @return integer Array of stats in $this->stats_commande (nb=nb of order, qty=qty ordered), <0 if ko or >0 if ok
*/
public function load_stats_inproduction($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
{
// phpcs:enable
global $conf, $user;
$sql = "SELECT COUNT(DISTINCT m.fk_soc) as nb_customers, COUNT(DISTINCT m.rowid) as nb,";
$sql .= " COUNT(mp.rowid) as nb_rows, SUM(mp.qty) as qty, role";
$sql .= " FROM ".MAIN_DB_PREFIX."mrp_production as mp";
$sql .= ", ".MAIN_DB_PREFIX."mrp_mo as m";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = m.fk_soc";
if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE m.rowid = mp.fk_mo";
$sql .= " AND m.entity IN (".getEntity('mrp').")";
$sql .= " AND mp.fk_product = ".$this->id;
if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) {
$sql .= " AND m.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
}
if ($socid > 0) {
$sql .= " AND m.fk_soc = ".$socid;
}
if ($filtrestatut <> '') {
$sql .= " AND m.status in (".$filtrestatut.")";
}
$sql .= " GROUP BY role";
$this->stats_mrptoconsume['customers'] = 0;
$this->stats_mrptoconsume['nb'] = 0;
$this->stats_mrptoconsume['rows'] = 0;
$this->stats_mrptoconsume['qty'] = 0;
$this->stats_mrptoproduce['customers'] = 0;
$this->stats_mrptoproduce['nb'] = 0;
$this->stats_mrptoproduce['rows'] = 0;
$this->stats_mrptoproduce['qty'] = 0;
$result = $this->db->query($sql);
if ($result) {
while ($obj = $this->db->fetch_object($result)) {
if ($obj->role == 'toconsume') {
$this->stats_mrptoconsume['customers'] += $obj->nb_customers;
$this->stats_mrptoconsume['nb'] += $obj->nb;
$this->stats_mrptoconsume['rows'] += $obj->nb_rows;
$this->stats_mrptoconsume['qty'] += ($obj->qty ? $obj->qty : 0);
}
if ($obj->role == 'consumed') {
//$this->stats_mrptoconsume['customers'] += $obj->nb_customers;
//$this->stats_mrptoconsume['nb'] += $obj->nb;
//$this->stats_mrptoconsume['rows'] += $obj->nb_rows;
$this->stats_mrptoconsume['qty'] -= ($obj->qty ? $obj->qty : 0);
}
if ($obj->role == 'toproduce') {
$this->stats_mrptoproduce['customers'] += $obj->nb_customers;
$this->stats_mrptoproduce['nb'] += $obj->nb;
$this->stats_mrptoproduce['rows'] += $obj->nb_rows;
$this->stats_mrptoproduce['qty'] += ($obj->qty ? $obj->qty : 0);
}
if ($obj->role == 'produced') {
//$this->stats_mrptoproduce['customers'] += $obj->nb_customers;
//$this->stats_mrptoproduce['nb'] += $obj->nb;
//$this->stats_mrptoproduce['rows'] += $obj->nb_rows;
$this->stats_mrptoproduce['qty'] -= ($obj->qty ? $obj->qty : 0);
}
}
// Clean data
if ($this->stats_mrptoconsume['qty'] < 0) $this->stats_mrptoconsume['qty'] = 0;
if ($this->stats_mrptoproduce['qty'] < 0) $this->stats_mrptoproduce['qty'] = 0;
return 1;
}
else
{
$this->error = $this->db->error();
return -1;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge tableau des stats contrat pour le produit/service
@ -4717,8 +4807,9 @@ class Product extends CommonObject
}
if (!empty($conf->mrp->enabled))
{
// TODO
$stock_inproduction = 0;
$result = $this->load_stats_inproduction(0, '1,2', 1);
if ($result < 0) dol_print_error($this->db, $this->error);
$stock_inproduction = $this->stats_mrptoproduce['qty'] - $this->stats_mrptoconsume['qty'];
}
$this->stock_theorique = $this->stock_reel + $stock_inproduction;

View File

@ -689,6 +689,14 @@ if ($id > 0 || $ref)
$helpondiff .= $langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$object->stats_reception['qty'];
}
// Number of product in production
if (!empty($conf->mrp->enabled)) {
if ($found) $helpondiff .= '<br>'; else $found = 1;
$helpondiff .= $langs->trans("ProductQtyToConsumeByMO").': '.$object->stats_mrptoconsume['qty'].'<br>';
$helpondiff .= $langs->trans("ProductQtyToProduceByMO").': '.$object->stats_mrptoproduce['qty'];
}
// Calculating a theorical value
print '<tr><td>';
print $form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc"));

View File

@ -717,7 +717,8 @@ if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head = '<link rel="styleshee
$conf->dol_hide_topmenu = 1;
$conf->dol_hide_leftmenu = 1;
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea);
// Check link validity
if ($source && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
@ -753,27 +754,7 @@ print '<input type="hidden" name="securekey" value="'.dol_escape_htmltag($SECURE
print '<input type="hidden" name="e" value="'.$entity.'" />';
print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox', 'int').'" />';
print "\n";
print '<!-- Form to send a payment -->'."\n";
print '<!-- creditor = '.$creditor.' -->'."\n";
// Additionnal information for each payment system
if (!empty($conf->paypal->enabled))
{
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
print '<!-- PAYPAL_API_INTEGRAL_OR_PAYPALONLY = '.$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY.' -->'."\n";
}
if (!empty($conf->paybox->enabled))
{
print '<!-- PAYBOX_CGI_URL = '.$conf->global->PAYBOX_CGI_URL_V2.' -->'."\n";
}
if (!empty($conf->stripe->enabled))
{
print '<!-- STRIPE_LIVE = '.$conf->global->STRIPE_LIVE.' -->'."\n";
}
print '<!-- urlok = '.$urlok.' -->'."\n";
print '<!-- urlko = '.$urlko.' -->'."\n";
print "\n";
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
$width = 0;
@ -803,13 +784,43 @@ elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$log
// Output html code for logo
if ($urllogo)
{
print '<tr>';
print '<td align="center"><img id="dolpaymentlogo" title="'.$title.'" src="'.$urllogo.'"';
print '<div class="backgreypublicpayment">';
print '<div class="logopublicpayment">';
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
if ($width) print ' width="'.$width.'"';
print '></td>';
print '</tr>'."\n";
print '>';
print '</div>';
if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
print '<div class="poweredbypublicpayment opacitymedium right"><a href="https://www.dolibarr.org" target="dolibarr">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.png" width="80px"></a></div>';
}
print '</div>';
}
print '<!-- Form to send a payment -->'."\n";
print '<!-- creditor = '.$creditor.' -->'."\n";
// Additionnal information for each payment system
if (!empty($conf->paypal->enabled))
{
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
print '<!-- PAYPAL_API_INTEGRAL_OR_PAYPALONLY = '.$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY.' -->'."\n";
}
if (!empty($conf->paybox->enabled))
{
print '<!-- PAYBOX_CGI_URL = '.$conf->global->PAYBOX_CGI_URL_V2.' -->'."\n";
}
if (!empty($conf->stripe->enabled))
{
print '<!-- STRIPE_LIVE = '.$conf->global->STRIPE_LIVE.' -->'."\n";
}
print '<!-- urlok = '.$urlok.' -->'."\n";
print '<!-- urlko = '.$urlko.' -->'."\n";
print "\n";
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
// Output introduction text
$text = '';
if (!empty($conf->global->PAYMENT_NEWFORM_TEXT))

View File

@ -391,7 +391,7 @@ class SupplierProposal extends CommonObject
* @param int $fk_fournprice Id supplier price. If 0, we will take best price. If -1 we keep it empty.
* @param int $pa_ht Buying price without tax
* @param string $label ???
* @param array $array_option extrafields array
* @param array $array_options extrafields array
* @param string $ref_supplier Supplier price reference
* @param int $fk_unit Id of the unit to use.
* @param string $origin 'order', 'supplier_proposal', ...
@ -403,7 +403,7 @@ class SupplierProposal extends CommonObject
*
* @see add_product()
*/
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $pu_ttc = 0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $array_option = 0, $ref_supplier = '', $fk_unit = '', $origin = '', $origin_id = 0, $pu_ht_devise = 0, $date_start = 0, $date_end = 0)
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $pu_ttc = 0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $array_options = 0, $ref_supplier = '', $fk_unit = '', $origin = '', $origin_id = 0, $pu_ht_devise = 0, $date_start = 0, $date_end = 0)
{
global $mysoc, $conf, $langs;
@ -605,8 +605,8 @@ class SupplierProposal extends CommonObject
// Mise en option de la ligne
if (empty($qty) && empty($special_code)) $this->line->special_code=3;
if (is_array($array_option) && count($array_option)>0) {
$this->line->array_options=$array_option;
if (is_array($array_options) && count($array_options)>0) {
$this->line->array_options=$array_options;
}
$result=$this->line->insert();
@ -664,13 +664,13 @@ class SupplierProposal extends CommonObject
* @param int $pa_ht Price (without tax) of product when it was bought
* @param string $label ???
* @param int $type 0/1=Product/service
* @param array $array_option extrafields array
* @param array $array_options extrafields array
* @param string $ref_supplier Supplier price reference
* @param int $fk_unit Id of the unit to use.
* @param double $pu_ht_devise Unit price in currency
* @return int 0 if OK, <0 if KO
*/
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $array_option = 0, $ref_supplier = '', $fk_unit = '', $pu_ht_devise = 0)
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $array_options = 0, $ref_supplier = '', $fk_unit = '', $pu_ht_devise = 0)
{
global $conf,$user,$langs, $mysoc;
@ -720,13 +720,17 @@ class SupplierProposal extends CommonObject
$multicurrency_total_tva = $tabprice[17];
$multicurrency_total_ttc = $tabprice[18];
// Update line
$this->line=new SupplierProposalLine($this->db);
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new SupplierProposalLine($this->db);
$line->fetch($rowid);
$line->fetch_optionals();
// Stock previous line records
$staticline=new SupplierProposalLine($this->db);
$staticline->fetch($rowid);
$this->line->oldline = $staticline;
$staticline = clone $line;
$line->oldline = $staticline;
$this->line = $line;
$this->line->context = $this->context;
// Reorder if fk_parent_line change
if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line)
@ -773,8 +777,11 @@ class SupplierProposal extends CommonObject
}
$this->line->pa_ht = $pa_ht;
if (is_array($array_option) && count($array_option)>0) {
$this->line->array_options=$array_option;
if (is_array($array_options) && count($array_options)>0) {
// We replace values in this->line->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$this->line->array_options[$key] = $array_options[$key];
}
}
// Multicurrency

View File

@ -78,6 +78,9 @@ if ($invoice->socid > 0) $soc->fetch($invoice->socid);
else $soc->fetch($conf->global->$constforcompanyid);
*/
// Security check
$result = restrictedArea($user, 'takepos', 0, '');
/*
* View

Binary file not shown.

Before

Width:  |  Height:  |  Size: 791 B

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

View File

@ -100,7 +100,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
}
.side-nav-vert .user-menu .dropdown-menu > .user-header {
min-height: 175px;
min-height: 100px;
padding: 10px;
text-align: center;
white-space: normal;

View File

@ -2462,6 +2462,9 @@ a.tabTitle {
text-decoration: none;
white-space: nowrap;
}
.imgTabTitle {
max-height: 14px;
}
a.tabunactive {
color: rgb(<?php print $colortextlink; ?>) !important;
@ -3496,7 +3499,7 @@ img.boxhandle, img.boxclose {
.ok { color: #114466; }
.warning { color: #887711 !important; }
.error { color: #550000 !important; font-weight: bold; }
.error { color: #660000 !important; font-weight: bold; }
.green { color: #118822; }
div.ok {
@ -3663,6 +3666,18 @@ table.table-fiche-title {
margin-bottom: 5px;
}
div.backgreypublicpayment { background-color: #f0f0f0; padding: 20px; border-bottom: 1px solid #ddd; }
.backgreypublicpayment a { color: #222 !important; }
.poweredbypublicpayment {
float: right;
top: 8px;
right: 8px;
position: absolute;
font-size: 0.8em;
color: #222;
opacity: 0.3;
}
#dolpaymenttable { min-width: 320px; font-size: 16px; } /* Width must have min to make stripe input area visible. Lower than 320 makes input area crazy for credit card that need zip code */
#tablepublicpayment { border: 1px solid #CCCCCC !important; width: 100%; padding: 20px; }
#tablepublicpayment .CTableRow1 { background-color: #F0F0F0 !important; }

View File

@ -153,7 +153,7 @@ a.info-box-text{ text-decoration: none;}
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$prefix='';
$prefix = 'background-';
//$prefix = 'background-';
if (! empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) $prefix = 'background-';
if (! isset($conf->global->THEME_AGRESSIVENESS_RATIO) && $prefix) $conf->global->THEME_AGRESSIVENESS_RATIO=-50;

View File

@ -46,7 +46,7 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_AP
"name": "<?php echo $appli; ?>",
"icons": [
{
"src": "<?php echo DOL_URL_ROOT.'/theme/common/dolibarr_logo_256x256.png'; ?>",
"src": "<?php echo DOL_URL_ROOT.'/theme/dolibarr_logo_256x256.png'; ?>",
"sizes": "256x256",
"type": "image/png"
}

View File

@ -53,7 +53,7 @@ $theme_bgcolor = array(hexdec('F4'), hexdec('F4'), hexdec('F4'));
$theme_bgcoloronglet = array(hexdec('DE'), hexdec('E7'), hexdec('EC'));
// Colors
$colorbackhmenu1 = '60,70,100'; // topmenu
$colorbackhmenu1 = '68,68,90'; // topmenu
$colorbackvmenu1 = '250,250,250'; // vmenu
$colortopbordertitle1 = '200,200,200'; // top border of title
$colorbacktitle1 = '233,234,237'; // title of tables,list
@ -112,7 +112,7 @@ $badgeStatus4 = '#55a580'; // Color ok
$badgeStatus5 = '#cad2d2';
$badgeStatus6 = '#cad2d2';
$badgeStatus7 = '#baa32b';
$badgeStatus8 = '#be3013';
$badgeStatus8 = '#993013';
$badgeStatus9 = '#e7f0f0';
// status color ajustement for color blind

View File

@ -98,7 +98,7 @@ a.info-box-text{ text-decoration: none;}
/* ICONS */
/* ICONS INFO BOX */
.info-box-icon {
color: #000 !important;
}

View File

@ -2637,8 +2637,6 @@ div.popuptab {
}
a.tabTitle {
/* background: #657090;
color: white;*/
color:rgba(0,0,0,.5);
margin-<?php print $right; ?>: 10px;
text-shadow:1px 1px 1px #ffffff;
@ -2649,6 +2647,9 @@ a.tabTitle {
text-decoration: none;
white-space: nowrap;
}
.imgTabTitle {
max-height: 14px;
}
a.tab:link, a.tab:visited, a.tab:hover, a.tab#active {
font-family: <?php print $fontlist ?>;
@ -3780,6 +3781,20 @@ table.table-fiche-title .col-title div.titre{
line-height: 40px;
}
div.backgreypublicpayment { background-color: #f0f0f0; padding: 20px; border-bottom: 1px solid #ddd; }
.backgreypublicpayment a { color: #222 !important; }
.poweredbypublicpayment {
float: right;
top: 8px;
right: 8px;
position: absolute;
font-size: 0.8em;
color: #222;
opacity: 0.3;
}
span.buttonpaymentsmall {
text-shadow: none;
}
#dolpaymenttable { min-width: 320px; font-size: 16px; } /* Width must have min to make stripe input area visible. Lower than 320 makes input area crazy for credit card that need zip code */
#tablepublicpayment { border: 1px solid #CCCCCC !important; width: 100%; padding: 20px; }
#tablepublicpayment .CTableRow1 { background-color: #F0F0F0 !important; }

View File

@ -99,5 +99,5 @@ $badgeStatus4 = '#277d1e';
$badgeStatus5 = '#cad2d2';
$badgeStatus6 = '#cad2d2';
$badgeStatus7 = '#baa32b';
$badgeStatus8 = '#be3013';
$badgeStatus8 = '#993013';
$badgeStatus9 = '#e7f0f0';