Merge pull request #18 from Dolibarr/develop

pull from develop
This commit is contained in:
Tobias Sekan 2020-04-20 14:05:52 +02:00 committed by GitHub
commit 9e1c0efc5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
75 changed files with 1440 additions and 1538 deletions

View File

@ -41,7 +41,7 @@ Ace 1.4.8 BSD Yes
ChartJS 2.9.3 MIT License Yes JS library for graph ChartJS 2.9.3 MIT License Yes JS library for graph
jQuery 3.4.1 MIT License Yes JS library jQuery 3.4.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images) jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)

View File

@ -13,7 +13,7 @@ For Developers or integrators:
- replace $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); - replace $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
- remove input field in form '<input type="hidden" name="page" value="'.$page.'">';' - remove input field in form '<input type="hidden" name="page" value="'.$page.'">';'
- add parameter $pagenavastextinput to value 1 when calling print_barre_liste - add parameter $pagenavastextinput to value 1 when calling print_barre_liste
* UserGroup class has been refactored with new architecture. Triggers of class UserGroup are now USERGROUP_CREATE, USERGROUP_MODIFY, USERGROUP_DELETE
WARNING: WARNING:

View File

@ -298,3 +298,15 @@ JEDITABLE.JS
* <button type="submit" /> => <button class="button" type="submit" /> * <button type="submit" /> => <button class="button" type="submit" />
* <button type="cancel" /> => <button class="button" type="cancel" /> * <button type="cancel" /> => <button class="button" type="cancel" />
SELECT2
-------
Edit CSS to restore line removed between 4.0.5 and 4.0.6. It generates this bug: https://github.com/select2/select2/issues/5832
.select2-hidden-accessible {
margin: -1px !important; /* line to restore */
}

View File

