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

This commit is contained in:
Laurent Destailleur 2021-04-19 22:52:26 +02:00
commit 22daecbeec
15 changed files with 267 additions and 116 deletions

View File

@ -211,11 +211,12 @@ if ($action == 'update') {
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity);
//dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST('MAIN_BUGTRACK_ENABLELINK', 'aZ09'), 'chaine', 0, '', $conf->entity);
//dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
$varforimage = 'imagebackground'; $dirforimage = $conf->mycompany->dir_output.'/logos/'; $varforimage = 'imagebackground'; $dirforimage = $conf->mycompany->dir_output.'/logos/';
@ -401,8 +402,7 @@ print '</tr>';
// Show bugtrack link // Show bugtrack link
print '<tr class="oddeven"><td>'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
print ajax_constantonoff("MAIN_BUGTRACK_ENABLELINK", array(), $conf->entity, 0, 0, 1, 0); print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" size="32" value="'.(isset($conf->global->MAIN_BUGTRACK_ENABLELINK) ? $conf->global->MAIN_BUGTRACK_ENABLELINK : '').'">';
//print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';

View File

@ -88,7 +88,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array(); $fieldstosearchall = array();
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
if ($val['searchall']) { if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label']; $fieldstosearchall['t.'.$key] = $val['label'];
} }
} }
@ -102,7 +102,7 @@ foreach ($object->fields as $key => $val) {
} }
} }
// Extra fields // Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
$arrayfields["ef.".$key] = array( $arrayfields["ef.".$key] = array(
@ -240,7 +240,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql); $sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
} }
if ($object->ismultientitymanaged == 1) { if ($object->ismultientitymanaged == 1) {
@ -497,11 +497,11 @@ foreach ($object->fields as $key => $val) {
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); print $form->selectarray('search_'.$key, $val['arrayofkeyval'], empty($search[$key]) ? '' : $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif (strpos($val['type'], 'integer:') === 0) { } elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) { } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">'; print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]).'">';
} }
print '</td>'; print '</td>';
} }
@ -552,7 +552,7 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line // Detect if we need a fetch on each output line
$needToFetchEachLine = 0; $needToFetchEachLine = 0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
if (preg_match('/\$object/', $val)) { if (preg_match('/\$object/', $val)) {
$needToFetchEachLine++; // There is at least one compute field that use $object $needToFetchEachLine++; // There is at least one compute field that use $object

View File

@ -45,16 +45,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page // Load translation files required by the page
$langsArray=array("errors", "admin", "mails", "languages"); $langsArray=array("errors", "admin", "mails", "languages");
if ($conf->adherent->enabled) { if (!empty($conf->adherent->enabled)) {
$langsArray[]='members'; $langsArray[]='members';
} }
if ($conf->eventorganization->enabled) { if (!empty($conf->eventorganization->enabled)) {
$langsArray[]='eventorganization'; $langsArray[]='eventorganization';
} }
$langs->loadLangs($langsArray); $langs->loadLangs($langsArray);
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
$massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
@ -181,55 +182,55 @@ $elementList = array();
$elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --'; $elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --';
$elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --'; $elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --';
$elementList['user'] = img_picto('', 'user', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToUser')); $elementList['user'] = img_picto('', 'user', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToUser'));
if ($conf->adherent->enabled && $user->rights->adherent->lire) { if (!empty($conf->adherent->enabled) && !empty($user->rights->adherent->lire)) {
$elementList['member'] = img_picto('', 'object_member', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToMember')); $elementList['member'] = img_picto('', 'object_member', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToMember'));
} }
if ($conf->recruitment->enabled && $user->rights->recruitment->recruitmentjobposition->read) { if (!empty($conf->recruitment->enabled) && !empty($user->rights->recruitment->recruitmentjobposition->read)) {
$elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="paddingright"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures')); $elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="paddingright"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures'));
} }
if ($conf->societe->enabled && $user->rights->societe->lire) { if (!empty($conf->societe->enabled) && !empty($user->rights->societe->lire)) {
$elementList['thirdparty'] = img_picto('', 'company', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToThirdparty')); $elementList['thirdparty'] = img_picto('', 'company', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToThirdparty'));
} }
if ($conf->projet->enabled) { if (!empty($conf->projet->enabled)) {
$elementList['project'] = img_picto('', 'project', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToProject')); $elementList['project'] = img_picto('', 'project', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToProject'));
} }
if ($conf->propal->enabled && $user->rights->propal->lire) { if (!empty($conf->propal->enabled) && !empty($user->rights->propal->lire)) {
$elementList['propal_send'] = img_picto('', 'propal', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendProposal')); $elementList['propal_send'] = img_picto('', 'propal', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendProposal'));
} }
if ($conf->commande->enabled && $user->rights->commande->lire) { if (!empty($conf->commande->enabled) && !empty($user->rights->commande->lire)) {
$elementList['order_send'] = img_picto('', 'order', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendOrder')); $elementList['order_send'] = img_picto('', 'order', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendOrder'));
} }
if ($conf->facture->enabled && $user->rights->facture->lire) { if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
$elementList['facture_send'] = img_picto('', 'bill', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendInvoice')); $elementList['facture_send'] = img_picto('', 'bill', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendInvoice'));
} }
if ($conf->expedition->enabled) { if (!empty($conf->expedition->enabled)) {
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment')); $elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
} }
if ($conf->reception->enabled) { if (!empty($conf->reception->enabled)) {
$elementList['reception_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception')); $elementList['reception_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception'));
} }
if ($conf->ficheinter->enabled) { if (!empty($conf->ficheinter->enabled)) {
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention')); $elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
} }
if ($conf->supplier_proposal->enabled) { if (!empty($conf->supplier_proposal->enabled)) {
$elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation')); $elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation'));
} }
if (($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_order->enabled && $user->rights->supplier_order->lire)) { if ((!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->commande->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && !empty($user->rights->supplier_order->lire))) {
$elementList['order_supplier_send'] = img_picto('', 'order', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierOrder')); $elementList['order_supplier_send'] = img_picto('', 'order', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierOrder'));
} }
if (($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_invoice->enabled && $user->rights->supplier_invoice->lire)) { if ((!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->supplier_invoice->lire))) {
$elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice')); $elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice'));
} }
if ($conf->contrat->enabled && $user->rights->contrat->lire) { if (!empty($conf->contrat->enabled) && !empty($user->rights->contrat->lire)) {
$elementList['contract'] = img_picto('', 'contract', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendContract')); $elementList['contract'] = img_picto('', 'contract', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendContract'));
} }
if ($conf->ticket->enabled && $user->rights->ticket->read) { if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) {
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket')); $elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket'));
} }
if ($conf->agenda->enabled) { if (!empty($conf->agenda->enabled)) {
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush')); $elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
} }
if ($conf->eventorganization->enabled && $user->rights->eventorganization->read) { if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) {
$elementList['eventorganization_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization')); $elementList['eventorganization_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
} }
@ -1183,98 +1184,98 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
foreach ($fieldlist as $field => $value) { foreach ($fieldlist as $field => $value) {
if ($fieldlist[$field] == 'fk_user') { if ($value == 'fk_user') {
print '<td>'; print '<td>';
if ($user->admin) { if ($user->admin) {
print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth200'); print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth200');
} else { } else {
if ($context == 'add') { // I am not admin and we show the add form if ($context == 'add') { // I am not admin and we show the add form
print $user->getNomUrl(1); // Me print $user->getNomUrl(1); // Me
$forcedvalue = $user->id; $forcedvalue = $user->id;
} else { } else {
if ($obj && !empty($obj->{$fieldlist[$field]}) && $obj->{$fieldlist[$field]} > 0) { if ($obj && !empty($obj->{$value}) && $obj->{$value} > 0) {
$fuser = new User($db); $fuser = new User($db);
$fuser->fetch($obj->{$fieldlist[$field]}); $fuser->fetch($obj->{$value});
print $fuser->getNomUrl(1); print $fuser->getNomUrl(1);
$forcedvalue = $fuser->id; $forcedvalue = $fuser->id;
} else { } else {
$forcedvalue = $obj->{$fieldlist[$field]}; $forcedvalue = $obj->{$value};
} }
} }
$keyname = $fieldlist[$field]; $keyname = $value;
print '<input type="hidden" value="'.$forcedvalue.'" name="'.$keyname.'">'; print '<input type="hidden" value="'.$forcedvalue.'" name="'.$keyname.'">';
} }
print '</td>'; print '</td>';
} elseif ($fieldlist[$field] == 'lang') { } elseif ($value == 'lang') {
print '<td>'; print '<td>';
if (!empty($conf->global->MAIN_MULTILANGS)) { if (!empty($conf->global->MAIN_MULTILANGS)) {
$selectedlang = GETPOSTISSET('langcode') ?GETPOST('langcode', 'aZ09') : $langs->defaultlang; $selectedlang = GETPOSTISSET('langcode') ?GETPOST('langcode', 'aZ09') : $langs->defaultlang;
if ($context == 'edit') { if ($context == 'edit') {
$selectedlang = $obj->{$fieldlist[$field]}; $selectedlang = $obj->{$value};
} }
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150'); print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150');
} else { } else {
if (!empty($obj->{$fieldlist[$field]})) { if (!empty($obj->{$value})) {
print $obj->{$fieldlist[$field]}.' - '.$langs->trans('Language_'.$obj->{$fieldlist[$field]}); print $obj->{$value}.' - '.$langs->trans('Language_'.$obj->{$value});
} }
$keyname = $fieldlist[$field]; $keyname = $value;
if ($keyname == 'lang') { if ($keyname == 'lang') {
$keyname = 'langcode'; // Avoid conflict with lang param $keyname = 'langcode'; // Avoid conflict with lang param
} }
print '<input type="hidden" value="'.$obj->{$fieldlist[$field]}.'" name="'.$keyname.'">'; print '<input type="hidden" value="'.(empty($obj->{$value}) ? '' : $obj->{$value}).'" name="'.$keyname.'">';
} }
print '</td>'; print '</td>';
} elseif ($fieldlist[$field] == 'type_template') { } elseif ($value == 'type_template') {
// Le type de template // Le type de template
print '<td class="center">'; print '<td class="center">';
if ($context == 'edit' && !empty($obj->{$fieldlist[$field]}) && !in_array($obj->{$fieldlist[$field]}, array_keys($elementList))) { if ($context == 'edit' && !empty($obj->{$value}) && !in_array($obj->{$value}, array_keys($elementList))) {
// Current template type is an unknown type, so we must keep it as it is. // Current template type is an unknown type, so we must keep it as it is.
print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">'; print '<input type="hidden" name="type_template" value="'.$obj->{$value}.'">';
print $obj->{$fieldlist[$field]}; print $obj->{$value};
} else { } else {
print $form->selectarray('type_template', $elementList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1, '', 0, 1); print $form->selectarray('type_template', $elementList, (!empty($obj->{$value}) ? $obj->{$value}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1, '', 0, 1);
} }
print '</td>'; print '</td>';
} elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) { } elseif ($context == 'add' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
continue; continue;
} elseif ($context == 'edit' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) { } elseif ($context == 'edit' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
continue; continue;
} elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) { } elseif ($context == 'hide' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
continue; continue;
} else { } else {
$size = ''; $class = ''; $classtd = ''; $size = ''; $class = ''; $classtd = '';
if ($fieldlist[$field] == 'code') { if ($value == 'code') {
$class = 'maxwidth100'; $class = 'maxwidth100';
} }
if ($fieldlist[$field] == 'label') { if ($value == 'label') {
$class = 'maxwidth200'; $class = 'maxwidth200';
} }
if ($fieldlist[$field] == 'private') { if ($value == 'private') {
$class = 'maxwidth50'; $classtd = 'center'; $class = 'maxwidth50'; $classtd = 'center';
} }
if ($fieldlist[$field] == 'position') { if ($value == 'position') {
$class = 'maxwidth50'; $classtd = 'center'; $class = 'maxwidth50'; $classtd = 'center';
} }
if ($fieldlist[$field] == 'libelle') { if ($value == 'libelle') {
$class = 'quatrevingtpercent'; $class = 'quatrevingtpercent';
} }
if ($fieldlist[$field] == 'topic') { if ($value == 'topic') {
$class = 'quatrevingtpercent'; $class = 'quatrevingtpercent';
} }
if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') { if ($value == 'sortorder' || $value == 'sens' || $value == 'category_type') {
$size = 'size="2" '; $size = 'size="2" ';
} }
print '<td'.($classtd ? ' class="'.$classtd.'"' : '').'>'; print '<td'.($classtd ? ' class="'.$classtd.'"' : '').'>';
if ($fieldlist[$field] == 'private') { if ($value == 'private') {
if (empty($user->admin)) { if (empty($user->admin)) {
print $form->selectyesno($fieldlist[$field], '1', 1); print $form->selectyesno($value, '1', 1);
} else { } else {
//print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="1" name="'.$fieldlist[$field].'">'; //print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="1" name="'.$fieldlist[$field].'">';
print $form->selectyesno($fieldlist[$field], (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1); print $form->selectyesno($value, (isset($obj->{$value}) ? $obj->{$value}:''), 1);
} }
} else { } else {
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">'; print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$value}) ? $obj->{$value}:'').'" name="'. $value .'">';
} }
print '</td>'; print '</td>';
} }

