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

This commit is contained in:
Laurent Destailleur 2022-09-23 18:53:42 +02:00
commit 8ade44b7ca
12 changed files with 295 additions and 99 deletions

View File

@ -1507,6 +1507,57 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
}
}
if (!$error && ($massaction == 'increaseholiday' || ($action == 'increaseholiday' && $confirm == 'yes')) && $permissiontoapprove) {
$db->begin();
$objecttmp = new $objectclass($db);
$nbok = 0;
$typeholiday = GETPOST('typeholiday', 'alpha');
$nbdaysholidays = GETPOST('nbdaysholidays', 'double');
if ($nbdaysholidays <= 0) {
setEventMessages($langs->trans("WrongAmount"), "", 'errors');
$error++;
}
if (!$error) {
foreach ($toselect as $toselectid) {
$balancecpuser = $objecttmp->getCPforUser($toselectid, $typeholiday);
if (!empty($balancecpuser)) {
$newnbdaysholidays = $nbdaysholidays + $balancecpuser;
} else {
$newnbdaysholidays = $nbdaysholidays;
}
$result = $holiday->addLogCP($user->id, $toselectid, $langs->transnoentitiesnoconv('ManualUpdate'), $newnbdaysholidays, $typeholiday);
if ($result <= 0) {
setEventMessages($holiday->error, $holiday->errors, 'errors');
$error++;
break;
}
$objecttmp->updateSoldeCP($toselectid, $newnbdaysholidays, $typeholiday);
if ($result > 0) {
$nbok++;
} else {
setEventMessages("", $langs->trans("ErrorUpdatingUsersCP"), 'errors');
$error++;
break;
}
}
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("HolidayRecordsIncreased", $nbok), null, 'mesgs');
} elseif ($nbok == 1) {
setEventMessages($langs->trans("HolidayRecordIncreased"), null, 'mesgs');
}
$db->commit();
$toselect=array();
} else {
$db->rollback();
}
}
$parameters['toselect'] = $toselect;
$parameters['uploaddir'] = $uploaddir;
$parameters['massaction'] = $massaction;

View File