@ -373,7 +373,7 @@ if ($result) {
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>'; print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>';
// Ref product // Ref product
print '<td>'; print '<td class="tdoverflowmax100">';
if ($product_static->id > 0) print $product_static->getNomUrl(1); if ($product_static->id > 0) print $product_static->getNomUrl(1);
if ($product_static->id > 0 && $objp->product_label) print '<br>'; if ($product_static->id > 0 && $objp->product_label) print '<br>';
if ($objp->product_label) print $objp->product_label; if ($objp->product_label) print $objp->product_label;

View File

@ -36,13 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('admin', 'errors', 'other', 'bills')); $langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
if (!$user->admin) accessforbidden(); if (! $user->admin) accessforbidden();
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type = 'invoice'; $type='invoice';
/* /*
@ -57,17 +57,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
* View * View
*/ */
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader( llxHeader(
"", $langs->trans("BillsSetup"), "", $langs->trans("BillsSetup"),
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura' 'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
); );
$form = new Form($db); $form=new Form($db);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
$head = invoice_admin_prepare_head(); $head = invoice_admin_prepare_head();
@ -96,7 +96,26 @@ print "</tr>\n";
_printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices')); _printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices'));
_printOnOff('INVOICE_USE_SITUATION_CREDIT_NOTE', $langs->trans('UseSituationInvoicesCreditNote')); _printOnOff('INVOICE_USE_SITUATION_CREDIT_NOTE', $langs->trans('UseSituationInvoicesCreditNote'));
_printOnOff('INVOICE_USE_SITUATION_RETAINED_WARRANTY', $langs->trans('Retainedwarranty')); //_printOnOff('INVOICE_USE_RETAINED_WARRANTY', $langs->trans('Retainedwarranty'));
$confkey = 'INVOICE_USE_RETAINED_WARRANTY';
$arrayAvailableType = array(
Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation"),
Facture::TYPE_STANDARD.'+'.Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation").' + '.$langs->trans("InvoiceStandard"),
);
$selected = array();
$implodeglue = '+';
if(!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})){
$selected = explode('+', $conf->global->{$confkey});
}
$curentInput = (empty($inputCount)?1:($inputCount+1));
$formSelectInvoiceType = $form->selectarray('value'. $curentInput, $arrayAvailableType, $selected, 1);
_printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType);
//_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation'));
_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituationFinal'));
$metas = array( $metas = array(
'type' => 'number', 'type' => 'number',
@ -107,7 +126,7 @@ $metas = array(
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas); _printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
// Conditions paiements // Conditions paiements
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1); $inputCount = empty($inputCount)?1:($inputCount+1);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>'; print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>';
print '<td class="center" width="20">&nbsp;</td>'; print '<td class="center" width="20">&nbsp;</td>';
@ -159,7 +178,7 @@ function _printOnOff($confkey, $title = false, $desc = '')
global $langs; global $langs;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.($title ? $title : $langs->trans($confkey)); print '<td>'.($title?$title:$langs->trans($confkey));
if (!empty($desc)) { if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>'; print '<br><small>'.$langs->trans($desc).'</small>';
} }
@ -187,14 +206,14 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
{ {
global $langs, $conf, $db, $inputCount; global $langs, $conf, $db, $inputCount;
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1); $inputCount = empty($inputCount)?1:($inputCount+1);
$form = new Form($db); $form=new Form($db);
$defaultMetas = array( $defaultMetas = array(
'name' => 'value'.$inputCount 'name' => 'value'.$inputCount
); );
if ($type != 'textarea') { if ($type!='textarea') {
$defaultMetas['type'] = 'text'; $defaultMetas['type'] = 'text';
$defaultMetas['value'] = $conf->global->{$confkey}; $defaultMetas['value'] = $conf->global->{$confkey};
} }
@ -210,9 +229,9 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
print '<td>'; print '<td>';
if (!empty($help)) { if (!empty($help)) {
print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, '')); print $form->textwithtooltip(($title?$title:$langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
} else { } else {
print $title ? $title : $langs->trans($confkey); print $title?$title:$langs->trans($confkey);
} }
if (!empty($desc)) { if (!empty($desc)) {
@ -225,10 +244,14 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">'; print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
print '<input type="hidden" name="action" value="setModuleOptions">'; print '<input type="hidden" name="action" value="setModuleOptions">';
if ($type == 'textarea') { if ($type=='textarea') {
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>'; print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
} else { }elseif($type=='input'){
print '<input '.$metascompil.' />'; print '<input '.$metascompil.' />';
}
else{
// custom
print $type;
} }
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -754,9 +754,9 @@ if ($resql)
print '<td class="center">'; print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">'; print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button buttongen" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>'; print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button buttongen" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>'; print '</td>';
$fieldsforcontent = array('topic', 'joinfiles', 'content'); $fieldsforcontent = array('topic', 'joinfiles', 'content');
@ -902,10 +902,10 @@ if ($resql)
// Modify link / Delete link // Modify link / Delete link
print '<td class="center nowraponall" width="64">'; print '<td class="center nowraponall" width="64">';
if ($canbemodified) print '<a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a>'; if ($canbemodified) print '<a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a>';
if ($iserasable) if ($iserasable)
{ {
print ' &nbsp; <a href="'.$url.'action=delete">'.img_delete().'</a>'; print '<a class="marginleftonly" href="'.$url.'action=delete">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
} }
print '</td>'; print '</td>';

View File

@ -172,7 +172,7 @@ if ($action == 'create')
// Owner // Owner
print '<tr><td>'.$langs->trans("Owner").'</td><td>'; print '<tr><td>'.$langs->trans("Owner").'</td><td>';
print $form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : $user->id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print img_picto('', 'user').' '.$form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : $user->id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '</td><td class="hideonsmartphone">&nbsp;</td></tr>'; print '</td><td class="hideonsmartphone">&nbsp;</td></tr>';
// Position // Position
@ -276,11 +276,11 @@ if ($id > 0 && !preg_match('/^add/i', $action))
print '<tr><td>'.$langs->trans("Owner").'</td><td>'; print '<tr><td>'.$langs->trans("Owner").'</td><td>';
if ($action == 'edit' && $user->admin) if ($action == 'edit' && $user->admin)
{ {
print $form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print img_picto('', 'user').' '.$form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
} }
else else
{ {
if ($object->fk_user) if ($object->fk_user > 0)
{ {
$fuser = new User($db); $fuser = new User($db);
$fuser->fetch($object->fk_user); $fuser->fetch($object->fk_user);

View File

@ -155,13 +155,12 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton = ''; $newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer)); $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer));
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit, 0, 0, 1);
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
@ -178,6 +177,8 @@ print_liste_field_titre("Position", $_SERVER["PHP_SELF"], "b.position", "", $par
print_liste_field_titre(''); print_liste_field_titre('');
print "</tr>\n"; print "</tr>\n";
$cacheOfUsers = array();
$i = 0; $i = 0;
while ($i < min($num, $limit)) while ($i < min($num, $limit))
{ {
@ -222,9 +223,13 @@ while ($i < min($num, $limit))
print '<td class="center">'; print '<td class="center">';
if ($obj->fk_user) if ($obj->fk_user)
{ {
$userstatic->id = $obj->fk_user; if (empty($cacheOfUsers[$obj->fk_user])) {
$userstatic->lastname = $obj->login; $tmpuser = new User($db);
print $userstatic->getNomUrl(1); $tmpuser->fetch($obj->fk_user);
$cacheOfUsers[$obj->fk_user] = $tmpuser;
}
$tmpuser = $cacheOfUsers[$obj->fk_user];
print $tmpuser->getNomUrl(1);
} }
else else
{ {
@ -242,11 +247,11 @@ while ($i < min($num, $limit))
print '<td class="nowrap right">'; print '<td class="nowrap right">';
if ($user->rights->bookmark->creer) if ($user->rights->bookmark->creer)
{ {
print '<a href="'.DOL_URL_ROOT."/bookmarks/card.php?action=edit&id=".$obj->rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"]).'">'.img_edit()."</a>"; print '<a class="editfielda" href="'.DOL_URL_ROOT."/bookmarks/card.php?action=edit&id=".$obj->rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"]).'">'.img_edit()."</a>";
} }
if ($user->rights->bookmark->supprimer) if ($user->rights->bookmark->supprimer)
{ {
print "<a href=\"".$_SERVER["PHP_SELF"]."?action=delete&id=$obj->rowid\">".img_delete()."</a>"; print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$obj->rowid.'">'.img_delete().'</a>';
} }
else else
{ {

View File

@ -3658,7 +3658,7 @@ class Propal extends CommonObject
if ($user->rights->propal->lire) if ($user->rights->propal->lire)
{ {
$label = '<u>'.$langs->trans("ShowPropal").'</u>'; $label = '<u>'.$langs->trans("Proposal").'</u>';
if (!empty($this->ref)) if (!empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->ref_client)) if (!empty($this->ref_client))
@ -3669,6 +3669,11 @@ class Propal extends CommonObject
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); $label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (!empty($this->total_ttc)) if (!empty($this->total_ttc))
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
if (isset($this->statut)) {
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
}
if ($option == '') { if ($option == '') {
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params; $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params;
} }
@ -3696,7 +3701,7 @@ class Propal extends CommonObject
{ {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
$label = $langs->trans("ShowPropal"); $label = $langs->trans("Proposal");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
} }
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';

View File

@ -287,7 +287,7 @@ $sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " ava.rowid as availability,"; $sql .= " ava.rowid as availability,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,'; $sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva as multicurrency_total_vat, p.multicurrency_total_ttc,'; $sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva as multicurrency_total_vat, p.multicurrency_total_ttc,';
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
$sql .= ' p.note_public, p.note_private,'; $sql .= ' p.note_public, p.note_private,';
@ -572,40 +572,40 @@ if ($resql)
if (!empty($arrayfields['p.ref']['checked'])) if (!empty($arrayfields['p.ref']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">'; print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['p.ref_client']['checked'])) if (!empty($arrayfields['p.ref_client']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).'">'; print '<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).'">';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['pr.ref']['checked'])) if (!empty($arrayfields['pr.ref']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).'">'; print '<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).'">';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['pr.title']['checked'])) if (!empty($arrayfields['pr.title']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).'">'; print '<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).'">';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['s.nom']['checked'])) if (!empty($arrayfields['s.nom']['checked']))
{ {
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="10" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">'; print '<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>'; if (!empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.'"></td>';
if (!empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>'; if (!empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.'"></td>';
// State // State
if (!empty($arrayfields['state.nom']['checked'])) if (!empty($arrayfields['state.nom']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">'; print '<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>'; print '</td>';
} }
// Country // Country
@ -618,7 +618,7 @@ if ($resql)
// Company type // Company type
if (!empty($arrayfields['typent.code']['checked'])) if (!empty($arrayfields['typent.code']['checked']))
{ {
print '<td class="liste_titre maxwidthonsmartphone" align="center">'; print '<td class="liste_titre maxwidth100onsmartphone" align="center">';
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT));
print ajax_combobox('search_type_thirdparty'); print ajax_combobox('search_type_thirdparty');
print '</td>'; print '</td>';
@ -668,7 +668,7 @@ if ($resql)
// Availability // Availability
if (!empty($arrayfields['ava.rowid']['checked'])) if (!empty($arrayfields['ava.rowid']['checked']))
{ {
print '<td class="liste_titre maxwidthonsmartphone" align="center">'; print '<td class="liste_titre maxwidth100onsmartphone center">';
$form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1); $form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1);
print ajax_combobox('search_availability'); print ajax_combobox('search_availability');
print '</td>'; print '</td>';
@ -862,6 +862,8 @@ if ($resql)
$objectstatic->ref_client = $obj->ref_client; $objectstatic->ref_client = $obj->ref_client;
$objectstatic->note_public = $obj->note_public; $objectstatic->note_public = $obj->note_public;
$objectstatic->note_private = $obj->note_private; $objectstatic->note_private = $obj->note_private;
$objectstatic->statut = $obj->status;
$objectstatic->status = $obj->status;
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
@ -900,16 +902,16 @@ if ($resql)
if (!empty($arrayfields['p.ref']['checked'])) if (!empty($arrayfields['p.ref']['checked']))
{ {
print '<td class="nowrap">'; print '<td class="nowraponall">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref // Picto + Ref
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowraponall">';
print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1));
print '</td>'; print '</td>';
// Warning // Warning
$warnornote = ''; $warnornote = '';
if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) $warnornote .= img_warning($langs->trans("Late")); if ($obj->status == Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) $warnornote .= img_warning($langs->trans("Late"));
if ($warnornote) if ($warnornote)
{ {
print '<td style="min-width: 20px" class="nobordernopadding nowrap">'; print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
@ -1232,7 +1234,7 @@ if ($resql)
// Status // Status
if (!empty($arrayfields['p.fk_statut']['checked'])) if (!empty($arrayfields['p.fk_statut']['checked']))
{ {
print '<td class="nowrap right">'.$objectstatic->LibStatut($obj->fk_statut, 5).'</td>'; print '<td class="nowrap right">'.$objectstatic->getLibStatut(5).'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Action column // Action column

View File

@ -113,7 +113,7 @@ $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php $permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
if (!empty($conf->expedition->enabled) && $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER = 1) { if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $object->warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $object->warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE;
if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $object->warehouse_id = $user->fk_warehouse; if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $object->warehouse_id = $user->fk_warehouse;
} }
@ -1506,9 +1506,10 @@ if ($action == 'create' && $usercancreate)
if (!empty($origin) && !empty($originid)) { if (!empty($origin) && !empty($originid)) {
// Parse element/subelement (ex: project_task) // Parse element/subelement (ex: project_task)
$element = $subelement = $origin; $element = $subelement = $origin;
$regs = array();
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
$element = $regs [1]; $element = $regs[1];
$subelement = $regs [2]; $subelement = $regs[2];
} }
if ($element == 'project') { if ($element == 'project') {

View File

@ -3697,7 +3697,7 @@ class Commande extends CommonOrder
$label = ''; $label = '';
if ($user->rights->commande->lire) { if ($user->rights->commande->lire) {
$label = '<u>'.$langs->trans("ShowOrder").'</u>'; $label = '<u>'.$langs->trans("Order").'</u>';
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.($this->ref_customer ? $this->ref_customer : $this->ref_client); $label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.($this->ref_customer ? $this->ref_customer : $this->ref_client);
if (!empty($this->total_ht)) { if (!empty($this->total_ht)) {
@ -3709,6 +3709,9 @@ class Commande extends CommonOrder
if (!empty($this->total_ttc)) { if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
} }
if (isset($this->statut)) {
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
}
} }
$linkclose = ''; $linkclose = '';
@ -3716,7 +3719,7 @@ class Commande extends CommonOrder
{ {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
$label = $langs->trans("ShowOrder"); $label = $langs->trans("Order");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
} }
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';

View File

@ -348,7 +348,7 @@ if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact
if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1); if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1);
if ($search_total_vat != '') $sql .= natural_search('c.tva', $search_total_vat, 1); if ($search_total_vat != '') $sql .= natural_search('c.tva', $search_total_vat, 1);
if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1); if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1);
if ($search_warehouse != '') $sql .= natural_search('c.fk_warehouse', $search_warehouse, 1); if ($search_warehouse != '' && $search_warehouse != '-1') $sql .= natural_search('c.fk_warehouse', $search_warehouse, 1);
if ($search_multicurrency_code != '') $sql .= ' AND c.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"'; if ($search_multicurrency_code != '') $sql .= ' AND c.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
if ($search_multicurrency_tx != '') $sql .= natural_search('c.multicurrency_tx', $search_multicurrency_tx, 1); if ($search_multicurrency_tx != '') $sql .= natural_search('c.multicurrency_tx', $search_multicurrency_tx, 1);
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1); if ($search_multicurrency_montant_ht != '') $sql .= natural_search('c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
@ -603,7 +603,7 @@ if ($resql)
$moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1); $moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
if (!empty($conf->expedition->enabled) && $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER = 1) { if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
@ -901,6 +901,7 @@ if ($resql)
$generic_commande->id = $obj->rowid; $generic_commande->id = $obj->rowid;
$generic_commande->ref = $obj->ref; $generic_commande->ref = $obj->ref;
$generic_commande->statut = $obj->fk_statut; $generic_commande->statut = $obj->fk_statut;
$generic_commande->billed = $obj->billed;
$generic_commande->date = $db->jdate($obj->date_commande); $generic_commande->date = $db->jdate($obj->date_commande);
$generic_commande->date_livraison = $db->jdate($obj->date_delivery); $generic_commande->date_livraison = $db->jdate($obj->date_delivery);
$generic_commande->ref_client = $obj->ref_client; $generic_commande->ref_client = $obj->ref_client;
@ -919,7 +920,7 @@ if ($resql)
// Ref // Ref
if (!empty($arrayfields['c.ref']['checked'])) if (!empty($arrayfields['c.ref']['checked']))
{ {
print '<td class="nowrap">'; print '<td class="nowraponall">';
$generic_commande->getLinesArray(); // This set ->lines $generic_commande->getLinesArray(); // This set ->lines

View File

@ -108,14 +108,6 @@ $pagenext = $page + 1;
if (!$sortorder) $sortorder = 'desc,desc,desc'; if (!$sortorder) $sortorder = 'desc,desc,desc';
if (!$sortfield) $sortfield = 'b.datev,b.dateo,b.rowid'; if (!$sortfield) $sortfield = 'b.datev,b.dateo,b.rowid';
$mode_balance_ok = false;
//if (($sortfield == 'b.datev' || $sortfield == 'b.datev,b.dateo,b.rowid')) // TODO Manage balance when account not selected
if (($sortfield == 'b.datev' || $sortfield == 'b.datev,b.dateo,b.rowid'))
{
$sortfield = 'b.datev,b.dateo,b.rowid';
if ($id > 0 || !empty($ref) || $search_account > 0) $mode_balance_ok = true;
}
$object = new Account($db); $object = new Account($db);
if ($id > 0 || !empty($ref)) if ($id > 0 || !empty($ref))
{ {
@ -130,6 +122,13 @@ if ($id > 0 || !empty($ref))
} }
} }
$mode_balance_ok = false;
//if (($sortfield == 'b.datev' || $sortfield == 'b.datev,b.dateo,b.rowid')) // TODO Manage balance when account not selected
if (($sortfield == 'b.datev' || $sortfield == 'b.datev,b.dateo,b.rowid'))
{
$sortfield = 'b.datev,b.dateo,b.rowid';
if ($id > 0 || !empty($ref) || $search_account > 0) $mode_balance_ok = true;
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('banktransactionlist', $contextpage)); $hookmanager->initHooks(array('banktransactionlist', $contextpage));
@ -574,6 +573,7 @@ if ($page >= $nbtotalofpages)
if ($page < 0) $page = 0; if ($page < 0) $page = 0;
} }
// If not account defined $mode_balance_ok=false // If not account defined $mode_balance_ok=false
if (empty($search_account)) $mode_balance_ok = false; if (empty($search_account)) $mode_balance_ok = false;
// If a search is done $mode_balance_ok=false // If a search is done $mode_balance_ok=false
@ -583,7 +583,7 @@ if (!empty($search_type)) $mode_balance_ok = false;
if (!empty($search_debit)) $mode_balance_ok = false; if (!empty($search_debit)) $mode_balance_ok = false;
if (!empty($search_credit)) $mode_balance_ok = false; if (!empty($search_credit)) $mode_balance_ok = false;
if (!empty($search_thirdparty)) $mode_balance_ok = false; if (!empty($search_thirdparty)) $mode_balance_ok = false;
if ($search_conciliated != '') $mode_balance_ok = false; if ($search_conciliated != '' && $search_conciliated != '-1') $mode_balance_ok = false;
if (!empty($search_num_releve)) $mode_balance_ok = false; if (!empty($search_num_releve)) $mode_balance_ok = false;
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
@ -751,8 +751,8 @@ if ($resql)
print '</td>'; print '</td>';
}*/ }*/
print '<td class="center">'; print '<td class="center">';
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Add").'"><br>'; print '<input type="submit" name="save" class="button buttongen marginbottomonly" value="'.$langs->trans("Add").'"><br>';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" name="cancel" class="button buttongen marginbottomonly" value="'.$langs->trans("Cancel").'">';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
@ -815,7 +815,7 @@ if ($resql)
$morehtml .= $buttonreconcile; $morehtml .= $buttonreconcile;
} }
$morehtml .= $newcardbutton; $morehtml .= '<!-- Add New button -->'.$newcardbutton;
$picto = 'bank_account'; $picto = 'bank_account';
if ($id > 0 || !empty($ref)) $picto = ''; if ($id > 0 || !empty($ref)) $picto = '';

View File

@ -1390,8 +1390,8 @@ class Account extends CommonObject
global $conf, $langs, $user; global $conf, $langs, $user;
$result = ''; $result = '';
$label = '<u>'.$langs->trans("ShowAccount").'</u>'; $label = '<u>'.$langs->trans("BankAccount").'</u>';
$label .= '<br><b>'.$langs->trans('BankAccount').':</b> '.$this->label; $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
$label .= '<br><b>'.$langs->trans('AccountNumber').':</b> '.$this->number; $label .= '<br><b>'.$langs->trans('AccountNumber').':</b> '.$this->number;
$label .= '<br><b>'.$langs->trans("AccountCurrency").':</b> '.$this->currency_code; $label .= '<br><b>'.$langs->trans("AccountCurrency").':</b> '.$this->currency_code;

View File

@ -538,7 +538,11 @@ foreach ($accounts as $key=>$type)
if ($result < 0) { if ($result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else { } else {
print '<span class="badge badge-info classfortooltip" title="'.dol_htmlentities($langs->trans("TransactionsToConciliate")).'">'.$result->nbtodo.'</span>'; print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'&search_conciliated=0">';
print '<span class="badge badge-info classfortooltip" title="'.dol_htmlentities($langs->trans("TransactionsToConciliate")).'">';
print $result->nbtodo;
print '</span>';
print '</a>';
if ($result->nbtodolate) { if ($result->nbtodolate) {
print '<span title="'.dol_htmlentities($langs->trans("Late")).'" class="classfortooltip badge badge-danger marginleftonlyshort">'; print '<span title="'.dol_htmlentities($langs->trans("Late")).'" class="classfortooltip badge badge-danger marginleftonlyshort">';
print '<i class="fa fa-exclamation-triangle"></i> '.$result->nbtodolate; print '<i class="fa fa-exclamation-triangle"></i> '.$result->nbtodolate;

View File

@ -51,8 +51,8 @@ if ($action == 'add')
$dateo = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateo = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$amount = GETPOST('amount', 'alpha'); $amount = price2num(GETPOST('amount', 'alpha'), 'MT');
$amountto = GETPOST('amountto', 'alpha'); $amountto = price2num(GETPOST('amountto', 'alpha'), 'MT');
if (!$label) if (!$label)
{ {
@ -115,9 +115,9 @@ if ($action == 'add')
$typeto = 'LIQ'; $typeto = 'LIQ';
} }
if (!$error) $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1 * price2num($amount), '', '', $user); if (!$error) $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, price2num(-1 * $amount), '', '', $user);
if (!($bank_line_id_from > 0)) $error++; if (!($bank_line_id_from > 0)) $error++;
if (!$error) $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, price2num($amountto), '', '', $user); if (!$error) $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, $amountto, '', '', $user);
if (!($bank_line_id_to > 0)) $error++; if (!($bank_line_id_to > 0)) $error++;
if (!$error) $result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'); if (!$error) $result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
@ -246,7 +246,6 @@ print '<td>'.$langs->trans("TransferFrom").'</td><td>'.$langs->trans("TransferTo
print '<td style="display:none" class="multicurrency">'.$langs->trans("AmountToOthercurrency").'</td>'; print '<td style="display:none" class="multicurrency">'.$langs->trans("AmountToOthercurrency").'</td>';
print '</tr>'; print '</tr>';
$var = false;
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
$form->select_comptes($account_from, 'account_from', 0, '', 1, '', empty($conf->multicurrency->enabled) ? 0 : 1); $form->select_comptes($account_from, 'account_from', 0, '', 1, '', empty($conf->multicurrency->enabled) ? 0 : 1);
print "</td>"; print "</td>";

View File

@ -139,6 +139,11 @@ if ($user->socid) $socid = $user->socid;
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft); $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
// retained warranty invoice available type
$retainedWarrantyInvoiceAvailableType=array();
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
$retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY);
}
/* /*
@ -947,7 +952,7 @@ if (empty($reshook))
} }
$discount->tva_tx = abs($tva_tx); $discount->tva_tx = abs($tva_tx);
$discount->vat_src_code = $vat_src_code; $discount->vat_src_code =$vat_src_code;
$result = $discount->create($user); $result = $discount->create($user);
if ($result < 0) if ($result < 0)
@ -1355,17 +1360,22 @@ if (empty($reshook))
$object->situation_counter = 1; $object->situation_counter = 1;
$object->situation_final = 0; $object->situation_final = 0;
$object->situation_cycle_ref = $object->newCycle(); $object->situation_cycle_ref = $object->newCycle();
}
if(in_array($object->type, $retainedWarrantyInvoiceAvailableType)){
$object->retained_warranty = GETPOST('retained_warranty', 'int'); $object->retained_warranty = GETPOST('retained_warranty', 'int');
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
}
else{
$object->retained_warranty = 0;
$object->retained_warranty_fk_cond_reglement = 0;
}
$retained_warranty_date_limit = GETPOST('retained_warranty_date_limit'); $retained_warranty_date_limit = GETPOST('retained_warranty_date_limit');
if (!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)) { if (!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)) {
$object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit); $object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit);
} }
$object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement); $object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
}
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -1756,20 +1766,31 @@ if (empty($reshook))
$object->fk_facture_source = $_POST['situations']; $object->fk_facture_source = $_POST['situations'];
$object->type = Facture::TYPE_SITUATION; $object->type = Facture::TYPE_SITUATION;
if (!empty($origin) && !empty($originid))
{
$object->origin = $origin;
$object->origin_id = $originid;
$object->retained_warranty = GETPOST('retained_warranty', 'int'); // retained warranty
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY))
{
$retained_warranty = GETPOST('retained_warranty', 'int');
if(price2num($retained_warranty) > 0)
{
$object->retained_warranty = price2num($retained_warranty);
}
if(GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0)
{
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
}
$retained_warranty_date_limit = GETPOST('retained_warranty_date_limit'); $retained_warranty_date_limit = GETPOST('retained_warranty_date_limit');
if (!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)) { if (!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)) {
$object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit); $object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit);
} }
$object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement); $object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
}
if (!empty($origin) && !empty($originid))
{
$object->origin = $origin;
$object->origin_id = $originid;
foreach ($object->lines as $i => &$line) foreach ($object->lines as $i => &$line)
{ {
@ -2608,10 +2629,10 @@ if (empty($reshook))
$pa_ht = $originLine->pa_ht; $pa_ht = $originLine->pa_ht;
$label = $originLine->label; $label = $originLine->label;
$array_options = $originLine->array_options; $array_options = $originLine->array_options;
if ($object->type == Facture::TYPE_SITUATION) { if($object->type == Facture::TYPE_SITUATION){
$situation_percent = 0; $situation_percent = 0;
} }
else { else{
$situation_percent = 100; $situation_percent = 100;
} }
$fk_prev_id = ''; $fk_prev_id = '';
@ -3371,22 +3392,20 @@ if ($action == 'create')
$form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id'); $form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id');
print '</td></tr>'; print '</td></tr>';
if (!empty($conf->global->INVOICE_USE_SITUATION))
{ if($conf->global->INVOICE_USE_RETAINED_WARRANTY){
if ($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY) {
$rwStyle = 'display:none;'; $rwStyle = 'display:none;';
if (GETPOST('type', 'int') == Facture::TYPE_SITUATION) { if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){
$rwStyle = ''; $rwStyle = '';
} }
$retained_warranty = GETPOST('retained_warranty', 'int'); $retained_warranty = GETPOST('retained_warranty', 'int');
if (empty($retained_warranty)) { if(empty($retained_warranty)){
if (!empty($objectsrc->retained_warranty)) { // use previous situation value if(!empty($objectsrc->retained_warranty)){ // use previous situation value
$retained_warranty = $objectsrc->retained_warranty; $retained_warranty = $objectsrc->retained_warranty;
} else {
$retained_warranty = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
} }
} }
$retained_warranty_js_default = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('RetainedWarranty').'</td><td colspan="2">'; print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('RetainedWarranty').'</td><td colspan="2">';
print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%'; print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%';
@ -3394,11 +3413,11 @@ if ($action == 'create')
// Retained warranty payment term // Retained warranty payment term
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td><td colspan="2">'; print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td><td colspan="2">';
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
if (empty($retained_warranty_fk_cond_reglement)) { if(empty($retained_warranty_fk_cond_reglement)){
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
if (!empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; $retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement;
} else { }else{
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
} }
} }
@ -3407,19 +3426,22 @@ if ($action == 'create')
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
$(document).ready(function() { $(document).ready(function() {
$("[name=\'type\'").change(function() { $("[name=\'type\']").change(function() {
if($( this ).prop("checked") && $( this ).val() == '.Facture::TYPE_SITUATION.') if($( this ).prop("checked") && $.inArray($( this ).val(), '.json_encode($retainedWarrantyInvoiceAvailableType).' ) !== -1)
{ {
$(".retained-warranty-line").show(); $(".retained-warranty-line").show();
$("#new-situation-invoice-retained-warranty").val("'.doubleval($retained_warranty_js_default).'");
} }
else{ else{
$(".retained-warranty-line").hide(); $(".retained-warranty-line").hide();
$("#new-situation-invoice-retained-warranty").val("");
} }
}); });
$("[name=\'type\']").trigger("change");
}); });
</script>'; </script>';
} }
}
// Payment mode // Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
@ -4333,21 +4355,17 @@ elseif ($id > 0 || !empty($ref))
print '</td></tr>'; print '</td></tr>';
} }
$displayWarranty = false;
if (($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY))))
{ if(!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
// Check if this situation invoice is 100% for real
if (!empty($object->situation_final) && !empty($object->lines)) {
$displayWarranty = true; $displayWarranty = true;
foreach ($object->lines as $i => $line) { if(!in_array($object->type, $retainedWarrantyInvoiceAvailableType) && empty($object->retained_warranty)){
if ($line->product_type < 2 && $line->situation_percent < 100) {
$displayWarranty = false; $displayWarranty = false;
break;
}
}
} }
if($displayWarranty)
{
// Retained Warranty // Retained Warranty
print '<tr class="retained-warranty-lines" ><td>'; print '<tr class="retained-warranty-lines" ><td>';
@ -4413,9 +4431,6 @@ elseif ($id > 0 || !empty($ref))
} }
print '</td></tr>'; print '</td></tr>';
if ($displayWarranty)
{
// Retained Warranty payment date limit // Retained Warranty payment date limit
print '<tr class="retained-warranty-lines" ><td>'; print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-date-limit-table" class="nobordernopadding" width="100%"><tr><td>'; print '<table id="retained-warranty-date-limit-table" class="nobordernopadding" width="100%"><tr><td>';

View File

@ -302,9 +302,9 @@ class Facture extends CommonInvoice
'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230), 'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230),
'situation_counter' =>array('type'=>'smallint(6)', 'label'=>'Situation counter', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>235), 'situation_counter' =>array('type'=>'smallint(6)', 'label'=>'Situation counter', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>235),
'situation_final' =>array('type'=>'smallint(6)', 'label'=>'Situation final', 'enabled'=>'empty($conf->global->INVOICE_USE_SITUATION) ? 0 : 1', 'visible'=>-1, 'position'=>240), 'situation_final' =>array('type'=>'smallint(6)', 'label'=>'Situation final', 'enabled'=>'empty($conf->global->INVOICE_USE_SITUATION) ? 0 : 1', 'visible'=>-1, 'position'=>240),
'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>245), 'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>'$conf->global->INVOICE_USE_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>245),
'retained_warranty_date_limit' =>array('type'=>'date', 'label'=>'Retained warranty date limit', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>250), 'retained_warranty_date_limit' =>array('type'=>'date', 'label'=>'Retained warranty date limit', 'enabled'=>'$conf->global->INVOICE_USE_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>250),
'retained_warranty_fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Retained warranty fk cond reglement', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>255), 'retained_warranty_fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Retained warranty fk cond reglement', 'enabled'=>'$conf->global->INVOICE_USE_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>255),
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>260), 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>260),
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>265), 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>265),
'date_pointoftax' =>array('type'=>'date', 'label'=>'DatePointOfTax', 'enabled'=>'$conf->global->INVOICE_POINTOFTAX_DATE', 'visible'=>-1, 'position'=>270), 'date_pointoftax' =>array('type'=>'date', 'label'=>'DatePointOfTax', 'enabled'=>'$conf->global->INVOICE_POINTOFTAX_DATE', 'visible'=>-1, 'position'=>270),
@ -813,12 +813,12 @@ class Facture extends CommonInvoice
$vatrate = $line->tva_tx; $vatrate = $line->tva_tx;
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')'; if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
if (!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) { if(!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
$originid = $line->origin_id; $originid=$line->origin_id;
$origintype = $line->origin; $origintype=$line->origin;
} else { } else {
$originid = $line->id; $originid=$line->id;
$origintype = $this->element; $origintype=$this->element;
} }
$result = $this->addline( $result = $this->addline(
@ -3733,44 +3733,44 @@ class Facture extends CommonInvoice
} }
if (!empty($addon)) { if (!empty($addon)) {
dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->nom.", type=".$soc->typent_code, LOG_DEBUG); dol_syslog("Call getNextNumRef with " . $addonConstName . " = " . $conf->global->FACTURE_ADDON . ", thirdparty=" . $soc->nom . ", type=" . $soc->typent_code, LOG_DEBUG);
$mybool = false; $mybool = false;
$file = $addon.'.php'; $file = $addon . '.php';
$classname = $addon; $classname = $addon;
// Include file with class // Include file with class
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) { foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir.'core/modules/'.$moduleName.'/'); $dir = dol_buildpath($reldir . 'core/modules/' . $moduleName . '/');
// Load file with numbering class (if found) // Load file with numbering class (if found)
if (is_file($dir.$file) && is_readable($dir.$file)) { if (is_file($dir . $file) && is_readable($dir . $file)) {
$mybool |= include_once $dir.$file; $mybool |= include_once $dir . $file;
} }
} }
// For compatibility // For compatibility
if (!$mybool) { if (!$mybool) {
$file = $addon.'/'.$addon.'.modules.php'; $file = $addon . '/' . $addon . '.modules.php';
$classname = 'mod_'.$moduleName.'_'.$addon; $classname = 'mod_' . $moduleName . '_' . $addon;
$classname = preg_replace('/\-.*$/', '', $classname); $classname = preg_replace('/\-.*$/', '', $classname);
// Include file with class // Include file with class
foreach ($conf->file->dol_document_root as $dirroot) { foreach ($conf->file->dol_document_root as $dirroot) {
$dir = $dirroot.'/core/modules/'.$moduleName.'/'; $dir = $dirroot . '/core/modules/' . $moduleName . '/';
// Load file with numbering class (if found) // Load file with numbering class (if found)
if (is_file($dir.$file) && is_readable($dir.$file)) { if (is_file($dir . $file) && is_readable($dir . $file)) {
$mybool |= include_once $dir.$file; $mybool |= include_once $dir . $file;
} }
} }
} }
if (!$mybool) { if (!$mybool) {
dol_print_error('', 'Failed to include file '.$file); dol_print_error('', 'Failed to include file ' . $file);
return ''; return '';
} }
@ -3789,7 +3789,7 @@ class Facture extends CommonInvoice
return $numref; return $numref;
} else { } else {
$langs->load('errors'); $langs->load('errors');
print $langs->trans('Error').' '.$langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName)); print $langs->trans('Error') . ' ' . $langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
return ''; return '';
} }
} }
@ -4742,6 +4742,43 @@ class Facture extends CommonInvoice
return $hasDelay; return $hasDelay;
} }
/**
* Currently used for documents generation : to know if retained warranty need to be displayed
* @return bool
*/
public function displayRetainedWarranty()
{
global $conf;
// TODO : add a flag on invoices to store this conf : INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION
// note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
$displayWarranty = false;
if(!empty($this->retained_warranty)) {
$displayWarranty = true;
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) {
// Check if this situation invoice is 100% for real
$displayWarranty = false;
if (!empty($this->situation_final)) {
$displayWarranty = true;
} elseif (!empty($this->lines) && $this->status == Facture::STATUS_DRAFT) {
// $object->situation_final need validation to be done so this test is need for draft
$displayWarranty = true;
foreach ($this->lines as $i => $line) {
if ($line->product_type < 2 && $line->situation_percent < 100) {
$displayWarranty = false;
break;
}
}
}
}
}
return $displayWarranty;
}
/** /**
* @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT) * @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT)
@ -4757,7 +4794,7 @@ class Facture extends CommonInvoice
$retainedWarrantyAmount = 0; $retainedWarrantyAmount = 0;
// Billed - retained warranty // Billed - retained warranty
if ($this->type == Facture::TYPE_SITUATION) if($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION))
{ {
$displayWarranty = true; $displayWarranty = true;
// Check if this situation invoice is 100% for real // Check if this situation invoice is 100% for real
@ -4795,7 +4832,10 @@ class Facture extends CommonInvoice
if ($rounding < 0) { if ($rounding < 0) {
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
return round($retainedWarrantyAmount, 2); }
if($rounding>0){
return round($retainedWarrantyAmount, $rounding);
} }
return $retainedWarrantyAmount; return $retainedWarrantyAmount;

View File

@ -208,7 +208,7 @@ $arrayfields = array(
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
); );
if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY) if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_RETAINED_WARRANTY)
{ {
$arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0, 'position'=>86); $arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0, 'position'=>86);
} }
@ -1137,7 +1137,7 @@ if ($resql)
$facturestatic->note_public = $obj->note_public; $facturestatic->note_public = $obj->note_public;
$facturestatic->note_private = $obj->note_private; $facturestatic->note_private = $obj->note_private;
if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY) if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_RETAINED_WARRANTY)
{ {
$facturestatic->retained_warranty = $obj->retained_warranty; $facturestatic->retained_warranty = $obj->retained_warranty;
$facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit; $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;

View File

@ -209,7 +209,7 @@ if ($id)
} }
} }
// Formulaire saisie tva // Form to enter VAT
if ($action == 'create') if ($action == 'create')
{ {
print load_fiche_titre($langs->trans("VAT").' - '.$langs->trans("New")); print load_fiche_titre($langs->trans("VAT").' - '.$langs->trans("New"));
@ -262,7 +262,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
print '<tr><td class="fieldrequired">'.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).'</td><td>'; print '<tr><td class="fieldrequired">'.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).'</td><td>';
print $form->selectDate($datev, "datev", '', '', '', 'add', 1, 1); print $form->selectDate((GETPOST("datevmonth", 'int') ? $datev : -1), "datev", '', '', '', 'add', 1, 1);
print '</td></tr>'; print '</td></tr>';
// Label // Label

View File

@ -52,15 +52,16 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC))
{ {
// Define if we have to generate thumbs or not // Define if we have to generate thumbs or not
$generatethumbs = 1; $generatethumbs = 1;
if (GETPOST('section_dir')) $generatethumbs = 0; if (GETPOST('section_dir', 'alpha')) $generatethumbs = 0;
$allowoverwrite = (GETPOST('overwritefile', 'int') ? 1 : 0);
if (!empty($upload_dirold) && !empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) if (!empty($upload_dirold) && !empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
{ {
$result = dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); $result = dol_add_file_process($upload_dirold, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs);
} }
elseif (!empty($upload_dir)) elseif (!empty($upload_dir))
{ {
$result = dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); $result = dol_add_file_process($upload_dir, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs);
} }
} }
} }
@ -150,7 +151,8 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
} }
else else
{ {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir', 'alpha') ? '&section_dir='.urlencode(GETPOST('section_dir', 'alpha')) : '').(!empty($withproject) ? '&withproject=1' : '')); $tmpurl = $_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir', 'alpha') ? '&section_dir='.urlencode(GETPOST('section_dir', 'alpha')) : '').(!empty($withproject) ? '&withproject=1' : '');
header('Location: '.$tmpurl);
exit; exit;
} }
} }

View File

@ -356,10 +356,12 @@ if ($useajax || $action == 'delete')
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$useglobalvars = 1; $useglobalvars = 1;
$form = new Form($db); $form = new Form($db);
$formquestion['urlfile'] = array('type'=>'hidden', 'value'=>$urlfile, 'name'=>'urlfile'); // We must always put field, even if empty because it is fille by javascript later $formquestion['urlfile'] = array('type'=>'hidden', 'value'=>$urlfile, 'name'=>'urlfile'); // We must always put field, even if empty because it is filled by javascript later
$formquestion['section'] = array('type'=>'hidden', 'value'=>$section, 'name'=>'section'); // We must always put field, even if empty because it is fille by javascript later $formquestion['section'] = array('type'=>'hidden', 'value'=>$section, 'name'=>'section'); // We must always put field, even if empty because it is filled by javascript later
$formquestion['section_id'] = array('type'=>'hidden', 'value'=>$section_id, 'name'=>'section_id'); // We must always put field, even if empty because it is fille by javascript later $formquestion['section_id'] = array('type'=>'hidden', 'value'=>$section_id, 'name'=>'section_id'); // We must always put field, even if empty because it is filled by javascript later
$formquestion['section_dir'] = array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir'); // We must always put field, even if empty because it is fille by javascript later $formquestion['section_dir'] = array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir'); // We must always put field, even if empty because it is filled by javascript later
$formquestion['sortfield'] = array('type'=>'hidden', 'value'=>$sortfield, 'name'=>'sortfield'); // We must always put field, even if empty because it is filled by javascript later
$formquestion['sortorder'] = array('type'=>'hidden', 'value'=>$sortorder, 'name'=>'sortorder'); // We must always put field, even if empty because it is filled by javascript later
if (!empty($action) && $action == 'file_manager') $formquestion['file_manager'] = array('type'=>'hidden', 'value'=>1, 'name'=>'file_manager'); if (!empty($action) && $action == 'file_manager') $formquestion['file_manager'] = array('type'=>'hidden', 'value'=>1, 'name'=>'file_manager');
if (!empty($websitekey)) $formquestion['website'] = array('type'=>'hidden', 'value'=>$websitekey, 'name'=>'website'); if (!empty($websitekey)) $formquestion['website'] = array('type'=>'hidden', 'value'=>$websitekey, 'name'=>'website');
if (!empty($pageid) && $pageid > 0) $formquestion['pageid'] = array('type'=>'hidden', 'value'=>$pageid, 'name'=>'pageid'); if (!empty($pageid) && $pageid > 0) $formquestion['pageid'] = array('type'=>'hidden', 'value'=>$pageid, 'name'=>'pageid');

View File

@ -575,7 +575,7 @@ abstract class CommonObject
{ {
$return = '<div class="box-flex-item">'; $return = '<div class="box-flex-item">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infoxbox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
$return .= '<i class="fa fa-dol-action"></i>'; // Can be image $return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
@ -7876,6 +7876,7 @@ abstract class CommonObject
public function createCommon(User $user, $notrigger = false) public function createCommon(User $user, $notrigger = false)
{ {
global $langs; global $langs;
dol_syslog(get_class($this)."::createCommon create", LOG_DEBUG);
$error = 0; $error = 0;
@ -8114,6 +8115,7 @@ abstract class CommonObject
public function updateCommon(User $user, $notrigger = false) public function updateCommon(User $user, $notrigger = false)
{ {
global $conf, $langs; global $conf, $langs;
dol_syslog(get_class($this)."::updateCommon update", LOG_DEBUG);
$error = 0; $error = 0;
@ -8203,6 +8205,8 @@ abstract class CommonObject
*/ */
public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0) public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0)
{ {
dol_syslog(get_class($this)."::deleteCommon delete", LOG_DEBUG);
$error = 0; $error = 0;
$this->db->begin(); $this->db->begin();
@ -8262,15 +8266,8 @@ abstract class CommonObject
if (!$error && !empty($this->isextrafieldmanaged)) if (!$error && !empty($this->isextrafieldmanaged))
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields"; $result = $this->deleteExtraFields();
$sql .= " WHERE fk_object=".$this->id; if ($result < 0) { $error++; }
$resql = $this->db->query($sql);
if (!$resql)
{
$this->errors[] = $this->db->lasterror();
$error++;
}
} }
if (!$error) if (!$error)