View File

@ -231,7 +231,8 @@ class modUser extends DolibarrModules
'u.birth'=>'DateOfBirth', 'u.birth'=>'DateOfBirth',
'u.datec'=>"DateCreation", 'u.tms'=>"DateLastModification", 'u.datec'=>"DateCreation", 'u.tms'=>"DateLastModification",
'u.admin'=>"Administrator", 'u.statut'=>'Status', 'u.datelastlogin'=>'LastConnexion', 'u.datepreviouslogin'=>'PreviousConnexion', 'u.admin'=>"Administrator", 'u.statut'=>'Status', 'u.datelastlogin'=>'LastConnexion', 'u.datepreviouslogin'=>'PreviousConnexion',
'u.fk_socpeople'=>"IdContact", 'u.fk_soc'=>"IdCompany", 'u.fk_member'=>"MemberId" 'u.fk_socpeople'=>"IdContact", 'u.fk_soc'=>"IdCompany", 'u.fk_member'=>"MemberId",
'g.nom'=>"Group"
); );
$this->export_TypeFields_array[$r] = array( $this->export_TypeFields_array[$r] = array(
'u.rowid'=>'Numeric', 'u.login'=>"Text", 'u.lastname'=>"Text", 'u.firstname'=>"Text", 'u.employee'=>'Boolean', 'u.job'=>'Text', 'u.rowid'=>'Numeric', 'u.login'=>"Text", 'u.lastname'=>"Text", 'u.firstname'=>"Text", 'u.employee'=>'Boolean', 'u.job'=>'Text',
@ -241,7 +242,8 @@ class modUser extends DolibarrModules
'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note'=>"Text", 'u.datelastlogin'=>'Date', 'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note'=>"Text", 'u.datelastlogin'=>'Date',
'u.fk_user'=>"List:user:login", 'u.fk_user'=>"List:user:login",
'u.birth'=>'Date', 'u.birth'=>'Date',
'u.datepreviouslogin'=>'Date', 'u.fk_soc'=>"List:societe:nom:rowid", 'u.fk_member'=>"List:adherent:firstname" 'u.datepreviouslogin'=>'Date', 'u.fk_soc'=>"List:societe:nom:rowid", 'u.fk_member'=>"List:adherent:firstname",
'g.nom'=>"Text"
); );
$this->export_entities_array[$r] = array( $this->export_entities_array[$r] = array(
'u.rowid'=>"user", 'u.login'=>"user", 'u.lastname'=>"user", 'u.firstname'=>"user", 'u.employee'=>'user', 'u.job'=>'user', 'u.gender'=>'user', 'u.rowid'=>"user", 'u.login'=>"user", 'u.lastname'=>"user", 'u.firstname'=>"user", 'u.employee'=>'user', 'u.job'=>'user', 'u.gender'=>'user',
@ -254,7 +256,8 @@ class modUser extends DolibarrModules
'u.birth'=>'user', 'u.birth'=>'user',
'u.datec'=>"user", 'u.tms'=>"user", 'u.datec'=>"user", 'u.tms'=>"user",
'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user', 'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user',
'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member" 'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member",
'g.nom'=>"Group"
); );
$keyforselect = 'user'; $keyforselect = 'user';
$keyforelement = 'user'; $keyforelement = 'user';
@ -267,6 +270,8 @@ class modUser extends DolibarrModules
$this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u'; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON u.rowid = extra.fk_object'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON u.rowid = extra.fk_object';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'usergroup_user as ug ON u.rowid = ug.fk_user';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'usergroup as g ON ug.fk_usergroup = g.rowid';
$this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')'; $this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')';
// Imports // Imports