@ -80,6 +80,7 @@ class ExtraFields
'datetime'=>'DateAndTime',
'boolean'=>'Boolean',
'price'=>'ExtrafieldPrice',
'pricecy'=>'ExtrafieldPriceWithCurrency',
'phone'=>'ExtrafieldPhone',
'mail'=>'ExtrafieldMail',
'url'=>'ExtrafieldUrl',
@ -113,7 +114,7 @@ class ExtraFields
*
* @param string $attrname Code of attribute
* @param string $label label of attribute
* @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price','phone','mail','password','url','select','checkbox','separate',...)
* @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price', 'pricecy', 'phone','mail','password','url','select','checkbox','separate',...)
* @param int $pos Position of attribute
* @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma.
* @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...)
@ -182,7 +183,7 @@ class ExtraFields
* This is a private method. For public method, use addExtraField.
*
* @param string $attrname code of attribute
* @param int $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
* @param int $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','pricecy','phone','mail','password','url','select','checkbox', ...)
* @param string $length Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @param int $unique Is field unique or not
@ -217,6 +218,9 @@ class ExtraFields
} elseif ($type == 'price') {
$typedb = 'double';
$lengthdb = '24,8';
} elseif ($type == 'pricecy') {
$typedb = 'varchar';
$lengthdb = '64';
} elseif ($type == 'phone') {
$typedb = 'varchar';
$lengthdb = '20';
@ -567,6 +571,9 @@ class ExtraFields
} elseif ($type == 'price') {
$typedb = 'double';
$lengthdb = '24,8';
} elseif ($type == 'pricecy') {
$typedb = 'varchar';
$lengthdb = '64';
} elseif ($type == 'phone') {
$typedb = 'varchar';
$lengthdb = '20';
@ -1089,6 +1096,16 @@ class ExtraFields
$value = price($value);
}
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'> '.$langs->getCurrencySymbol($conf->currency);
} elseif ($type == 'pricecy') {
$currency = $conf->currency;
if (!empty($value)) {
// $value in memory is a php string like '10.01:USD'
$pricetmp = explode(':', $value);
$currency = !empty($pricetmp[1]) ? $pricetmp[1] : $conf->currency;
$value = price($pricetmp[0]);
}
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'> ';
$out .= $form->selectCurrency($currency, $keyprefix.$key.$keysuffix.'currency_id');
} elseif ($type == 'double') {
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value = price($value);
@ -1624,6 +1641,17 @@ class ExtraFields
if ($value || $value == '0') {
$value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$langs->getCurrencySymbol($conf->currency);
}
} elseif ($type == 'pricecy') {
$currency = $conf->currency;
if (!empty($value)) {
// $value in memory is a php string like '0.01:EUR'
$pricetmp = explode(':', $value);
$currency = !empty($pricetmp[1]) ? $pricetmp[1] : $conf->currency;
$value = $pricetmp[0];
}
if ($value || $value == '0') {
$value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1, $currency);
}
} elseif ($type == 'select') {
$valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : '');
if (($pos = strpos($valstr, "|")) !== false) {
@ -2095,6 +2123,8 @@ class ExtraFields
} elseif (in_array($key_type, array('price', 'double'))) {
$value_arr = GETPOST("options_".$key, 'alpha');
$value_key = price2num($value_arr);
} elseif (in_array($key_type, array('pricecy', 'double'))) {
$value_key = price2num(GETPOST("options_".$key, 'alpha')).':'.GETPOST("options_".$key."currency_id", 'alpha');
} elseif (in_array($key_type, array('html'))) {
$value_key = GETPOST("options_".$key, 'restricthtml');
} elseif (in_array($key_type, array('text'))) {

View File

@ -80,7 +80,10 @@ function categories_prepare_head(Categorie $object, $type)
*/
function categoriesadmin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('categorie');
$langs->load("categories");
@ -94,6 +97,10 @@ function categoriesadmin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsCategories");
$nbExtrafields = $extrafields->attributes['categorie']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes_categories';
$h++;

View File

@ -20,8 +20,8 @@
*/
/**
* \file htdocs/core/lib/member.lib.php
* \brief Functions for module members
* \file htdocs/core/lib/member.lib.php
* \brief Functions for module members
*/
/**
@ -184,7 +184,11 @@ function member_type_prepare_head(AdherentType $object)
*/
function member_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('adherent');
$extrafields->fetch_name_optionals_label('adherent_type');
$h = 0;
$head = array();
@ -207,11 +211,19 @@ function member_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/member_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsMember");
$nbExtrafields = $extrafields->attributes['adherent']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/member_type_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsMemberType");
$nbExtrafields = $extrafields->attributes['adherent_type']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes_type';
$h++;

View File

@ -42,7 +42,7 @@ function commande_prepare_head(Commande $object)
$h = 0;
$head = array();
if (isModEnabled('commande') && $user->rights->commande->lire) {
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
$head[$h][0] = DOL_URL_ROOT.'/commande/card.php?id='.$object->id;
$head[$h][1] = $langs->trans("CustomerOrder");
$head[$h][2] = 'order';
@ -61,27 +61,27 @@ function commande_prepare_head(Commande $object)
}
if ((isModEnabled('expedition_bon') && $user->hasRight('expedition', 'lire'))
|| ($conf->delivery_note->enabled && $user->hasRight('expedition', 'delivery', 'lire'))) {
|| (isModEnabled('delivery_note') && $user->hasRight('expedition', 'delivery', 'lire'))) {
$nbShipments = $object->getNbOfShipments();
$nbReceiption = 0;
$head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id;
$text = '';
if ($conf->expedition_bon->enabled) {
if (isModEnabled('expedition_bon')) {
$text .= $langs->trans("Shipments");
}
if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled) {
if (isModEnabled('expedition_bon') && isModEnabled('delivery_note')) {
$text .= ' - ';
}
if ($conf->delivery_note->enabled) {
if (isModEnabled('delivery_note')) {
$text .= $langs->trans("Receivings");
}
if ($nbShipments > 0 || $nbReceiption > 0) {
$text .= '<span class="badge marginleftonlyshort">'.($nbShipments ? $nbShipments : 0);
}
if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled && ($nbShipments > 0 || $nbReceiption > 0)) {
if (isModEnabled('expedition_bon') && isModEnabled('delivery_note') && ($nbShipments > 0 || $nbReceiption > 0)) {
$text .= ' - ';
}
if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled && ($nbShipments > 0 || $nbReceiption > 0)) {
if (isModEnabled('expedition_bon') && isModEnabled('delivery_note') && ($nbShipments > 0 || $nbReceiption > 0)) {
$text .= ($nbReceiption ? $nbReceiption : 0);
}
if ($nbShipments > 0 || $nbReceiption > 0) {
@ -147,7 +147,11 @@ function commande_prepare_head(Commande $object)
*/
function order_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('commande');
$extrafields->fetch_name_optionals_label('commandedet');
$h = 0;
$head = array();
@ -161,11 +165,19 @@ function order_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/admin/order_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['commande']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/orderdet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['commandedet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslines';
$h++;
@ -188,7 +200,7 @@ function getCustomerOrderPieChart($socid = 0)
$result = '';
if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) {
if (!isModEnabled('commande') || !$user->hasRight('commande', 'lire')) {
return '';
}
@ -278,7 +290,7 @@ function getCustomerOrderPieChart($socid = 0)
$result .= "</tr>\n";
}
}
if ($conf->use_javascript_ajax) {
if (!empty($conf->use_javascript_ajax)) {
$result .= '<tr class="impair"><td align="center" colspan="2">';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';

View File

@ -97,6 +97,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php<br>Contact:con
else if (type == 'password') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helppassword").show();}
else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'pricecy') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'select') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();}
else if (type == 'sellist') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpsellist").show();}
else if (type == 'radio') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();}

View File

@ -96,6 +96,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php<br>Contact:con
else if (type == 'password') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helppassword").show();}
else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
else if (type == 'pricecy') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
else if (type == 'select') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();}
else if (type == 'sellist') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpsellist").show();}
else if (type == 'radio') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();}