View File

@ -259,7 +259,7 @@ class DolEditor
})'; })';
$out .= '</script>'."\n"; $out .= '</script>'."\n";
} }
var_dump($this->height);
$out .= '<pre id="'.$this->htmlname.'aceeditorid" style="'.($this->width ? 'width: '.$this->width.'px; ' : ''); $out .= '<pre id="'.$this->htmlname.'aceeditorid" style="'.($this->width ? 'width: '.$this->width.'px; ' : '');
$out .= ($this->height ? ' height: '.$this->height.'px; ' : ''); $out .= ($this->height ? ' height: '.$this->height.'px; ' : '');
//$out.=" min-height: 100px;"; //$out.=" min-height: 100px;";

View File

@ -100,9 +100,9 @@ class Events // extends CommonObject
array('id'=>'USER_NEW_PASSWORD', 'test'=>1), array('id'=>'USER_NEW_PASSWORD', 'test'=>1),
array('id'=>'USER_ENABLEDISABLE', 'test'=>1), array('id'=>'USER_ENABLEDISABLE', 'test'=>1),
array('id'=>'USER_DELETE', 'test'=>1), array('id'=>'USER_DELETE', 'test'=>1),
array('id'=>'GROUP_CREATE', 'test'=>1), array('id'=>'USERGROUP_CREATE', 'test'=>1),
array('id'=>'GROUP_MODIFY', 'test'=>1), array('id'=>'USERGROUP_MODIFY', 'test'=>1),
array('id'=>'GROUP_DELETE', 'test'=>1), array('id'=>'USERGROUP_DELETE', 'test'=>1),
); );

View File

