Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
ed8b4100c8
@ -884,7 +884,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Gender
|
||||
print '<tr><td>'.$langs->trans("Gender").'</td>';
|
||||
print '<td>';
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother"));
|
||||
print $form->selectarray('gender', $arraygender, GETPOST('gender', 'alphanohtml'), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1107,7 +1107,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Gender
|
||||
print '<tr><td>'.$langs->trans("Gender").'</td>';
|
||||
print '<td>';
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother"));
|
||||
print $form->selectarray('gender', $arraygender, GETPOSTISSET('gender') ? GETPOST('gender', 'alphanohtml') : $object->gender, 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -477,7 +477,7 @@ if (!empty($arrayfields['d.lastname']['checked'])) {
|
||||
}
|
||||
if (!empty($arrayfields['d.gender']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), , 'other'=>$langs->trans("Genderother"));
|
||||
print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -628,7 +628,7 @@ if ($rowid > 0) {
|
||||
$subscriptionstatic->ref = $objp->crowid;
|
||||
$subscriptionstatic->id = $objp->crowid;
|
||||
|
||||
$typeid = ($objp->cfk_type > 0 ? $objp->cfk_type : $adh->typeid);
|
||||
$typeid = $objp->cfk_type;
|
||||
if ($typeid > 0) {
|
||||
$adht->fetch($typeid);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014-2018 Frederic France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -155,6 +156,9 @@ if ($mode == 'setup' && $user->admin)
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'userinfo_email,userinfo_profile,cloud_print';
|
||||
if (!empty($conf->global->OAUTH_GSUITE)){
|
||||
$shortscope .= ',admin_directory_user';
|
||||
}
|
||||
//$scope.=',gmail_full';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
|
||||
@ -36,7 +36,7 @@ if (!$user->admin) accessforbidden();
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$scandir = GETPOST('scandir', 'alpha');
|
||||
$type = 'supplier_payment';
|
||||
|
||||
|
||||
@ -267,7 +267,7 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/', '', $file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -923,6 +923,9 @@ if ($id > 0 || !empty($ref)) {
|
||||
print '<td colspan="3"> </td>'; // Supplier ref + Qty ordered + qty already dispatched
|
||||
} else {
|
||||
$type = 'dispatch';
|
||||
$colspan = 7;
|
||||
$colspan = (!empty($conf->global->PRODUCT_DISABLE_EATBY)) ? --$colspan : $colspan;
|
||||
$colspan = (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) ? --$colspan : $colspan;
|
||||
print '<td class="right">';
|
||||
print '</td>'; // Qty to dispatch
|
||||
print '<td>';
|
||||
@ -949,7 +952,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven" name="'.$type.$suffix.'">';
|
||||
print '<td colspan="7">';
|
||||
print '<td colspan="'.$colspan.'">';
|
||||
print '<input name="fk_commandefourndet'.$suffix.'" type="hidden" value="'.$objp->rowid.'">';
|
||||
print '<input name="product'.$suffix.'" type="hidden" value="'.$objp->fk_product.'">';
|
||||
|
||||
@ -1086,7 +1089,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
var fk_default_warehouse = $("option:selected", this).val();
|
||||
$("select[name^=entrepot_]").val(fk_default_warehouse).change();
|
||||
});
|
||||
|
||||
|
||||
jQuery("#autoreset").click(function() {';
|
||||
$i = 0;
|
||||
while ($i < $nbproduct) {
|
||||
|
||||
@ -116,6 +116,11 @@ class Google extends AbstractService
|
||||
// Android Publisher
|
||||
const SCOPE_ANDROID_PUBLISHER = 'https://www.googleapis.com/auth/androidpublisher';
|
||||
|
||||
|
||||
// Google Gsuite
|
||||
const SCOPE_ADMIN_DIRECTORY_USER = "https://www.googleapis.com/auth/admin.directory.user";
|
||||
const SCOPE_ADMIN_DIRECTORY_CUSTOMER = "https://www.googleapis.com/auth/admin.directory.customer";
|
||||
|
||||
protected $accessType = 'online';
|
||||
|
||||
public function __construct(
|
||||
@ -150,7 +155,7 @@ class Google extends AbstractService
|
||||
}
|
||||
$this->approvalPrompt = $prompt;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
@ -840,6 +840,7 @@ ListOfTemplates=List of templates
|
||||
Gender=Gender
|
||||
Genderman=Man
|
||||
Genderwoman=Woman
|
||||
Genderother=Other
|
||||
ViewList=List view
|
||||
ViewGantt=Gantt view
|
||||
ViewKanban=Kanban view
|
||||
|
||||
@ -44,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
@ -290,7 +291,8 @@ if (empty($reshook))
|
||||
$object->note_private = dol_htmlcleanlastbr(GETPOST('note_private', 'none'));
|
||||
$object->note = $object->note_private; // deprecated
|
||||
$object->customcode = GETPOST('customcode', 'alphanohtml');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
$object->duration_value = $duration_value;
|
||||
$object->duration_unit = $duration_unit;
|
||||
$object->fk_default_warehouse = GETPOST('fk_default_warehouse');
|
||||
@ -395,7 +397,8 @@ if (empty($reshook))
|
||||
$object->note = $object->note_private;
|
||||
}
|
||||
$object->customcode = GETPOST('customcode', 'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
$object->status = GETPOST('statut', 'int');
|
||||
$object->status_buy = GETPOST('statut_buy', 'int');
|
||||
$object->status_batch = GETPOST('status_batch', 'aZ09');
|
||||
@ -866,6 +869,7 @@ llxHeader('', $title, $helpurl);
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formproduct = new FormProduct($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
if (!empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
||||
|
||||
// Load object modBarCodeProduct
|
||||
@ -908,6 +912,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
print '<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#selectcountry_id").change(function() {
|
||||
document.formprod.action.value="create";
|
||||
document.formprod.submit();
|
||||
});
|
||||
});';
|
||||
print '</script>'."\n";
|
||||
|
||||
// Load object modCodeProduct
|
||||
$module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard');
|
||||
if (substr($module, 0, 16) == 'mod_codeproduct_' && substr($module, -3) == 'php')
|
||||
@ -922,7 +935,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
|
||||
dol_set_focus('input[name="ref"]');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formprod">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">'."\n";
|
||||
@ -942,6 +955,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
$linkback = "";
|
||||
print load_fiche_titre($title, $linkback, $picto);
|
||||
|
||||
// We set country_id, country_code and country for the selected country
|
||||
$object->country_id = GETPOST('country_id', 'int) ? GETPOST('country_id', 'int') : null;
|
||||
if ($object->country_id > 0)
|
||||
{
|
||||
$tmparray = getCountry($object->country_id, 'all');
|
||||
$object->country_code = $tmparray['code'];
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
@ -1114,14 +1136,31 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
// Custom code
|
||||
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO) && empty($type))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.GETPOST('customcode').'"></td>';
|
||||
if ($conf->browser->layout == 'phone') print '</tr><tr>';
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.GETPOST('customcode').'"></td></tr>';
|
||||
|
||||
// Origin country
|
||||
print '<td>'.$langs->trans("CountryOrigin").'</td>';
|
||||
print '<td>';
|
||||
print $form->select_country(GETPOST('country_id', 'int'), 'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
print '</td></tr>';
|
||||
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
|
||||
print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
print '</td>';
|
||||
|
||||
// State
|
||||
if (empty($conf->global->PRODUCT_DISABLE_STATE))
|
||||
{
|
||||
if ($conf->browser->layout == 'phone') print '</tr><tr>';
|
||||
if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2))
|
||||
{
|
||||
print '<td>'.$form->editfieldkey('Region-StateOrigine', 'state_id', '', $object, 0).'</td><td colspan="3">';
|
||||
} else {
|
||||
print '<td>'.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).'</td><td colspan="3">';
|
||||
}
|
||||
|
||||
print $formcompany->select_state($object->state_id, $object->country_code);
|
||||
print '</tr>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
@ -1333,12 +1372,31 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
print '<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#selectcountry_id").change(function () {
|
||||
document.formprod.action.value="edit";
|
||||
document.formprod.submit();
|
||||
});
|
||||
});';
|
||||
print '</script>'."\n";
|
||||
|
||||
// We set country_id, country_code and country for the selected country
|
||||
$object->country_id = GETPOST('country_id') ? GETPOST('country_id') : $object->country_id;
|
||||
if ($object->country_id)
|
||||
{
|
||||
$tmparray = getCountry($object->country_id, 'all');
|
||||
$object->country_code = $tmparray['code'];
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
|
||||
|
||||
$type = $langs->trans('Product');
|
||||
if ($object->isService()) $type = $langs->trans('Service');
|
||||
//print load_fiche_titre($langs->trans('Modify').' '.$type.' : '.(is_object($object->oldcopy)?$object->oldcopy->ref:$object->ref), "");
|
||||
|
||||
// Main official, simple, and not duplicated code
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'."\n";
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST" name="formprod">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
@ -1349,6 +1407,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
$picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
|
||||
dol_fiche_head($head, 'card', $titre, 0, $picto);
|
||||
|
||||
|
||||
print '<table class="border allwidth">';
|
||||
|
||||
// Ref
|
||||
@ -1529,12 +1588,29 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
// Custom code
|
||||
if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.$object->customcode.'"></td>';
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.$object->customcode.'"></td></tr>';
|
||||
// Origin country
|
||||
print '<td>'.$langs->trans("CountryOrigin").'</td><td>';
|
||||
print '<td>'.$langs->trans("CountryOrigin").'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
|
||||
print $form->select_country($object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
// State
|
||||
if (empty($conf->global->PRODUCT_DISABLE_STATE))
|
||||
{
|
||||
if ($conf->browser->layout == 'phone') print '</tr><tr>';
|
||||
if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2))
|
||||
{
|
||||
print '<td>'.$form->editfieldkey('Region-StateOrigine', 'state_id', '', $object, 0).'</td><td colspan="3">';
|
||||
} else {
|
||||
print '<td>'.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).'</td><td colspan="3">';
|
||||
}
|
||||
|
||||
print $formcompany->select_state($object->state_id, $object->country_code);
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
@ -2031,7 +2107,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td colspan="2">'.$object->customcode.'</td>';
|
||||
|
||||
// Origin country code
|
||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($object->country_id, 0, $db).'</td>';
|
||||
print '<tr><td>'.$langs->trans("Origin").'</td><td colspan="2">'.getCountry($object->country_id, 0, $db);
|
||||
if (!empty($object->state_id)) print ' - '.getState($object->state_id, 0, $db);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
|
||||
@ -883,6 +883,10 @@ class Product extends CommonObject
|
||||
$this->country_id = 0;
|
||||
}
|
||||
|
||||
if (empty($this->state_id)) {
|
||||
$this->state_id = 0;
|
||||
}
|
||||
|
||||
// Barcode value
|
||||
$this->barcode = trim($this->barcode);
|
||||
|
||||
@ -1000,6 +1004,7 @@ class Product extends CommonObject
|
||||
$sql .= ", url = ".($this->url ? "'".$this->db->escape($this->url)."'" : 'null');
|
||||
$sql .= ", customcode = '".$this->db->escape($this->customcode)."'";
|
||||
$sql .= ", fk_country = ".($this->country_id > 0 ? (int) $this->country_id : 'null');
|
||||
$sql .= ", fk_state = ".($this->state_id > 0 ? (int) $this->state_id : 'null');
|
||||
$sql .= ", note = ".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : 'null');
|
||||
$sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'";
|
||||
$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
|
||||
@ -2025,7 +2030,7 @@ class Product extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid, ref, ref_ext, label, description, url, note_public, note as note_private, customcode, fk_country, price, price_ttc,";
|
||||
$sql = "SELECT rowid, ref, ref_ext, label, description, url, note_public, note as note_private, customcode, fk_country, fk_state, price, price_ttc,";
|
||||
$sql .= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,";
|
||||
$sql .= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, net_measure, net_measure_units, weight, weight_units,";
|
||||
$sql .= " length, length_units, width, width_units, height, height_units,";
|
||||
@ -2073,6 +2078,7 @@ class Product extends CommonObject
|
||||
$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->price = $obj->price;
|
||||
$this->price_ttc = $obj->price_ttc;
|
||||
$this->price_min = $obj->price_min;
|
||||
@ -5204,17 +5210,15 @@ class Product extends CommonObject
|
||||
$this->barcode = -1; // Create barcode automatically
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the label, shot_label or code found in units dictionary from ->fk_unit.
|
||||
* A langs->trans() must be called on result to get translated value.
|
||||
*
|
||||
* @param string $type Label type (long, short or code)
|
||||
* @return string|int <0 if KO, label if OK (Example: 'long', 'short', 'unitCODE')
|
||||
* @see getLabelOfUnit() in CommonObjectLine
|
||||
*/
|
||||
public function getLabelOfUnit($type = 'long')
|
||||
{
|
||||
global $langs;
|
||||
/**
|
||||
* Returns the text label from units dictionary
|
||||
*
|
||||
* @param string $type Label type (long or short)
|
||||
* @return string|int <0 if ko, label if ok
|
||||
*/
|
||||
public function getLabelOfUnit($type = 'long')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if (!$this->fk_unit) {
|
||||
return '';
|
||||
@ -5222,24 +5226,25 @@ class Product extends CommonObject
|
||||
|
||||
$langs->load('products');
|
||||
|
||||
$label_type = 'label';
|
||||
if ($type == 'short') $label_type = 'short_label';
|
||||
elseif ($type == 'code') $label_type = 'code';
|
||||
$label_type = 'label';
|
||||
|
||||
$sql = 'select '.$label_type.', code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql && $this->db->num_rows($resql) > 0) {
|
||||
$res = $this->db->fetch_array($resql);
|
||||
if ($label_type == 'code') $label = 'unit'.$res['code'];
|
||||
else $label = $res[$label_type];
|
||||
$this->db->free($resql);
|
||||
return $label;
|
||||
} else {
|
||||
$this->error = $this->db->error().' sql='.$sql;
|
||||
dol_syslog(get_class($this)."::getLabelOfUnit Error ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if ($type == 'short') {
|
||||
$label_type = 'short_label';
|
||||
}
|
||||
|
||||
$sql = 'select '.$label_type.', code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql && $this->db->num_rows($resql) > 0) {
|
||||
$res = $this->db->fetch_array($resql);
|
||||
$label = ($label_type == 'short_label' ? $res[$label_type] : 'unit'.$res['code']);
|
||||
$this->db->free($resql);
|
||||
return $label;
|
||||
} else {
|
||||
$this->error = $this->db->error().' sql='.$sql;
|
||||
dol_syslog(get_class($this)."::getLabelOfUnit Error ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if object has a sell-by date or eat-by date
|
||||
|
||||
@ -6350,7 +6350,23 @@ a.phpdebugbar-tab.phpdebugbar-active {
|
||||
font-family: "Font Awesome 5 Free";
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-value.phpdebugbar-widgets-warning:before,
|
||||
div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-value.phpdebugbar-widgets-error:before,
|
||||
div.phpdebugbar-widgets-exceptions a.phpdebugbar-widgets-editor-link:before,
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-database:before,
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-duration:before,
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-memory:before,
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-row-count:before,
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard:before,
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-stmt-id:before,
|
||||
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render-time:before,
|
||||
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-memory:before,
|
||||
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count:before,
|
||||
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before,
|
||||
div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before
|
||||
{
|
||||
font-family: "Font Awesome 5 Free" !important;
|
||||
}
|
||||
|
||||
/* ============================================================================== */
|
||||
/* CSS style used for jFlot */
|
||||
|
||||
@ -6210,7 +6210,23 @@ a.phpdebugbar-tab.phpdebugbar-active {
|
||||
font-family: "Font Awesome 5 Free";
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-value.phpdebugbar-widgets-warning:before,
|
||||
div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-value.phpdebugbar-widgets-error:before,
|
||||
div.phpdebugbar-widgets-exceptions a.phpdebugbar-widgets-editor-link:before,
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-database:before,
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-duration:before,
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-memory:before,
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-row-count:before,
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard:before,
|
||||
div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-stmt-id:before,
|
||||
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render-time:before,
|
||||
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-memory:before,
|
||||
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count:before,
|
||||
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before,
|
||||
div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before
|
||||
{
|
||||
font-family: "Font Awesome 5 Free" !important;
|
||||
}
|
||||
|
||||
/* ============================================================================== */
|
||||
/* CSS style used for jFlot */
|
||||
|
||||
@ -943,7 +943,7 @@ if ($action == 'create' || $action == 'adduserldap')
|
||||
// Gender
|
||||
print '<tr><td>'.$langs->trans("Gender").'</td>';
|
||||
print '<td>';
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother"));
|
||||
print $form->selectarray('gender', $arraygender, GETPOST('gender'), 1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -2200,7 +2200,7 @@ if ($action == 'create' || $action == 'adduserldap')
|
||||
// Gender
|
||||
print '<tr><td>'.$langs->trans("Gender").'</td>';
|
||||
print '<td>';
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother"));
|
||||
if ($caneditfield) {
|
||||
print $form->selectarray('gender', $arraygender, GETPOSTISSET('gender') ?GETPOST('gender') : $object->gender, 1);
|
||||
} else {
|
||||
|
||||
@ -386,7 +386,7 @@ if (!empty($arrayfields['u.firstname']['checked']))
|
||||
if (!empty($arrayfields['u.gender']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother"));
|
||||
print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user