View File

@ -283,6 +283,29 @@ if ($massaction == 'preapproveleave') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassLeaveApproval"), $langs->trans("ConfirmMassLeaveApprovalQuestion", count($toselect)), "approveleave", null, 'yes', 0, 200, 500, 1);
}
if ($massaction == 'preincreaseholiday') {
$langs->load("holiday", "hrm");
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
$staticholiday = new Holiday($db);
$arraytypeholidays = $staticholiday->getTypes(1, 1);
$formquestion[] = array();
$labeltypes = array();
foreach ($typeleaves as $key => $val) {
$labeltypes[$val['id']] = ($langs->trans($val['code']) != $val['code']) ? $langs->trans($val['code']) : $langs->trans($val['label']);
}
$formquestion [] = array( 'type' => 'other',
'name' => 'typeofholiday',
'label' => $langs->trans("Type"),
'value' => $form->selectarray('typeholiday', $labeltypes, GETPOST('typeholiday', 'alpha'), 1)
);
$formquestion [] = array( 'type' => 'other',
'name' => 'nbdaysholydays',
'label' => $langs->trans("NumberDayAddMass"),
'value' => '<input name="nbdaysholidays" id="nbdaysholidays" value="'.GETPOST('nbdaysholidays', 'int').'">'
);
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassIncreaseHoliday"), $langs->trans("ConfirmMassIncreaseHolidayQuestion", count($toselect)), "increaseholiday", $formquestion, 1, 0, 200, 500, 1);
}
// Allow Pre-Mass-Action hook (eg for confirmation dialog)
$parameters = array(
'toselect' => $toselect,

View File

@ -46,6 +46,9 @@ $search_supervisor = GETPOST('search_supervisor', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$confirm = GETPOST('confirm', 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
@ -113,14 +116,13 @@ if (empty($reshook)) {
}
// Mass actions
/*
$objectclass='Skeleton';
$objectlabel='Skeleton';
$permissiontoread = $user->rights->skeleton->read;
$permissiontodelete = $user->rights->skeleton->delete;
$uploaddir = $conf->skeleton->dir_output;
$objectclass = 'Holiday';
$objectlabel = 'Holiday';
$permissiontoread = $user->hasRight('holiday', 'read');
$permissiontodelete = $user->hasRight('holiday', 'delete');
$permissiontoapprove = $user->hasRight('holiday', 'approve');
$uploaddir = $conf->holiday->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
*/
// Si il y a une action de mise à jour
if ($action == 'update' && GETPOSTISSET('update_cp')) {
@ -213,6 +215,17 @@ if ($result < 0) {
setEventMessages($holiday->error, $holiday->errors, 'errors');
}
// List of mass actions available
$arrayofmassactions = array(
//'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
);
if ($user->hasRight("holiday", "approve")) {
$arrayofmassactions['preincreaseholiday'] = img_picto('', 'add', 'class="pictofixedwidth"').$langs->trans("IncreaseHolidays");
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') {
@ -226,7 +239,10 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print load_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png');
$title = $langs->trans("MenuConfCP");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $massactionbutton, '', '', 'title_hrm', 0, '', '', $limit, 0, 0, 1);
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
print '<div class="info">'.$langs->trans('LastUpdateCP').': '."\n";
$lastUpdate = $holiday->getConfCP('lastUpdate');
@ -298,6 +314,7 @@ if (count($typeleaves) == 0) {
print '<td class="liste_titre"></td>';
}
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
// Action column
print '<td class="liste_titre maxwidthsearch center">';
@ -320,11 +337,19 @@ if (count($typeleaves) == 0) {
}
print_liste_field_titre((empty($user->rights->holiday->define_holiday) ? '' : 'Note'), $_SERVER["PHP_SELF"]);
print_liste_field_titre('');
if ($massactionbutton) {
$selectedfields = $form->showCheckAddButtons('checkforselect', 1);
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print '</tr>';
$usersupervisor = new User($db);
foreach ($listUsers as $users) {
$arrayofselected = is_array($toselect) ? $toselect : array();
// If user has not permission to edit/read all, we must see only subordinates
if (empty($user->rights->holiday->readall)) {
if (($users['rowid'] != $user->id) && (!in_array($users['rowid'], $userchilds))) {
@ -389,11 +414,21 @@ if (count($typeleaves) == 0) {
print '</td>';
// Button modify
print '<td>';
print '<td class="center">';
if (!empty($user->rights->holiday->define_holiday)) { // Allowed to set the balance of any user
print '<input type="submit" name="update_cp['.$users['rowid'].']" value="'.dol_escape_htmltag($langs->trans("Save")).'" class="button smallpaddingimp"/>';
}
print '</td>'."\n";
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($userstatic->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$userstatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$userstatic->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
print '</tr>';
$i++;

View File

@ -437,6 +437,7 @@ Unique=Unique
Boolean=Boolean (one checkbox)
ExtrafieldPhone = Phone
ExtrafieldPrice = Price
ExtrafieldPriceWithCurrency=Price with currency
ExtrafieldMail = Email
ExtrafieldUrl = Url
ExtrafieldIP = IP

View File

@ -149,4 +149,10 @@ XIsAUsualNonWorkingDay=%s is usualy a NON working day
BlockHolidayIfNegative=Block if balance negative
LeaveRequestCreationBlockedBecauseBalanceIsNegative=The creation of this leave request is blocked because your balance is negative
ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted=Leave request %s must be draft, canceled or refused to be deleted
IncreaseHolidays=Increase holiday
HolidayRecordsIncreased= %s holiday records increased
HolidayRecordIncreased=Holiday record increased
ConfirmMassIncreaseHoliday=Bulk holiday increase
NumberDayAddMass=Number of day to add to the selection
ConfirmMassIncreaseHolidayQuestion=Are you sure you want to increase holiday of the %s selected record(s)?
HolidayQtyNotModified=Balance of remaining days for %s has not been changed

View File

@ -14,7 +14,7 @@
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017 Gustavo Novaro
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2022 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
@ -255,6 +255,14 @@ class Product extends CommonObject
*/
public $status = 0;
/**
* Status indicates whether the product is on sale '1' or not '0'
* @var int
* @deprecated
* @see $status
*/
public $tosell;
/**
* Status indicate whether the product is available for purchase '1' or not '0'
*
@ -262,6 +270,14 @@ class Product extends CommonObject
*/
public $status_buy = 0;
/**
* Status indicate whether the product is available for purchase '1' or not '0'
* @var int
* @deprecated
* @see $status_buy
*/
public $tobuy;
/**
* Status indicates whether the product is a finished product '1' or a raw material '0'
*
@ -1977,11 +1993,11 @@ class Product extends CommonObject
$this->remise_percent = $obj->remise_percent; // remise percent if present and not typed
$this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
$this->default_vat_code = $obj->default_vat_code; // Vat code supplier
$this->fourn_multicurrency_price = $obj->multicurrency_price;
$this->fourn_multicurrency_unitprice = $obj->multicurrency_unitprice;
$this->fourn_multicurrency_tx = $obj->multicurrency_tx;
$this->fourn_multicurrency_id = $obj->fk_multicurrency;
$this->fourn_multicurrency_code = $obj->multicurrency_code;
$this->fourn_multicurrency_price = $obj->multicurrency_price;
$this->fourn_multicurrency_unitprice = $obj->multicurrency_unitprice;
$this->fourn_multicurrency_tx = $obj->multicurrency_tx;
$this->fourn_multicurrency_id = $obj->fk_multicurrency;
$this->fourn_multicurrency_code = $obj->multicurrency_code;
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$this->packaging = $obj->packaging;
}
@ -2042,11 +2058,11 @@ class Product extends CommonObject
$this->remise_percent = $obj->remise_percent; // remise percent if present and not typed
$this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
$this->default_vat_code = $obj->default_vat_code; // Vat code supplier
$this->fourn_multicurrency_price = $obj->multicurrency_price;
$this->fourn_multicurrency_unitprice = $obj->multicurrency_unitprice;
$this->fourn_multicurrency_tx = $obj->multicurrency_tx;
$this->fourn_multicurrency_id = $obj->fk_multicurrency;
$this->fourn_multicurrency_code = $obj->multicurrency_code;
$this->fourn_multicurrency_price = $obj->multicurrency_price;
$this->fourn_multicurrency_unitprice = $obj->multicurrency_unitprice;
$this->fourn_multicurrency_tx = $obj->multicurrency_tx;
$this->fourn_multicurrency_id = $obj->fk_multicurrency;
$this->fourn_multicurrency_code = $obj->multicurrency_code;
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$this->packaging = $obj->packaging;
}
@ -2383,57 +2399,57 @@ class Product extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->ref_ext = $obj->ref_ext;
$this->label = $obj->label;
$this->description = $obj->description;
$this->url = $obj->url;
$this->note_public = $obj->note_public;
$this->note_private = $obj->note_private;
$this->note = $obj->note_private; // deprecated
$this->ref = $obj->ref;
$this->ref_ext = $obj->ref_ext;
$this->label = $obj->label;
$this->description = $obj->description;
$this->url = $obj->url;
$this->note_public = $obj->note_public;
$this->note_private = $obj->note_private;
$this->note = $obj->note_private; // deprecated
$this->type = $obj->fk_product_type;
$this->status = $obj->tosell;
$this->status_buy = $obj->tobuy;
$this->status_batch = $obj->tobatch;
$this->batch_mask = $obj->batch_mask;
$this->type = $obj->fk_product_type;
$this->status = $obj->tosell;
$this->status_buy = $obj->tobuy;
$this->status_batch = $obj->tobatch;
$this->batch_mask = $obj->batch_mask;
$this->customcode = $obj->customcode;
$this->country_id = $obj->fk_country;
$this->customcode = $obj->customcode;
$this->country_id = $obj->fk_country;
$this->country_code = getCountry($this->country_id, 2, $this->db);
$this->state_id = $obj->fk_state;
$this->lifetime = $obj->lifetime;
$this->qc_frequency = $obj->qc_frequency;
$this->price = $obj->price;
$this->price_ttc = $obj->price_ttc;
$this->price_min = $obj->price_min;
$this->price_min_ttc = $obj->price_min_ttc;
$this->lifetime = $obj->lifetime;
$this->qc_frequency = $obj->qc_frequency;
$this->price = $obj->price;
$this->price_ttc = $obj->price_ttc;
$this->price_min = $obj->price_min;
$this->price_min_ttc = $obj->price_min_ttc;
$this->price_base_type = $obj->price_base_type;
$this->cost_price = $obj->cost_price;
$this->cost_price = $obj->cost_price;
$this->default_vat_code = $obj->default_vat_code;
$this->tva_tx = $obj->tva_tx;
$this->tva_tx = $obj->tva_tx;
//! French VAT NPR
$this->tva_npr = $obj->tva_npr;
$this->recuperableonly = $obj->tva_npr; // For backward compatibility
$this->tva_npr = $obj->tva_npr;
$this->recuperableonly = $obj->tva_npr; // For backward compatibility
//! Local taxes
$this->localtax1_tx = $obj->localtax1_tx;
$this->localtax2_tx = $obj->localtax2_tx;
$this->localtax1_type = $obj->localtax1_type;
$this->localtax2_type = $obj->localtax2_type;
$this->localtax1_tx = $obj->localtax1_tx;
$this->localtax2_tx = $obj->localtax2_tx;
$this->localtax1_type = $obj->localtax1_type;
$this->localtax2_type = $obj->localtax2_type;
$this->finished = $obj->finished;
$this->fk_default_bom = $obj->fk_default_bom;
$this->finished = $obj->finished;
$this->fk_default_bom = $obj->fk_default_bom;
$this->duration = $obj->duration;
$this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration) - 1);
$this->duration = $obj->duration;
$this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration) - 1);
$this->duration_unit = substr($obj->duration, -1);
$this->canvas = $obj->canvas;
$this->canvas = $obj->canvas;
$this->net_measure = $obj->net_measure;
$this->net_measure_units = $obj->net_measure_units;
$this->weight = $obj->weight;
$this->weight_units = $obj->weight_units;
$this->length = $obj->length;
$this->length_units = $obj->length_units;
$this->weight = $obj->weight;
$this->weight_units = $obj->weight_units;
$this->length = $obj->length;
$this->length_units = $obj->length_units;
$this->width = $obj->width;
$this->width_units = $obj->width_units;
$this->height = $obj->height;
@ -2442,32 +2458,32 @@ class Product extends CommonObject
$this->surface = $obj->surface;
$this->surface_units = $obj->surface_units;
$this->volume = $obj->volume;
$this->volume_units = $obj->volume_units;
$this->volume_units = $obj->volume_units;
$this->barcode = $obj->barcode;
$this->barcode_type = $obj->fk_barcode_type;
$this->barcode_type = $obj->fk_barcode_type;
$this->accountancy_code_buy = $obj->accountancy_code_buy;
$this->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
$this->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
$this->accountancy_code_sell = $obj->accountancy_code_sell;
$this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
$this->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
$this->accountancy_code_buy = $obj->accountancy_code_buy;
$this->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
$this->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
$this->accountancy_code_sell = $obj->accountancy_code_sell;
$this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
$this->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
$this->fk_default_warehouse = $obj->fk_default_warehouse;
$this->fk_default_workstation = $obj->fk_default_workstation;
$this->seuil_stock_alerte = $obj->seuil_stock_alerte;
$this->desiredstock = $obj->desiredstock;
$this->stock_reel = $obj->stock;
$this->fk_default_warehouse = $obj->fk_default_warehouse;
$this->fk_default_workstation = $obj->fk_default_workstation;
$this->seuil_stock_alerte = $obj->seuil_stock_alerte;
$this->desiredstock = $obj->desiredstock;
$this->stock_reel = $obj->stock;
$this->pmp = $obj->pmp;
$this->date_creation = $obj->datec;
$this->date_modification = $obj->tms;
$this->import_key = $obj->import_key;
$this->entity = $obj->entity;
$this->date_creation = $obj->datec;
$this->date_modification = $obj->tms;
$this->import_key = $obj->import_key;
$this->entity = $obj->entity;
$this->ref_ext = $obj->ref_ext;
$this->fk_price_expression = $obj->fk_price_expression;
$this->fk_unit = $obj->fk_unit;
$this->ref_ext = $obj->ref_ext;
$this->fk_price_expression = $obj->fk_price_expression;
$this->fk_unit = $obj->fk_unit;
$this->price_autogen = $obj->price_autogen;
$this->model_pdf = $obj->model_pdf;
@ -5255,7 +5271,7 @@ class Product extends CommonObject
* @param string $origin_element Origin element type
* @param int $origin_id Origin id of element
* @param int $disablestockchangeforsubproduct Disable stock change for sub-products of kit (usefull only if product is a subproduct)
* @param array $extrafields Array of extrafields
* @param Extrafields $extrafields Array of extrafields
* @return int <0 if KO, >0 if OK
*/
public function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $inventorycode = '', $origin_element = '', $origin_id = null, $disablestockchangeforsubproduct = 0, $extrafields = null)
@ -5315,7 +5331,7 @@ class Product extends CommonObject
* @param string $origin_element Origin element type
* @param int $origin_id Origin id of element
* @param int $disablestockchangeforsubproduct Disable stock change for sub-products of kit (usefull only if product is a subproduct)
* @param array $extrafields Array of extrafields
* @param Extrafields $extrafields Array of extrafields
* @return int <0 if KO, >0 if OK
*/
public function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $dlc = '', $dluo = '', $lot = '', $inventorycode = '', $origin_element = '', $origin_id = null, $disablestockchangeforsubproduct = 0, $extrafields = null)
@ -5921,10 +5937,11 @@ class Product extends CommonObject
$this->description = 'This is description of this product specimen that was created the '.dol_print_date($now, 'dayhourlog').'.';
$this->specimen = 1;
$this->country_id = 1;
$this->tosell = 1;
$this->tobuy = 1;
$this->status = 1;
$this->status_buy = 1;
$this->tobatch = 0;
$this->note = 'This is a comment (private)';
$this->note_private = 'This is a comment (private)';
$this->note_public = 'This is a comment (public)';
$this->date_creation = $now;
$this->date_modification = $now;