@ -4386,7 +4386,7 @@ class Form
buttons: { buttons: {
"'.dol_escape_js($langs->transnoentities("Yes")).'": function() { "'.dol_escape_js($langs->transnoentities("Yes")).'": function() {
var options = "&token='.urlencode(newToken()).'"; var options = "&token='.urlencode(newToken()).'";
var inputok = '.json_encode($inputok).'; var inputok = '.json_encode($inputok).'; /* List of fields into form */
var pageyes = "'.dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; var pageyes = "'.dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
if (inputok.length>0) { if (inputok.length>0) {
$.each(inputok, function(i, inputname) { $.each(inputok, function(i, inputname) {
@ -4405,7 +4405,7 @@ class Form
}, },
"'.dol_escape_js($langs->transnoentities("No")).'": function() { "'.dol_escape_js($langs->transnoentities("No")).'": function() {
var options = "&token='.urlencode(newToken()).'"; var options = "&token='.urlencode(newToken()).'";
var inputko = '.json_encode($inputko).'; var inputko = '.json_encode($inputko).'; /* List of fields into form */
var pageno="'.dol_escape_js(!empty($pageno) ? $pageno : '').'"; var pageno="'.dol_escape_js(!empty($pageno) ? $pageno : '').'";
if (inputko.length>0) { if (inputko.length>0) {
$.each(inputko, function(i, inputname) { $.each(inputko, function(i, inputname) {

View File

@ -203,7 +203,7 @@ class FormActions
if ($typeelement == 'project') $projectid = $object->id; if ($typeelement == 'project') $projectid = $object->id;
$newcardbutton = ''; $newcardbutton = '';
if (!empty($conf->agenda->enabled)) if (!empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create))
{ {
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage)); $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage));
} }

View File

@ -76,7 +76,7 @@ class FormFile
* @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files * @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files
* @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM) * @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM)
* @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*') * @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*')
* @param string $sectiondir If upload must be done inside a particular directory (is sectiondir defined, sectionid must not be) * @param string $sectiondir If upload must be done inside a particular directory (if sectiondir defined, sectionid must not be)
* @param int $usewithoutform 0=Default, 1=Disable <form> and style to use in existing area * @param int $usewithoutform 0=Default, 1=Disable <form> and style to use in existing area
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -108,8 +108,6 @@ class FormFile
return 1; return 1;
} }
$maxlength = $size;
$out = "\n\n".'<!-- Start form attach new file --><div class="formattachnewfile">'."\n"; $out = "\n\n".'<!-- Start form attach new file --><div class="formattachnewfile">'."\n";
if (empty($title)) $title = $langs->trans("AttachANewFile"); if (empty($title)) $title = $langs->trans("AttachANewFile");
@ -174,6 +172,10 @@ class FormFile
$out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""'); $out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""');
$out .= '>'; $out .= '>';
$out .= ' '; $out .= ' ';
if ($sectionid) { // Show overwrite if exists for ECM module only
$langs->load('link');
$out .= '<input style="margin-right: 2px;" type="checkbox" id="overwritefile" name="overwritefile" value="1"><label for="overwritefile">'.$langs->trans("OverwriteIfExists").'</label>';
}
$out .= '<input type="submit" class="button reposition" name="sendit" value="'.$langs->trans("Upload").'"'; $out .= '<input type="submit" class="button reposition" name="sendit" value="'.$langs->trans("Upload").'"';
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''); $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
$out .= '>'; $out .= '>';
@ -731,7 +733,9 @@ class FormFile
$arraykeys = array_keys($modellist); $arraykeys = array_keys($modellist);
$modelselected = $arraykeys[0]; $modelselected = $arraykeys[0];
} }
$out .= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100'); $morecss = 'maxwidth200';
if ($conf->browser->layout == 'phone') $morecss = 'maxwidth100';
$out .= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss);
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
$out .= ajax_combobox('model'); $out .= ajax_combobox('model');
@ -869,7 +873,7 @@ class FormFile
if ($printer) if ($printer)
{ {
//$out.= '<td class="right">'; //$out.= '<td class="right">';
$out .= '<a class="paddingleft" href="'.$urlsource.(strpos($urlsource, '?') ? '&amp;' : '?').'action=print_file&amp;printer='.$modulepart.'&amp;file='.urlencode($relativepath); $out .= '<a class="marginleftonly" href="'.$urlsource.(strpos($urlsource, '?') ? '&amp;' : '?').'action=print_file&amp;printer='.$modulepart.'&amp;file='.urlencode($relativepath);
$out .= ($param ? '&amp;'.$param : ''); $out .= ($param ? '&amp;'.$param : '');
$out .= '">'.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').'</a>'; $out .= '">'.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').'</a>';
} }
@ -990,7 +994,7 @@ class FormFile
{ {
$out = '<dl class="dropdown inline-block"> $out = '<dl class="dropdown inline-block">
<dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight', '', 0, 0, 0, '', 'valignmiddle').'</a></dt> <dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight', '', 0, 0, 0, '', 'valignmiddle').'</a></dt>
<dd><div class="multichoicedoc" style="position:absolute;left:100px;" ><ul class="ulselectedfields" style="display: none;">'; <dd><div class="multichoicedoc" style="position:absolute;left:100px;" ><ul class="ulselectedfields">';
$tmpout = ''; $tmpout = '';
// Loop on each file found // Loop on each file found
@ -1297,7 +1301,7 @@ class FormFile
{ {
$fileinfo = pathinfo($file['name']); $fileinfo = pathinfo($file['name']);
print '<td class="center">'; print '<td class="center">';
if (image_format_supported($file['name']) > 0) if (image_format_supported($file['name']) >= 0)
{ {
if ($useinecm == 5 || $useinecm == 6) if ($useinecm == 5 || $useinecm == 6)
{ {

View File

@ -1598,15 +1598,20 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
$formmail->add_attached_files($destfull, $destfile, $TFile['type'][$i]); $formmail->add_attached_files($destfull, $destfile, $TFile['type'][$i]);
} }
// Update table of files // Update index table of files (llx_ecm_files)
if ($donotupdatesession == 1) if ($donotupdatesession == 1)
{ {
$result = addFileIntoDatabaseIndex($upload_dir, basename($destfile), $TFile['name'][$i], 'uploaded', 0); $result = addFileIntoDatabaseIndex($upload_dir, basename($destfile), $TFile['name'][$i], 'uploaded', 0);
if ($result < 0) if ($result < 0)
{ {
if ($allowoverwrite) {
// Do not show error message. We can have an error due to DB_ERROR_RECORD_ALREADY_EXISTS
}
else {
setEventMessages('FailedToAddFileIntoDatabaseIndex', '', 'warnings'); setEventMessages('FailedToAddFileIntoDatabaseIndex', '', 'warnings');
} }
} }
}
$nbok++; $nbok++;
} }
@ -1760,7 +1765,6 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo
return $result; return $result;
} }
/** /**
* Delete files into database index using search criterias. * Delete files into database index using search criterias.
* *

View File

@ -3147,15 +3147,17 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'object_accounting', 'object_action', 'object_account', 'object_barcode', 'object_bom', 'object_accounting', 'object_action', 'object_account', 'object_barcode', 'object_bom',
'object_category', 'object_bookmark', 'object_bug', 'object_generic', 'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser', 'object_category', 'object_bookmark', 'object_bug', 'object_generic', 'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_dynamicprice', 'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_dynamicprice',
'object_holiday', 'object_hrm', 'object_multicurrency', 'object_payment', 'object_holiday', 'object_hrm', 'object_intervention', 'object_multicurrency', 'object_order', 'object_payment',
'object_lot', 'object_mrp', 'object_product', 'object_service', 'object_stock', 'object_lot', 'object_mrp', 'object_product', 'object_propal', 'object_supplier_proposal', 'object_service', 'object_stock',
'object_paragraph', 'object_printer', 'object_resource', 'object_rss', 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_other', 'object_paragraph', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask',
'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_other',
'object_phoning', 'object_phoning_fax', 'object_email', 'object_phoning', 'object_phoning_fax', 'object_email',
'off', 'on', 'paiment', 'play', 'playdisabled', 'printer', 'product', 'resize', 'service', 'stats', 'trip', 'off', 'on',
'paiment', 'play', 'playdisabled', 'printer', 'product', 'propal', 'resize', 'service', 'stats', 'trip',
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe', 'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe',
'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top',
'home', 'companies', 'products', 'commercial', 'invoicing', 'accountancy', 'preview', 'project', 'hrm', 'members', 'ticket', 'generic', 'home', 'companies', 'products', 'commercial', 'invoicing', 'accountancy', 'preview', 'project', 'projectpub', 'hrm', 'members', 'ticket', 'generic',
'error', 'warning', 'error', 'warning',
'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda' 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda'
) )
@ -3182,16 +3184,19 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'info-circle', 'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'info-circle',
'generic'=>'file', 'holiday'=>'umbrella-beach', 'member'=>'users', 'mrp'=>'cubes', 'trip'=>'wallet', 'group'=>'users', 'generic'=>'file', 'holiday'=>'umbrella-beach', 'member'=>'users', 'mrp'=>'cubes', 'trip'=>'wallet', 'group'=>'users',
'sign-out'=>'sign-out-alt', 'sign-out'=>'sign-out-alt',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star', 'stats' => 'chart-bar', 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star',
'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter', 'split'=>'code-branch', 'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter',
'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table', 'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table',
'multicurrency'=>'dollar-sign', 'other'=>'square', 'resource'=>'laptop-house', 'intervention'=>'ambulance', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice',
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'other'=>'square',
'playdisabled'=>'play', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks', 'propal'=>'file-signature',
'resize'=>'crop', 'supplier_proposal'=>'file-signature',
'payment'=>'money-bill-alt', 'phoning'=>'phone', 'phoning_fax'=>'fax', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell', 'payment'=>'money-bill-alt', 'phoning'=>'phone', 'phoning_fax'=>'fax', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
'stock'=>'box-open', 'technic'=>'cogs', 'ticket'=>'ticket-alt', 'resource'=>'laptop-house',
'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
'title_agenda'=>'calendar-alt', 'title_agenda'=>'calendar-alt',
'playdisabled'=>'play', 'preview'=>'binoculars', 'project'=>'sitemap', 'resize'=>'crop',
'uparrow'=>'mail-forward', 'uparrow'=>'mail-forward',
'jabber'=>'comment-o' 'jabber'=>'comment-o'
); );
@ -3241,15 +3246,18 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
// Add CSS // Add CSS
$arrayconvpictotomorcess = array( $arrayconvpictotomorcess = array(
'action'=>'bg-infoxbox-action', 'account'=>'bg-infoxbox-bank_account', 'bank_account'=>'bg-infoxbox-bank_account', 'cash-register'=>'bg-infoxbox-bank_account', 'action'=>'bg-infobox-action', 'account'=>'bg-infobox-bank_account', 'bank_account'=>'bg-infobox-bank_account', 'cash-register'=>'bg-infobox-bank_account',
'contract'=>'bg-infoxbox-contrat', 'contract'=>'bg-infobox-contrat',
'multicurrency'=>'bg-infoxbox-bank_account', 'multicurrency'=>'bg-infobox-bank_account',
'check'=>'font-status4', 'check'=>'font-status4',
'hrm'=>'bg-infoxbox-adherent', 'group'=>'bg-infoxbox-adherent', 'hrm'=>'bg-infobox-adherent', 'group'=>'bg-infobox-adherent', 'intervention'=>'bg-infobox-contrat',
'members'=>'bg-infoxbox-adherent', 'member'=>'bg-infoxbox-adherent', 'user'=>'bg-infoxbox-adherent', 'users'=>'bg-infoxbox-adherent', 'members'=>'bg-infobox-adherent', 'member'=>'bg-infobox-adherent', 'order'=>'bg-infobox-commande',
'user'=>'bg-infobox-adherent', 'users'=>'bg-infobox-adherent',
'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4', 'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4',
'holiday'=>'bg-infoxbox-holiday', 'payment'=>'bg-infoxbox-bank_account', 'project'=>'bg-infoxbox-project', 'resource'=>'bg-infoxbox-action', 'holiday'=>'bg-infobox-holiday',
'ticket'=>'bg-infoxbox-contrat', 'title_hrm'=>'bg-infoxbox-holiday', 'trip'=>'bg-infoxbox-expensereport', 'title_agenda'=>'bg-infoxbox-action', 'payment'=>'bg-infobox-bank_account', 'project'=>'bg-infobox-project', 'projecttask'=>'bg-infobox-project', 'propal'=>'bg-infobox-propal',
'resource'=>'bg-infobox-action', 'supplier_proposal'=>'bg-infobox-supplier_proposal',
'ticket'=>'bg-infobox-contrat', 'title_hrm'=>'bg-infobox-holiday', 'trip'=>'bg-infobox-expensereport', 'title_agenda'=>'bg-infobox-action',
'list-alt'=>'imgforviewmode', 'calendar'=>'imgforviewmode', 'calendarweek'=>'imgforviewmode', 'calendarmonth'=>'imgforviewmode', 'calendarday'=>'imgforviewmode', 'calendarperuser'=>'imgforviewmode' 'list-alt'=>'imgforviewmode', 'calendar'=>'imgforviewmode', 'calendarweek'=>'imgforviewmode', 'calendarmonth'=>'imgforviewmode', 'calendarday'=>'imgforviewmode', 'calendarperuser'=>'imgforviewmode'
); );
if (!empty($arrayconvpictotomorcess[$pictowithouttext])) { if (!empty($arrayconvpictotomorcess[$pictowithouttext])) {
@ -3263,7 +3271,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'listlight'=>'#999', 'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'listlight'=>'#999',
'lot'=>'#a69944', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944', 'lot'=>'#a69944', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944',
'other'=>'#ddd', 'other'=>'#ddd',
'playdisabled'=>'#ccc', 'printer'=>'#444', 'resize'=>'#444', 'rss'=>'#cba', 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba',
'stats'=>'#444', 'switch_off'=>'#999', 'uparrow'=>'#555', 'warning'=>'' 'stats'=>'#444', 'switch_off'=>'#999', 'uparrow'=>'#555', 'warning'=>''
); );
if (isset($arrayconvpictotocolor[$pictowithouttext])) { if (isset($arrayconvpictotocolor[$pictowithouttext])) {
@ -3349,7 +3357,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
* @param int $srconly Return only content of the src attribute of img. * @param int $srconly Return only content of the src attribute of img.
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
* @return string Return img tag * @return string Return img tag
* @see #img_picto, #img_picto_common * @see img_picto(), img_picto_common()
*/ */
function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0) function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0)
{ {
@ -3365,7 +3373,7 @@ function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false,
* @param int $pictoisfullpath If 1, image path is a full path * @param int $pictoisfullpath If 1, image path is a full path
* @param string $morecss More CSS * @param string $morecss More CSS
* @return string Return img tag * @return string Return img tag
* @see #img_object, #img_picto * @see img_object(), img_picto()
*/ */
function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $morecss = '') function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $morecss = '')
{ {
@ -3392,7 +3400,7 @@ function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $mo
* @param string $moreatt Add more attribute on img tag * @param string $moreatt Add more attribute on img tag
* @param int $pictoisfullpath If 1, image path is a full path * @param int $pictoisfullpath If 1, image path is a full path
* @return string Return img tag * @return string Return img tag
* @see #img_object, #img_picto * @see img_object(), img_picto()
*/ */
function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0) function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0)
{ {

View File

@ -1393,26 +1393,12 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
// Retained warranty // Retained warranty
if (!empty($object->situation_final) && ($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty)))) if ($object->displayRetainedWarranty())
{ {
$displayWarranty = false;
// Check if this situation invoice is 100% for real
if (!empty($object->lines)) {
$displayWarranty = true;
foreach ($object->lines as $i => $line) {
if ($line->product_type < 2 && $line->situation_percent < 100) {
$displayWarranty = false;
break;
}
}
}
if ($displayWarranty) {
$pdf->SetTextColor(40, 40, 40); $pdf->SetTextColor(40, 40, 40);
$pdf->SetFillColor(255, 255, 255); $pdf->SetFillColor(255, 255, 255);
$retainedWarranty = $object->total_ttc * $object->retained_warranty / 100; $retainedWarranty = $object->getRetainedWarrantyAmount();
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty; $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty;
// Billed - retained warranty // Billed - retained warranty
@ -1433,7 +1419,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
}
} }
} }
} }

View File

@ -776,9 +776,9 @@ class pdf_sponge extends ModelePDFFactures
$parameters = array( $parameters = array(
'object' => $object, 'object' => $object,
'i' => $i, 'i' => $i,
'pdf' => &$pdf, 'pdf' =>& $pdf,
'curY' => &$curY, 'curY' =>& $curY,
'nexY' => &$nexY, 'nexY' =>& $nexY,
'outputlangs' => $outputlangs, 'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails 'hidedetails' => $hidedetails
); );
@ -1685,51 +1685,21 @@ class pdf_sponge extends ModelePDFFactures
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
/*if($object->type == Facture::TYPE_SITUATION)
{
// reste à payer total
$index++;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetFillColor(255,255,255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities('SituationTotalRayToRest'), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer_ttc-$deja_regle, 0, $outputlangs), 0, 'R', 1);
}*/
// Retained warranty // Retained warranty
if (!empty($object->situation_final) && ($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty)))) if ($object->displayRetainedWarranty())
{ {
$displayWarranty = false;
// Check if this situation invoice is 100% for real
if (!empty($object->situation_final)) {
$displayWarranty = true;
}
elseif (!empty($object->lines) && $object->status == Facture::STATUS_DRAFT) {
// $object->situation_final need validation to be done so this test is need for draft
$displayWarranty = true;
foreach ($object->lines as $i => $line) {
if ($line->product_type < 2 && $line->situation_percent < 100) {
$displayWarranty = false;
break;
}
}
}
if ($displayWarranty) {
$pdf->SetTextColor(40, 40, 40); $pdf->SetTextColor(40, 40, 40);
$pdf->SetFillColor(255, 255, 255); $pdf->SetFillColor(255, 255, 255);
$retainedWarranty = $total_a_payer_ttc * $object->retained_warranty / 100; $retainedWarranty = $object->getRetainedWarrantyAmount();
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty; $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty;
// Billed - retained warranty // Billed - retained warranty
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFEVOLToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
@ -1738,8 +1708,8 @@ class pdf_sponge extends ModelePDFFactures
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty").' ('.$object->retained_warranty.'%)'; $retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)';
$retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : ''; $retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : '';
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
@ -1747,7 +1717,6 @@ class pdf_sponge extends ModelePDFFactures
} }
} }
} }
}
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);

View File

@ -1,5 +1,7 @@
<?php <?php
print '<!-- extrafields_list_search_input.tpl.php -->'."\n";
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) if (empty($conf) || !is_object($conf))
{ {

View File

@ -251,8 +251,8 @@ $coldisplay++;
<!-- colspan for this td because it replace total_ht+3 td for buttons+... --> <!-- colspan for this td because it replace total_ht+3 td for buttons+... -->
<td class="center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay += $colspan; ?> <td class="center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay += $colspan; ?>
<input type="submit" class="button" id="savelinebutton marginbottomonly" name="save" value="<?php echo $langs->trans("Save"); ?>"><br> <input type="submit" class="button buttongen marginbottomonly" id="savelinebutton marginbottomonly" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
<input type="submit" class="button" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>"> <input type="submit" class="button buttongen marginbottomonly" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
</td> </td>
</tr> </tr>

View File

@ -151,7 +151,7 @@ class InterfaceLogevents extends DolibarrTriggers
} }
// Groupes // Groupes
elseif ($action == 'GROUP_CREATE') elseif ($action == 'USERGROUP_CREATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users"); $langs->load("users");
@ -159,7 +159,7 @@ class InterfaceLogevents extends DolibarrTriggers
$text = $langs->transnoentities("NewGroupCreated", $object->name); $text = $langs->transnoentities("NewGroupCreated", $object->name);
$desc = $langs->transnoentities("NewGroupCreated", $object->name); $desc = $langs->transnoentities("NewGroupCreated", $object->name);
} }
elseif ($action == 'GROUP_MODIFY') elseif ($action == 'USERGROUP_MODIFY')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users"); $langs->load("users");
@ -167,7 +167,7 @@ class InterfaceLogevents extends DolibarrTriggers
$text = $langs->transnoentities("GroupModified", $object->name); $text = $langs->transnoentities("GroupModified", $object->name);
$desc = $langs->transnoentities("GroupModified", $object->name); $desc = $langs->transnoentities("GroupModified", $object->name);
} }
elseif ($action == 'GROUP_DELETE') elseif ($action == 'USERGROUP_DELETE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users"); $langs->load("users");

View File

@ -269,7 +269,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
} }
// Groupes // Groupes
elseif ($action == 'GROUP_CREATE') elseif ($action == 'USERGROUP_CREATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
@ -293,7 +293,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
} }
} }
elseif ($action == 'GROUP_MODIFY') elseif ($action == 'USERGROUP_MODIFY')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
@ -330,7 +330,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
} }
} }
elseif ($action == 'GROUP_DELETE') elseif ($action == 'USERGROUP_DELETE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')

View File

@ -147,9 +147,9 @@ class InterfaceZapierTriggers extends DolibarrTriggers
break; break;
// Groups // Groups
//case 'GROUP_CREATE': //case 'USERGROUP_CREATE':
//case 'GROUP_MODIFY': //case 'USERGROUP_MODIFY':
//case 'GROUP_DELETE': //case 'USERGROUP_DELETE':
// Companies // Companies
case 'COMPANY_CREATE': case 'COMPANY_CREATE':

View File