View File

@ -1,6 +1,6 @@
<?php <?php
// Move fields of totalizable into the common array pos and val // Move fields of totalizable into the common array pos and val
if (is_array($totalarray['totalizable'])) { if (!empty($totalarray['totalizable']) && is_array($totalarray['totalizable'])) {
foreach ($totalarray['totalizable'] as $keytotalizable => $valtotalizable) { foreach ($totalarray['totalizable'] as $keytotalizable => $valtotalizable) {
$totalarray['pos'][$valtotalizable['pos']] = $keytotalizable; $totalarray['pos'][$valtotalizable['pos']] = $keytotalizable;
$totalarray['val'][$keytotalizable] = $valtotalizable['total']; $totalarray['val'][$keytotalizable] = $valtotalizable['total'];

View File

@ -177,7 +177,13 @@ class FactureFournisseur extends CommonInvoice
public $amount = 0; public $amount = 0;
public $remise = 0; public $remise = 0;
/**
* @var float tva
* @deprecated Use $total_tva
*/
public $tva = 0; public $tva = 0;
public $localtax1; public $localtax1;
public $localtax2; public $localtax2;
public $total_ht = 0; public $total_ht = 0;
@ -703,7 +709,7 @@ class FactureFournisseur extends CommonInvoice
$this->remise = $obj->remise; $this->remise = $obj->remise;
$this->close_code = $obj->close_code; $this->close_code = $obj->close_code;
$this->close_note = $obj->close_note; $this->close_note = $obj->close_note;
$this->tva = $obj->tva; $this->tva = $obj->tva;
$this->total_localtax1 = $obj->localtax1; $this->total_localtax1 = $obj->localtax1;
$this->total_localtax2 = $obj->localtax2; $this->total_localtax2 = $obj->localtax2;
$this->total_ht = $obj->total_ht; $this->total_ht = $obj->total_ht;

View File

@ -26,6 +26,8 @@
-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; -- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL;
-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; -- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
-- Note: fields with type BLOB/TEXT can't have default value. -- Note: fields with type BLOB/TEXT can't have default value.
-- To rebuild sequence for postgresql after insert by forcing id autoincrement fields:
-- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences();
-- Missing in v13 or lower -- Missing in v13 or lower
@ -275,15 +277,15 @@ create table llx_salary
fk_user_modif integer -- user making last change fk_user_modif integer -- user making last change
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_payment_salary CHANGE COLUMN fk_user fk_user integer NULL; -- VMYSQL4.1 ALTER TABLE llx_payment_salary CHANGE COLUMN fk_user fk_user integer NULL;
-- VPGSQL8.2 ALTER TABLE llx_payment_salary ALTER COLUMN fk_user DROP NOT NULL;
ALTER TABLE llx_payment_salary ADD COLUMN fk_salary integer; ALTER TABLE llx_payment_salary ADD COLUMN fk_salary integer;
INSERT INTO llx_salary (rowid, ref, fk_user, amount, fk_projet, fk_typepayment, label, datesp, dateep, entity, note, fk_bank, paye) SELECT ps.rowid, ps.rowid, ps.fk_user, ps.amount, ps.fk_projet, ps.fk_typepayment, ps.label, ps.datesp, ps.dateep, ps.entity, ps.note, ps.fk_bank, 1 FROM llx_payment_salary ps WHERE ps.fk_salary IS NULL; INSERT INTO llx_salary (rowid, ref, fk_user, amount, fk_projet, fk_typepayment, label, datesp, dateep, entity, note, fk_bank, paye) SELECT ps.rowid, ps.rowid, ps.fk_user, ps.amount, ps.fk_projet, ps.fk_typepayment, ps.label, ps.datesp, ps.dateep, ps.entity, ps.note, ps.fk_bank, 1 FROM llx_payment_salary ps WHERE ps.fk_salary IS NULL;
UPDATE llx_payment_salary SET fk_salary = rowid WHERE fk_salary IS NULL; UPDATE llx_payment_salary SET fk_salary = rowid WHERE fk_salary IS NULL;
UPDATE llx_payment_salary SET ref = rowid WHERE ref IS NULL; UPDATE llx_payment_salary SET ref = rowid WHERE ref IS NULL;
ALTER TABLE llx_salary CHANGE paye paye smallint default 0 NOT NULL; ALTER TABLE llx_salary ALTER COLUMN paye set default 0;
DELETE FROM llx_boxes WHERE box_id IN (SELECT rowid FROM llx_boxes_def WHERE file IN ('box_graph_ticket_by_severity', 'box_ticket_by_severity.php', 'box_nb_ticket_last_x_days.php', 'box_nb_tickets_type.php', 'box_new_vs_close_ticket.php')); DELETE FROM llx_boxes WHERE box_id IN (SELECT rowid FROM llx_boxes_def WHERE file IN ('box_graph_ticket_by_severity', 'box_ticket_by_severity.php', 'box_nb_ticket_last_x_days.php', 'box_nb_tickets_type.php', 'box_new_vs_close_ticket.php'));
DELETE FROM llx_boxes_def WHERE file IN ('box_graph_ticket_by_severity', 'box_ticket_by_severity.php', 'box_nb_ticket_last_x_days.php', 'box_nb_tickets_type.php', 'box_new_vs_close_ticket.php'); DELETE FROM llx_boxes_def WHERE file IN ('box_graph_ticket_by_severity', 'box_ticket_by_severity.php', 'box_nb_ticket_last_x_days.php', 'box_nb_tickets_type.php', 'box_new_vs_close_ticket.php');
@ -425,4 +427,10 @@ ALTER TABLE llx_facture_fourn ADD COLUMN date_closing datetime DEFAULT NULL afte
ALTER TABLE llx_facture_fourn ADD COLUMN fk_user_closing integer DEFAULT NULL after fk_user_valid; ALTER TABLE llx_facture_fourn ADD COLUMN fk_user_closing integer DEFAULT NULL after fk_user_valid;
ALTER TABLE llx_entrepot ADD COLUMN fk_project INTEGER DEFAULT NULL AFTER entity; -- project associated to warehouse if any ALTER TABLE llx_entrepot ADD COLUMN fk_project INTEGER DEFAULT NULL AFTER entity; -- project associated to warehouse if any
-- Rebuild sequence for postgres only after query INSERT INTO llx_salary(rowid, ...
-- VPGSQL8.2 SELECT dol_util_rebuild_sequences();
UPDATE llx_const SET value = 'github' WHERE __DECRYPT('name')__ = 'MAIN_BUGTRACK_ENABLELINK' AND __DECRYPT('value')__ = 1;

View File

@ -1159,7 +1159,7 @@ DoNotSuggestPaymentMode=Do not suggest
NoActiveBankAccountDefined=No active bank account defined NoActiveBankAccountDefined=No active bank account defined
OwnerOfBankAccount=Owner of bank account %s OwnerOfBankAccount=Owner of bank account %s
BankModuleNotActive=Bank accounts module not enabled BankModuleNotActive=Bank accounts module not enabled
ShowBugTrackLink=Show link "<strong>%s</strong>" ShowBugTrackLink=Define the link "<strong>%s</strong>" (empty to not display this link, 'github' for the link to the Dolibarr project or define directly an url 'https://...')
Alerts=Alerts Alerts=Alerts
DelaysOfToleranceBeforeWarning=Delay before displaying a warning alert for: DelaysOfToleranceBeforeWarning=Delay before displaying a warning alert for:
DelaysOfToleranceDesc=Set the delay before an alert icon %s is shown onscreen for the late element. DelaysOfToleranceDesc=Set the delay before an alert icon %s is shown onscreen for the late element.

View File

@ -28,8 +28,8 @@ SerialNumberAlreadyInUse=Serial number %s is already used for product %s
TooManyQtyForSerialNumber=You can only have one product %s for serial number %s TooManyQtyForSerialNumber=You can only have one product %s for serial number %s
BatchLotNumberingModules=Options for automatic generation of batch products managed by lots BatchLotNumberingModules=Options for automatic generation of batch products managed by lots
BatchSerialNumberingModules=Options for automatic generation of batch products managed by serial numbers BatchSerialNumberingModules=Options for automatic generation of batch products managed by serial numbers
ManageLotMask=Custom mask
CustomMasks=Adds an option to define mask in the product card CustomMasks=Adds an option to define mask in the product card
LotProductTooltip=Adds an option in the product card to define a dedicated batch number mask LotProductTooltip=Adds an option in the product card to define a dedicated batch number mask
SNProductTooltip=Adds an option in the product card to define a dedicated serial number mask SNProductTooltip=Adds an option in the product card to define a dedicated serial number mask
QtyToAddAfterBarcodeScan=Qty to add for each barcode/lot/serial scanned QtyToAddAfterBarcodeScan=Qty to add for each barcode/lot/serial scanned

View File

@ -28,6 +28,7 @@ SerialNumberAlreadyInUse=Le numéro de série %s est déjà utilisé pour le pro
TooManyQtyForSerialNumber=Vous ne pouvez avoir qu'un produit %s avec le numéro de série %s TooManyQtyForSerialNumber=Vous ne pouvez avoir qu'un produit %s avec le numéro de série %s
BatchLotNumberingModules=Modèle de génération et contrôle des numéros de lot BatchLotNumberingModules=Modèle de génération et contrôle des numéros de lot
BatchSerialNumberingModules=Modèle de génération et contrôle des numéros de série BatchSerialNumberingModules=Modèle de génération et contrôle des numéros de série
ManageLotMask=Masque personnalisé
CustomMasks=Ajoute une option pour définir le masque dans la fiche produit CustomMasks=Ajoute une option pour définir le masque dans la fiche produit
LotProductTooltip=Crée un champ dans la fiche produit pour définir un modèle spécifique de numéro de lot LotProductTooltip=Crée un champ dans la fiche produit pour définir un modèle spécifique de numéro de lot
SNProductTooltip=Crée un champ dans la fiche produit pour définir un modèle spécifique de numéro de série SNProductTooltip=Crée un champ dans la fiche produit pour définir un modèle spécifique de numéro de série

View File

@ -2743,41 +2743,49 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
if (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) { if (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new?labels=Bug'; if ($conf->global->MAIN_BUGTRACK_ENABLELINK == 'github') {
$bugbaseurl .= '&title='; $bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new?labels=Bug';
$bugbaseurl .= urlencode("Bug: "); $bugbaseurl .= '&title=';
$bugbaseurl .= '&body='; $bugbaseurl .= urlencode("Bug: ");
$bugbaseurl .= urlencode("# Instructions\n"); $bugbaseurl .= '&body=';
$bugbaseurl .= urlencode("*This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.*\n"); $bugbaseurl .= urlencode("# Instructions\n");
$bugbaseurl .= urlencode("*Please:*\n"); $bugbaseurl .= urlencode("*This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.*\n");
$bugbaseurl .= urlencode("- *replace the bracket enclosed texts with meaningful information*\n"); $bugbaseurl .= urlencode("*Please:*\n");
$bugbaseurl .= urlencode("- *remove any unused sub-section*\n"); $bugbaseurl .= urlencode("- *replace the bracket enclosed texts with meaningful information*\n");
$bugbaseurl .= urlencode("\n"); $bugbaseurl .= urlencode("- *remove any unused sub-section*\n");
$bugbaseurl .= urlencode("\n"); $bugbaseurl .= urlencode("\n");
$bugbaseurl .= urlencode("# Bug\n"); $bugbaseurl .= urlencode("\n");
$bugbaseurl .= urlencode("[*Short description*]\n"); $bugbaseurl .= urlencode("# Bug\n");
$bugbaseurl .= urlencode("\n"); $bugbaseurl .= urlencode("[*Short description*]\n");
$bugbaseurl .= urlencode("## Environment\n"); $bugbaseurl .= urlencode("\n");
$bugbaseurl .= urlencode("- **Version**: ".DOL_VERSION."\n"); $bugbaseurl .= urlencode("## Environment\n");
$bugbaseurl .= urlencode("- **OS**: ".php_uname('s')."\n"); $bugbaseurl .= urlencode("- **Version**: " . DOL_VERSION . "\n");
$bugbaseurl .= urlencode("- **Web server**: ".$_SERVER["SERVER_SOFTWARE"]."\n"); $bugbaseurl .= urlencode("- **OS**: " . php_uname('s') . "\n");
$bugbaseurl .= urlencode("- **PHP**: ".php_sapi_name().' '.phpversion()."\n"); $bugbaseurl .= urlencode("- **Web server**: " . $_SERVER["SERVER_SOFTWARE"] . "\n");
$bugbaseurl .= urlencode("- **Database**: ".$db::LABEL.' '.$db->getVersion()."\n"); $bugbaseurl .= urlencode("- **PHP**: " . php_sapi_name() . ' ' . phpversion() . "\n");
$bugbaseurl .= urlencode("- **URL(s)**: ".$_SERVER["REQUEST_URI"]."\n"); $bugbaseurl .= urlencode("- **Database**: " . $db::LABEL . ' ' . $db->getVersion() . "\n");
$bugbaseurl .= urlencode("\n"); $bugbaseurl .= urlencode("- **URL(s)**: " . $_SERVER["REQUEST_URI"] . "\n");
$bugbaseurl .= urlencode("## Expected and actual behavior\n"); $bugbaseurl .= urlencode("\n");
$bugbaseurl .= urlencode("[*Verbose description*]\n"); $bugbaseurl .= urlencode("## Expected and actual behavior\n");
$bugbaseurl .= urlencode("\n"); $bugbaseurl .= urlencode("[*Verbose description*]\n");
$bugbaseurl .= urlencode("## Steps to reproduce the behavior\n"); $bugbaseurl .= urlencode("\n");
$bugbaseurl .= urlencode("[*Verbose description*]\n"); $bugbaseurl .= urlencode("## Steps to reproduce the behavior\n");
$bugbaseurl .= urlencode("\n"); $bugbaseurl .= urlencode("[*Verbose description*]\n");
$bugbaseurl .= urlencode("## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…)\n"); $bugbaseurl .= urlencode("\n");
$bugbaseurl .= urlencode("[*Files*]\n"); $bugbaseurl .= urlencode("## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…)\n");
$bugbaseurl .= urlencode("\n"); $bugbaseurl .= urlencode("[*Files*]\n");
$bugbaseurl .= urlencode("\n");
$bugbaseurl .= urlencode("\n");
$bugbaseurl .= urlencode("## Report\n");
} elseif (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) {
$bugbaseurl = $conf->global->MAIN_BUGTRACK_ENABLELINK;
} else {
$bugbaseurl = "";
}
// Execute hook printBugtrackInfo // Execute hook printBugtrackInfo
$parameters = array('bugbaseurl'=>$bugbaseurl); $parameters = array('bugbaseurl' => $bugbaseurl);
$reshook = $hookmanager->executeHooks('printBugtrackInfo', $parameters); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('printBugtrackInfo', $parameters); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) { if (empty($reshook)) {
$bugbaseurl .= $hookmanager->resPrint; $bugbaseurl .= $hookmanager->resPrint;
@ -2785,8 +2793,6 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
$bugbaseurl = $hookmanager->resPrint; $bugbaseurl = $hookmanager->resPrint;
} }
$bugbaseurl .= urlencode("\n");
$bugbaseurl .= urlencode("## Report\n");
print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">'; print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">';
print '<a class="help" target="_blank" rel="noopener" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a>'; print '<a class="help" target="_blank" rel="noopener" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a>';
print '</div>'; print '</div>';

View File

@ -307,6 +307,7 @@ if (empty($reshook)) {
$object->status = GETPOST('statut'); $object->status = GETPOST('statut');
$object->status_buy = GETPOST('statut_buy'); $object->status_buy = GETPOST('statut_buy');
$object->status_batch = GETPOST('status_batch'); $object->status_batch = GETPOST('status_batch');
$object->batch_mask = GETPOST('batch_mask');
$object->barcode_type = GETPOST('fk_barcode_type'); $object->barcode_type = GETPOST('fk_barcode_type');
$object->barcode = GETPOST('barcode'); $object->barcode = GETPOST('barcode');
@ -475,6 +476,7 @@ if (empty($reshook)) {
$object->status = GETPOST('statut', 'int'); $object->status = GETPOST('statut', 'int');
$object->status_buy = GETPOST('statut_buy', 'int'); $object->status_buy = GETPOST('statut_buy', 'int');
$object->status_batch = GETPOST('status_batch', 'aZ09'); $object->status_batch = GETPOST('status_batch', 'aZ09');
$object->batch_mask = GETPOST('batch_mask', 'alpha');
$object->fk_default_warehouse = GETPOST('fk_default_warehouse'); $object->fk_default_warehouse = GETPOST('fk_default_warehouse');
// removed from update view so GETPOST always empty // removed from update view so GETPOST always empty
/* /*
@ -1083,10 +1085,50 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Batch number management // Batch number management
if (!empty($conf->productbatch->enabled)) { if (!empty($conf->productbatch->enabled)) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
print $form->selectarray('status_batch', $statutarray, GETPOST('status_batch')); print $form->selectarray('status_batch', $statutarray, GETPOST('status_batch'));
print '</td></tr>'; print '</td>';
// Product specific batch number management
$status_batch = GETPOST('status_batch');
if ($status_batch !== '0') {
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Batch"), $langs->transnoentities("Batch"));
$tooltip .= $langs->trans("GenericMaskCodes2");
$tooltip .= $langs->trans("GenericMaskCodes3");
$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Batch"), $langs->transnoentities("Batch"));
$tooltip .= $langs->trans("GenericMaskCodes5");
print '<td id="mask_option">'.$langs->trans("ManageLotMask").'</td>';
if (($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') || ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced')) {
$inherited_mask_lot = $conf->global->LOT_ADVANCED_MASK;
$inherited_mask_sn = $conf->global->SN_ADVANCED_MASK;
print '<td id="field_mask">';
print $form->textwithpicto('<input type="text" class="flat" size="24" name="batch_mask" id="batch_mask_input">', $tooltip, 1, 1);
print '</td>';
print '<script type="text/javascript">
$(document).ready(function() {
$("#field_mask, #mask_option").addClass("hideobject");
$("#status_batch").on("change", function () {
var optionSelected = $("option:selected", this);
var valueSelected = this.value;
$("#field_mask, #mask_option").addClass("hideobject");
if (this.value == 1) {
$("#field_mask, #mask_option").toggleClass("hideobject");
$("#batch_mask_input").val("'.$inherited_mask_lot.'");
}
if (this.value == 2) {
$("#field_mask, #mask_option").toggleClass("hideobject");
$("#batch_mask_input").val("'.$inherited_mask_sn.'");
}
})
})
</script>';
} else {
print '<td></td>';
}
} else {
print '<td colspan="2"></td>';
}
print '</tr>';
} }
$showbarcode = empty($conf->barcode->enabled) ? 0 : 1; $showbarcode = empty($conf->barcode->enabled) ? 0 : 1;
@ -1545,10 +1587,55 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Batch number managment // Batch number managment
if ($conf->productbatch->enabled) { if ($conf->productbatch->enabled) {
if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
print $form->selectarray('status_batch', $statutarray, $object->status_batch); print $form->selectarray('status_batch', $statutarray, $object->status_batch);
print '</td></tr>'; print '</td>';
if ($object->status_batch !== '0') {
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Batch"), $langs->transnoentities("Batch"));
$tooltip .= $langs->trans("GenericMaskCodes2");
$tooltip .= $langs->trans("GenericMaskCodes3");
$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Batch"), $langs->transnoentities("Batch"));
$tooltip .= $langs->trans("GenericMaskCodes5");
print '<td id="mask_option">'.$langs->trans("ManageLotMask").'</td>';
if ($object->status_batch == '1' && $conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') {
$mask = !is_empty($object->batch_mask) ? $object->batch_mask : $conf->global->LOT_ADVANCED_MASK;
}
if ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced') {
$mask = !is_empty($object->batch_mask) ? $object->batch_mask : $conf->global->SN_ADVANCED_MASK;
}
$inherited_mask_lot = $conf->global->LOT_ADVANCED_MASK;
$inherited_mask_sn = $conf->global->SN_ADVANCED_MASK;
print '<td id="field_mask">';
print $form->textwithpicto('<input type="text" class="flat" size="24" name="batch_mask" id="batch_mask_input" value="'.$mask.'">', $tooltip, 1, 1);
print '</td>';
print '<script type="text/javascript">
$(document).ready(function() {
$("#field_mask, #mask_option").addClass("hideobject");
var preselect = $("#status_batch option:selected");
if (preselect !== "0") {
$("#field_mask, #mask_option").toggleClass("hideobject");
}
$("#status_batch").on("change", function () {
var optionSelected = $("option:selected", this);
var valueSelected = this.value;
$("#field_mask, #mask_option").addClass("hideobject");
if (this.value == 1) {
$("#field_mask, #mask_option").toggleClass("hideobject");
$("#batch_mask_input").val("'.$inherited_mask_lot.'");
}
if (this.value == 2) {
$("#field_mask, #mask_option").toggleClass("hideobject");
$("#batch_mask_input").val("'.$inherited_mask_sn.'");
}
})
})
</script>';
} else {
print '<td colspan="2"></td>';
}
print '</tr>';
} }
} }
@ -2036,6 +2123,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td colspan="2">'; print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td colspan="2">';
print $object->getLibStatut(0, 2); print $object->getLibStatut(0, 2);
print '</td></tr>'; print '</td></tr>';
if ((($object->status_batch == '1' &&$conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced')
|| ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS))) {
print '<tr><td>'.$langs->trans("ManageLotMask").'</td><td colspan="2">';
print $object->batch_mask;
print '</td></tr>';
}
} }
} }

View File

@ -264,6 +264,13 @@ class Product extends CommonObject
*/ */
public $status_batch = 0; public $status_batch = 0;
/**
* If allowed, we can edit batch or serial number mask for each product
*
* @var string
*/
public $batch_mask = '';
/** /**
* Customs code * Customs code
* *
@ -671,6 +678,7 @@ class Product extends CommonObject
$sql .= ", canvas"; $sql .= ", canvas";
$sql .= ", finished"; $sql .= ", finished";
$sql .= ", tobatch"; $sql .= ", tobatch";
$sql .= ", batch_mask";
$sql .= ", fk_unit"; $sql .= ", fk_unit";
$sql .= ") VALUES ("; $sql .= ") VALUES (";
$sql .= "'".$this->db->idate($now)."'"; $sql .= "'".$this->db->idate($now)."'";
@ -698,6 +706,7 @@ class Product extends CommonObject
$sql .= ", '".$this->db->escape($this->canvas)."'"; $sql .= ", '".$this->db->escape($this->canvas)."'";
$sql .= ", ".((!isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : (int) $this->finished); $sql .= ", ".((!isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : (int) $this->finished);
$sql .= ", ".((empty($this->status_batch) || $this->status_batch < 0) ? '0' : $this->status_batch); $sql .= ", ".((empty($this->status_batch) || $this->status_batch < 0) ? '0' : $this->status_batch);
$sql .= ", '".$this->db->escape($this->batch_mask)."'";
$sql .= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit); $sql .= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
$sql .= ")"; $sql .= ")";
@ -1059,6 +1068,8 @@ class Product extends CommonObject
$sql .= ", tosell = ".(int) $this->status; $sql .= ", tosell = ".(int) $this->status;
$sql .= ", tobuy = ".(int) $this->status_buy; $sql .= ", tobuy = ".(int) $this->status_buy;
$sql .= ", tobatch = ".((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch); $sql .= ", tobatch = ".((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch);
$sql .= ", batch_mask = '".$this->db->escape($this->batch_mask)."'";
$sql .= ", finished = ".((!isset($this->finished) || $this->finished < 0 || $this->finished == '') ? "null" : (int) $this->finished); $sql .= ", finished = ".((!isset($this->finished) || $this->finished < 0 || $this->finished == '') ? "null" : (int) $this->finished);
$sql .= ", net_measure = ".($this->net_measure != '' ? "'".$this->db->escape($this->net_measure)."'" : 'null'); $sql .= ", net_measure = ".($this->net_measure != '' ? "'".$this->db->escape($this->net_measure)."'" : 'null');
$sql .= ", net_measure_units = ".($this->net_measure_units != '' ? "'".$this->db->escape($this->net_measure_units)."'" : 'null'); $sql .= ", net_measure_units = ".($this->net_measure_units != '' ? "'".$this->db->escape($this->net_measure_units)."'" : 'null');
@ -2170,7 +2181,7 @@ class Product extends CommonObject
} else { } else {
$sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export, pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,"; $sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export, pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,";
} }
$sql .= " p.stock,p.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.fk_unit,"; $sql .= " p.stock,p.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,";
$sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf"; $sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
@ -2210,6 +2221,7 @@ class Product extends CommonObject
$this->status = $obj->tosell; $this->status = $obj->tosell;
$this->status_buy = $obj->tobuy; $this->status_buy = $obj->tobuy;
$this->status_batch = $obj->tobatch; $this->status_batch = $obj->tobatch;
$this->batch_mask = $obj->batch_mask;
$this->customcode = $obj->customcode; $this->customcode = $obj->customcode;
$this->country_id = $obj->fk_country; $this->country_id = $obj->fk_country;

View File

@ -66,6 +66,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
// Init vars // Init vars
@ -81,6 +82,19 @@ $email = GETPOST("email");
$encodedid = GETPOST('id'); $encodedid = GETPOST('id');
$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); $id = dol_decode($encodedid, $dolibarr_main_instance_unique_id);
$conference = new ConferenceOrBooth($db);
$resultconf = $conference->fetch($id);
if ($resultconf < 0) {
setEventMessages(null, $object->errors, "errors");
}
$project = new Project($db);
$resultproject = $project->fetch($conference->fk_project);
if ($resultproject < 0) {
$error++;
$errmsg .= $project->error;
}
// Getting 'securekey'.'id' from Post and decoding it // Getting 'securekey'.'id' from Post and decoding it
$encodedsecurekeyandid = GETPOST('securekey', 'alpha'); $encodedsecurekeyandid = GETPOST('securekey', 'alpha');
$securekeyandid = dol_decode($encodedsecurekeyandid, $dolibarr_main_instance_unique_id); $securekeyandid = dol_decode($encodedsecurekeyandid, $dolibarr_main_instance_unique_id);
@ -193,10 +207,11 @@ if (empty($reshook) && $action == 'add') {
$error++; $error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
} }
/*if (!GETPOST("societe")) { // If the price has been set, name is required for the invoice
if (!GETPOST("societe") && !empty(floatval($project->price_registration))) {
$error++; $error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."<br>\n";
}*/ }
if (GETPOST("email") && !isValidEmail(GETPOST("email"))) { if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
@ -350,7 +365,11 @@ print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."
// Email // Email
print '<tr><td>'.$langs->trans("Email").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n"; print '<tr><td>'.$langs->trans("Email").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
// Company // Company
print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").' </td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n"; print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company");
if (!empty(floatval($project->price_registration))) {
print '<FONT COLOR="red">*</FONT>';
}
print ' </td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
// Address // Address
print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n"; print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n"; print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";

View File

@ -227,8 +227,8 @@ if (empty($reshook) && $action == 'add') {
$langs->load("errors"); $langs->load("errors");
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST('email'))."<br>\n"; $errmsg .= $langs->trans("ErrorBadEMail", GETPOST('email'))."<br>\n";
} }
$birthday = dol_mktime(GETPOST('birthhour', 'int'), GETPOST('birthmin', 'int'), GETPOST('birthsec', 'int'), GETPOST('birthmonth', 'int'), GETPOST('birthday', 'int'), GETPOST('birthyear', 'int')); $birthday = dol_mktime(GETPOST("birthhour", 'int'), GETPOST("birthmin", 'int'), GETPOST("birthsec", 'int'), GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int'));
if (GETPOSTISSET('birthmonth') && empty($birthday)) { if (GETPOST("birthmonth") && empty($birthday)) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg .= $langs->trans("ErrorBadDateFormat")."<br>\n"; $errmsg .= $langs->trans("ErrorBadDateFormat")."<br>\n";