Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into fix_see_ldap_connected_server
This commit is contained in:
commit
390d5eccaf
@ -829,23 +829,23 @@ if ($action == 'edit') {
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') {
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD)) {
|
||||
// List of string to add in SPF if the setup use the mail method. Example 'include:sendgrid.net include:spf.mydomain.com'
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD);
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD);
|
||||
} else {
|
||||
// MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is list of IPs where email is sent from. Example: '1.2.3.4, [aaaa:bbbb:cccc:dddd]'.
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) {
|
||||
// List of IP show as record to add in SPF if we use the mail method
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) {
|
||||
// List of IP show as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]'
|
||||
// TODO Add a key to allow to show the IP/name of server detected dynamically
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS -->'.$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
}
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD)) { // Should be required only if you have preset the Dolibarr to use your own SMTP and you want to warn users to update their domain name to match your SMTP server.
|
||||
// List of string to add in SPF if we use the smtp method. Example 'include:spf.mydomain.com'
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
require '../../main.inc.php';
|
||||
|
||||
$action = GETPOST('action', 'alphanohtml');
|
||||
$select_product_val = GETPOST('select_product_val', 'int');
|
||||
$current_bom_id = GETPOST('current_bom_id', 'int');
|
||||
|
||||
global $db;
|
||||
|
||||
switch ($action) {
|
||||
case 'select_BOM':
|
||||
//Selection of nomenclatures corresponding to the selected product
|
||||
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product, p.label AS product_label FROM '.MAIN_DB_PREFIX.'bom_bom AS b ';
|
||||
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product AS p ON b.fk_product=p.rowid';
|
||||
$sql.= ' WHERE fk_product='.(int) $select_product_val.' AND b.rowid<>'. (int) $current_bom_id;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql && $db->num_rows($resql) > 0) {
|
||||
$options = array();
|
||||
$cpt=0;
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$options[$obj->rowid] = $obj->ref.' - '.$obj->label;
|
||||
$cpt++;
|
||||
}
|
||||
print json_encode($options);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -242,6 +242,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
$conf->global->BOM_SUB_BOM=1;
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -573,38 +574,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
||||
print '</table>';
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
let select_product_val;
|
||||
let current_bom_id = <?php echo $object->id?>;
|
||||
//On change on the bom select
|
||||
$('#idprod').on('change', function () {
|
||||
select_product_val = $('#idprod').select2().val();
|
||||
|
||||
//Ajax to set all options without reloading the page
|
||||
$.ajax({
|
||||
url: 'script/interface.php'
|
||||
, method: 'POST'
|
||||
, dataType: 'text'
|
||||
, data: {
|
||||
action: 'select_BOM'
|
||||
, select_product_val: select_product_val
|
||||
, current_bom_id: current_bom_id
|
||||
}
|
||||
}).done(function (data) {
|
||||
//To remove all options of the bom select on change
|
||||
$('#bom_select').get(0).length = 0;
|
||||
|
||||
//To set options for the bom select on change
|
||||
let options = JSON.parse(data)
|
||||
for (let key in options) {
|
||||
let opt = new Option(options[key], key);
|
||||
$('#bom_select').append(opt)
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<?php
|
||||
print '</div>';
|
||||
|
||||
print "</form>\n";
|
||||
@ -612,9 +581,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
// When clicking on collapse
|
||||
$(".collapse_bom").click(function() {
|
||||
|
||||
console.log("We click on collapse");
|
||||
var id_bom_line = $(this).attr('id').replace('collapse-', '');
|
||||
if($(this).text().indexOf('+') > 0) {
|
||||
$('[parentid="'+ id_bom_line +'"]').show();
|
||||
@ -628,14 +597,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
return false;
|
||||
});
|
||||
|
||||
//To Show all the sub bom lines
|
||||
// To Show all the sub bom lines
|
||||
$("#show_all").click(function() {
|
||||
console.log("We click on show all");
|
||||
$("[class^=sub_bom_lines]").show();
|
||||
$("[class^=collapse_bom]").html('(-) ');
|
||||
return false;
|
||||
});
|
||||
//To Hide all the sub bom lines
|
||||
|
||||
// To Hide all the sub bom lines
|
||||
$("#hide_all").click(function() {
|
||||
console.log("We click on hide all");
|
||||
$("[class^=sub_bom_lines]").hide();
|
||||
$("[class^=collapse_bom]").html('(+) ');
|
||||
return false;
|
||||
|
||||
@ -61,8 +61,6 @@ if ($nolinesbefore) {
|
||||
print '<td class="linecoldescription minwidth500imp">';
|
||||
print '<div id="add"></div><span class="hideonsmartphone">'.$langs->trans('AddNewLine').'</span>';
|
||||
print '</td>';
|
||||
// Linked BOM
|
||||
print '<td class="linecolBOM">'.$langs->trans('BOM').'</td>';
|
||||
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="linecoluseunit left">';
|
||||
@ -90,15 +88,14 @@ print '<td class="bordertop nobottom linecoldescription minwidth500imp">';
|
||||
|
||||
// Predefined product/service
|
||||
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
|
||||
if ($forceall >= 0 && $freelines) {
|
||||
echo '<br>';
|
||||
if (!empty($conf->global->BOM_SUB_BOM)) {
|
||||
print $langs->trans("Product");
|
||||
}
|
||||
echo '<span class="prod_entry_mode_predef">';
|
||||
$filtertype = '';
|
||||
if (!empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) {
|
||||
$filtertype = '1';
|
||||
$filtertype = 0;
|
||||
if (!empty($object->element) && $object->element == 'contrat' && empty($conf->global->STOCK_SUPPORT_SERVICES)) {
|
||||
$filtertype = -1;
|
||||
}
|
||||
|
||||
$statustoshow = -1;
|
||||
if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) {
|
||||
// hide products in closed warehouse, but show products for internal transfer
|
||||
@ -109,11 +106,14 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
|
||||
|
||||
echo '</span>';
|
||||
}
|
||||
$coldisplay++;
|
||||
print '<td class="bordertop nobottom linecolbom">';
|
||||
print '<select id="bom_select" name="bom_select"><options value="-1"></options></select>';
|
||||
if (!empty($conf->global->BOM_SUB_BOM)) {
|
||||
print '<br>'.$langs->trans("or").' '.$langs->trans("BOM");
|
||||
// TODO Add component to select a BOM
|
||||
print '<select id="bom_select" name="bom_select"><options value="-1"></options></select>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="bordertop nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(GETPOSTISSET("qty") ? GETPOST("qty", 'alpha', 2) : 1).'">';
|
||||
print '</td>';
|
||||
@ -134,7 +134,7 @@ print '</td>';
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="bordertop nobottom nowrap linecollost right">';
|
||||
print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.(GETPOSTISSET("efficiency") ?GETPOST("efficiency", 'alpha') : 1).'">';
|
||||
print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="'.((GETPOSTISSET("efficiency") && $action == 'addline') ?GETPOST("efficiency", 'alpha') : 1).'">';
|
||||
print '</td>';
|
||||
|
||||
$coldisplay++;
|
||||
|
||||
@ -97,8 +97,6 @@ print '</td>';
|
||||
*/
|
||||
|
||||
$coldisplay++;
|
||||
// For BOM
|
||||
print '<td></td>';
|
||||
|
||||
print '<td class="nobottom linecolqty right">';
|
||||
if (($line->info_bits & 2) != 2) {
|
||||
@ -126,7 +124,7 @@ print '</td>';
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom nowrap linecollost right">';
|
||||
print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>';
|
||||
print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>';
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom nowrap linecolcostprice right">';
|
||||
@ -135,9 +133,8 @@ print '</td>';
|
||||
$coldisplay += $colspan;
|
||||
print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
|
||||
$coldisplay += $colspan;
|
||||
print '<input type="submit" class="button buttongen marginbottomonly button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans("Save").'">';
|
||||
print '<br>';
|
||||
print '<input type="submit" class="button buttongen marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input type="submit" class="button buttongen margintoponly marginbottomonly button-save" id="savelinebutton" name="save" value="'.$langs->trans("Save").'">';
|
||||
print '<input type="submit" class="button buttongen margintoponly marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -39,23 +39,25 @@ if (empty($object) || !is_object($object)) {
|
||||
exit;
|
||||
}
|
||||
print "<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->\n";
|
||||
|
||||
|
||||
// Title line
|
||||
print "<thead>\n";
|
||||
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
print '<a id="show_all" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'</a> ';
|
||||
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a> ';
|
||||
|
||||
// Adds a line numbering column
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
print '<td class="linecolnum center"> </td>';
|
||||
}
|
||||
|
||||
// Description
|
||||
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
|
||||
|
||||
// Linked BOM
|
||||
print '<td class="linecolBOM">'.$langs->trans('BOM').'</td>';
|
||||
// Product or sub-bom
|
||||
print '<td class="linecoldescription">'.$langs->trans('Description');
|
||||
if (!empty($conf->global->BOM_SUB_BOM)) {
|
||||
print ' <a id="show_all" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'</a> ';
|
||||
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a> ';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Qty
|
||||
print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('Qty'), $langs->trans("QtyRequiredIfNoLoss")).'</td>';
|
||||
|
||||
@ -82,19 +82,14 @@ $tmpproduct = new Product($object->db);
|
||||
$tmpproduct->fetch($line->fk_product);
|
||||
$tmpbom = new BOM($object->db);
|
||||
$res = $tmpbom->fetch($line->fk_bom_child);
|
||||
if (!empty($tmpbom->id)) {
|
||||
if ($tmpbom->id > 0) {
|
||||
print $tmpbom->getNomUrl(1);
|
||||
print '<a class="collapse_bom" id="collapse-'.$line->id.'" href="#">' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' </a>';
|
||||
}
|
||||
print $tmpproduct->getNomUrl(1);
|
||||
print ' - '.$tmpproduct->label;
|
||||
print '</td>';
|
||||
|
||||
// To show BOM links in the list
|
||||
if ($res > 0) {
|
||||
print '<td id="bom_id">'.$tmpbom->getNomUrl(1).'</td>';
|
||||
} else {
|
||||
print '<td id="bom_id"> </td>';
|
||||
print $tmpproduct->getNomUrl(1);
|
||||
print ' - '.$tmpproduct->label;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="linecolqty nowrap right">';
|
||||
$coldisplay++;
|
||||
|
||||
@ -193,12 +193,12 @@ class Form
|
||||
* @param object $object Object
|
||||
* @param boolean $perm Permission to allow button to edit parameter
|
||||
* @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datepickerhour', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...')
|
||||
* @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of value). Use '' to use same than $value
|
||||
* @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of numeric value). Use '' to use same than $value
|
||||
* @param object $extObject External object
|
||||
* @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')
|
||||
* @param string $moreparam More param to add on the form action href URL
|
||||
* @param int $notabletag Do no output table tags
|
||||
* @param string $formatfunc Call a specific function to output field
|
||||
* @param string $formatfunc Call a specific function to output field in view mode (For example: 'dol_print_email')
|
||||
* @param string $paramid Key of parameter for id ('id', 'socid')
|
||||
* @return string HTML edit field
|
||||
*/
|
||||
@ -214,7 +214,7 @@ class Form
|
||||
}
|
||||
|
||||
// When option to edit inline is activated
|
||||
if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker and support select
|
||||
if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|day|datepicker|dayhour|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker and support select
|
||||
$ret .= $this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg);
|
||||
} else {
|
||||
$editmode = (GETPOST('action', 'aZ09') == 'edit'.$htmlname);
|
||||
@ -236,7 +236,7 @@ class Form
|
||||
} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) {
|
||||
$tmp = explode(':', $typeofdata);
|
||||
$valuetoshow = price2num($editvalue ? $editvalue : $value);
|
||||
$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ?price($valuetoshow) : '').'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').' autofocus>';
|
||||
$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').' autofocus>';
|
||||
} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
|
||||
$tmp = explode(':', $typeofdata);
|
||||
$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($tmp[1] ? $tmp[1] : '') . '/>';
|
||||
@ -8679,7 +8679,7 @@ class Form
|
||||
*/
|
||||
public function showrefnav($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlstatus = '', $morehtmlright = '')
|
||||
{
|
||||
global $langs, $conf, $hookmanager, $extralanguages;
|
||||
global $conf, $langs, $hookmanager, $extralanguages;
|
||||
|
||||
$ret = '';
|
||||
if (empty($fieldid)) {
|
||||
@ -8691,7 +8691,7 @@ class Form
|
||||
|
||||
// Preparing gender's display if there is one
|
||||
$addgendertxt = '';
|
||||
if (!empty($object->gender)) {
|
||||
if (property_exists($object, 'gender') && !empty($object->gender)) {
|
||||
$addgendertxt = ' ';
|
||||
switch ($object->gender) {
|
||||
case 'man':
|
||||
@ -8705,6 +8705,15 @@ class Form
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
$addadmin = '';
|
||||
if (property_exists($object, 'admin')) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
||||
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||
} elseif (!empty($object->admin)) {
|
||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||
}
|
||||
}*/
|
||||
|
||||
// Add where from hooks
|
||||
if (is_object($hookmanager)) {
|
||||
@ -8837,7 +8846,7 @@ class Form
|
||||
$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
|
||||
}
|
||||
} elseif (in_array($object->element, array('contact', 'user', 'usergroup'))) {
|
||||
$ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt;
|
||||
$ret .= dol_htmlentities($object->getFullName($langs));
|
||||
} elseif (in_array($object->element, array('action', 'agenda'))) {
|
||||
$ret .= $object->ref.'<br>'.$object->label;
|
||||
} elseif (in_array($object->element, array('adherent_type'))) {
|
||||
@ -9085,7 +9094,7 @@ class Form
|
||||
}
|
||||
$ret .= '<table class="nobordernopadding centpercent">';
|
||||
if ($object->photo) {
|
||||
$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>';
|
||||
$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>';
|
||||
}
|
||||
$ret .= '<tr><td class="tdoverflow"><input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'></td></tr>';
|
||||
$ret .= '</table>';
|
||||
|
||||
@ -691,9 +691,9 @@ class FormMail extends Form
|
||||
$out .= '<tr><td class="minwidth200">';
|
||||
$out .= $langs->trans("GroupEmails");
|
||||
$out .= '</td><td>';
|
||||
$out .= ' <input type="checkbox" name="oneemailperrecipient"'.($this->withoptiononeemailperrecipient > 0 ? ' checked="checked"' : '').'> ';
|
||||
$out .= $langs->trans("OneEmailPerRecipient");
|
||||
$out .= '<span class="hideonsmartphone">';
|
||||
$out .= ' <input type="checkbox" id="oneemailperrecipient" name="oneemailperrecipient"'.($this->withoptiononeemailperrecipient > 0 ? ' checked="checked"' : '').'> ';
|
||||
$out .= '<label for="oneemailperrecipient">'.$langs->trans("OneEmailPerRecipient").'</label>';
|
||||
$out .= '<span class="hideonsmartphone opacitymedium">';
|
||||
$out .= ' - ';
|
||||
$out .= $langs->trans("WarningIfYouCheckOneRecipientPerEmail");
|
||||
$out .= '</span>';
|
||||
@ -773,12 +773,11 @@ class FormMail extends Form
|
||||
|
||||
if (!empty($this->withmaindocfile)) {
|
||||
if ($this->withmaindocfile == 1) {
|
||||
$out .= '<input type="checkbox" name="addmaindocfile" value="1" />';
|
||||
$out .= '<input type="checkbox" id="addmaindocfile" name="addmaindocfile" value="1" />';
|
||||
} elseif ($this->withmaindocfile == -1) {
|
||||
$out .= '<input type="checkbox" id="addmaindocfile" name="addmaindocfile" value="1" checked="checked" />';
|
||||
}
|
||||
if ($this->withmaindocfile == -1) {
|
||||
$out .= '<input type="checkbox" name="addmaindocfile" value="1" checked="checked" />';
|
||||
}
|
||||
$out .= ' '.$langs->trans("JoinMainDoc").'.<br>';
|
||||
$out .= ' <label for="addmaindocfile">'.$langs->trans("JoinMainDoc").'.</label><br>';
|
||||
}
|
||||
|
||||
if (is_numeric($this->withfile)) {
|
||||
|
||||
@ -586,18 +586,22 @@ class ImportCsv extends ModeleImports
|
||||
$arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
|
||||
}
|
||||
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getrefifauto') {
|
||||
$defaultref = '';
|
||||
// TODO provide the $modTask (module of generation of ref) as parameter of import_insert function
|
||||
$obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
|
||||
if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php")) {
|
||||
require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php';
|
||||
$modTask = new $obj;
|
||||
$defaultref = $modTask->getNextValue(null, null);
|
||||
}
|
||||
if (is_numeric($defaultref) && $defaultref <= 0) {
|
||||
if (strtolower($newval) == 'auto') {
|
||||
$defaultref = '';
|
||||
|
||||
$classModForNumber = $objimport->array_import_convertvalue[0][$val]['class'];
|
||||
$pathModForNumber = $objimport->array_import_convertvalue[0][$val]['path'];
|
||||
|
||||
if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) {
|
||||
require_once DOL_DOCUMENT_ROOT.$pathModForNumber;
|
||||
$modForNumber = new $classModForNumber;
|
||||
$defaultref = $modForNumber->getNextValue(null, null);
|
||||
}
|
||||
if (is_numeric($defaultref) && $defaultref <= 0) {
|
||||
$defaultref = '';
|
||||
}
|
||||
$newval = $defaultref;
|
||||
}
|
||||
$newval = $defaultref;
|
||||
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'compute') {
|
||||
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
|
||||
$class = $objimport->array_import_convertvalue[0][$val]['class'];
|
||||
|
||||
@ -627,18 +627,22 @@ class ImportXlsx extends ModeleImports
|
||||
$arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
|
||||
}
|
||||
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getrefifauto') {
|
||||
$defaultref = '';
|
||||
// TODO provide the $modTask (module of generation of ref) as parameter of import_insert function
|
||||
$obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
|
||||
if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . ".php")) {
|
||||
require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . '.php';
|
||||
$modTask = new $obj;
|
||||
$defaultref = $modTask->getNextValue(null, null);
|
||||
}
|
||||
if (is_numeric($defaultref) && $defaultref <= 0) {
|
||||
if (strtolower($newval) == 'auto') {
|
||||
$defaultref = '';
|
||||
|
||||
$classModForNumber = $objimport->array_import_convertvalue[0][$val]['class'];
|
||||
$pathModForNumber = $objimport->array_import_convertvalue[0][$val]['path'];
|
||||
|
||||
if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) {
|
||||
require_once DOL_DOCUMENT_ROOT.$pathModForNumber;
|
||||
$modForNumber = new $classModForNumber;
|
||||
$defaultref = $modForNumber->getNextValue(null, null);
|
||||
}
|
||||
if (is_numeric($defaultref) && $defaultref <= 0) {
|
||||
$defaultref = '';
|
||||
}
|
||||
$newval = $defaultref;
|
||||
}
|
||||
$newval = $defaultref;
|
||||
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'compute') {
|
||||
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
|
||||
$class = $objimport->array_import_convertvalue[0][$val]['class'];
|
||||
|
||||
183
htdocs/core/modules/member/mod_member_simple.php
Normal file
183
htdocs/core/modules/member/mod_member_simple.php
Normal file
@ -0,0 +1,183 @@
|
||||
<?php
|
||||
/* Copyright (C) 2021 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* or see https://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/member/mod_member_simple.php
|
||||
* \ingroup member
|
||||
* \brief File with class to manage the numbering module Simple for member references
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_member.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage the numbering module Simple for member references
|
||||
*/
|
||||
class mod_member_simple extends ModeleNumRefMembers
|
||||
{
|
||||
/**
|
||||
* Dolibarr version of the loaded document
|
||||
* @var string
|
||||
*/
|
||||
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
|
||||
public $prefix = 'MEM';
|
||||
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var string Nom du modele
|
||||
* @deprecated
|
||||
* @see $name
|
||||
*/
|
||||
public $nom = 'Simple';
|
||||
|
||||
/**
|
||||
* @var string model name
|
||||
*/
|
||||
public $name = 'Simple';
|
||||
|
||||
|
||||
/**
|
||||
* Return description of numbering module
|
||||
*
|
||||
* @return string Text with description
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an example of numbering module values
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
return $this->prefix."0501-0001";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the numbers already in the database do not
|
||||
* cause conflicts that would prevent this numbering working.
|
||||
*
|
||||
* @return boolean false if conflict, true if ok
|
||||
*/
|
||||
public function canBeActivated()
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
|
||||
$coyymm = '';
|
||||
$max = '';
|
||||
|
||||
$posindice = strlen($this->prefix) + 6;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row) {
|
||||
$coyymm = substr($row[0], 0, 6);
|
||||
$max = $row[0];
|
||||
}
|
||||
}
|
||||
if (!$coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
|
||||
return true;
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorNumRefModel', $max);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Value if OK, 0 if KO
|
||||
*/
|
||||
public function getNextValue($objsoc, $object)
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
/*
|
||||
// First, we get the max value
|
||||
$posindice = strlen($this->prefix) + 6;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$max = intval($obj->max);
|
||||
} else {
|
||||
$max = 0;
|
||||
}
|
||||
} else {
|
||||
dol_syslog("mod_member_simple::getNextValue", LOG_DEBUG);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$date = empty($object->date_c) ? dol_now() : $object->date_c;
|
||||
|
||||
//$yymm = strftime("%y%m",time());
|
||||
$yymm = strftime("%y%m", $date);
|
||||
|
||||
if ($max >= (pow(10, 4) - 1)) {
|
||||
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
|
||||
} else {
|
||||
$num = sprintf("%04s", $max + 1);
|
||||
}
|
||||
|
||||
dol_syslog("mod_member_simple::getNextValue return ".$this->prefix.$yymm."-".$num);
|
||||
return $this->prefix.$yymm."-".$num;
|
||||
*/
|
||||
|
||||
// For the moment, the ref of a member is the rowid
|
||||
$sql = "SELECT MAX(rowid) as max";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$max = intval($obj->max);
|
||||
} else {
|
||||
$max = 0;
|
||||
}
|
||||
} else {
|
||||
dol_syslog("mod_member_simple::getNextValue", LOG_DEBUG);
|
||||
return -1;
|
||||
}
|
||||
return ($max + 1);
|
||||
}
|
||||
}
|
||||
@ -60,3 +60,97 @@ abstract class ModelePDFMember extends CommonDocGenerator
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Classe mere des modeles de numerotation des references de members
|
||||
*/
|
||||
abstract class ModeleNumRefMembers
|
||||
{
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* Return if a module can be used or not
|
||||
*
|
||||
* @return boolean true if module can be used
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi la description par defaut du modele de numerotation
|
||||
*
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("members");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an example of numbering
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("members");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the numbers already in the database do not
|
||||
* cause conflicts that would prevent this numbering working.
|
||||
*
|
||||
* @return boolean false if conflict, true if ok
|
||||
*/
|
||||
public function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi prochaine valeur attribuee
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Valeur
|
||||
*/
|
||||
public function getNextValue($objsoc, $object)
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi version du module numerotation
|
||||
*
|
||||
* @return string Valeur
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
if ($this->version == 'development') {
|
||||
return $langs->trans("VersionDevelopment");
|
||||
} elseif ($this->version == 'experimental') {
|
||||
return $langs->trans("VersionExperimental");
|
||||
} elseif ($this->version == 'dolibarr') {
|
||||
return DOL_VERSION;
|
||||
} elseif ($this->version) {
|
||||
return $this->version;
|
||||
} else {
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,7 +286,7 @@ class modAdherent extends DolibarrModules
|
||||
$this->export_label[$r] = 'MembersAndSubscriptions';
|
||||
$this->export_permission[$r] = array(array("adherent", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'a.rowid'=>'Id', 'a.civility'=>"UserTitle", 'a.lastname'=>"Lastname", 'a.firstname'=>"Firstname", 'a.login'=>"Login", 'a.gender'=>"Gender", 'a.morphy'=>'Nature',
|
||||
'a.rowid'=>'Id', 'a.civility'=>"UserTitle", 'a.lastname'=>"Lastname", 'a.firstname'=>"Firstname", 'a.login'=>"Login", 'a.gender'=>"Gender", 'a.morphy'=>'MemberNature',
|
||||
'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town", 'd.nom'=>"State", 'co.code'=>"CountryCode", 'co.label'=>"Country",
|
||||
'a.phone'=>"PhonePro", 'a.phone_perso'=>"PhonePerso", 'a.phone_mobile'=>"PhoneMobile", 'a.email'=>"Email", 'a.birth'=>"Birthday", 'a.statut'=>"Status",
|
||||
'a.photo'=>"Photo", 'a.note_public'=>"NotePublic", 'a.note_private'=>"NotePrivate", 'a.datec'=>'DateCreation', 'a.datevalid'=>'DateValidation',
|
||||
@ -338,8 +338,9 @@ class modAdherent extends DolibarrModules
|
||||
$this->import_tables_array[$r] = array('a'=>MAIN_DB_PREFIX.'adherent', 'extra'=>MAIN_DB_PREFIX.'adherent_extrafields');
|
||||
$this->import_tables_creator_array[$r] = array('a'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r] = array(
|
||||
'a.ref' => 'Member Ref*',
|
||||
'a.civility'=>"UserTitle", 'a.lastname'=>"Lastname*", 'a.firstname'=>"Firstname", 'a.gender'=>"Gender", 'a.login'=>"Login*", "a.pass"=>"Password",
|
||||
"a.fk_adherent_type"=>"MemberType*", 'a.morphy'=>'Nature*', 'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town",
|
||||
"a.fk_adherent_type"=>"MemberType*", 'a.morphy'=>'MemberNature*', 'a.societe'=>'Company', 'a.address'=>"Address", 'a.zip'=>"Zip", 'a.town'=>"Town",
|
||||
'a.state_id'=>'StateId', 'a.country'=>"CountryId", 'a.phone'=>"PhonePro", 'a.phone_perso'=>"PhonePerso", 'a.phone_mobile'=>"PhoneMobile",
|
||||
'a.email'=>"Email", 'a.birth'=>"Birthday", 'a.statut'=>"Status*", 'a.photo'=>"Photo", 'a.note_public'=>"NotePublic", 'a.note_private'=>"NotePrivate",
|
||||
'a.datec'=>'DateCreation', 'a.datefin'=>'DateEndSubscription'
|
||||
@ -358,7 +359,27 @@ class modAdherent extends DolibarrModules
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_convertvalue_array[$r] = array();
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'a.ref'=>array(
|
||||
'rule'=>'getrefifauto',
|
||||
'class'=>(empty($conf->global->MEMBER_ADDON) ? 'mod_member_simple' : $conf->global->MEMBER_ADDON),
|
||||
'path'=>"/core/modules/member/".(empty($conf->global->MEMBER_ADDON) ? 'mod_member_simple' : $conf->global->MEMBER_ADDON).'.php'
|
||||
),
|
||||
'a.state_id' => array(
|
||||
'rule' => 'fetchidfromcodeid',
|
||||
'classfile' => '/core/class/cstate.class.php',
|
||||
'class' => 'Cstate',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryStateCode'
|
||||
),
|
||||
'a.country' => array(
|
||||
'rule' => 'fetchidfromcodeid',
|
||||
'classfile' => '/core/class/ccountry.class.php',
|
||||
'class' => 'Ccountry',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryCountry'
|
||||
)
|
||||
);
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
$this->import_convertvalue_array[$r]['a.fk_soc'] = array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty');
|
||||
}
|
||||
@ -367,6 +388,7 @@ class modAdherent extends DolibarrModules
|
||||
'a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility', 'a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type', 'a.morphy'=>'(phy|mor)',
|
||||
'a.statut'=>'^[0|1]', 'a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 'a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
|
||||
$this->import_examplevalues_array[$r] = array(
|
||||
'a.ref'=>"auto or MEM2010-1234",
|
||||
'a.civility'=>"MR", 'a.lastname'=>'Smith', 'a.firstname'=>'John', 'a.gender'=>'man or woman', 'a.login'=>'jsmith', 'a.pass'=>'passofjsmith', 'a.fk_adherent_type'=>'1',
|
||||
'a.morphy'=>'"mor" or "phy"', 'a.societe'=>'JS company', 'a.address'=>'21 jump street', 'a.zip'=>'55000', 'a.town'=>'New York', 'a.country'=>'1',
|
||||
'a.email'=>'jsmith@example.com', 'a.birth'=>'1972-10-10', 'a.statut'=>"0 or 1", 'a.note_public'=>"This is a public comment on member",
|
||||
@ -375,7 +397,7 @@ class modAdherent extends DolibarrModules
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
$this->import_examplevalues_array[$r]['a.fk_soc'] = "rowid or name";
|
||||
}
|
||||
$this->import_updatekeys_array[$r] = array('a.login'=>'Login');
|
||||
$this->import_updatekeys_array[$r] = array('a.ref'=>'Member Ref', 'a.login'=>'Login');
|
||||
|
||||
// Cronjobs
|
||||
$arraydate = dol_getdate(dol_now());
|
||||
|
||||
@ -309,7 +309,7 @@ class modProjet extends DolibarrModules
|
||||
$this->import_fieldshidden_array[$r] = array('t.fk_user_creat'=>'user->id', 'extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'projet_task'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
't.fk_projet'=>array('rule'=>'fetchidfromref', 'classfile'=>'/projet/class/project.class.php', 'class'=>'Project', 'method'=>'fetch', 'element'=>'Project'),
|
||||
't.ref'=>array('rule'=>'getrefifauto')
|
||||
't.ref'=>array('rule'=>'getrefifauto', 'class'=>(empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON), 'path'=>"/core/modules/project/task/".(empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON).'.php')
|
||||
);
|
||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||
$this->import_regex_array[$r] = array('t.dateo'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 't.datee'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 't.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');
|
||||
|
||||
@ -414,7 +414,7 @@ class modStock extends DolibarrModules
|
||||
);
|
||||
$this->import_updatekeys_array[$r] = array('ps.fk_product'=>'Product', 'ps.fk_entrepot'=>"Warehouse");
|
||||
$this->import_run_sql_after_array[$r] = array( // Because we may change data that are denormalized, we must update dernormalized data after.
|
||||
'UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);'
|
||||
'UPDATE '.MAIN_DB_PREFIX.'product as p SET p.stock = (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ class modUser extends DolibarrModules
|
||||
$this->module_position = '05';
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||
$this->description = "Gestion des utilisateurs (requis)";
|
||||
$this->description = "Management of users and groups of users (mandatory)";
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'dolibarr';
|
||||
@ -90,7 +90,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 251;
|
||||
$this->rights[$r][1] = 'Read information of other users';
|
||||
$this->rights[$r][1] = 'Read information of other users, groups and permissions';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'user';
|
||||
@ -101,12 +101,12 @@ class modUser extends DolibarrModules
|
||||
$this->rights[$r][1] = 'Read permissions of other users';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'user_advance';
|
||||
$this->rights[$r][4] = 'user_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][5] = 'readperms';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 253;
|
||||
$this->rights[$r][1] = 'Create/modify internal and external users';
|
||||
$this->rights[$r][1] = 'Create/modify internal and external users, groups and permissions';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'user';
|
||||
@ -117,7 +117,7 @@ class modUser extends DolibarrModules
|
||||
$this->rights[$r][1] = 'Create/modify external users only';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'user_advance';
|
||||
$this->rights[$r][4] = 'user_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][5] = 'write';
|
||||
|
||||
$r++;
|
||||
@ -170,7 +170,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 351;
|
||||
$this->rights[$r][1] = 'Consulter les groupes';
|
||||
$this->rights[$r][1] = 'Read groups';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
@ -178,7 +178,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 352;
|
||||
$this->rights[$r][1] = 'Consulter les permissions des groupes';
|
||||
$this->rights[$r][1] = 'Read permissions of groups';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
@ -186,7 +186,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 353;
|
||||
$this->rights[$r][1] = 'Creer/modifier les groupes et leurs permissions';
|
||||
$this->rights[$r][1] = 'Create/modify groups and permissions';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
@ -194,7 +194,7 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 354;
|
||||
$this->rights[$r][1] = 'Supprimer ou desactiver les groupes';
|
||||
$this->rights[$r][1] = 'Delete groups';
|
||||
$this->rights[$r][2] = 'd';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
|
||||
@ -147,7 +147,7 @@ if ($massaction == 'presend') {
|
||||
// $formmail->withfile = 2; Not yet supported in mass action
|
||||
$formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document"
|
||||
if ($objecttmp->element != 'societe') {
|
||||
$formmail->withfile = '<span class="hideonsmartphone">'.$langs->trans("OnlyPDFattachmentSupported").'</span>';
|
||||
$formmail->withfile = '<span class="hideonsmartphone opacitymedium">'.$langs->trans("OnlyPDFattachmentSupported").'</span>';
|
||||
$formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default
|
||||
}
|
||||
$formmail->withbody = 1;
|
||||
|
||||
@ -706,12 +706,12 @@ if ($step == 3 && $datatoimport) {
|
||||
print $out;
|
||||
print '</div>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder centpercent" width="100%" cellpadding="4">';
|
||||
|
||||
// Search available imports
|
||||
$filearray = dol_dir_list($conf->import->dir_temp, 'files', 0, '', '', 'name', SORT_DESC);
|
||||
if (count($filearray) > 0) {
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder centpercent" width="100%" cellpadding="4">';
|
||||
|
||||
$dir = $conf->import->dir_temp;
|
||||
|
||||
// Search available files to import
|
||||
@ -752,10 +752,10 @@ if ($step == 3 && $datatoimport) {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ WarningPHPMailB=- Some Email Service Providers (like Yahoo) do not allow you to
|
||||
WarningPHPMailC=- Using the SMTP server of your own Email Service Provider to send emails is also interesting so all emails sent from application will also be saved into your "Sent" directory of your mailbox.
|
||||
WarningPHPMailD=Also, it is therefore recommended to change the sending method of e-mails to the value "SMTP". If you really want to keep the default "PHP" method to send emails, just ignore this warning, or remove it by setting the MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP constant to 1 in Home - Setup - Other.
|
||||
WarningPHPMail2=If your email SMTP provider need to restrict email client to some IP addresses (very rare), this is the IP address of the mail user agent (MUA) for your ERP CRM application: <strong>%s</strong>.
|
||||
WarningPHPMailSPF=If the domain name in your sender email address is protected by a SPF record (ask you domain name registar), you must add the following IPs in the SPF record of the DNS of your domain: <strong>%s</strong>.
|
||||
WarningPHPMailSPF=If the domain name in your sender email address is protected by a SPF record (ask your domain name registar), you must add the following IPs in the SPF record of the DNS of your domain: <strong>%s</strong>.
|
||||
ClickToShowDescription=Click to show description
|
||||
DependsOn=This module needs the module(s)
|
||||
RequiredBy=This module is required by module(s)
|
||||
|
||||
@ -1007,12 +1007,12 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
|
||||
// Fields title search
|
||||
print '<tr class="liste_titre_filter">';
|
||||
if (!empty($arrayfields['s.rowid']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<td class="liste_titre" data-key="id">';
|
||||
print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<td class="liste_titre" data-key="ref">';
|
||||
if (!empty($search_nom_only) && empty($search_nom)) {
|
||||
$search_nom = $search_nom_only;
|
||||
}
|
||||
@ -1243,10 +1243,10 @@ print '</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['s.rowid']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, ' data-key="id"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, ' data-key="ref"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['s.name_alias']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", "", $param, "", $sortfield, $sortorder);
|
||||
@ -1394,7 +1394,7 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
print '>';
|
||||
if (!empty($arrayfields['s.rowid']['checked'])) {
|
||||
print '<td class="tdoverflowmax50">';
|
||||
print '<td class="tdoverflowmax50" data-key="id">';
|
||||
print $obj->rowid;
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
@ -1406,7 +1406,7 @@ while ($i < min($num, $limit)) {
|
||||
if (!empty($arrayfields['s.name_alias']['checked'])) {
|
||||
$companystatic->name_alias = '';
|
||||
}
|
||||
print '<td'.(empty($conf->global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200"' : '').'>';
|
||||
print '<td'.(empty($conf->global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200"' : '').' data-key="ref">';
|
||||
if ($contextpage == 'poslist') {
|
||||
print $obj->name;
|
||||
} else {
|
||||
|
||||
@ -1432,7 +1432,7 @@ table[summary="list_of_modules"] .fa-cog {
|
||||
.minheight40 { min-height: 40px; }
|
||||
.titlefieldcreate { width: 20%; }
|
||||
.titlefield { /* width: 25%; */ width: 250px; }
|
||||
.titlefieldmiddle { width: 50%; }
|
||||
.titlefieldmiddle { width: 45%; }
|
||||
.titlefieldmax45 { max-width: 45%; }
|
||||
.imgmaxwidth180 { max-width: 180px; }
|
||||
.imgmaxheight50 { max-height: 50px; }
|
||||
@ -3385,6 +3385,15 @@ td.border, div.tagtable div div.border {
|
||||
width:auto;
|
||||
}
|
||||
|
||||
/* To have left column sticky
|
||||
.tagtable td[data-key="ref"] {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
top: 0;
|
||||
max-width: 150px !important;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* Main boxes */
|
||||
.nobordertop, .nobordertop tr:first-of-type td {
|
||||
@ -4471,7 +4480,7 @@ div.titre {
|
||||
}
|
||||
div.fiche > table.table-fiche-title:first-of-type div {
|
||||
color: var(--colortexttitlenotab);
|
||||
font-size: 1.05em;
|
||||
font-size: 1.1em;
|
||||
/* text-transform: uppercase; */
|
||||
/* font-weight: 600; */
|
||||
}
|
||||
|
||||
@ -150,13 +150,14 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
|
||||
cursor: default;
|
||||
|
||||
font-size: 10px;
|
||||
line-height: 22px;
|
||||
padding: 0px 3px;
|
||||
line-height: 1.5em;
|
||||
padding: 4px 3px;
|
||||
text-align: center;
|
||||
opacity: 1;
|
||||
-webkit-transition: opacity 0.5s, visibility 0s 0.5s;
|
||||
transition: opacity 0.5s, visibility 0s 0.5s;
|
||||
}
|
||||
|
||||
.box-flex-item.info-box-module.--disabled {
|
||||
/* opacity: 0.6; */
|
||||
}
|
||||
|
||||
@ -242,8 +242,8 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
|
||||
cursor: default;
|
||||
|
||||
font-size: 10px;
|
||||
line-height: 22px;
|
||||
padding: 0px 3px;
|
||||
line-height: 1.5em;
|
||||
padding: 4px 3px;
|
||||
text-align: center;
|
||||
opacity: 1;
|
||||
-webkit-transition: opacity 0.5s, visibility 0s 0.5s;
|
||||
|
||||
@ -203,8 +203,17 @@ if ($action == 'update' && !$cancel && $permissiontoaddbankaccount) {
|
||||
}
|
||||
}
|
||||
|
||||
// update birth
|
||||
if ($action == 'setbirth' && $canadduser && !$cancel) {
|
||||
$object->birth = dol_mktime(0, 0, 0, GETPOST('birthmonth', 'int'), GETPOST('birthday', 'int'), GETPOST('birthyear', 'int'));
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// update personal email
|
||||
if ($action == 'setpersonal_email' && $canadduser) {
|
||||
if ($action == 'setpersonal_email' && $canadduser && !$cancel) {
|
||||
$object->personal_email = (string) GETPOST('personal_email', 'alphanohtml');
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) {
|
||||
@ -213,7 +222,7 @@ if ($action == 'setpersonal_email' && $canadduser) {
|
||||
}
|
||||
|
||||
// update personal mobile
|
||||
if ($action == 'setpersonal_mobile' && $canadduser) {
|
||||
if ($action == 'setpersonal_mobile' && $canadduser && !$cancel) {
|
||||
$object->personal_mobile = (string) GETPOST('personal_mobile', 'alphanohtml');
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) {
|
||||
@ -288,23 +297,160 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
|
||||
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
|
||||
print '<td>'.$object->login.'</td>';
|
||||
print '<tr><td class="titlefieldmiddle">'.$langs->trans("Login").'</td>';
|
||||
if (!empty($object->ldap_sid) && $object->statut == 0) {
|
||||
print '<td class="error">';
|
||||
print $langs->trans("LoginAccountDisableInDolibarr");
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
$addadmin = '';
|
||||
if (property_exists($object, 'admin')) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
||||
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||
} elseif (!empty($object->admin)) {
|
||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||
}
|
||||
}
|
||||
print showValueWithClipboardCPButton($object->login).$addadmin;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Hierarchy
|
||||
print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</td>';
|
||||
print '<td>';
|
||||
if (empty($object->fk_user)) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
|
||||
} else {
|
||||
$huser = new User($db);
|
||||
if ($object->fk_user > 0) {
|
||||
$huser->fetch($object->fk_user);
|
||||
print $huser->getNomUrl(1);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Expense report validator
|
||||
if (!empty($conf->expensereport->enabled)) {
|
||||
print '<tr><td>';
|
||||
$text = $langs->trans("ForceUserExpenseValidator");
|
||||
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (!empty($object->fk_user_expense_validator)) {
|
||||
$evuser = new User($db);
|
||||
$evuser->fetch($object->fk_user_expense_validator);
|
||||
print $evuser->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// Holiday request validator
|
||||
if (!empty($conf->holiday->enabled)) {
|
||||
print '<tr><td>';
|
||||
$text = $langs->trans("ForceUserHolidayValidator");
|
||||
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (!empty($object->fk_user_holiday_validator)) {
|
||||
$hvuser = new User($db);
|
||||
$hvuser->fetch($object->fk_user_holiday_validator);
|
||||
print $hvuser->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// Position/Job
|
||||
print '<tr><td>'.$langs->trans("PostOrFunction").'</td>';
|
||||
print '<td>'.dol_escape_htmltag($object->job).'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Weeklyhours
|
||||
print '<tr><td>'.$langs->trans("WeeklyHours").'</td>';
|
||||
print '<td>';
|
||||
print price2num($object->weeklyhours);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Sensitive salary/value information
|
||||
if ((empty($user->socid) && in_array($id, $childids)) // A user can always see salary/value information for its subordinates
|
||||
|| (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))
|
||||
|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))) {
|
||||
$langs->load("salaries");
|
||||
|
||||
// Salary
|
||||
print '<tr><td>'.$langs->trans("Salary").'</td>';
|
||||
print '<td>';
|
||||
print ($object->salary != '' ? img_picto('', 'salary', 'class="pictofixedwidth paddingright"').'<span class="amount">'.price($object->salary, '', $langs, 1, -1, -1, $conf->currency) : '').'</span>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// THM
|
||||
print '<tr><td>';
|
||||
$text = $langs->trans("THM");
|
||||
print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print ($object->thm != '' ?price($object->thm, '', $langs, 1, -1, -1, $conf->currency) : '');
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// TJM
|
||||
print '<tr><td>';
|
||||
$text = $langs->trans("TJM");
|
||||
print $form->textwithpicto($text, $langs->trans("TJMDescription"), 1, 'help', 'classtjm');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print ($object->tjm != '' ?price($object->tjm, '', $langs, 1, -1, -1, $conf->currency) : '');
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// Date employment
|
||||
print '<tr><td>'.$langs->trans("DateOfEmployment").'</td>';
|
||||
print '<td>';
|
||||
if ($object->dateemployment) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("FromDate").'</span> ';
|
||||
print dol_print_date($object->dateemployment, 'day');
|
||||
}
|
||||
if ($object->dateemploymentend) {
|
||||
print '<span class="opacitymedium"> - '.$langs->trans("To").'</span> ';
|
||||
print dol_print_date($object->dateemploymentend, 'day');
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Date of birth
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer, 'day', $object->birth);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Personal email
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer, 'email', ($object->personal_email != '' ? dol_print_email($object->personal_email) : ''));
|
||||
print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer, 'email', '', null, null, '', 0, 'dol_print_email');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Personal phone
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer, 'string', ($object->personal_mobile != '' ? dol_print_phone($object->personal_mobile) : ''));
|
||||
print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer, 'string', '', null, null, '', 0, 'dol_print_phone');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -1408,23 +1408,24 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
// Login
|
||||
print '<tr><td class="titlefieldmiddle">'.$langs->trans("Login").'</td>';
|
||||
if (!empty($object->ldap_sid) && $object->statut == 0) {
|
||||
print '<td class="error">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
|
||||
print '<td class="error">';
|
||||
print $langs->trans("LoginAccountDisableInDolibarr");
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>'.showValueWithClipboardCPButton($object->login).'</td>';
|
||||
print '<td>';
|
||||
$addadmin = '';
|
||||
if (property_exists($object, 'admin')) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
||||
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||
} elseif (!empty($object->admin)) {
|
||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||
}
|
||||
}
|
||||
print showValueWithClipboardCPButton($object->login).$addadmin;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Administrator
|
||||
print '<tr><td>'.$langs->trans("Administrator").'</td><td>';
|
||||
if (!empty($conf->multicompany->enabled) && $object->admin && !$object->entity) {
|
||||
print $form->textwithpicto(yn($object->admin), $langs->trans("SuperAdministratorDesc"), 1, "superadmin");
|
||||
} elseif ($object->admin) {
|
||||
print $form->textwithpicto(yn($object->admin), $langs->trans("AdministratorDesc"), 1, "admin");
|
||||
} else {
|
||||
print yn($object->admin);
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Type
|
||||
print '<tr><td>';
|
||||
$text = $langs->trans("Type");
|
||||
@ -1455,7 +1456,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
//print yn($object->employee);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// TODO Move this into tab RH, visible when salarie or RH is visible (HierarchicalResponsible must be on both tab)
|
||||
// TODO This is also available into the tab RH
|
||||
|
||||
// Hierarchy
|
||||
print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</td>';
|
||||
@ -1506,30 +1507,31 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// Default warehouse
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
|
||||
if ($object->fk_warehouse > 0) {
|
||||
$warehousestatic = new Entrepot($db);
|
||||
$warehousestatic->fetch($object->fk_warehouse);
|
||||
print $warehousestatic->getNomUrl(1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Position/Job
|
||||
print '<tr><td>'.$langs->trans("PostOrFunction").'</td>';
|
||||
print '<td>'.dol_escape_htmltag($object->job).'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read) && in_array($id, $childids))
|
||||
// Weeklyhours
|
||||
print '<tr><td>'.$langs->trans("WeeklyHours").'</td>';
|
||||
print '<td>';
|
||||
print price2num($object->weeklyhours);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Sensitive salary/value information
|
||||
if ((empty($user->socid) && in_array($id, $childids)) // A user can always see salary/value information for its subordinates
|
||||
|| (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))
|
||||
|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))) {
|
||||
// Even a superior can't see this info of its subordinates wihtout $user->rights->salaries->read and $user->rights->hrm->employee->read (setting/viewing is reserverd to HR people).
|
||||
// However, he can see the valuation of timesheet of its subordinates even without these permissions.
|
||||
$langs->load("salaries");
|
||||
|
||||
// Salary
|
||||
print '<tr><td>'.$langs->trans("Salary").'</td>';
|
||||
print '<td>';
|
||||
print ($object->salary != '' ? img_picto('', 'salary', 'class="pictofixedwidth paddingright"').'<span class="amount">'.price($object->salary, '', $langs, 1, -1, -1, $conf->currency) : '').'</span>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// THM
|
||||
print '<tr><td>';
|
||||
$text = $langs->trans("THM");
|
||||
@ -1549,22 +1551,8 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print ($object->tjm != '' ?price($object->tjm, '', $langs, 1, -1, -1, $conf->currency) : '');
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Salary
|
||||
print '<tr><td>'.$langs->trans("Salary").'</td>';
|
||||
print '<td>';
|
||||
print ($object->salary != '' ? img_picto('', 'salary', 'class="pictofixedwidth paddingright"').'<span class="amount">'.price($object->salary, '', $langs, 1, -1, -1, $conf->currency) : '').'</span>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// Weeklyhours
|
||||
print '<tr><td>'.$langs->trans("WeeklyHours").'</td>';
|
||||
print '<td>';
|
||||
print price2num($object->weeklyhours);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Date employment
|
||||
print '<tr><td>'.$langs->trans("DateOfEmployment").'</td>';
|
||||
print '<td>';
|
||||
@ -1579,12 +1567,17 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Date of birth
|
||||
print '<tr><td>'.$langs->trans("DateOfBirth").'</td>';
|
||||
print '<td>';
|
||||
print dol_print_date($object->birth, 'day');
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
// Default warehouse
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
|
||||
if ($object->fk_warehouse > 0) {
|
||||
$warehousestatic = new Entrepot($db);
|
||||
$warehousestatic->fetch($object->fk_warehouse);
|
||||
print $warehousestatic->getNomUrl(1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy code
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
@ -2336,6 +2329,18 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// OpenID url
|
||||
if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER)) {
|
||||
print "<tr>".'<td>'.$langs->trans("OpenIDURL").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield) {
|
||||
print '<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.'">';
|
||||
} else {
|
||||
print '<input type="hidden" name="openid" value="'.$object->openid.'">';
|
||||
print $object->openid;
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table><hr><table class="border centpercent">';
|
||||
|
||||
@ -2465,21 +2470,16 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
}
|
||||
}
|
||||
|
||||
// OpenID url
|
||||
if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER)) {
|
||||
print "<tr>".'<td>'.$langs->trans("OpenIDURL").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield) {
|
||||
print '<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.'">';
|
||||
} else {
|
||||
print '<input type="hidden" name="openid" value="'.$object->openid.'">';
|
||||
print $object->openid;
|
||||
}
|
||||
print '</table><hr><table class="border centpercent">';
|
||||
|
||||
// Default warehouse
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("DefaultWarehouse").'</td><td>';
|
||||
print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&token='.newToken().'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken()).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddWarehouse").'"></span></a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table><hr><table class="border centpercent">';
|
||||
|
||||
// Accountancy code
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
print "<tr>";
|
||||
@ -2637,14 +2637,6 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
|
||||
// TODO Move this into tab RH (HierarchicalResponsible must be on both tab)
|
||||
|
||||
// Default warehouse
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("DefaultWarehouse").'</td><td>';
|
||||
print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&token='.newToken().'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken()).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddWarehouse").'"></span></a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Position/Job
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("PostOrFunction").'</td>';
|
||||
print '<td>';
|
||||
@ -2656,10 +2648,29 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read) && in_array($id, $childids))
|
||||
// Weeklyhours
|
||||
print '<tr><td>'.$langs->trans("WeeklyHours").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield) {
|
||||
print '<input size="8" type="text" name="weeklyhours" value="'.price2num(GETPOST('weeklyhours') ?GETPOST('weeklyhours') : $object->weeklyhours).'">';
|
||||
} else {
|
||||
print price2num($object->weeklyhours);
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Sensitive salary/value information
|
||||
if ((empty($user->socid) && in_array($id, $childids)) // A user can always see salary/value information for its subordinates
|
||||
|| (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))
|
||||
|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))) {
|
||||
$langs->load("salaries");
|
||||
$langs->load("salaries");
|
||||
|
||||
// Salary
|
||||
print '<tr><td>'.$langs->trans("Salary").'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'salary', 'class="pictofixedwidth paddingright"').'<input size="8" type="text" name="salary" value="'.price2num(GETPOST('salary') ?GETPOST('salary') : $object->salary).'">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// THM
|
||||
print '<tr><td>';
|
||||
@ -2688,26 +2699,8 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Salary
|
||||
print '<tr><td>'.$langs->trans("Salary").'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'salary', 'class="pictofixedwidth paddingright"').'<input size="8" type="text" name="salary" value="'.price2num(GETPOST('salary') ?GETPOST('salary') : $object->salary).'">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// Weeklyhours
|
||||
print '<tr><td>'.$langs->trans("WeeklyHours").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield) {
|
||||
print '<input size="8" type="text" name="weeklyhours" value="'.price2num(GETPOST('weeklyhours') ?GETPOST('weeklyhours') : $object->weeklyhours).'">';
|
||||
} else {
|
||||
print price2num($object->weeklyhours);
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Date employment
|
||||
print '<tr><td>'.$langs->trans("DateEmployment").'</td>';
|
||||
print '<td>';
|
||||
|
||||
@ -163,7 +163,25 @@ if ($object->id) {
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Login
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
|
||||
if (!empty($object->ldap_sid) && $object->statut == 0) {
|
||||
print '<td class="error">';
|
||||
print $langs->trans("LoginAccountDisableInDolibarr");
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
$addadmin = '';
|
||||
if (property_exists($object, 'admin')) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
||||
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||
} elseif (!empty($object->admin)) {
|
||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||
}
|
||||
}
|
||||
print showValueWithClipboardCPButton($object->login).$addadmin;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Nunber of files
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td>'.count($filearray).'</td></tr>';
|
||||
|
||||
@ -112,7 +112,25 @@ if ($id) {
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Login
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
|
||||
if (!empty($object->ldap_sid) && $object->statut == 0) {
|
||||
print '<td class="error">';
|
||||
print $langs->trans("LoginAccountDisableInDolibarr");
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
$addadmin = '';
|
||||
if (property_exists($object, 'admin')) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
||||
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||
} elseif (!empty($object->admin)) {
|
||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||
}
|
||||
}
|
||||
print showValueWithClipboardCPButton($object->login).$addadmin;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$editenabled = (($action == 'edit') && !empty($user->rights->user->user->creer));
|
||||
|
||||
|
||||
@ -164,9 +164,21 @@ if ($result > 0) {
|
||||
// Login
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
|
||||
if (!empty($object->ldap_sid) && $object->statut == 0) {
|
||||
print '<td class="error">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
|
||||
print '<td class="error">';
|
||||
print $langs->trans("LoginAccountDisableInDolibarr");
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>'.$object->login.'</td>';
|
||||
print '<td>';
|
||||
$addadmin = '';
|
||||
if (property_exists($object, 'admin')) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
||||
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||
} elseif (!empty($object->admin)) {
|
||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||
}
|
||||
}
|
||||
print showValueWithClipboardCPButton($object->login).$addadmin;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user