@ -825,7 +825,7 @@ if ($action == 'create')
$soc = new Societe($db); $soc = new Societe($db);
print load_fiche_titre($langs->trans("AddIntervention"), '', 'title_commercial'); print load_fiche_titre($langs->trans("AddIntervention"), '', 'commercial');
dol_htmloutput_mesg($mesg); dol_htmloutput_mesg($mesg);
@ -1395,7 +1395,6 @@ elseif ($id > 0 || !empty($ref))
print '<td class="liste_titre right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans('Duration') : '').'</td>'; print '<td class="liste_titre right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans('Duration') : '').'</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
} }
while ($i < $num) while ($i < $num)
@ -1420,16 +1419,14 @@ elseif ($id > 0 || !empty($ref))
print "</td>\n"; print "</td>\n";
// Icone d'edition et suppression // Econ to edit and delete
if ($object->statut == 0 && $user->rights->ficheinter->creer) if ($object->statut == 0 && $user->rights->ficheinter->creer)
{ {
print '<td class="center">'; print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=editline&amp;line_id='.$objp->rowid.'#'.$objp->rowid.'">'; print '<a class="editfielda marginrightonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=editline&amp;line_id='.$objp->rowid.'#'.$objp->rowid.'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';
print '</td>'; print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=ask_deleteline&amp;line_id='.$objp->rowid.'">';
print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=ask_deleteline&amp;line_id='.$objp->rowid.'">';
print img_delete(); print img_delete();
print '</a></td>'; print '</a></td>';
print '<td class="center">'; print '<td class="center">';
@ -1437,13 +1434,13 @@ elseif ($id > 0 || !empty($ref))
{ {
if ($i > 0) if ($i > 0)
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=up&amp;line_id='.$objp->rowid.'">'; print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=up&amp;line_id='.$objp->rowid.'">';
print img_up(); print img_up();
print '</a>'; print '</a>';
} }
if ($i < $num - 1) if ($i < $num - 1)
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=down&amp;line_id='.$objp->rowid.'">'; print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=down&amp;line_id='.$objp->rowid.'">';
print img_down(); print img_down();
print '</a>'; print '</a>';
} }
@ -1452,7 +1449,7 @@ elseif ($id > 0 || !empty($ref))
} }
else else
{ {
print '<td colspan="3">&nbsp;</td>'; print '<td colspan="2">&nbsp;</td>';
} }
print '</tr>'; print '</tr>';
@ -1470,7 +1467,7 @@ elseif ($id > 0 || !empty($ref))
// Line in update mode // Line in update mode
if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id', 'int') == $objp->rowid) if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id', 'int') == $objp->rowid)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven nohover">';
print '<td>'; print '<td>';
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
@ -1499,8 +1496,9 @@ elseif ($id > 0 || !empty($ref))
} }
print '</td>'; print '</td>';
print '<td class="center" colspan="5" valign="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">'; print '<td class="center" colspan="5" valign="center">';
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td>'; print '<input type="submit" class="button buttongen marginbottomonly" name="save" value="'.$langs->trans("Save").'">';
print '<input type="submit" class="button buttongen marginbottomonly" name="cancel" value="'.$langs->trans("Cancel").'"></td>';
print '</tr>'."\n"; print '</tr>'."\n";
$line = new FichinterLigne($db); $line = new FichinterLigne($db);
@ -1534,7 +1532,7 @@ elseif ($id > 0 || !empty($ref))
print "</tr>\n"; print "</tr>\n";
} }
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven nohover">'."\n";
print '<td>'; print '<td>';
// editeur wysiwyg // editeur wysiwyg
if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) { if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {

View File

@ -729,7 +729,7 @@ class Fichinter extends CommonObject
*/ */
public function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->statut, $mode); return $this->LibStatut((isset($this->statut) ? $this->statut : $this->status), $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -783,7 +783,7 @@ class Fichinter extends CommonObject
$label = '<u>'.$langs->trans("ShowIntervention").'</u>'; $label = '<u>'.$langs->trans("ShowIntervention").'</u>';
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (isset($this->statut)) { if (isset($this->status)) {
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5); $label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
} }

View File

@ -57,11 +57,12 @@ if ($user->socid > 0)
$fichinterstatic = new Fichinter($db); $fichinterstatic = new Fichinter($db);
$form = new Form($db); $form = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$help_url = "EN:ModuleFichinters|FR:Module_Fiche_Interventions|ES:Módulo_FichaInterventiones"; $help_url = "EN:ModuleFichinters|FR:Module_Fiche_Interventions|ES:Módulo_FichaInterventiones";
llxHeader("", $langs->trans("Interventions"), $help_url); llxHeader("", $langs->trans("Interventions"), $help_url);
print load_fiche_titre($langs->trans("InterventionsArea")); print load_fiche_titre($langs->trans("InterventionsArea"), '', 'commercial');
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';

View File

@ -202,7 +202,7 @@ foreach ($arrayfields as $tmpkey => $tmpval)
} }
$sql = "SELECT"; $sql = "SELECT";
$sql .= " f.ref, f.rowid, f.fk_statut, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,"; $sql .= " f.ref, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,";
if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= "fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= "fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
$sql .= " s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus"; $sql .= " s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus";
if (!empty($conf->projet->enabled)) { if (!empty($conf->projet->enabled)) {
@ -249,7 +249,7 @@ if ($search_desc) {
else $sql .= natural_search(array('f.description'), $search_desc); else $sql .= natural_search(array('f.description'), $search_desc);
} }
if ($search_status != '' && $search_status >= 0) { if ($search_status != '' && $search_status >= 0) {
$sql .= ' AND f.fk_statut = '.$search_status; $sql .= ' AND f.fk_statut = '.urlencode($search_status);
} }
if (!$user->rights->societe->client->voir && empty($socid)) if (!$user->rights->societe->client->voir && empty($socid))
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
@ -476,7 +476,8 @@ if ($resql)
$objectstatic->id = $obj->rowid; $objectstatic->id = $obj->rowid;
$objectstatic->ref = $obj->ref; $objectstatic->ref = $obj->ref;
$objectstatic->statut = $obj->fk_statut; $objectstatic->statut = $obj->status;
$objectstatic->status = $obj->status;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
@ -587,7 +588,7 @@ if ($resql)
// Status // Status
if (!empty($arrayfields['f.fk_statut']['checked'])) if (!empty($arrayfields['f.fk_statut']['checked']))
{ {
print '<td class="right">'.$objectstatic->LibStatut($obj->fk_statut, 5).'</td>'; print '<td class="right">'.$objectstatic->getLibStatut(5).'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Fields of detail of line // Fields of detail of line

View File

@ -1057,7 +1057,8 @@ class ProductFournisseur extends Product
$label = '<u>'.$langs->trans("SupplierRef").'</u>'; $label = '<u>'.$langs->trans("SupplierRef").'</u>';
$label .= '<br>'; $label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref_supplier; $label .= '<b>'.$langs->trans('Product').':</b> '.$this->ref;
$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_supplier;
$logPrices = $this->listProductFournisseurPriceLog($this->product_fourn_price_id, 'pfpl.datec', 'DESC'); // set sort order here $logPrices = $this->listProductFournisseurPriceLog($this->product_fourn_price_id, 'pfpl.datec', 'DESC'); // set sort order here
if (is_array($logPrices) && count($logPrices) > 0) { if (is_array($logPrices) && count($logPrices) > 0) {
@ -1095,7 +1096,7 @@ class ProductFournisseur extends Product
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
if ($withpicto != 2) $result .= $this->fourn_ref; if ($withpicto != 2) $result .= $this->ref.($this->ref_supplier ? ' ('.$this->ref_supplier.')' : '');
$result .= $linkend; $result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');

View File

@ -121,6 +121,7 @@
-webkit-clip-path: inset(50%) !important; -webkit-clip-path: inset(50%) !important;
clip-path: inset(50%) !important; clip-path: inset(50%) !important;
height: 1px !important; height: 1px !important;
margin: -1px !important;
overflow: hidden !important; overflow: hidden !important;
padding: 0 !important; padding: 0 !important;
position: absolute !important; position: absolute !important;

View File

@ -1,56 +0,0 @@
define([
'jquery',
'./utils'
], function ($, CompatUtils) {
// No-op CSS adapter that discards all classes by default
function _containerAdapter (clazz) {
return null;
}
function ContainerCSS () { }
ContainerCSS.prototype.render = function (decorated) {
var $container = decorated.call(this);
var containerCssClass = this.options.get('containerCssClass') || '';
if ($.isFunction(containerCssClass)) {
containerCssClass = containerCssClass(this.$element);
}
var containerCssAdapter = this.options.get('adaptContainerCssClass');
containerCssAdapter = containerCssAdapter || _containerAdapter;
if (containerCssClass.indexOf(':all:') !== -1) {
containerCssClass = containerCssClass.replace(':all:', '');
var _cssAdapter = containerCssAdapter;
containerCssAdapter = function (clazz) {
var adapted = _cssAdapter(clazz);
if (adapted != null) {
// Append the old one along with the adapted one
return adapted + ' ' + clazz;
}
return clazz;
};
}
var containerCss = this.options.get('containerCss') || {};
if ($.isFunction(containerCss)) {
containerCss = containerCss(this.$element);
}
CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter);
$container.css(containerCss);
$container.addClass(containerCssClass);
return $container;
};
return ContainerCSS;
});

View File

@ -1,32 +0,0 @@
{
"name": "select2",
"title": "Select2",
"description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.",
"keywords": [
"select",
"autocomplete",
"typeahead",
"dropdown",
"multiselect",
"tag",
"tagging"
],
"version": "4.0.4",
"author": {
"name": "Kevin Brown",
"url": "https://github.com/kevin-brown"
},
"licenses": [
{
"type": "MIT",
"url": "http://opensource.org/licenses/MIT"
}
],
"bugs": "https://github.com/select2/select2/issues",
"homepage": "https://select2.org",
"docs": "https://select2.org",
"download": "https://github.com/select2/select2/releases",
"dependencies": {
"jquery": ">=1.7.2"
}
}

View File

@ -152,16 +152,17 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
// Class file containing the method load_state_board for each line // Class file containing the method load_state_board for each line
$includes = array( $includes = array(
DOL_DOCUMENT_ROOT."/user/class/user.class.php", DOL_DOCUMENT_ROOT."/user/class/user.class.php",
DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
DOL_DOCUMENT_ROOT."/societe/class/client.class.php", DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
DOL_DOCUMENT_ROOT."/societe/class/client.class.php", DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php",
DOL_DOCUMENT_ROOT."/contact/class/contact.class.php", DOL_DOCUMENT_ROOT."/contact/class/contact.class.php",
DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
DOL_DOCUMENT_ROOT."/product/class/product.class.php", DOL_DOCUMENT_ROOT."/product/class/product.class.php",
DOL_DOCUMENT_ROOT."/product/class/product.class.php", DOL_DOCUMENT_ROOT."/product/class/product.class.php",
DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php", DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php",
DOL_DOCUMENT_ROOT."/commande/class/commande.class.php", DOL_DOCUMENT_ROOT."/commande/class/commande.class.php",
DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php", DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",
DOL_DOCUMENT_ROOT."/don/class/don.class.php",
DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php", DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
@ -170,21 +171,22 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
DOL_DOCUMENT_ROOT."/projet/class/project.class.php", DOL_DOCUMENT_ROOT."/projet/class/project.class.php",
DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php",
DOL_DOCUMENT_ROOT."/holiday/class/holiday.class.php", DOL_DOCUMENT_ROOT."/holiday/class/holiday.class.php",
DOL_DOCUMENT_ROOT."/don/class/don.class.php",
DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php" DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"
); );
// Name class containing the method load_state_board for each line // Name class containing the method load_state_board for each line
$classes = array('User', $classes = array(
'User',
'Adherent',
'Client', 'Client',
'Client', 'Client',
'Fournisseur', 'Fournisseur',
'Contact', 'Contact',
'Adherent',
'Product', 'Product',
'Product', 'Product',
'Propal', 'Propal',
'Commande', 'Commande',
'Facture', 'Facture',
'Don',
'Contrat', 'Contrat',
'Fichinter', 'Fichinter',
'CommandeFournisseur', 'CommandeFournisseur',
@ -193,21 +195,22 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
'Project', 'Project',
'ExpenseReport', 'ExpenseReport',
'Holiday', 'Holiday',
'Don',
'Ticket', 'Ticket',
); );
// Cle array returned by the method load_state_board for each line // Cle array returned by the method load_state_board for each line
$keys = array('users', $keys = array(
'users',
'members',
'customers', 'customers',
'prospects', 'prospects',
'suppliers', 'suppliers',
'contacts', 'contacts',
'members',
'products', 'products',
'services', 'services',
'proposals', 'proposals',
'orders', 'orders',
'invoices', 'invoices',
'donations',
'contracts', 'contracts',
'interventions', 'interventions',
'supplier_orders', 'supplier_orders',
@ -216,44 +219,46 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
'projects', 'projects',
'expensereports', 'expensereports',
'holidays', 'holidays',
'donations',
'ticket' 'ticket'
); );
// Dashboard Icon lines // Dashboard Icon lines
$icons = array('user', $icons = array(
'user',
'user',
'company', 'company',
'company', 'company',
'company', 'company',
'contact', 'contact',
'user',
'product', 'product',
'service', 'service',
'propal', 'propal',
'order', 'order',
'bill', 'bill',
'generic',
'contract', 'contract',
'intervention', 'intervention',
'order', 'order',
'bill', 'bill',
'propal', 'propal',
'projectpub', 'project',
'trip', 'trip',
'holiday', 'holiday',
'generic',
'ticket', 'ticket',
); );
// Translation keyword // Translation keyword
$titres = array("Users", $titres = array(
"Users",
"Members",
"ThirdPartyCustomersStats", "ThirdPartyCustomersStats",
"ThirdPartyProspectsStats", "ThirdPartyProspectsStats",
"Suppliers", "Suppliers",
"Contacts", "Contacts",
"Members",
"Products", "Products",
"Services", "Services",
"CommercialProposalsShort", "CommercialProposalsShort",
"CustomersOrders", "CustomersOrders",
"BillsCustomers", "BillsCustomers",
"Donations",
"Contracts", "Contracts",
"Interventions", "Interventions",
"SuppliersOrders", "SuppliersOrders",
@ -262,23 +267,22 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
"Projects", "Projects",
"ExpenseReports", "ExpenseReports",
"Holidays", "Holidays",
"Donations",
"Ticket", "Ticket",
); );
// Dashboard Link lines // Dashboard Link lines
$links = array( $links = array(
DOL_URL_ROOT.'/user/list.php', DOL_URL_ROOT.'/user/list.php',
DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members',
DOL_URL_ROOT.'/societe/list.php?type=c&mainmenu=companies', DOL_URL_ROOT.'/societe/list.php?type=c&mainmenu=companies',
DOL_URL_ROOT.'/societe/list.php?type=p&mainmenu=companies', DOL_URL_ROOT.'/societe/list.php?type=p&mainmenu=companies',
DOL_URL_ROOT.'/societe/list.php?type=f&mainmenu=companies', DOL_URL_ROOT.'/societe/list.php?type=f&mainmenu=companies',
DOL_URL_ROOT.'/contact/list.php?mainmenu=companies', DOL_URL_ROOT.'/contact/list.php?mainmenu=companies',
DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members',
DOL_URL_ROOT.'/adherents/list.php?statut=-1&mainmenu=members',
DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products', DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products',
DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products', DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products',
DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals', DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals',
DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial&leftmenu=orders', DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial&leftmenu=orders',
DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills',
DOL_URL_ROOT.'/don/list.php?leftmenu=donations',
DOL_URL_ROOT.'/contrat/list.php?mainmenu=commercial&leftmenu=contracts', DOL_URL_ROOT.'/contrat/list.php?mainmenu=commercial&leftmenu=contracts',
DOL_URL_ROOT.'/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter', DOL_URL_ROOT.'/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter',
DOL_URL_ROOT.'/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers', DOL_URL_ROOT.'/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers',
@ -287,22 +291,22 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
DOL_URL_ROOT.'/projet/list.php?mainmenu=project', DOL_URL_ROOT.'/projet/list.php?mainmenu=project',
DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport', DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport',
DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&leftmenu=holiday', DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&leftmenu=holiday',
DOL_URL_ROOT.'/don/list.php?leftmenu=donations',
DOL_URL_ROOT.'/ticket/list.php?leftmenu=ticket' DOL_URL_ROOT.'/ticket/list.php?leftmenu=ticket'
); );
// Translation lang files // Translation lang files
$langfile = array( $langfile = array(
"users", "users",
"members",
"companies", "companies",
"prospects", "prospects",
"suppliers", "suppliers",
"companies", "companies",
"members",
"products", "products",
"products", "products",
"propal", "propal",
"orders", "orders",
"bills", "bills",
"donations",
"contracts", "contracts",
"interventions", "interventions",
"bills", "bills",
@ -311,7 +315,6 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
"projects", "projects",
"trips", "trips",
"holiday", "holiday",
"donations",
"ticket" "ticket"
); );
@ -721,7 +724,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$openedDashBoard .= '<div class="box-flex-item">'."\n"; $openedDashBoard .= '<div class="box-flex-item">'."\n";
$openedDashBoard .= ' <div class="info-box '.$openedDashBoardSize.'">'."\n"; $openedDashBoard .= ' <div class="info-box '.$openedDashBoardSize.'">'."\n";
$openedDashBoard .= ' <span class="info-box-icon bg-infoxbox-'.$groupKeyLowerCase.'">'."\n"; $openedDashBoard .= ' <span class="info-box-icon bg-infobox-'.$groupKeyLowerCase.'">'."\n";
$openedDashBoard .= ' <i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n"; $openedDashBoard .= ' <i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n";
// Show the span for the total of record // Show the span for the total of record
@ -923,6 +926,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
} }
if (!empty($boxstatFromHook) || !empty($boxstatItems)) { if (!empty($boxstatFromHook) || !empty($boxstatItems)) {
$boxstat .= '<!-- Database statistics -->'."\n";
$boxstat .= '<div class="box">'; $boxstat .= '<div class="box">';
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">'; $boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">';
$boxstat .= '<tr class="liste_titre">'; $boxstat .= '<tr class="liste_titre">';

View File

@ -557,7 +557,7 @@ else
} }
if ($disabled) if ($disabled)
{ {
$choice .= '<span class="button">'.$langs->trans("NotYetAvailable").'</span>'; $choice .= '<span class="opacitymedium">'.$langs->trans("NotYetAvailable").'</span>';
} }
else else
{ {

View File

@ -45,6 +45,11 @@ UPDATE llx_accounting_system SET fk_country = NULL, active = 0 WHERE pcg_version
-- For v12 -- For v12
-- Delete an old index that is duplicated
-- VMYSQL4.1 DROP INDEX ix_fk_product_stock on llx_product_batch;
-- VPGSQL8.2 DROP INDEX ix_fk_product_stock
DELETE FROM llx_menu where module='supplier_proposal'; DELETE FROM llx_menu where module='supplier_proposal';
UPDATE llx_website SET lang = 'en' WHERE lang like 'en_%'; UPDATE llx_website SET lang = 'en' WHERE lang like 'en_%';
@ -200,6 +205,8 @@ DELETE FROM llx_const WHERE name = __ENCRYPT('DONATION_ART885')__;
ALTER TABLE llx_extrafields MODIFY COLUMN printable integer DEFAULT 0; ALTER TABLE llx_extrafields MODIFY COLUMN printable integer DEFAULT 0;
ALTER TABLE llx_extrafields ADD COLUMN printable integer DEFAULT 0; ALTER TABLE llx_extrafields ADD COLUMN printable integer DEFAULT 0;
UPDATE llx_const SET name = 'INVOICE_USE_RETAINED_WARRANTY' WHERE name = 'INVOICE_USE_SITUATION_RETAINED_WARRANTY';
ALTER TABLE llx_accounting_account DROP COLUMN pcg_subtype; ALTER TABLE llx_accounting_account DROP COLUMN pcg_subtype;
ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_intra varchar(32) AFTER accountancy_code_buy; ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_intra varchar(32) AFTER accountancy_code_buy;
@ -241,3 +248,5 @@ ALTER TABLE llx_categorie ADD COLUMN date_creation datetime;
ALTER TABLE llx_categorie ADD COLUMN tms timestamp; ALTER TABLE llx_categorie ADD COLUMN tms timestamp;
ALTER TABLE llx_categorie ADD COLUMN fk_user_creat integer; ALTER TABLE llx_categorie ADD COLUMN fk_user_creat integer;
ALTER TABLE llx_categorie ADD COLUMN fk_user_modif integer; ALTER TABLE llx_categorie ADD COLUMN fk_user_modif integer;
ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commandefourndet FOREIGN KEY (fk_commandefourndet) REFERENCES llx_commande_fournisseurdet (rowid);

View File

@ -216,10 +216,6 @@ ALTER TABLE llx_expeditiondet_batch ADD INDEX idx_fk_expeditiondet (fk_expeditio
ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid); ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid);
ALTER TABLE llx_product_batch ADD INDEX ix_fk_product_stock (fk_product_stock);
ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid);
-- New 1074 : Stock mouvement link to origin -- New 1074 : Stock mouvement link to origin
ALTER TABLE llx_stock_mouvement ADD fk_origin integer; ALTER TABLE llx_stock_mouvement ADD fk_origin integer;
ALTER TABLE llx_stock_mouvement ADD origintype VARCHAR(32); ALTER TABLE llx_stock_mouvement ADD origintype VARCHAR(32);

View File

@ -25,3 +25,8 @@ ALTER TABLE llx_commandedet ADD INDEX idx_commandedet_fk_product (fk_product);
ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid); ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commande FOREIGN KEY (fk_commande) REFERENCES llx_commande (rowid); ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commande FOREIGN KEY (fk_commande) REFERENCES llx_commande (rowid);
ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commandefourndet FOREIGN KEY (fk_commandefourndet) REFERENCES llx_commande_fournisseurdet (rowid);
--ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_multicurrency FOREIGN KEY (fk_multicurrency) REFERENCES llx_multicurrency (rowid);
--ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_product_fournisseur_price FOREIGN KEY (fk_product_fournisseur_price) REFERENCES llx_product_fournisseur_price (rowid);
--ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_remise_except FOREIGN KEY (fk_remise_except) REFERENCES llx_societe_remise_except (rowid);

View File

@ -219,7 +219,10 @@ ShowInvoiceSituation=Show situation invoice
UseSituationInvoices=Allow situation invoice UseSituationInvoices=Allow situation invoice
UseSituationInvoicesCreditNote=Allow situation invoice credit note UseSituationInvoicesCreditNote=Allow situation invoice credit note
Retainedwarranty=Retained warranty Retainedwarranty=Retained warranty
AllowedInvoiceForRetainedWarranty=Retained warranty usable on the following types of invoices
RetainedwarrantyDefaultPercent=Retained warranty default percent RetainedwarrantyDefaultPercent=Retained warranty default percent
RetainedwarrantyOnlyForSituation=Make "retained warranty" available only for situation invoices
RetainedwarrantyOnlyForSituationFinal=On situation invoices the global "retained warranty" deduction is applied only on the final situation
ToPayOn=To pay on %s ToPayOn=To pay on %s
toPayOn=to pay on %s toPayOn=to pay on %s
RetainedWarranty=Retained Warranty RetainedWarranty=Retained Warranty

View File

@ -446,6 +446,7 @@ SaleRepresentativeFirstname=First name of sales representative
SaleRepresentativeLastname=Last name of sales representative SaleRepresentativeLastname=Last name of sales representative
ErrorThirdpartiesMerge=There was an error when deleting the third parties. Please check the log. Changes have been reverted. ErrorThirdpartiesMerge=There was an error when deleting the third parties. Please check the log. Changes have been reverted.
NewCustomerSupplierCodeProposed=Customer or Vendor code already used, a new code is suggested NewCustomerSupplierCodeProposed=Customer or Vendor code already used, a new code is suggested
KeepEmptyIfGenericAddress=Keep this field empty if this address is a generic address
#Imports #Imports
PaymentTypeCustomer=Payment Type - Customer PaymentTypeCustomer=Payment Type - Customer
PaymentTermsCustomer=Payment Terms - Customer PaymentTermsCustomer=Payment Terms - Customer

View File

@ -8,3 +8,4 @@ LinkRemoved=The link %s has been removed
ErrorFailedToDeleteLink= Failed to remove link '<b>%s</b>' ErrorFailedToDeleteLink= Failed to remove link '<b>%s</b>'
ErrorFailedToUpdateLink= Failed to update link '<b>%s</b>' ErrorFailedToUpdateLink= Failed to update link '<b>%s</b>'
URLToLink=URL to link URLToLink=URL to link
OverwriteIfExists=Overwrite file if exists

View File

@ -118,9 +118,9 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
//case 'ACTION_DELETE': //case 'ACTION_DELETE':
// Groups // Groups
//case 'GROUP_CREATE': //case 'USERGROUP_CREATE':
//case 'GROUP_MODIFY': //case 'USERGROUP_MODIFY':
//case 'GROUP_DELETE': //case 'USERGROUP_DELETE':
// Companies // Companies
//case 'COMPANY_CREATE': //case 'COMPANY_CREATE':

View File

@ -100,11 +100,6 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view';
// Load object // Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
$permissiontoread = $user->rights->mymodule->myobject->read; $permissiontoread = $user->rights->mymodule->myobject->read;
$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
@ -113,6 +108,14 @@ $permissionnote = $user->rights->mymodule->myobject->write; // Used by the inclu
$permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php $permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1]; $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1];
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
//if (!$permissiontoread) accessforbidden();
/* /*
* Actions * Actions

View File

@ -107,16 +107,6 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
if (!$sortorder) $sortorder = "ASC"; if (!$sortorder) $sortorder = "ASC";
// Security check
if (empty($conf->mymodule->enabled)) accessforbidden('Module not enabled');
$socid = 0;
if ($user->socid > 0) // Protection if external user
{
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'mymodule', $id, '');
// Initialize array of search criterias // Initialize array of search criterias
$search_all = trim(GETPOST("search_all", 'alpha')); $search_all = trim(GETPOST("search_all", 'alpha'));
$search = array(); $search = array();
@ -161,6 +151,18 @@ $permissiontoread = $user->rights->mymodule->myobject->read;
$permissiontoadd = $user->rights->mymodule->myobject->write; $permissiontoadd = $user->rights->mymodule->myobject->write;
$permissiontodelete = $user->rights->mymodule->myobject->delete; $permissiontodelete = $user->rights->mymodule->myobject->delete;
// Security check
if (empty($conf->mymodule->enabled)) accessforbidden('Module not enabled');
$socid = 0;
if ($user->socid > 0) // Protection if external user
{
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'mymodule', $id, '');
//if (!$permissiontoread) accessforbidden();
/* /*
* Actions * Actions

View File

@ -4734,7 +4734,7 @@ class Product extends CommonObject
$op[1] = "-".trim($nbpiece); $op[1] = "-".trim($nbpiece);
$movementstock = new MouvementStock($this->db); $movementstock = new MouvementStock($this->db);
$movementstock->setOrigin($origin_element, $origin_id); $movementstock->setOrigin($origin_element, $origin_id); // Set ->origin and ->origin->id
$result = $movementstock->_create($user, $this->id, $id_entrepot, $op[$movement], $movement, $price, $label, $inventorycode); $result = $movementstock->_create($user, $this->id, $id_entrepot, $op[$movement], $movement, $price, $label, $inventorycode);
if ($result >= 0) { if ($result >= 0) {

View File

@ -142,7 +142,7 @@ class MouvementStock extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
$langs->load("errors");
$error = 0; $error = 0;
dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".$skip_batch); dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".$skip_batch);
@ -408,13 +408,13 @@ class MouvementStock extends CommonObject
$sql .= " ".($batch ? "'".$batch."'" : "null").", "; $sql .= " ".($batch ? "'".$batch."'" : "null").", ";
$sql .= " ".($eatby ? "'".$this->db->idate($eatby)."'" : "null").", "; $sql .= " ".($eatby ? "'".$this->db->idate($eatby)."'" : "null").", ";
$sql .= " ".($sellby ? "'".$this->db->idate($sellby)."'" : "null").", "; $sql .= " ".($sellby ? "'".$this->db->idate($sellby)."'" : "null").", ";
$sql .= " ".$this->entrepot_id.", ".$this->qty.", ".$this->type.","; $sql .= " ".$this->entrepot_id.", ".$this->qty.", ".((int) $this->type).",";
$sql .= " ".$user->id.","; $sql .= " ".$user->id.",";
$sql .= " '".$this->db->escape($label)."',"; $sql .= " '".$this->db->escape($label)."',";
$sql .= " ".($inventorycode ? "'".$this->db->escape($inventorycode)."'" : "null").","; $sql .= " ".($inventorycode ? "'".$this->db->escape($inventorycode)."'" : "null").",";
$sql .= " '".price2num($price)."',"; $sql .= " ".price2num($price).",";
$sql .= " '".$fk_origin."',"; $sql .= " ".$fk_origin.",";
$sql .= " '".$origintype."',"; $sql .= " '".$this->db->escape($origintype)."',";
$sql .= " ".$fk_project; $sql .= " ".$fk_project;
$sql .= ")"; $sql .= ")";
@ -438,7 +438,7 @@ class MouvementStock extends CommonObject
$oldpmp = $product->pmp; $oldpmp = $product->pmp;
$oldqtywarehouse = 0; $oldqtywarehouse = 0;
// Test if there is already a record for couple (warehouse / product) // Test if there is already a record for couple (warehouse / product), so later we will make an update or create.
$alreadyarecord = 0; $alreadyarecord = 0;
if (!$error) if (!$error)
{ {
@ -486,7 +486,7 @@ class MouvementStock extends CommonObject
} }
elseif ($type == 1 || $type == 2) elseif ($type == 1 || $type == 2)
{ {
// After a stock decrease, we don't change value of PMP for product. // After a stock decrease, we don't change value of the AWP/PMP of a product.
$newpmp = $oldpmp; $newpmp = $oldpmp;
} }
else else
@ -543,7 +543,7 @@ class MouvementStock extends CommonObject
// $sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty; // $sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty;
// $sql.= " WHERE rowid = ".$fk_product; // $sql.= " WHERE rowid = ".$fk_product;
// Update pmp + denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql // Update pmp + denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql
$sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET pmp = ".$newpmp.", "; $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET pmp = ".$newpmp.",";
$sql .= " stock=(SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; $sql .= " stock=(SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)";
$sql .= " WHERE rowid = ".$fk_product; $sql .= " WHERE rowid = ".$fk_product;

View File

@ -1046,9 +1046,12 @@ class Project extends CommonObject
$result = ''; $result = '';
$label = ''; $label = '';
if ($option != 'nolink') $label = '<u>'.$langs->trans("ShowProject").'</u>'; if ($option != 'nolink') $label = '<u>'.$langs->trans("Project").'</u>';
$label .= ($label ? '<br>' : '').'<b>'.$langs->trans('Ref').': </b>'.$this->ref; // The space must be after the : to not being explode when showing the title in img_picto $label .= ($label ? '<br>' : '').'<b>'.$langs->trans('Ref').': </b>'.$this->ref; // The space must be after the : to not being explode when showing the title in img_picto
$label .= ($label ? '<br>' : '').'<b>'.$langs->trans('Label').': </b>'.$this->title; // The space must be after the : to not being explode when showing the title in img_picto $label .= ($label ? '<br>' : '').'<b>'.$langs->trans('Label').': </b>'.$this->title; // The space must be after the : to not being explode when showing the title in img_picto
if (isset($this->public)) {
$label .= '<br><b>'.$langs->trans("Visibility").":</b> ".($this->public ? $langs->trans("SharedProject") : $langs->trans("PrivateProject"));
}
if (!empty($this->thirdparty_name)) if (!empty($this->thirdparty_name))
$label .= ($label ? '<br>' : '').'<b>'.$langs->trans('ThirdParty').': </b>'.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto $label .= ($label ? '<br>' : '').'<b>'.$langs->trans('ThirdParty').': </b>'.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto
if (!empty($this->dateo)) if (!empty($this->dateo))

View File

@ -289,7 +289,7 @@ else dol_print_error($db);
if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found
$distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. $distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat"; $sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat";
$sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount, p.usage_opportunity, p.usage_task, p.usage_bill_time"; $sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount, p.usage_opportunity, p.usage_task, p.usage_bill_time";
$sql .= ", s.rowid as socid, s.nom as name, s.email"; $sql .= ", s.rowid as socid, s.nom as name, s.email";
$sql .= ", cls.code as opp_status_code"; $sql .= ", cls.code as opp_status_code";
@ -713,7 +713,9 @@ while ($i < min($num, $limit))
$object->public = $obj->public; $object->public = $obj->public;
$object->ref = $obj->ref; $object->ref = $obj->ref;
$object->datee = $db->jdate($obj->date_end); $object->datee = $db->jdate($obj->date_end);
$object->statut = $obj->fk_statut; $object->statut = $obj->status; // deprecated
$object->status = $obj->status;
$object->public = $obj->public;
$object->opp_status = $obj->fk_opp_status; $object->opp_status = $obj->fk_opp_status;
$object->title = $obj->title; $object->title = $obj->title;

View File

@ -70,7 +70,7 @@ class SupplierProposal extends CommonObject
/** /**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/ */
public $picto = 'propal'; public $picto = 'supplier_proposal';
/** /**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
@ -2225,7 +2225,7 @@ class SupplierProposal extends CommonObject
*/ */
public function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->statut, $mode); return $this->LibStatut((isset($this->statut) ? $this->statut : $this->status), $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -2555,17 +2555,16 @@ class SupplierProposal extends CommonObject
$url = ''; $url = '';
$result = ''; $result = '';
$label = '<u>'.$langs->trans("ShowSupplierProposal").'</u>'; $label = '<u>'.$langs->trans("SupplierProposal").'</u>';
if (!empty($this->ref)) if (!empty($this->ref)) $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; if (!empty($this->ref_fourn)) $label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_fourn;
if (!empty($this->ref_fourn)) if (!empty($this->total_ht)) $label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_fourn; if (!empty($this->total_tva)) $label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (!empty($this->total_ht)) if (!empty($this->total_ttc)) $label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); if (isset($this->status)) {
if (!empty($this->total_tva)) $label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); }
if (!empty($this->total_ttc))
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
if ($option == '') { if ($option == '') {
$url = DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$this->id.$get_params; $url = DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$this->id.$get_params;
} }
@ -2597,8 +2596,6 @@ class SupplierProposal extends CommonObject
$linkstart .= $linkclose.'>'; $linkstart .= $linkclose.'>';
$linkend = '</a>'; $linkend = '</a>';
$picto = 'supplier_proposal';
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); if ($withpicto) $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
if ($withpicto != 2) $result .= $this->ref; if ($withpicto != 2) $result .= $this->ref;

View File

@ -259,7 +259,7 @@ if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= ' sp.rowid, sp.note_private, sp.total_ht, sp.tva as total_vat, sp.total as total_ttc, sp.localtax1, sp.localtax2, sp.ref, sp.fk_statut, sp.fk_user_author, sp.date_valid, sp.date_livraison as dp,'; $sql .= ' sp.rowid, sp.note_private, sp.total_ht, sp.tva as total_vat, sp.total as total_ttc, sp.localtax1, sp.localtax2, sp.ref, sp.fk_statut as status, sp.fk_user_author, sp.date_valid, sp.date_livraison as dp,';
$sql .= ' sp.fk_multicurrency, sp.multicurrency_code, sp.multicurrency_tx, sp.multicurrency_total_ht, sp.multicurrency_total_tva as multicurrency_total_vat, sp.multicurrency_total_ttc,'; $sql .= ' sp.fk_multicurrency, sp.multicurrency_code, sp.multicurrency_tx, sp.multicurrency_total_ht, sp.multicurrency_total_tva as multicurrency_total_vat, sp.multicurrency_total_ttc,';
$sql .= ' sp.datec as date_creation, sp.tms as date_update,'; $sql .= ' sp.datec as date_creation, sp.tms as date_update,';
$sql .= " p.rowid as project_id, p.ref as project_ref,"; $sql .= " p.rowid as project_id, p.ref as project_ref,";
@ -695,6 +695,13 @@ if ($resql)
$objectstatic->ref = $obj->ref; $objectstatic->ref = $obj->ref;
$objectstatic->note_public = $obj->note_public; $objectstatic->note_public = $obj->note_public;
$objectstatic->note_private = $obj->note_private; $objectstatic->note_private = $obj->note_private;
$objectstatic->status = $obj->status;
// Company
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->client = $obj->client;
$companystatic->code_client = $obj->code_client;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -728,14 +735,6 @@ if ($resql)
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
$url = DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid;
// Company
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->client = $obj->client;
$companystatic->code_client = $obj->code_client;
// Thirdparty // Thirdparty
if (!empty($arrayfields['s.nom']['checked'])) if (!empty($arrayfields['s.nom']['checked']))
{ {
@ -901,7 +900,7 @@ if ($resql)
// Status // Status
if (!empty($arrayfields['sp.fk_statut']['checked'])) if (!empty($arrayfields['sp.fk_statut']['checked']))
{ {
print '<td class="right">'.$objectstatic->LibStatut($obj->fk_statut, 5)."</td>\n"; print '<td class="right">'.$objectstatic->getLibStatut(5)."</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }

View File

@ -763,8 +763,10 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
echo '<span class="hideonsmartphone"> - '.dol_print_date(dol_now(), "day").'</span>'; echo '<span class="hideonsmartphone"> - '.dol_print_date(dol_now(), "day").'</span>';
?> ?>
</a></div> </a></div>
<!-- section for customer and open sales -->
<div class="inline-block valignmiddle" id="customerandsales"> <div class="inline-block valignmiddle" id="customerandsales">
</div> </div>
<!-- More info about customer -->
<div class="inline-block valignmiddle" id="moreinfo"></div> <div class="inline-block valignmiddle" id="moreinfo"></div>
<div class="inline-block valignmiddle" id="infowarehouse"></div> <div class="inline-block valignmiddle" id="infowarehouse"></div>
</div> </div>

View File

@ -733,7 +733,7 @@ function DolibarrTakeposPrinting(id) {
$( document ).ready(function() { $( document ).ready(function() {
console.log("Set customer info in header"); console.log("Set customer info and sales in header");
<?php <?php
$s = $langs->trans("Customer"); $s = $langs->trans("Customer");
@ -742,7 +742,9 @@ $( document ).ready(function() {
} }
?> ?>
$("#customerandsales").html('<a class="valignmiddle" id="customer" onclick="Customer();"><?php print dol_escape_js($s); ?></a>'); $("#customerandsales").html('');
$("#customerandsales").append('<a class="valignmiddle tdoverflowmax100 minwidth100" id="customer" onclick="Customer();" title="<?php print dol_escape_js($s); ?>"><span class="fas fa-building paddingrightonly"></span><?php print dol_escape_js($s); ?></a>');
<?php <?php
$sql = "SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX."facture"; $sql = "SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX."facture";
@ -752,12 +754,13 @@ $( document ).ready(function() {
if ($resql) { if ($resql) {
while ($obj = $db->fetch_object($resql)) { while ($obj = $db->fetch_object($resql)) {
echo '$("#customerandsales").append(\''; echo '$("#customerandsales").append(\'';
if ($placeid == $obj->rowid) echo "<b>";
echo '<a class="valignmiddle" onclick="place=\\\''; echo '<a class="valignmiddle" onclick="place=\\\'';
$num_sale = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref)); $num_sale = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
echo $num_sale; echo $num_sale;
if (str_replace("-", "", $num_sale) > $max_sale) $max_sale = str_replace("-", "", $num_sale); if (str_replace("-", "", $num_sale) > $max_sale) $max_sale = str_replace("-", "", $num_sale);
echo '\\\';Refresh();">'.date('H:i', strtotime($obj->datec)); echo '\\\';Refresh();">';
if ($placeid == $obj->rowid) echo "<b>";
echo date('H:i', strtotime($obj->datec));
if ($placeid == $obj->rowid) echo "</b>"; if ($placeid == $obj->rowid) echo "</b>";
echo '</a>\');'; echo '</a>\');';
} }
@ -787,7 +790,7 @@ $( document ).ready(function() {
<?php <?php
// Module Adherent // Module Adherent
$s = ''; $s = '';
if (!empty($conf->adherent->enabled) && $invoice->socid != $conf->global->$constforcompanyid) if (!empty($conf->adherent->enabled) && $invoice->socid > 0 && $invoice->socid != $conf->global->$constforcompanyid)
{ {
$s = '<span class="small">'; $s = '<span class="small">';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@ -941,6 +944,7 @@ if ($placeid > 0)
if (is_array($invoice->lines) && count($invoice->lines)) if (is_array($invoice->lines) && count($invoice->lines))
{ {
print '<!-- Show lines of invoices -->'."\n";
$tmplines = array_reverse($invoice->lines); $tmplines = array_reverse($invoice->lines);
foreach ($tmplines as $line) foreach ($tmplines as $line)
{ {
@ -990,12 +994,15 @@ if ($placeid > 0)
else $htmlforlines .= img_object('', 'service').' '; else $htmlforlines .= img_object('', 'service').' ';
} }
if (empty($conf->global->TAKEPOS_SHOW_N_FIRST_LINES)) { if (empty($conf->global->TAKEPOS_SHOW_N_FIRST_LINES)) {
$tooltiptext = '<b>'.$langs->trans("Ref").'</b> : '.$line->product_ref.'<br>'; $tooltiptext = '';
if ($line->product_ref) {
$tooltiptext .= '<b>'.$langs->trans("Ref").'</b> : '.$line->product_ref.'<br>';
$tooltiptext .= '<b>'.$langs->trans("Label").'</b> : '.$line->product_label.'<br>'; $tooltiptext .= '<b>'.$langs->trans("Label").'</b> : '.$line->product_label.'<br>';
if ($line->product_label != $line->desc) { if ($line->product_label != $line->desc) {
if ($line->desc) $tooltiptext .= '<br>'; if ($line->desc) $tooltiptext .= '<br>';
$tooltiptext .= $line->desc; $tooltiptext .= $line->desc;
} }
}
$htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : ($line->product_ref ? $line->product_ref : dolGetFirstLineOfText($line->desc, 1)), $tooltiptext); $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : ($line->product_ref ? $line->product_ref : dolGetFirstLineOfText($line->desc, 1)), $tooltiptext);
} else { } else {
if ($line->product_label) $htmlforlines .= $line->product_label; if ($line->product_label) $htmlforlines .= $line->product_label;

View File

@ -1695,8 +1695,8 @@ div.statusrefbis {
} }
img.photoref, div.photoref { img.photoref, div.photoref {
/* border: 1px solid #DDD; */ /* border: 1px solid #DDD; */
-webkit-box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2), 0px 0px 2px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2), 0px 0px 2px rgba(0, 0, 0, 0.1); box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
padding: 4px; padding: 4px;
height: 80px; height: 80px;
width: 80px; width: 80px;

View File

@ -204,35 +204,35 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
opacity: 0.95; opacity: 0.95;
} }
.bg-infoxbox-project{ .bg-infobox-project{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#6c6a98', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#6c6aa8', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-action{ .bg-infobox-action{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#a47080', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#a47080', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-propal, .bg-infobox-propal,
.bg-infoxbox-facture, .bg-infobox-facture,
.bg-infoxbox-commande{ .bg-infobox-commande{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#99a17d', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#99a17d', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-supplier_proposal, .bg-infobox-supplier_proposal,
.bg-infoxbox-invoice_supplier, .bg-infobox-invoice_supplier,
.bg-infoxbox-order_supplier{ .bg-infobox-order_supplier{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#599caf', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#599caf', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-contrat, .bg-infoxbox-ticket{ .bg-infobox-contrat, .bg-infobox-ticket{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#46a676', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#46a676', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-bank_account{ .bg-infobox-bank_account{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#b0a53e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#b0a53e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-adherent{ .bg-infobox-adherent{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#79633f', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#79633f', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-expensereport{ .bg-infobox-expensereport{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#79633f', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#79633f', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-holiday{ .bg-infobox-holiday{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#755114', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#755114', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
@ -242,7 +242,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
} }
.fa-dol-propal:before, .fa-dol-propal:before,
.fa-dol-supplier_proposal:before { .fa-dol-supplier_proposal:before {
content: "\f2b5"; content: "\f573";
} }
.fa-dol-facture:before, .fa-dol-facture:before,
.fa-dol-invoice_supplier:before { .fa-dol-invoice_supplier:before {

View File

@ -110,35 +110,35 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (!isset($conf->global->THEME_AGRESSIVENESS_RATIO)) $conf->global->THEME_AGRESSIVENESS_RATIO = -100; if (!isset($conf->global->THEME_AGRESSIVENESS_RATIO)) $conf->global->THEME_AGRESSIVENESS_RATIO = -100;
if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENESS_RATIO = GETPOST('THEME_AGRESSIVENESS_RATIO', 'int'); if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENESS_RATIO = GETPOST('THEME_AGRESSIVENESS_RATIO', 'int');
?> ?>
.bg-infoxbox-project i.fa{ .bg-infobox-project i.fa{
color: <?php print colorAgressiveness('#605ca8', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; color: <?php print colorAgressiveness('#605ca8', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-action i.fa{ .bg-infobox-action i.fa{
color: <?php print colorAgressiveness('#d84b80', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; color: <?php print colorAgressiveness('#d84b80', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-propal i.fa, .bg-infobox-propal i.fa,
.bg-infoxbox-facture i.fa, .bg-infobox-facture i.fa,
.bg-infoxbox-commande i.fa{ .bg-infobox-commande i.fa{
color: <?php print colorAgressiveness('#abb87b', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; color: <?php print colorAgressiveness('#abb87b', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-supplier_proposal i.fa, .bg-infobox-supplier_proposal i.fa,
.bg-infoxbox-invoice_supplier i.fa, .bg-infobox-invoice_supplier i.fa,
.bg-infoxbox-order_supplier i.fa{ .bg-infobox-order_supplier i.fa{
color: <?php print colorAgressiveness('#40b0cf', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; color: <?php print colorAgressiveness('#40b0cf', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-contrat i.fa, .bg-infoxbox-ticket i.fa{ .bg-infobox-contrat i.fa, .bg-infobox-ticket i.fa{
color: <?php print colorAgressiveness('#20a68a', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; color: <?php print colorAgressiveness('#20a68a', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-bank_account i.fa{ .bg-infobox-bank_account i.fa{
color: <?php print colorAgressiveness('#b0a53e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; color: <?php print colorAgressiveness('#b0a53e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-adherent i.fa{ .bg-infobox-adherent i.fa{
color: <?php print colorAgressiveness('#f39c12', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; color: <?php print colorAgressiveness('#f39c12', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-expensereport i.fa{ .bg-infobox-expensereport i.fa{
color: <?php print colorAgressiveness('#755114', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; color: <?php print colorAgressiveness('#755114', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infoxbox-holiday i.fa{ .bg-infobox-holiday i.fa{
color: <?php print colorAgressiveness('#755114', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; color: <?php print colorAgressiveness('#755114', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }

View File

@ -2808,7 +2808,7 @@ class Ticket extends CommonObject
$clause = " AND"; $clause = " AND";
} }
$sql .= $clause." p.entity IN (".getEntity('ticket').")"; $sql .= $clause." p.entity IN (".getEntity('ticket').")";
if ($mode == 'opened') $sql .= " AND p.fk_statut in (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")"; if ($mode == 'opened') $sql .= " AND p.fk_statut NOT IN (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")";
if ($user->socid) $sql .= " AND p.fk_soc = ".$user->socid; if ($user->socid) $sql .= " AND p.fk_soc = ".$user->socid;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);

View File

@ -1618,7 +1618,9 @@ else
// Hierarchy // Hierarchy
print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</td>'; print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</td>';
print '<td>'; print '<td>';
if (empty($object->fk_user)) print $langs->trans("None"); if (empty($object->fk_user)) {
print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
}
else { else {
$huser = new User($db); $huser = new User($db);
$huser->fetch($object->fk_user); $huser->fetch($object->fk_user);
@ -1993,6 +1995,8 @@ else
if ($canreadgroup) if ($canreadgroup)
{ {
print '<!-- Group section -->'."\n";
print load_fiche_titre($langs->trans("ListOfGroupsForUser"), '', ''); print load_fiche_titre($langs->trans("ListOfGroupsForUser"), '', '');
// On selectionne les groupes auquel fait parti le user // On selectionne les groupes auquel fait parti le user
@ -2031,13 +2035,11 @@ else
print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity); print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity);
print ' &nbsp; '; print ' &nbsp; ';
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />'; print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'" />'; print '<input type="submit" class="button buttongen" value="'.$langs->trans("Add").'" />';
} }
print '</th></tr>'."\n"; print '</th></tr>'."\n";
/* // List of groups of user
* Groups assigned to user
*/
if (!empty($groupslist)) if (!empty($groupslist))
{ {
foreach ($groupslist as $group) foreach ($groupslist as $group)
@ -2046,7 +2048,7 @@ else
print '<td>'; print '<td>';
if ($caneditgroup) if ($caneditgroup)
{ {
print '<a href="'.DOL_URL_ROOT.'/user/group/card.php?id='.$group->id.'">'.img_object($langs->trans("ShowGroup"), "group").' '.$group->name.'</a>'; print $group->getNomUrl(1);
} }
else else
{ {
@ -2085,7 +2087,7 @@ else
} }
/* /*
* Fiche en mode edition * Card in edit mode
*/ */
if ($action == 'edit' && ($canedituser || $caneditfield || $caneditpassword || ($user->id == $object->id))) if ($action == 'edit' && ($canedituser || $caneditfield || $caneditpassword || ($user->id == $object->id)))
{ {

View File

@ -100,6 +100,31 @@ class UserGroup extends CommonObject
public $oldcopy; // To contains a clone of this when we need to save old properties of object public $oldcopy; // To contains a clone of this when we need to save old properties of object
public $fields = array(
'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
'nom'=>array('type'=>'varchar(180)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Group name'),
'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1,),
'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>60, 'notnull'=>1,),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>100),
);
/**
* @var int Field with ID of parent key if this field has a parent
*/
public $fk_element = 'fk_usergroup';
/**
* @var array List of child tables. To test if we can delete object.
*/
protected $childtables=array();
/**
* @var array List of child tables. To know object to delete on cascade.
*/
protected $childtablesoncascade = array('usergroup_rights','usergroup_user');
/** /**
* Constructor de la classe * Constructor de la classe
@ -125,47 +150,25 @@ class UserGroup extends CommonObject
{ {
global $conf; global $conf;
$sql = "SELECT g.rowid, g.entity, g.nom as name, g.note, g.datec, g.tms as datem"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g"; if (!empty($groupname))
if ($groupname)
{ {
$sql .= " WHERE g.nom = '".$this->db->escape($groupname)."'"; $result = $this->fetchCommon(0, '', ' AND nom = \''.$this->db->escape($groupname).'\'');
} }
else else
{ {
$sql .= " WHERE g.rowid = ".$id; $result = $this->fetchCommon($id);
} }
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $this->name = $this->nom; // For compatibility with field name
$result = $this->db->query($sql);
if ($result)
{
if ($this->db->num_rows($result))
{
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->entity = $obj->entity;
$this->name = $obj->name;
$this->nom = $obj->name; // Deprecated
$this->note = $obj->note;
$this->datec = $obj->datec;
$this->datem = $obj->datem;
if($result)
{
if ($load_members) if ($load_members)
{
$this->members = $this->listUsersForGroup(); $this->members = $this->listUsersForGroup();
// Retreive all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
// Sav current LDAP Current DN
//$this->ldap_dn = $this->_load_ldap_dn($this->_load_ldap_info(),0);
} }
$this->db->free($result);
return 1; return 1;
} }
else else
@ -403,7 +406,7 @@ class UserGroup extends CommonObject
$this->context = array('audit'=>$langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : '')); $this->context = array('audit'=>$langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : ''));
// Call trigger // Call trigger
$result = $this->call_trigger('GROUP_MODIFY', $user); $result = $this->call_trigger('USERGROUP_MODIFY', $user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
@ -527,7 +530,7 @@ class UserGroup extends CommonObject
$this->context = array('audit'=>$langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : '')); $this->context = array('audit'=>$langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : ''));
// Call trigger // Call trigger
$result = $this->call_trigger('GROUP_MODIFY', $user); $result = $this->call_trigger('USERGROUP_MODIFY', $user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
@ -637,50 +640,7 @@ class UserGroup extends CommonObject
*/ */
public function delete(User $user) public function delete(User $user)
{ {
global $conf, $langs; return $this->deleteCommon($user);
$error = 0;
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_rights";
$sql .= " WHERE fk_usergroup = ".$this->id;
$this->db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user";
$sql .= " WHERE fk_usergroup = ".$this->id;
$this->db->query($sql);
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{
$result = $this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup";
$sql .= " WHERE rowid = ".$this->id;
$result = $this->db->query($sql);
if ($result)
{
// Call trigger
$result = $this->call_trigger('GROUP_DELETE', $user);
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
dol_print_error($this->db);
return -1;
}
} }
/** /**
@ -691,67 +651,15 @@ class UserGroup extends CommonObject
*/ */
public function create($notrigger = 0) public function create($notrigger = 0)
{ {
global $user, $conf, $langs, $hookmanager; global $user, $conf;
$error = 0; $this->datec = dol_now();
$now = dol_now();
if (!isset($this->entity)) $this->entity = $conf->entity; // If not defined, we use default value if (!isset($this->entity)) $this->entity = $conf->entity; // If not defined, we use default value
$entity = $this->entity; $entity = $this->entity;
if (!empty($conf->multicompany->enabled) && $conf->entity == 1) $entity = $this->entity; if (!empty($conf->multicompany->enabled) && $conf->entity == 1) $entity = $this->entity;
$this->db->begin(); return $this->createCommon($user, $notrigger);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup (";
$sql .= "datec";
$sql .= ", nom";
$sql .= ", entity";
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($now)."'";
$sql .= ",'".$this->db->escape($this->nom)."'";
$sql .= ",".$this->db->escape($entity);
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."usergroup");
if ($this->update(1) < 0) return -2;
$action = 'create';
// Actions on extra fields (by external module or standard code)
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (!$error && !$notrigger)
{
// Call trigger
$result = $this->call_trigger('GROUP_CREATE', $user);
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers
}
if ($error > 0) { $error++; $this->db->rollback(); return -1; }
else $this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
$this->error = $this->db->lasterror();
return -1;
}
} }
/** /**
@ -762,9 +670,7 @@ class UserGroup extends CommonObject
*/ */
public function update($notrigger = 0) public function update($notrigger = 0)
{ {
global $user, $conf, $langs, $hookmanager; global $user, $conf;
$error = 0;
$entity = $conf->entity; $entity = $conf->entity;
if (!empty($conf->multicompany->enabled) && $conf->entity == 1) if (!empty($conf->multicompany->enabled) && $conf->entity == 1)
@ -772,55 +678,7 @@ class UserGroup extends CommonObject
$entity = $this->entity; $entity = $this->entity;
} }
$this->db->begin(); return $this->updateCommon($user, $notrigger);
$sql = "UPDATE ".MAIN_DB_PREFIX."usergroup SET ";
$sql .= " nom = '".$this->db->escape($this->name)."'";
$sql .= ", entity = ".$this->db->escape($entity);
$sql .= ", note = '".$this->db->escape($this->note)."'";
$sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$action = 'update';
// Actions on extra fields (by external module or standard code)
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (!$error && !$notrigger)
{
// Call trigger
$result = $this->call_trigger('GROUP_MODIFY', $user);
if ($result < 0) { $error++; }
// End call triggers
}
if (!$error)
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
return -$error;
}
}
else
{
$this->db->rollback();
dol_print_error($this->db);
return -1;
}
} }

View File

@ -54,6 +54,7 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'groupcard'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'groupcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$userid = GETPOST('user', 'int'); $userid = GETPOST('user', 'int');
@ -67,16 +68,14 @@ if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->
} }
$object = new Usergroup($db); $object = new Usergroup($db);
if ($id > 0)
{
$object->fetch($id);
$object->getrights();
}
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$object->getrights();
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('groupcard', 'globalcard')); $hookmanager->initHooks(array('groupcard', 'globalcard'));
@ -91,20 +90,20 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) { if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/user/group/list.php';
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/user/group/card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
}
}
if ($cancel) if ($cancel)
{
if (!empty($backtopage))
{ {
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} }
else
{
header("Location: ".DOL_URL_ROOT.'/user/group/list.php');
exit;
}
$action = '';
}
// Action remove group // Action remove group
if ($action == 'confirm_delete' && $confirm == "yes") if ($action == 'confirm_delete' && $confirm == "yes")
@ -215,7 +214,7 @@ if (empty($reshook)) {
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
$object->name = trim(GETPOST("group", 'nohtml')); $object->name = trim(GETPOST("nom", 'nohtml'));
$object->nom = $object->name; // For backward compatibility $object->nom = $object->name; // For backward compatibility
$object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'none'))); $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'none')));
@ -273,14 +272,11 @@ if ($action == 'create')
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head('', '', '', 0, ''); dol_fiche_head('', '', '', 0, '');
print '<table class="border centpercent">'; print '<table class="border centpercent tableforfieldcreate">';
print "<tr>";
print '<td class="fieldrequired titlefield">'.$langs->trans("Name").'</td>';
print '<td><input type="text" id="nom" name="nom" value="'.dol_escape_htmltag(GETPOST('nom', 'nohtml')).'"></td></tr>';
// Multicompany // Multicompany
if (!empty($conf->multicompany->enabled) && is_object($mc)) if (!empty($conf->multicompany->enabled) && is_object($mc))
@ -297,27 +293,18 @@ if ($action == 'create')
} }
} }
print "<tr>".'<td class="tdtop">'.$langs->trans("Description").'</td><td>'; // Common attributes
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
$doleditor = new DolEditor('note', '', '', 240, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%');
$doleditor->Create();
print "</td></tr>\n";
// Other attributes // Other attributes
$parameters = array('object' => $object); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
print $object->showOptionals($extrafields, 'edit');
}
print "</table>\n"; print "</table>\n";
dol_fiche_end(); dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input class="button" value="'.$langs->trans("CreateGroup").'" type="submit">'; print '<input class="button" name="add" value="'.$langs->trans("CreateGroup").'" type="submit">';
print ' &nbsp; '; print ' &nbsp; ';
print '<input class="button" value="'.$langs->trans("Cancel").'" name="cancel" type="submit">'; print '<input class="button" value="'.$langs->trans("Cancel").'" name="cancel" type="submit">';
print '</div>'; print '</div>';
@ -335,6 +322,8 @@ else
{ {
if ($id) if ($id)
{ {
$res = $object->fetch_optionals();
$head = group_prepare_head($object); $head = group_prepare_head($object);
$title = $langs->trans("Group"); $title = $langs->trans("Group");
@ -359,6 +348,7 @@ else
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin); dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
@ -384,19 +374,20 @@ else
print "</td></tr>\n"; print "</td></tr>\n";
} }
// Note unset($object->fields['nom']); // Name already displayed in banner
print '<tr><td class="titlefield tdtop">'.$langs->trans("Description").'</td>';
print '<td class="valeur sensiblehtmlcontent"">'; // Common attributes
print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note)); $keyforbreak = '';
print '</td>'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
print "</tr>\n";
// Other attributes // Other attributes
$parameters = array('colspan' => ' colspan="2"');
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print "</table>\n"; print '</table>';
print '</div>'; print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end(); dol_fiche_end();
@ -407,6 +398,10 @@ else
print '<div class="tabsAction">'; print '<div class="tabsAction">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($caneditperms) if ($caneditperms)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
@ -421,7 +416,7 @@ else
// List users in group // List users in group
print load_fiche_titre($langs->trans("ListOfUsersInGroup"), '', ''); print load_fiche_titre($langs->trans("ListOfUsersInGroup"), '', 'user');
// On selectionne les users qui ne sont pas deja dans le groupe // On selectionne les users qui ne sont pas deja dans le groupe
$exclude = array(); $exclude = array();
@ -452,7 +447,7 @@ else
print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'maxwidth300'); print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'maxwidth300');
print ' &nbsp; '; print ' &nbsp; ';
print '<input type="hidden" name="entity" value="'.$conf->entity.'">'; print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button buttongen" value="'.$langs->trans("Add").'">';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '</table></form>'."\n"; print '</table></form>'."\n";
print '<br>'; print '<br>';
@ -461,6 +456,7 @@ else
/* /*
* Group members * Group members
*/ */
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("Login").'</td>'; print '<td class="liste_titre">'.$langs->trans("Login").'</td>';
@ -485,7 +481,7 @@ else
print '</td>'; print '</td>';
print '<td>'.$useringroup->lastname.'</td>'; print '<td>'.$useringroup->lastname.'</td>';
print '<td>'.$useringroup->firstname.'</td>'; print '<td>'.$useringroup->firstname.'</td>';
print '<td class="center">'.$useringroup->getLibStatut(3).'</td>'; print '<td class="center">'.$useringroup->getLibStatut(5).'</td>';
print '<td class="right">'; print '<td class="right">';
if (!empty($user->admin)) { if (!empty($user->admin)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=removeuser&amp;user='.$useringroup->id.'">'; print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=removeuser&amp;user='.$useringroup->id.'">';
@ -542,16 +538,15 @@ else
if ($action == 'edit' && $caneditperms) if ($action == 'edit' && $caneditperms)
{ {
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post" name="updategroup" enctype="multipart/form-data">'; print '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="updategroup" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
dol_fiche_head($head, 'group', $title, 0, 'group'); dol_fiche_head($head, 'group', $title, 0, 'group');
print '<table class="border centpercent">'; print '<table class="border centpercent tableforfieldedit">'."\n";
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Name").'</td>';
print '<td class="valeur"><input class="minwidth300" type="text" name="group" value="'.dol_escape_htmltag($object->name).'">';
print "</td></tr>\n";
// Multicompany // Multicompany
if (!empty($conf->multicompany->enabled) && is_object($mc)) if (!empty($conf->multicompany->enabled) && is_object($mc))
@ -568,27 +563,19 @@ else
} }
} }
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>'; // Common attributes
print '<td class="valeur">'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('note', $object->note, '', 240, 'dolibarr_notes', '', true, false, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%');
$doleditor->Create();
print '</td>';
print "</tr>\n";
// Other attributes
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
print $object->showOptionals($extrafields, 'edit');
}
print "</table>\n"; // Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
print '</table>';
dol_fiche_end(); dol_fiche_end();
print '<div class="center"><input class="button" value="'.$langs->trans("Save").'" type="submit"></div>'; print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>'; print '</form>';
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* *
@ -28,6 +28,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by page // Load translation files required by page
$langs->loadLangs(array('users', 'admin')); $langs->loadLangs(array('users', 'admin'));
@ -39,9 +40,9 @@ $module = GETPOST('module', 'alpha');
$rights = GETPOST('rights', 'int'); $rights = GETPOST('rights', 'int');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'groupperms'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'groupperms'; // To manage different context of search
// Defini si peux lire les permissions // Define if user can read permissions
$canreadperms = ($user->admin || $user->rights->user->user->lire); $canreadperms = ($user->admin || $user->rights->user->user->lire);
// Defini si peux modifier les permissions // Define if user can modify group permissions
$caneditperms = ($user->admin || $user->rights->user->user->creer); $caneditperms = ($user->admin || $user->rights->user->user->creer);
// Advanced permissions // Advanced permissions
$advancedpermsactive = false; $advancedpermsactive = false;
@ -76,7 +77,12 @@ if (empty($reshook)) {
$editgroup = new Usergroup($db); $editgroup = new Usergroup($db);
$result = $editgroup->fetch($id); $result = $editgroup->fetch($id);
if ($result > 0) { if ($result > 0) {
$editgroup->addrights($rights, $module, '', $entity); $result= $editgroup->addrights($rights, $module, '', $entity);
if ($result < 0) {
setEventMessages($editgroup->error, $editgroup->errors, 'errors');
}
} else {
dol_print_error($db);
} }
} }
@ -84,7 +90,12 @@ if (empty($reshook)) {
$editgroup = new Usergroup($db); $editgroup = new Usergroup($db);
$result = $editgroup->fetch($id); $result = $editgroup->fetch($id);
if ($result > 0) { if ($result > 0) {
$editgroup->delrights($rights, $module, '', $entity); $result = $editgroup->delrights($rights, $module, '', $entity);
if ($result < 0) {
setEventMessages($editgroup->error, $editgroup->errors, 'errors');
}
} else {
dol_print_error($db);
} }
} }
} }
@ -117,8 +128,6 @@ if ($object->id > 0)
foreach ($modulesdir as $dir) foreach ($modulesdir as $dir)
{ {
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
$handle = @opendir(dol_osencode($dir)); $handle = @opendir(dol_osencode($dir));
if (is_resource($handle)) if (is_resource($handle))
{ {
@ -130,7 +139,7 @@ if ($object->id > 0)
if ($modName) if ($modName)
{ {
include_once $dir."/".$file; include_once $dir.$file;
$objMod = new $modName($db); $objMod = new $modName($db);
// Load all lang files of module // Load all lang files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles)) if (isset($objMod->langfiles) && is_array($objMod->langfiles))
@ -154,7 +163,7 @@ if ($object->id > 0)
$db->commit(); $db->commit();
// Lecture des droits groupes // Read permissions of group
$permsgroupbyentity = array(); $permsgroupbyentity = array();
$sql = "SELECT DISTINCT r.id, r.libelle, r.module, gr.entity"; $sql = "SELECT DISTINCT r.id, r.libelle, r.module, gr.entity";
@ -225,20 +234,22 @@ if ($object->id > 0)
$reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print "\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>'; print '<td>'.$langs->trans("Module").'</td>';
if ($caneditperms) if ($caneditperms)
{ {
print '<td class="center nowrap">'; print '<td class="center nowrap">';
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module=allmodules">'.$langs->trans("All")."</a>"; print '<a class="reposition commonlink" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module=allmodules">'.$langs->trans("All")."</a>";
print '/'; print '/';
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;module=allmodules">'.$langs->trans("None")."</a>"; print '<a class="reposition commonlink" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;module=allmodules">'.$langs->trans("None")."</a>";
print '</td>'; print '</td>';
} }
print '<td class="center" width="24">&nbsp;</td>'; print '<td class="center" width="24">&nbsp;</td>';
print '<td>'.$langs->trans("Permissions").'</td>'; print '<td>'.$langs->trans("Permissions").'</td>';
print '</tr>'; print '</tr>'."\n";
$sql = "SELECT r.id, r.libelle as label, r.module"; $sql = "SELECT r.id, r.libelle as label, r.module";
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
@ -250,16 +261,15 @@ if ($object->id > 0)
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result);
$i = 0; $i = 0;
$oldmod = ''; $oldmod = '';
$num = $db->num_rows($result);
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
// Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore // If line is for a module that doe snot existe anymore (absent of includes/module), we ignore it
if (empty($modules[$obj->module])) if (empty($modules[$obj->module]))
{ {
$i++; $i++;
@ -270,29 +280,37 @@ if ($object->id > 0)
{ {
$oldmod = $obj->module; $oldmod = $obj->module;
// Rupture detectee, on recupere objMod // Break detected, we get objMod
$objMod = $modules[$obj->module]; $objMod = $modules[$obj->module];
$picto = ($objMod->picto ? $objMod->picto : 'generic'); $picto = ($objMod->picto ? $objMod->picto : 'generic');
// Show break line
print '<tr class="oddeven trforbreak">'; print '<tr class="oddeven trforbreak">';
print '<td class="nowrap">'.img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName(); print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
print '<a name="'.$objMod->getName().'">&nbsp;</a></td>'; print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
print '<td class="center nowrap">'; print '<a name="'.$objMod->getName().'"></a>';
print '</td>';
if ($caneditperms) if ($caneditperms)
{ {
print '<a title='.$langs->trans("All").' alt='.$langs->trans("All").' href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("All")."</a>"; print '<td class="center nowrap">';
print '<a class="reposition" title='.$langs->trans("All").' alt='.$langs->trans("All").' href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module='.$obj->module.'">'.$langs->trans("All")."</a>";
print '/'; print '/';
print '<a title='.$langs->trans("None").' alt='.$langs->trans("None").' href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("None")."</a>"; print '<a class="reposition" title='.$langs->trans("None").' alt='.$langs->trans("None").' href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;module='.$obj->module.'">'.$langs->trans("None")."</a>";
}
print '</td>'; print '</td>';
} else {
print '<td>&nbsp;</td>';
}
print '<td colspan="2">&nbsp;</td>'; print '<td colspan="2">&nbsp;</td>';
print '</tr>'; print '</tr>';
} }
print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Module // Picto and label of module
print '<td class="nowrap">'.img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName().'</td>'; print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
//print img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName();
print '</td>';
if (is_array($permsgroupbyentity[$entity])) if (is_array($permsgroupbyentity[$entity]))
{ {
@ -303,7 +321,7 @@ if ($object->id > 0)
{ {
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">'.img_edit_remove($langs->trans("Remove")).'</a></td>'; print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">'.img_edit_remove($langs->trans("Remove")).'</a></td>';
} }
print '<td class="center">'; print '<td class="center nowrap">';
print img_picto($langs->trans("Active"), 'tick'); print img_picto($langs->trans("Active"), 'tick');
print '</td>'; print '</td>';
} }
@ -327,15 +345,16 @@ if ($object->id > 0)
print '<td>&nbsp</td>'; print '<td>&nbsp</td>';
} }
$perm_libelle = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->label))); $permlabel = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->label)));
print '<td>'.$perm_libelle.'</td>'; print '<td class="maxwidthonsmartphone">'.$permlabel.'</td>';
print '</tr>'; print '</tr>'."\n";
$i++; $i++;
} }
} }
print '</table>'; print '</table>';
print '</div>';
print '</div>'; print '</div>';

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
@ -42,9 +42,9 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'use
if (!isset($id) || empty($id)) accessforbidden(); if (!isset($id) || empty($id)) accessforbidden();
// Defini si peux lire les permissions // Define if user can read permissions
$canreaduser = ($user->admin || $user->rights->user->user->lire); $canreaduser = ($user->admin || $user->rights->user->user->lire);
// Defini si peux modifier les autres utilisateurs et leurs permisssions // Define if user can modify other users and permissions
$caneditperms = ($user->admin || $user->rights->user->user->creer); $caneditperms = ($user->admin || $user->rights->user->user->creer);
// Advanced permissions // Advanced permissions
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
@ -132,10 +132,10 @@ if (empty($reshook)) {
* View * View
*/ */
llxHeader('', $langs->trans("Permissions"));
$form = new Form($db); $form = new Form($db);
llxHeader('', $langs->trans("Permissions"));
$head = user_prepare_head($object); $head = user_prepare_head($object);
$title = $langs->trans("User"); $title = $langs->trans("User");

View File

@ -327,6 +327,8 @@ if ($cancel)
$savbacktopage = $backtopage; $savbacktopage = $backtopage;
$backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir', 'alpha') ? '&section_dir='.urlencode(GETPOST('section_dir', 'alpha')) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php $backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir', 'alpha') ? '&section_dir='.urlencode(GETPOST('section_dir', 'alpha')) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php
if ($sortfield) $backtopage.='&sortfield='.$sortfield;
if ($sortorder) $backtopage.='&sortorder='.$sortorder;
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
$backtopage = $savbacktopage; $backtopage = $savbacktopage;
@ -3326,6 +3328,8 @@ if ($action == 'editmeta' || $action == 'createcontainer')
{ {
$fuser->fetch($pageauthorid); $fuser->fetch($pageauthorid);
print $fuser->getNomUrl(1); print $fuser->getNomUrl(1);
} else {
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
} }
print '</td></tr>'; print '</td></tr>';