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
jQuery 3.4.1 MIT License Yes JS library
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 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)

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');
- remove input field in form '<input type="hidden" name="page" value="'.$page.'">';'
- 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:

View File

@ -298,3 +298,15 @@ JEDITABLE.JS
* <button type="submit" /> => <button class="button" type="submit" />
* <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>';
// Ref product
print '<td>';
print '<td class="tdoverflowmax100">';
if ($product_static->id > 0) print $product_static->getNomUrl(1);
if ($product_static->id > 0 && $objp->product_label) print '<br>';
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
$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
if (!$user->admin) accessforbidden();
if (! $user->admin) accessforbidden();
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'invoice';
$type='invoice';
/*
@ -57,17 +57,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
* View
*/
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader(
"", $langs->trans("BillsSetup"),
'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');
$head = invoice_admin_prepare_head();
@ -96,7 +96,26 @@ print "</tr>\n";
_printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices'));
_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(
'type' => 'number',
@ -107,7 +126,7 @@ $metas = array(
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
// Conditions paiements
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
$inputCount = empty($inputCount)?1:($inputCount+1);
print '<tr class="oddeven">';
print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>';
print '<td class="center" width="20">&nbsp;</td>';
@ -159,7 +178,7 @@ function _printOnOff($confkey, $title = false, $desc = '')
global $langs;
print '<tr class="oddeven">';
print '<td>'.($title ? $title : $langs->trans($confkey));
print '<td>'.($title?$title:$langs->trans($confkey));
if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>';
}
@ -187,14 +206,14 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
{
global $langs, $conf, $db, $inputCount;
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
$form = new Form($db);
$inputCount = empty($inputCount)?1:($inputCount+1);
$form=new Form($db);
$defaultMetas = array(
'name' => 'value'.$inputCount
);
if ($type != 'textarea') {
if ($type!='textarea') {
$defaultMetas['type'] = 'text';
$defaultMetas['value'] = $conf->global->{$confkey};
}
@ -210,9 +229,9 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
print '<td>';
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 {
print $title ? $title : $langs->trans($confkey);
print $title?$title:$langs->trans($confkey);
}
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="action" value="setModuleOptions">';
if ($type == 'textarea') {
if ($type=='textarea') {
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
} else {
}elseif($type=='input'){
print '<input '.$metascompil.' />';
}
else{
// custom
print $type;
}
print '</td></tr>';
}

View File

@ -754,9 +754,9 @@ if ($resql)
print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
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 '<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>';
$fieldsforcontent = array('topic', 'joinfiles', 'content');
@ -902,10 +902,10 @@ if ($resql)
// Modify link / Delete link
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)
{
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
}
print '</td>';

View File

@ -172,7 +172,7 @@ if ($action == 'create')
// Owner
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>';
// Position
@ -276,11 +276,11 @@ if ($id > 0 && !preg_match('/^add/i', $action))
print '<tr><td>'.$langs->trans("Owner").'</td><td>';
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
{
if ($object->fk_user)
if ($object->fk_user > 0)
{
$fuser = new User($db);
$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="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton = '';
$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 '<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 "</tr>\n";
$cacheOfUsers = array();
$i = 0;
while ($i < min($num, $limit))
{
@ -222,9 +223,13 @@ while ($i < min($num, $limit))
print '<td class="center">';
if ($obj->fk_user)
{
$userstatic->id = $obj->fk_user;
$userstatic->lastname = $obj->login;
print $userstatic->getNomUrl(1);
if (empty($cacheOfUsers[$obj->fk_user])) {
$tmpuser = new User($db);
$tmpuser->fetch($obj->fk_user);
$cacheOfUsers[$obj->fk_user] = $tmpuser;
}
$tmpuser = $cacheOfUsers[$obj->fk_user];
print $tmpuser->getNomUrl(1);
}
else
{
@ -242,11 +247,11 @@ while ($i < min($num, $limit))
print '<td class="nowrap right">';
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)
{
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
{

View File

@ -3658,7 +3658,7 @@ class Propal extends CommonObject
if ($user->rights->propal->lire)
{
$label = '<u>'.$langs->trans("ShowPropal").'</u>';
$label = '<u>'.$langs->trans("Proposal").'</u>';
if (!empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
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);
if (!empty($this->total_ttc))
$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 == '') {
$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))
{
$label = $langs->trans("ShowPropal");
$label = $langs->trans("Proposal");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';

View File

@ -155,8 +155,8 @@ $arrayfields = array(
'p.ref'=>array('label'=>"Ref", 'checked'=>1),
'p.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1),
'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1)),
'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1)),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1)),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
's.town'=>array('label'=>"Town", 'checked'=>1),
's.zip'=>array('label'=>"Zip", 'checked'=>1),
'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
@ -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 .= " ava.rowid as availability,";
$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.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
$sql .= ' p.note_public, p.note_private,';
@ -408,7 +408,7 @@ if ($resql)
$objectstatic = new Propal($db);
$userstatic = new User($db);
if ($socid > 0)
if ($socid > 0)
{
$soc = new Societe($db);
$soc->fetch($socid);
@ -473,7 +473,7 @@ if ($resql)
$arrayofmassactions = array(
'generate_doc'=>$langs->trans("ReGeneratePDF"),
'builddoc'=>$langs->trans("PDFMerge"),
'presend'=>$langs->trans("SendByMail"),
'presend'=>$langs->trans("SendByMail"),
);
if ($user->rights->propal->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if ($user->rights->propal->cloturer) $arrayofmassactions['closed'] = $langs->trans("Close");
@ -483,8 +483,8 @@ if ($resql)
$newcardbutton = '';
if ($user->rights->propal->creer)
{
$newcardbutton .= dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/propal/card.php?action=create');
}
$newcardbutton .= dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/propal/card.php?action=create');
}
// Fields title search
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -514,19 +514,19 @@ if ($resql)
$moreforfilter = '';
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid)
{
$langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid)
{
$moreforfilter .= '<div class="divsearchfield">';
$langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid)
{
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('LinkedToSpecificUsers').': ';
$moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter .= '</div>';
@ -545,9 +545,9 @@ if ($resql)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': ';
$moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': ';
$moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1);
$moreforfilter .= '</div>';
$moreforfilter .= '</div>';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
@ -572,40 +572,40 @@ if ($resql)
if (!empty($arrayfields['p.ref']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
}
if (!empty($arrayfields['p.ref_client']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).'">';
print '</td>';
print '<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).'">';
print '</td>';
}
if (!empty($arrayfields['pr.ref']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).'">';
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).'">';
print '</td>';
}
if (!empty($arrayfields['pr.title']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).'">';
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).'">';
print '</td>';
}
if (!empty($arrayfields['s.nom']['checked']))
{
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 '</td>';
print '<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">';
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.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.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 maxwidth50" type="text" name="search_zip" value="'.$search_zip.'"></td>';
// State
if (!empty($arrayfields['state.nom']['checked']))
{
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>';
}
// Country
@ -618,7 +618,7 @@ if ($resql)
// Company type
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 ajax_combobox('search_type_thirdparty');
print '</td>';
@ -668,7 +668,7 @@ if ($resql)
// Availability
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);
print ajax_combobox('search_availability');
print '</td>';
@ -783,7 +783,7 @@ if ($resql)
print '<td class="liste_titre">';
print '</td>';
}
// Date cloture
// Date cloture
if (!empty($arrayfields['p.date_cloture']['checked']))
{
print '<td class="liste_titre">';
@ -862,6 +862,8 @@ if ($resql)
$objectstatic->ref_client = $obj->ref_client;
$objectstatic->note_public = $obj->note_public;
$objectstatic->note_private = $obj->note_private;
$objectstatic->statut = $obj->status;
$objectstatic->status = $obj->status;
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
@ -900,16 +902,16 @@ if ($resql)
if (!empty($arrayfields['p.ref']['checked']))
{
print '<td class="nowrap">';
print '<td class="nowraponall">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// 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 '</td>';
// Warning
$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)
{
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
@ -939,24 +941,24 @@ if ($resql)
if (!empty($arrayfields['pr.ref']['checked']))
{
// Project ref
print '<td class="nowrap">';
if ($obj->project_id > 0) {
// Project ref
print '<td class="nowrap">';
if ($obj->project_id > 0) {
print $projectstatic->getNomUrl(1);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
if (!empty($arrayfields['pr.title']['checked']))
{
// Project label
print '<td class="nowrap">';
if ($obj->project_id > 0) {
print $projectstatic->title;
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
// Project label
print '<td class="nowrap">';
if ($obj->project_id > 0) {
print $projectstatic->title;
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Thirdparty
@ -1059,10 +1061,10 @@ if ($resql)
// Amount HT
if (!empty($arrayfields['p.total_ht']['checked']))
{
print '<td class="nowrap right">'.price($obj->total_ht)."</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht';
$totalarray['val']['p.total_ht'] += $obj->total_ht;
print '<td class="nowrap right">'.price($obj->total_ht)."</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht';
$totalarray['val']['p.total_ht'] += $obj->total_ht;
}
// Amount VAT
if (!empty($arrayfields['p.total_vat']['checked']))
@ -1081,42 +1083,42 @@ if ($resql)
$totalarray['val']['p.total_ttc'] += $obj->total_ttc;
}
// Amount invoiced
if (!empty($arrayfields['p.total_ht_invoiced']['checked']))
{
print '<td class="nowrap right">'.price($totalInvoicedHT)."</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced';
$totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT;
}
// Amount invoiced
if (!empty($arrayfields['p.total_invoiced']['checked']))
{
print '<td class="nowrap right">'.price($totalInvoicedTTC)."</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced';
$totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC;
}
if (!empty($arrayfields['p.total_ht_invoiced']['checked']))
{
print '<td class="nowrap right">'.price($totalInvoicedHT)."</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced';
$totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT;
}
// Amount invoiced
if (!empty($arrayfields['p.total_invoiced']['checked']))
{
print '<td class="nowrap right">'.price($totalInvoicedTTC)."</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced';
$totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC;
}
// Currency
if (!empty($arrayfields['p.multicurrency_code']['checked']))
{
print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
if (!$i) $totalarray['nbfield']++;
print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
if (!$i) $totalarray['nbfield']++;
}
// Currency rate
if (!empty($arrayfields['p.multicurrency_tx']['checked']))
{
print '<td class="nowrap">';
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
print '<td class="nowrap">';
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
}
// Amount HT
if (!empty($arrayfields['p.multicurrency_total_ht']['checked']))
{
print '<td class="right nowrap">'.price($obj->multicurrency_total_ht)."</td>\n";
if (!$i) $totalarray['nbfield']++;
print '<td class="right nowrap">'.price($obj->multicurrency_total_ht)."</td>\n";
if (!$i) $totalarray['nbfield']++;
}
// Amount VAT
if (!empty($arrayfields['p.multicurrency_total_vat']['checked']))
@ -1131,17 +1133,17 @@ if ($resql)
if (!$i) $totalarray['nbfield']++;
}
// Amount invoiced
if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked']))
{
print '<td class="nowrap right">'.price($multicurrency_totalInvoicedHT)."</td>\n";
if (!$i) $totalarray['nbfield']++;
}
// Amount invoiced
if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked']))
{
print '<td class="nowrap right">'.price($multicurrency_totalInvoicedTTC)."</td>\n";
if (!$i) $totalarray['nbfield']++;
}
if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked']))
{
print '<td class="nowrap right">'.price($multicurrency_totalInvoicedHT)."</td>\n";
if (!$i) $totalarray['nbfield']++;
}
// Amount invoiced
if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked']))
{
print '<td class="nowrap right">'.price($multicurrency_totalInvoicedTTC)."</td>\n";
if (!$i) $totalarray['nbfield']++;
}
$userstatic->id = $obj->fk_user_author;
$userstatic->login = $obj->login;
@ -1221,7 +1223,7 @@ if ($resql)
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Date cloture
// Date cloture
if (!empty($arrayfields['p.date_cloture']['checked']))
{
print '<td align="center" class="nowrap">';
@ -1232,7 +1234,7 @@ if ($resql)
// Status
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']++;
}
// 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
$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_USER)) $object->warehouse_id = $user->fk_warehouse;
}
@ -1506,9 +1506,10 @@ if ($action == 'create' && $usercancreate)
if (!empty($origin) && !empty($originid)) {
// Parse element/subelement (ex: project_task)
$element = $subelement = $origin;
$regs = array();
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
$element = $regs [1];
$subelement = $regs [2];
$element = $regs[1];
$subelement = $regs[2];
}
if ($element == 'project') {

View File

@ -3697,7 +3697,7 @@ class Commande extends CommonOrder
$label = '';
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('RefCustomer').':</b> '.($this->ref_customer ? $this->ref_customer : $this->ref_client);
if (!empty($this->total_ht)) {
@ -3709,6 +3709,9 @@ class Commande extends CommonOrder
if (!empty($this->total_ttc)) {
$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 = '';
@ -3716,7 +3719,7 @@ class Commande extends CommonOrder
{
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label = $langs->trans("ShowOrder");
$label = $langs->trans("Order");
$linkclose .= ' alt="'.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_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_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_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);
@ -603,7 +603,7 @@ if ($resql)
$moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1);
$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';
$formproduct = new FormProduct($db);
$moreforfilter .= '<div class="divsearchfield">';
@ -901,6 +901,7 @@ if ($resql)
$generic_commande->id = $obj->rowid;
$generic_commande->ref = $obj->ref;
$generic_commande->statut = $obj->fk_statut;
$generic_commande->billed = $obj->billed;
$generic_commande->date = $db->jdate($obj->date_commande);
$generic_commande->date_livraison = $db->jdate($obj->date_delivery);
$generic_commande->ref_client = $obj->ref_client;
@ -919,7 +920,7 @@ if ($resql)
// Ref
if (!empty($arrayfields['c.ref']['checked']))
{
print '<td class="nowrap">';
print '<td class="nowraponall">';
$generic_commande->getLinesArray(); // This set ->lines

View File

@ -108,14 +108,6 @@ $pagenext = $page + 1;
if (!$sortorder) $sortorder = 'desc,desc,desc';
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);
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
$hookmanager->initHooks(array('banktransactionlist', $contextpage));
@ -574,6 +573,7 @@ if ($page >= $nbtotalofpages)
if ($page < 0) $page = 0;
}
// If not account defined $mode_balance_ok=false
if (empty($search_account)) $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_credit)) $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;
$sql .= $db->plimit($limit + 1, $offset);
@ -751,8 +751,8 @@ if ($resql)
print '</td>';
}*/
print '<td class="center">';
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Add").'"><br>';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" name="save" class="button buttongen marginbottomonly" value="'.$langs->trans("Add").'"><br>';
print '<input type="submit" name="cancel" class="button buttongen marginbottomonly" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
print '</table>';
@ -815,7 +815,7 @@ if ($resql)
$morehtml .= $buttonreconcile;
}
$morehtml .= $newcardbutton;
$morehtml .= '<!-- Add New button -->'.$newcardbutton;
$picto = 'bank_account';
if ($id > 0 || !empty($ref)) $picto = '';

View File

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

View File

@ -538,7 +538,11 @@ foreach ($accounts as $key=>$type)
if ($result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} 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) {
print '<span title="'.dol_htmlentities($langs->trans("Late")).'" class="classfortooltip badge badge-danger marginleftonlyshort">';
print '<i class="fa fa-exclamation-triangle"></i> '.$result->nbtodolate;

View File

@ -5,7 +5,7 @@
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -51,8 +51,8 @@ if ($action == 'add')
$dateo = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$label = GETPOST('label', 'alpha');
$amount = GETPOST('amount', 'alpha');
$amountto = GETPOST('amountto', 'alpha');
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
$amountto = price2num(GETPOST('amountto', 'alpha'), 'MT');
if (!$label)
{
@ -115,9 +115,9 @@ if ($action == 'add')
$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 (!$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 (!$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 '</tr>';
$var = false;
print '<tr class="oddeven"><td>';
$form->select_comptes($account_from, 'account_from', 0, '', 1, '', empty($conf->multicurrency->enabled) ? 0 : 1);
print "</td>";

View File

@ -139,6 +139,11 @@ if ($user->socid) $socid = $user->socid;
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$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->vat_src_code = $vat_src_code;
$discount->vat_src_code =$vat_src_code;
$result = $discount->create($user);
if ($result < 0)
@ -1355,17 +1360,22 @@ if (empty($reshook))
$object->situation_counter = 1;
$object->situation_final = 0;
$object->situation_cycle_ref = $object->newCycle();
}
if(in_array($object->type, $retainedWarrantyInvoiceAvailableType)){
$object->retained_warranty = GETPOST('retained_warranty', 'int');
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_date_limit = GETPOST('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 = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
}
else{
$object->retained_warranty = 0;
$object->retained_warranty_fk_cond_reglement = 0;
}
$retained_warranty_date_limit = GETPOST('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 = !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();
@ -1756,21 +1766,32 @@ if (empty($reshook))
$object->fk_facture_source = $_POST['situations'];
$object->type = Facture::TYPE_SITUATION;
$object->retained_warranty = GETPOST('retained_warranty', 'int');
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_date_limit = GETPOST('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 = !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))
if (!empty($origin) && !empty($originid))
{
$object->origin = $origin;
$object->origin_id = $originid;
// 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');
}
$retained_warranty_date_limit = GETPOST('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 = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
}
foreach ($object->lines as $i => &$line)
{
$line->origin = $object->origin;
@ -2608,10 +2629,10 @@ if (empty($reshook))
$pa_ht = $originLine->pa_ht;
$label = $originLine->label;
$array_options = $originLine->array_options;
if ($object->type == Facture::TYPE_SITUATION) {
if($object->type == Facture::TYPE_SITUATION){
$situation_percent = 0;
}
else {
else{
$situation_percent = 100;
}
$fk_prev_id = '';
@ -3371,54 +3392,55 @@ if ($action == 'create')
$form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id');
print '</td></tr>';
if (!empty($conf->global->INVOICE_USE_SITUATION))
{
if ($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY) {
$rwStyle = 'display:none;';
if (GETPOST('type', 'int') == Facture::TYPE_SITUATION) {
$rwStyle = '';
}
$retained_warranty = GETPOST('retained_warranty', 'int');
if (empty($retained_warranty)) {
if (!empty($objectsrc->retained_warranty)) { // use previous situation value
$retained_warranty = $objectsrc->retained_warranty;
} else {
$retained_warranty = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
}
}
if($conf->global->INVOICE_USE_RETAINED_WARRANTY){
$rwStyle = 'display:none;';
if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){
$rwStyle = '';
}
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" />%';
$retained_warranty = GETPOST('retained_warranty', 'int');
if(empty($retained_warranty)){
if(!empty($objectsrc->retained_warranty)){ // use previous situation value
$retained_warranty = $objectsrc->retained_warranty;
}
}
$retained_warranty_js_default = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
// Retained warranty payment term
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');
if (empty($retained_warranty_fk_cond_reglement)) {
$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
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement;
} else {
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
}
}
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '</td></tr>';
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 '<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("[name=\'type\'").change(function() {
if($( this ).prop("checked") && $( this ).val() == '.Facture::TYPE_SITUATION.')
{
$(".retained-warranty-line").show();
}
else{
$(".retained-warranty-line").hide();
}
});
});
</script>';
}
// Retained warranty payment term
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');
if(empty($retained_warranty_fk_cond_reglement)){
$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
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement;
}else{
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
}
}
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '</td></tr>';
print '<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("[name=\'type\']").change(function() {
if($( this ).prop("checked") && $.inArray($( this ).val(), '.json_encode($retainedWarrantyInvoiceAvailableType).' ) !== -1)
{
$(".retained-warranty-line").show();
$("#new-situation-invoice-retained-warranty").val("'.doubleval($retained_warranty_js_default).'");
}
else{
$(".retained-warranty-line").hide();
$("#new-situation-invoice-retained-warranty").val("");
}
});
$("[name=\'type\']").trigger("change");
});
</script>';
}
// Payment mode
@ -4333,89 +4355,82 @@ elseif ($id > 0 || !empty($ref))
print '</td></tr>';
}
$displayWarranty = false;
if (($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY))))
{
// Check if this situation invoice is 100% for real
if (!empty($object->situation_final) && !empty($object->lines)) {
$displayWarranty = true;
foreach ($object->lines as $i => $line) {
if ($line->product_type < 2 && $line->situation_percent < 100) {
$displayWarranty = false;
break;
}
}
}
if(!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
// Retained Warranty
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RetainedWarranty');
print '</td>';
if ($action != 'editretainedwarranty' && $user->rights->facture->creer) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarranty&amp;facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'</a></td>';
}
$displayWarranty = true;
if(!in_array($object->type, $retainedWarrantyInvoiceAvailableType) && empty($object->retained_warranty)){
$displayWarranty = false;
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editretainedwarranty')
{
print '<form id="retained-warranty-form" method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
print '<input type="hidden" name="action" value="setretainedwarranty">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input name="retained_warranty" type="number" step="0.01" min="0" max="100" value="'.$object->retained_warranty.'" >';
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
}
else
{
print price($object->retained_warranty).'%';
}
print '</td></tr>';
if($displayWarranty)
{
// Retained warranty payment term
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-cond-reglement-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShortRetainedWarranty');
print '</td>';
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantypaymentterms&amp;facid='.$object->id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'</a></td>';
}
// Retained Warranty
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RetainedWarranty');
print '</td>';
if ($action != 'editretainedwarranty' && $user->rights->facture->creer) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarranty&amp;facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
$defaultDate = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : strtotime('-1 years', $object->date_lim_reglement);
if ($object->date > $defaultDate) {
$defaultDate = $object->date;
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editretainedwarranty')
{
print '<form id="retained-warranty-form" method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
print '<input type="hidden" name="action" value="setretainedwarranty">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input name="retained_warranty" type="number" step="0.01" min="0" max="100" value="'.$object->retained_warranty.'" >';
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
}
else
{
print price($object->retained_warranty).'%';
}
print '</td></tr>';
if ($action == 'editretainedwarrantypaymentterms')
{
//date('Y-m-d',$object->date_lim_reglement)
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
print '<input type="hidden" name="action" value="setretainedwarrantyconditions">';
print '<input type="hidden" name="token" value="'.newToken().'">';
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $object->retained_warranty_fk_cond_reglement;
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
}
else
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
if (!$displayWarranty) {
print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
}
}
print '</td></tr>';
// Retained warranty payment term
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-cond-reglement-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShortRetainedWarranty');
print '</td>';
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantypaymentterms&amp;facid='.$object->id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
$defaultDate = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : strtotime('-1 years', $object->date_lim_reglement);
if ($object->date > $defaultDate) {
$defaultDate = $object->date;
}
if ($action == 'editretainedwarrantypaymentterms')
{
//date('Y-m-d',$object->date_lim_reglement)
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
print '<input type="hidden" name="action" value="setretainedwarrantyconditions">';
print '<input type="hidden" name="token" value="'.newToken().'">';
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $object->retained_warranty_fk_cond_reglement;
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
}
else
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
if (!$displayWarranty) {
print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
}
}
print '</td></tr>';
if ($displayWarranty)
{
// Retained Warranty payment date limit
print '<tr class="retained-warranty-lines" ><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_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),
'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_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_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' =>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_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_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>255),
'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),
'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;
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
if (!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
$originid = $line->origin_id;
$origintype = $line->origin;
if(!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
$originid=$line->origin_id;
$origintype=$line->origin;
} else {
$originid = $line->id;
$origintype = $this->element;
$originid=$line->id;
$origintype=$this->element;
}
$result = $this->addline(
@ -3733,44 +3733,44 @@ class Facture extends CommonInvoice
}
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;
$file = $addon.'.php';
$file = $addon . '.php';
$classname = $addon;
// Include file with class
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
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)
if (is_file($dir.$file) && is_readable($dir.$file)) {
$mybool |= include_once $dir.$file;
if (is_file($dir . $file) && is_readable($dir . $file)) {
$mybool |= include_once $dir . $file;
}
}
// For compatibility
if (!$mybool) {
$file = $addon.'/'.$addon.'.modules.php';
$classname = 'mod_'.$moduleName.'_'.$addon;
$file = $addon . '/' . $addon . '.modules.php';
$classname = 'mod_' . $moduleName . '_' . $addon;
$classname = preg_replace('/\-.*$/', '', $classname);
// Include file with class
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)
if (is_file($dir.$file) && is_readable($dir.$file)) {
$mybool |= include_once $dir.$file;
if (is_file($dir . $file) && is_readable($dir . $file)) {
$mybool |= include_once $dir . $file;
}
}
}
if (!$mybool) {
dol_print_error('', 'Failed to include file '.$file);
dol_print_error('', 'Failed to include file ' . $file);
return '';
}
@ -3789,7 +3789,7 @@ class Facture extends CommonInvoice
return $numref;
} else {
$langs->load('errors');
print $langs->trans('Error').' '.$langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
print $langs->trans('Error') . ' ' . $langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
return '';
}
}
@ -4742,6 +4742,43 @@ class Facture extends CommonInvoice
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)
@ -4757,7 +4794,7 @@ class Facture extends CommonInvoice
$retainedWarrantyAmount = 0;
// 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;
// Check if this situation invoice is 100% for real
@ -4795,7 +4832,10 @@ class Facture extends CommonInvoice
if ($rounding < 0) {
$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;

View File

@ -208,7 +208,7 @@ $arrayfields = array(
'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);
}
@ -1137,7 +1137,7 @@ if ($resql)
$facturestatic->note_public = $obj->note_public;
$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_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')
{
print load_fiche_titre($langs->trans("VAT").' - '.$langs->trans("New"));
@ -262,7 +262,7 @@ if ($action == 'create')
print '</td></tr>';
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>';
// 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
$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))
{
$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))
{
$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);
}
}
}
@ -145,12 +146,13 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
if (is_object($object) && $object->id > 0) {
if ($backtopage) {
header('Location: '.$backtopage);
header('Location: '.$backtopage);
exit;
}
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;
}
}

View File

@ -356,10 +356,12 @@ if ($useajax || $action == 'delete')
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$useglobalvars = 1;
$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['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_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_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['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 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 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 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($websitekey)) $formquestion['website'] = array('type'=>'hidden', 'value'=>$websitekey, 'name'=>'website');
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="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 .= '</span>';
$return .= '<div class="info-box-content">';
@ -7876,6 +7876,7 @@ abstract class CommonObject
public function createCommon(User $user, $notrigger = false)
{
global $langs;
dol_syslog(get_class($this)."::createCommon create", LOG_DEBUG);
$error = 0;
@ -8114,6 +8115,7 @@ abstract class CommonObject
public function updateCommon(User $user, $notrigger = false)
{
global $conf, $langs;
dol_syslog(get_class($this)."::updateCommon update", LOG_DEBUG);
$error = 0;
@ -8203,6 +8205,8 @@ abstract class CommonObject
*/
public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0)
{
dol_syslog(get_class($this)."::deleteCommon delete", LOG_DEBUG);
$error = 0;
$this->db->begin();
@ -8262,15 +8266,8 @@ abstract class CommonObject
if (!$error && !empty($this->isextrafieldmanaged))
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields";
$sql .= " WHERE fk_object=".$this->id;
$resql = $this->db->query($sql);
if (!$resql)
{
$this->errors[] = $this->db->lasterror();
$error++;
}
$result = $this->deleteExtraFields();
if ($result < 0) { $error++; }
}
if (!$error)

View File

@ -96,7 +96,7 @@ class DolEditor
$this->cols = (preg_match('/%/', $cols) ? $cols : max(40, $cols)); // If $cols is a percent, we keep it, otherwise, we take max
$this->height = $height;
$this->width = $width;
}
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -259,7 +259,7 @@ class DolEditor
})';
$out .= '</script>'."\n";
}
var_dump($this->height);
$out .= '<pre id="'.$this->htmlname.'aceeditorid" style="'.($this->width ? 'width: '.$this->width.'px; ' : '');
$out .= ($this->height ? ' height: '.$this->height.'px; ' : '');
//$out.=" min-height: 100px;";

View File

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

View File

@ -52,19 +52,19 @@
class Form
{
/**
* @var DoliDB Database handler.
*/
public $db;
* @var DoliDB Database handler.
*/
public $db;
/**
* @var string Error code (or message)
*/
public $error = '';
/**
* @var string[] Array of error strings
*/
public $errors = array();
/**
* @var string[] Array of error strings
*/
public $errors = array();
public $num;
@ -103,8 +103,8 @@ class Form
* @param string $help Tooltip help
* @return string HTML edit field
*/
public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id', $help = '')
{
public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id', $help = '')
{
global $conf, $langs;
$ret = '';
@ -157,7 +157,7 @@ class Form
}
return $ret;
}
}
/**
* Output value of a field for an editable field
@ -177,7 +177,7 @@ class Form
* @param string $paramid Key of parameter for id ('id', 'socid')
* @return string HTML edit field
*/
public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 0, $formatfunc = '', $paramid = 'id')
public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 0, $formatfunc = '', $paramid = 'id')
{
global $conf, $langs, $db;
@ -243,7 +243,7 @@ class Form
elseif (preg_match('/^select;/', $typeofdata))
{
$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
$arraylist = array();
$arraylist = array();
foreach ($arraydata as $val)
{
$tmp = explode(':', $val);
@ -254,7 +254,7 @@ class Form
}
elseif (preg_match('/^ckeditor/', $typeofdata))
{
$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser
$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), ($tmp[2] ? $tmp[2] : ''), ($tmp[3] ? $tmp[3] : '100'), ($tmp[1] ? $tmp[1] : 'dolibarr_notes'), 'In', ($tmp[5] ? $tmp[5] : 0), (isset($tmp[8]) ? ($tmp[8] ?true:false) : true), true, ($tmp[6] ? $tmp[6] : '20'), ($tmp[7] ? $tmp[7] : '100'));
$ret .= $doleditor->Create(1);
@ -263,12 +263,12 @@ class Form
if (empty($notabletag)) $ret .= '<td class="left">';
//else $ret.='<div class="clearboth"></div>';
$ret .= '<input type="submit" class="button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) $ret .= '<br>'."\n";
$ret .= '<input type="submit" class="button'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
if (empty($notabletag)) $ret .= '</td>';
$ret .= '<input type="submit" class="button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) $ret .= '<br>'."\n";
$ret .= '<input type="submit" class="button'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
if (empty($notabletag)) $ret .= '</td>';
if (empty($notabletag)) $ret .= '</tr></table>'."\n";
if (empty($notabletag)) $ret .= '</tr></table>'."\n";
$ret .= '</form>'."\n";
}
else
@ -282,7 +282,7 @@ class Form
elseif (preg_match('/^select;/', $typeofdata))
{
$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
$arraylist = array();
$arraylist = array();
foreach ($arraydata as $val)
{
$tmp = explode(':', $val);
@ -492,8 +492,8 @@ class Form
{
if (!empty($custommsg['success']))
$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n";
if (!empty($custommsg['error']))
$out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";
if (!empty($custommsg['error']))
$out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";
}
else
$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n";
@ -532,7 +532,7 @@ class Form
* @see textwithpicto() Use thisfunction if you can.
* TODO Move this as static as soon as everybody use textwithpicto or @Form::textwithtooltip
*/
public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
{
if ($incbefore) $text = $incbefore.$text;
if (!$htmltext) return $text;
@ -613,7 +613,7 @@ class Form
* @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only)
* @return string HTML code of text, picto, tooltip
*/
public function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 3, $tooltiptrigger = '', $forcenowrap = 0)
public function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 3, $tooltiptrigger = '', $forcenowrap = 0)
{
global $conf, $langs;
@ -643,7 +643,7 @@ class Form
// If info or help with smartphone, show only text (tooltip on click does not works with dialog on smaprtphone)
//if (! empty($conf->dol_no_mouse_hover) && ! empty($tooltiptrigger))
//{
//if ($type == 'info' || $type == 'help') return '<a href="'..'">'.$text.''</a>';
//if ($type == 'info' || $type == 'help') return '<a href="'..'">'.$text.''</a>';
//}
$img = '';
@ -666,7 +666,7 @@ class Form
* @param int $alwaysvisible 1=select button always visible
* @return string|void Select list
*/
public function selectMassAction($selected, $arrayofaction, $alwaysvisible = 0)
public function selectMassAction($selected, $arrayofaction, $alwaysvisible = 0)
{
global $conf, $langs, $hookmanager;
@ -760,7 +760,7 @@ class Form
return $ret;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return combo list of activated countries, into language of user
*
@ -776,9 +776,9 @@ class Form
* @param array $exclude_country_code Array of country code (iso2) to exclude
* @return string HTML string with select
*/
public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array())
public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array())
{
// phpcs:enable
// phpcs:enable
global $conf, $langs, $mysoc;
$langs->load("dict");
@ -878,7 +878,7 @@ class Form
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list of incoterms
*
@ -891,9 +891,9 @@ class Form
* @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return string HTML string with select and input
*/
public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array())
public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array())
{
// phpcs:enable
// phpcs:enable
global $conf, $langs;
$langs->load("dict");
@ -972,7 +972,7 @@ class Form
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of types of lines (product or service)
* Example: 0=product, 1=service, 9=other (for external module)
@ -984,14 +984,14 @@ class Form
* @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, 2=Force to show only Products, 3=Force to show only services, -1=Force none (and set hidden field to 'service')
* @return void
*/
public function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0)
public function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0)
{
// phpcs:enable
// phpcs:enable
global $db, $langs, $user, $conf;
// If product & services are enabled or both disabled.
if ($forceall == 1 || (empty($forceall) && !empty($conf->product->enabled) && !empty($conf->service->enabled))
|| (empty($forceall) && empty($conf->product->enabled) && empty($conf->service->enabled)))
|| (empty($forceall) && empty($conf->product->enabled) && empty($conf->service->enabled)))
{
if (empty($hidetext)) print $langs->trans("Type").': ';
print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
@ -1029,15 +1029,15 @@ class Form
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load into cache cache_types_fees, array of types of fees
*
* @return int Nb of lines loaded, <0 if KO
*/
public function load_cache_types_fees()
public function load_cache_types_fees()
{
// phpcs:enable
// phpcs:enable
global $langs;
$num = count($this->cache_types_fees);
@ -1078,7 +1078,7 @@ class Form
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of types of notes
*
@ -1087,9 +1087,9 @@ class Form
* @param int $showempty Add an empty field
* @return void
*/
public function select_type_fees($selected = '', $htmlname = 'type', $showempty = 0)
public function select_type_fees($selected = '', $htmlname = 'type', $showempty = 0)
{
// phpcs:enable
// phpcs:enable
global $user, $langs;
dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
@ -1118,7 +1118,7 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return HTML code to select a company.
*
@ -1131,13 +1131,13 @@ class Form
* @return string Return select box for thirdparty.
* @deprecated 3.8 Use select_company instead. For exemple $form->select_thirdparty(GETPOST('socid'),'socid','',0) => $form->select_company(GETPOST('socid'),'socid','',1,0,0,array(),0)
*/
public function select_thirdparty($selected = '', $htmlname = 'socid', $filter = '', $limit = 20, $ajaxoptions = array(), $forcecombo = 0)
public function select_thirdparty($selected = '', $htmlname = 'socid', $filter = '', $limit = 20, $ajaxoptions = array(), $forcecombo = 0)
{
// phpcs:enable
return $this->select_thirdparty_list($selected, $htmlname, $filter, 1, 0, $forcecombo, array(), '', 0, $limit);
// phpcs:enable
return $this->select_thirdparty_list($selected, $htmlname, $filter, 1, 0, $forcecombo, array(), '', 0, $limit);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output html form to select a third party
*
@ -1157,9 +1157,9 @@ class Form
* @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter)
* @return string HTML string with select box for thirdparty.
*/
public function select_company($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $limit = 0, $morecss = 'minwidth100', $moreparam = '', $selected_input_value = '', $hidelabel = 1, $ajaxoptions = array(), $multiple = false)
public function select_company($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $limit = 0, $morecss = 'minwidth100', $moreparam = '', $selected_input_value = '', $hidelabel = 1, $ajaxoptions = array(), $multiple = false)
{
// phpcs:enable
// phpcs:enable
global $conf, $user, $langs;
$out = '';
@ -1201,7 +1201,7 @@ class Form
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output html form to select a third party.
* Note, you must use the select_company to get the component to select a third party. This function must only be called by select_company.
@ -1221,9 +1221,9 @@ class Form
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @return string HTML string with
*/
public function select_thirdparty_list($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $filterkey = '', $outputmode = 0, $limit = 0, $morecss = 'minwidth100', $moreparam = '', $multiple = false)
public function select_thirdparty_list($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $filterkey = '', $outputmode = 0, $limit = 0, $morecss = 'minwidth100', $moreparam = '', $multiple = false)
{
// phpcs:enable
// phpcs:enable
global $conf, $user, $langs;
$out = '';
@ -1245,7 +1245,7 @@ class Form
if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
$sql .= ", s.address, s.zip, s.town";
$sql .= ", dictp.code as country_code";
$sql .= ", dictp.code as country_code";
}
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -1288,7 +1288,7 @@ class Form
$resql = $this->db->query($sql);
if ($resql)
{
if (!$forcecombo)
if (!$forcecombo)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
@ -1383,7 +1383,7 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return HTML combo list of absolute discounts
*
@ -1394,9 +1394,9 @@ class Form
* @param int $maxvalue Max value for lines that can be selected
* @return int Return number of qualifed lines in list
*/
public function select_remises($selected, $htmlname, $filter, $socid, $maxvalue = 0)
public function select_remises($selected, $htmlname, $filter, $socid, $maxvalue = 0)
{
// phpcs:enable
// phpcs:enable
global $langs, $conf;
// On recherche les remises
@ -1460,7 +1460,7 @@ class Form
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of all contacts (for a third party or all)
*
@ -1481,12 +1481,12 @@ class Form
* @return int <0 if KO, Nb of contact in list if OK
* @deprected You can use selectcontacts directly (warning order of param was changed)
*/
public function select_contacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $showsoc = 0, $forcecombo = 0, $events = array(), $options_only = false, $moreparam = '', $htmlid = '')
{
// phpcs:enable
public function select_contacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $showsoc = 0, $forcecombo = 0, $events = array(), $options_only = false, $moreparam = '', $htmlid = '')
{
// phpcs:enable
print $this->selectcontacts($socid, $selected, $htmlname, $showempty, $exclude, $limitto, $showfunction, $moreclass, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid);
return $this->num;
}
}
/**
* Return HTML code of the SELECT of list of all contacts (for a third party or all).
@ -1511,8 +1511,8 @@ class Form
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @return int <0 if KO, Nb of contact in list if OK
*/
public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false)
{
public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false)
{
global $conf, $langs, $hookmanager, $action;
$langs->load('companies');
@ -1570,42 +1570,42 @@ class Form
$contactstatic->lastname = $obj->lastname;
$contactstatic->firstname = $obj->firstname;
if ($obj->statut == 1) {
if ($htmlname != 'none')
{
$disabled = 0;
if (is_array($exclude) && count($exclude) && in_array($obj->rowid, $exclude)) $disabled = 1;
if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto)) $disabled = 1;
if (!empty($selected) && in_array($obj->rowid, $selected))
{
$out .= '<option value="'.$obj->rowid.'"';
if ($disabled) $out .= ' disabled';
$out .= ' selected>';
$out .= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out .= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out .= ' - ('.$obj->company.')';
$out .= '</option>';
}
else
{
$out .= '<option value="'.$obj->rowid.'"';
if ($disabled) $out .= ' disabled';
$out .= '>';
$out .= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out .= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out .= ' - ('.$obj->company.')';
$out .= '</option>';
}
}
else
{
if (in_array($obj->rowid, $selected))
{
$out .= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out .= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out .= ' - ('.$obj->company.')';
}
}
}
if ($htmlname != 'none')
{
$disabled = 0;
if (is_array($exclude) && count($exclude) && in_array($obj->rowid, $exclude)) $disabled = 1;
if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto)) $disabled = 1;
if (!empty($selected) && in_array($obj->rowid, $selected))
{
$out .= '<option value="'.$obj->rowid.'"';
if ($disabled) $out .= ' disabled';
$out .= ' selected>';
$out .= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out .= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out .= ' - ('.$obj->company.')';
$out .= '</option>';
}
else
{
$out .= '<option value="'.$obj->rowid.'"';
if ($disabled) $out .= ' disabled';
$out .= '>';
$out .= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out .= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out .= ' - ('.$obj->company.')';
$out .= '</option>';
}
}
else
{
if (in_array($obj->rowid, $selected))
{
$out .= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out .= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out .= ' - ('.$obj->company.')';
}
}
}
$i++;
}
}
@ -1642,7 +1642,7 @@ class Form
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list of users
*
@ -1658,13 +1658,13 @@ class Form
* @deprecated Use select_dolusers instead
* @see select_dolusers()
*/
public function select_users($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0')
public function select_users($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0')
{
// phpcs:enable
// phpcs:enable
print $this->select_dolusers($selected, $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list of users
*
@ -1688,9 +1688,9 @@ class Form
* @return string HTML select string
* @see select_dolgroups()
*/
public function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $noactive = 0, $outputmode = 0, $multiple = false)
public function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $noactive = 0, $outputmode = 0, $multiple = false)
{
// phpcs:enable
// phpcs:enable
global $conf, $user, $langs, $hookmanager;
// If no preselected user defined, we take current user
@ -1773,7 +1773,7 @@ class Form
$i = 0;
if ($num)
{
// Enhance with select2
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
@ -1847,7 +1847,7 @@ class Form
{
$out .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
$moreinfo++;
}
}
}
$out .= ($moreinfo ? ')' : '');
if ($disableline && $disableline != '1')
@ -1877,7 +1877,7 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list of users. Selected users are stored into session.
* List of users are provided into $_SESSION['assignedtouser'].
@ -1900,9 +1900,9 @@ class Form
* @return string HTML select string
* @see select_dolgroups()
*/
public function select_dolusers_forevent($action = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $showproperties = 0, $listofuserid = array(), $listofcontactid = array(), $listofotherid = array())
public function select_dolusers_forevent($action = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $showproperties = 0, $listofuserid = array(), $listofcontactid = array(), $listofotherid = array())
{
// phpcs:enable
// phpcs:enable
global $conf, $user, $langs;
$userstatic = new User($this->db);
@ -1967,7 +1967,7 @@ class Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_list
*
@ -1993,9 +1993,9 @@ class Form
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
* @return void
*/
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = array())
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = array())
{
// phpcs:enable
// phpcs:enable
global $langs, $conf;
// check parameters
@ -4386,7 +4386,7 @@ class Form
buttons: {
"'.dol_escape_js($langs->transnoentities("Yes")).'": function() {
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 : '').'";
if (inputok.length>0) {
$.each(inputok, function(i, inputname) {
@ -4405,7 +4405,7 @@ class Form
},
"'.dol_escape_js($langs->transnoentities("No")).'": function() {
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 : '').'";
if (inputko.length>0) {
$.each(inputko, function(i, inputname) {

View File

@ -203,7 +203,7 @@ class FormActions
if ($typeelement == 'project') $projectid = $object->id;
$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));
}

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 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 $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
* @return int <0 if KO, >0 if OK
*/
@ -108,8 +108,6 @@ class FormFile
return 1;
}
$maxlength = $size;
$out = "\n\n".'<!-- Start form attach new file --><div class="formattachnewfile">'."\n";
if (empty($title)) $title = $langs->trans("AttachANewFile");
@ -174,6 +172,10 @@ class FormFile
$out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""');
$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 .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
$out .= '>';
@ -731,7 +733,9 @@ class FormFile
$arraykeys = array_keys($modellist);
$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)
{
$out .= ajax_combobox('model');
@ -869,7 +873,7 @@ class FormFile
if ($printer)
{
//$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 .= '">'.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').'</a>';
}
@ -990,7 +994,7 @@ class FormFile
{
$out = '<dl class="dropdown inline-block">
<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 = '';
// Loop on each file found
@ -1297,7 +1301,7 @@ class FormFile
{
$fileinfo = pathinfo($file['name']);
print '<td class="center">';
if (image_format_supported($file['name']) > 0)
if (image_format_supported($file['name']) >= 0)
{
if ($useinecm == 5 || $useinecm == 6)
{

View File

@ -1598,13 +1598,18 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
$formmail->add_attached_files($destfull, $destfile, $TFile['type'][$i]);
}
// Update table of files
// Update index table of files (llx_ecm_files)
if ($donotupdatesession == 1)
{
$result = addFileIntoDatabaseIndex($upload_dir, basename($destfile), $TFile['name'][$i], 'uploaded', 0);
if ($result < 0)
{
setEventMessages('FailedToAddFileIntoDatabaseIndex', '', 'warnings');
if ($allowoverwrite) {
// Do not show error message. We can have an error due to DB_ERROR_RECORD_ALREADY_EXISTS
}
else {
setEventMessages('FailedToAddFileIntoDatabaseIndex', '', 'warnings');
}
}
}
@ -1760,7 +1765,6 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo
return $result;
}
/**
* 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_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_holiday', 'object_hrm', 'object_multicurrency', 'object_payment',
'object_lot', 'object_mrp', 'object_product', '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_holiday', 'object_hrm', 'object_intervention', 'object_multicurrency', 'object_order', 'object_payment',
'object_lot', 'object_mrp', 'object_product', 'object_propal', 'object_supplier_proposal', 'object_service', 'object_stock',
'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',
'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',
'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'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',
'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',
'generic'=>'file', 'holiday'=>'umbrella-beach', 'member'=>'users', 'mrp'=>'cubes', 'trip'=>'wallet', 'group'=>'users',
'sign-out'=>'sign-out-alt',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star', 'stats' => 'chart-bar',
'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter', 'split'=>'code-branch',
'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',
'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',
'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',
'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_agenda'=>'calendar-alt',
'playdisabled'=>'play', 'preview'=>'binoculars', 'project'=>'sitemap', 'resize'=>'crop',
'uparrow'=>'mail-forward',
'jabber'=>'comment-o'
);
@ -3241,15 +3246,18 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
// Add CSS
$arrayconvpictotomorcess = array(
'action'=>'bg-infoxbox-action', 'account'=>'bg-infoxbox-bank_account', 'bank_account'=>'bg-infoxbox-bank_account', 'cash-register'=>'bg-infoxbox-bank_account',
'contract'=>'bg-infoxbox-contrat',
'multicurrency'=>'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-infobox-contrat',
'multicurrency'=>'bg-infobox-bank_account',
'check'=>'font-status4',
'hrm'=>'bg-infoxbox-adherent', 'group'=>'bg-infoxbox-adherent',
'members'=>'bg-infoxbox-adherent', 'member'=>'bg-infoxbox-adherent', 'user'=>'bg-infoxbox-adherent', 'users'=>'bg-infoxbox-adherent',
'hrm'=>'bg-infobox-adherent', 'group'=>'bg-infobox-adherent', 'intervention'=>'bg-infobox-contrat',
'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',
'holiday'=>'bg-infoxbox-holiday', 'payment'=>'bg-infoxbox-bank_account', 'project'=>'bg-infoxbox-project', 'resource'=>'bg-infoxbox-action',
'ticket'=>'bg-infoxbox-contrat', 'title_hrm'=>'bg-infoxbox-holiday', 'trip'=>'bg-infoxbox-expensereport', 'title_agenda'=>'bg-infoxbox-action',
'holiday'=>'bg-infobox-holiday',
'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'
);
if (!empty($arrayconvpictotomorcess[$pictowithouttext])) {
@ -3263,7 +3271,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'listlight'=>'#999',
'lot'=>'#a69944', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944',
'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'=>''
);
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 $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
* @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)
{
@ -3365,7 +3373,7 @@ function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false,
* @param int $pictoisfullpath If 1, image path is a full path
* @param string $morecss More CSS
* @return string Return img tag
* @see #img_object, #img_picto
* @see img_object(), img_picto()
*/
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 int $pictoisfullpath If 1, image path is a full path
* @return string Return img tag
* @see #img_object, #img_picto
* @see img_object(), img_picto()
*/
function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0)
{

View File

@ -1393,47 +1393,33 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
// Retained warranty
if (!empty($object->situation_final) && ($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty))))
if ($object->displayRetainedWarranty())
{
$displayWarranty = false;
$pdf->SetTextColor(40, 40, 40);
$pdf->SetFillColor(255, 255, 255);
// 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;
}
}
}
$retainedWarranty = $object->getRetainedWarrantyAmount();
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty;
if ($displayWarranty) {
$pdf->SetTextColor(40, 40, 40);
$pdf->SetFillColor(255, 255, 255);
// Billed - retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
$retainedWarranty = $object->total_ttc * $object->retained_warranty / 100;
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
// Billed - retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
// retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
$retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)';
$retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : '';
// retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
$retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)';
$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->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
}
}
}
}

View File

@ -43,82 +43,82 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
*/
class pdf_sponge extends ModelePDFFactures
{
/**
* @var DoliDb Database handler
*/
public $db;
/**
* @var DoliDb Database handler
*/
public $db;
/**
* @var string model name
*/
public $name;
* @var string model name
*/
public $name;
/**
* @var string model description (short text)
*/
public $description;
* @var string model description (short text)
*/
public $description;
/**
* @var int Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
/**
* @var int Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
* @var string document type
*/
public $type;
/**
* @var string document type
*/
public $type;
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP 5.5 = array(5, 5)
*/
* @var array Minimum version of PHP required by module.
* e.g.: PHP 5.5 = array(5, 5)
*/
public $phpmin = array(5, 5);
/**
* Dolibarr version of the loaded document
* @var string
*/
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'dolibarr';
/**
* @var int page_largeur
*/
public $page_largeur;
/**
* @var int page_largeur
*/
public $page_largeur;
/**
* @var int page_hauteur
*/
public $page_hauteur;
* @var int page_hauteur
*/
public $page_hauteur;
/**
* @var array format
*/
public $format;
* @var array format
*/
public $format;
/**
* @var int marge_gauche
*/
* @var int marge_gauche
*/
public $marge_gauche;
/**
* @var int marge_droite
*/
* @var int marge_droite
*/
public $marge_droite;
/**
* @var int marge_haute
*/
* @var int marge_haute
*/
public $marge_haute;
/**
* @var int marge_basse
*/
* @var int marge_basse
*/
public $marge_basse;
/**
* Issuer
* @var Societe Object that emits
*/
/**
* Issuer
* @var Societe Object that emits
*/
public $emetteur;
/**
@ -776,9 +776,9 @@ class pdf_sponge extends ModelePDFFactures
$parameters = array(
'object' => $object,
'i' => $i,
'pdf' => &$pdf,
'curY' => &$curY,
'nexY' => &$nexY,
'pdf' =>& $pdf,
'curY' =>& $curY,
'nexY' =>& $nexY,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails
);
@ -1204,13 +1204,13 @@ class pdf_sponge extends ModelePDFFactures
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0);
$posy = $pdf->GetY() + 1;
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
{
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
{
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
$posy = $pdf->GetY() + 2;
}
}
}
if ($conf->global->FACTURE_CHQ_NUMBER == -1)
{
@ -1219,13 +1219,13 @@ class pdf_sponge extends ModelePDFFactures
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0);
$posy = $pdf->GetY() + 1;
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
{
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
{
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
$posy = $pdf->GetY() + 2;
}
}
}
}
}
@ -1267,10 +1267,10 @@ class pdf_sponge extends ModelePDFFactures
{
global $conf, $mysoc, $hookmanager;
$sign = 1;
if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1;
$sign = 1;
if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$default_font_size = pdf_getPDFFontSize($outputlangs);
$tab2_top = $posy;
$tab2_hl = 4;
@ -1311,10 +1311,10 @@ class pdf_sponge extends ModelePDFFactures
}
if (!empty($i)) {
$avancementGlobal = $percent / $i;
$avancementGlobal = $percent / $i;
}
else {
$avancementGlobal = 0;
$avancementGlobal = 0;
}
$object->fetchPreviousNextSituationInvoice();
@ -1323,98 +1323,98 @@ class pdf_sponge extends ModelePDFFactures
$total_a_payer = 0;
$total_a_payer_ttc = 0;
foreach ($TPreviousIncoice as &$fac) {
$total_a_payer += $fac->total_ht;
$total_a_payer_ttc += $fac->total_ttc;
$total_a_payer += $fac->total_ht;
$total_a_payer_ttc += $fac->total_ttc;
}
$total_a_payer += $object->total_ht;
$total_a_payer_ttc += $object->total_ttc;
if (!empty($avancementGlobal)) {
$total_a_payer = $total_a_payer * 100 / $avancementGlobal;
$total_a_payer_ttc = $total_a_payer_ttc * 100 / $avancementGlobal;
$total_a_payer = $total_a_payer * 100 / $avancementGlobal;
$total_a_payer_ttc = $total_a_payer_ttc * 100 / $avancementGlobal;
}
else {
$total_a_payer = 0;
$total_a_payer_ttc = 0;
$total_a_payer = 0;
$total_a_payer_ttc = 0;
}
$i = 1;
if (!empty($TPreviousIncoice)) {
$pdf->setY($tab2_top);
$posy = $pdf->GetY();
$pdf->setY($tab2_top);
$posy = $pdf->GetY();
foreach ($TPreviousIncoice as &$fac) {
if ($posy > $this->page_hauteur - 4) {
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$pdf->addPage();
$pdf->setY($this->marge_haute);
$posy = $pdf->GetY();
}
foreach ($TPreviousIncoice as &$fac) {
if ($posy > $this->page_hauteur - 4) {
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$pdf->addPage();
$pdf->setY($this->marge_haute);
$posy = $pdf->GetY();
}
// cumul TVA précédent
$index++;
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
// cumul TVA précédent
$index++;
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $posy);
$pdf->SetXY($col2x, $posy);
$facSign = '';
if ($i > 1) {
$facSign = $fac->total_ht >= 0 ? '+' : '';
}
$facSign = '';
if ($i > 1) {
$facSign = $fac->total_ht >= 0 ? '+' : '';
}
$displayAmount = ' '.$facSign.' '.price($fac->total_ht, 0, $outputlangs);
$displayAmount = ' '.$facSign.' '.price($fac->total_ht, 0, $outputlangs);
$pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1);
$i++;
$posy += $tab2_hl;
$i++;
$posy += $tab2_hl;
$pdf->setY($posy);
}
$pdf->setY($posy);
}
// Display current total
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
// Display current total
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $posy);
$facSign = '';
if ($i > 1) {
$facSign = $object->total_ht >= 0 ? '+' : ''; // management of a particular customer case
}
$pdf->SetXY($col2x, $posy);
$facSign = '';
if ($i > 1) {
$facSign = $object->total_ht >= 0 ? '+' : ''; // management of a particular customer case
}
if ($fac->type === facture::TYPE_CREDIT_NOTE) {
$facSign = '-'; // les avoirs
}
if ($fac->type === facture::TYPE_CREDIT_NOTE) {
$facSign = '-'; // les avoirs
}
$displayAmount = ' '.$facSign.' '.price($object->total_ht, 0, $outputlangs);
$pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1);
$displayAmount = ' '.$facSign.' '.price($object->total_ht, 0, $outputlangs);
$pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1);
$posy += $tab2_hl;
$posy += $tab2_hl;
// Display all total
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", $avancementGlobal), 0, 'L', 1);
// Display all total
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", $avancementGlobal), 0, 'L', 1);
$pdf->SetXY($col2x, $posy);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer * $avancementGlobal / 100, 0, $outputlangs), 0, 'R', 1);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($col2x, $posy);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer * $avancementGlobal / 100, 0, $outputlangs), 0, 'R', 1);
$pdf->SetFont('', '', $default_font_size - 2);
$posy += $tab2_hl;
$posy += $tab2_hl;
if ($posy > $this->page_hauteur - 4) {
$pdf->addPage();
$pdf->setY($this->marge_haute);
$posy = $pdf->GetY();
}
if ($posy > $this->page_hauteur - 4) {
$pdf->addPage();
$pdf->setY($this->marge_haute);
$posy = $pdf->GetY();
}
$tab2_top = $posy;
$index = 0;
$tab2_top = $posy;
$index = 0;
}
$tab2_top += 3;
@ -1425,30 +1425,30 @@ class pdf_sponge extends ModelePDFFactures
// Total remise
$total_line_remise = 0;
foreach ($object->lines as $i => $line) {
$total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this methode to core/lib/pdf.lib
// Gestion remise sous forme de ligne négative
if ($line->total_ht < 0) $total_line_remise += -$line->total_ht;
$total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this methode to core/lib/pdf.lib
// Gestion remise sous forme de ligne négative
if ($line->total_ht < 0) $total_line_remise += -$line->total_ht;
}
if ($total_line_remise > 0) {
if (!empty($conf->global->MAIN_SHOW_AMOUNT_DISCOUNT)) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
if (!empty($conf->global->MAIN_SHOW_AMOUNT_DISCOUNT)) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
$index++;
}
// Show total NET before discount
if (!empty($conf->global->MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT)) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
$index++;
}
// Show total NET before discount
if (!empty($conf->global->MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT)) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
$index++;
}
$index++;
}
}
// Total HT
@ -1475,7 +1475,7 @@ class pdf_sponge extends ModelePDFFactures
}
else
{
// FIXME amount of vat not supported with multicurrency
// FIXME amount of vat not supported with multicurrency
//Local tax 1 before VAT
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
@ -1510,7 +1510,7 @@ class pdf_sponge extends ModelePDFFactures
}
}
}
//}
//}
//Local tax 2 before VAT
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
//{
@ -1543,7 +1543,7 @@ class pdf_sponge extends ModelePDFFactures
}
}
}
//}
//}
// VAT
// Situations totals migth be wrong on huge amounts
@ -1554,13 +1554,13 @@ class pdf_sponge extends ModelePDFFactures
}
if ($sum_pdf_tva != $object->total_tva) { // apply coef to recover the VAT object amount (the good one)
if (!empty($sum_pdf_tva))
{
if (!empty($sum_pdf_tva))
{
$coef_fix_tva = $object->total_tva / $sum_pdf_tva;
}
else {
$coef_fix_tva = 1;
}
}
else {
$coef_fix_tva = 1;
}
foreach ($this->tva as $tvakey => $tvaval) {
@ -1626,7 +1626,7 @@ class pdf_sponge extends ModelePDFFactures
}
}
}
//}
//}
//Local tax 2 after VAT
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
//{
@ -1636,7 +1636,7 @@ class pdf_sponge extends ModelePDFFactures
foreach ($localtax_rate as $tvakey => $tvaval)
{
// retrieve global local tax
// retrieve global local tax
if ($tvakey != 0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
@ -1685,66 +1685,35 @@ class pdf_sponge extends ModelePDFFactures
$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
if (!empty($object->situation_final) && ($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty))))
if ($object->displayRetainedWarranty())
{
$displayWarranty = false;
$pdf->SetTextColor(40, 40, 40);
$pdf->SetFillColor(255, 255, 255);
// 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;
}
}
}
$retainedWarranty = $object->getRetainedWarrantyAmount();
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty;
if ($displayWarranty) {
$pdf->SetTextColor(40, 40, 40);
$pdf->SetFillColor(255, 255, 255);
// Billed - retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
$retainedWarranty = $total_a_payer_ttc * $object->retained_warranty / 100;
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
// Billed - retained warranty
$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);
// retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
$retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)';
$retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : '';
// retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty").' ('.$object->retained_warranty.'%)';
$retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : '';
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
}
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
}
}
}
@ -1878,7 +1847,7 @@ class pdf_sponge extends ModelePDFFactures
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
if (empty($hidetop)) {
$pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter
$pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter
}
}
@ -1906,9 +1875,9 @@ class pdf_sponge extends ModelePDFFactures
// Show Draft Watermark
if ($object->statut == Facture::STATUS_DRAFT && (!empty($conf->global->FACTURE_DRAFT_WATERMARK)))
{
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK);
}
{
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK);
}
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
@ -1916,7 +1885,7 @@ class pdf_sponge extends ModelePDFFactures
$w = 110;
$posy = $this->marge_haute;
$posx = $this->page_largeur - $this->marge_droite - $w;
$posx = $this->page_largeur - $this->marge_droite - $w;
$pdf->SetXY($this->marge_gauche, $posy);
@ -1936,7 +1905,7 @@ class pdf_sponge extends ModelePDFFactures
}
if (is_readable($logo))
{
$height = pdf_getHeightForLogo($logo);
$height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
}
else
@ -2088,16 +2057,16 @@ class pdf_sponge extends ModelePDFFactures
// Get contact
if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP))
{
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
if (count($arrayidcontact) > 0)
{
$usertmp = new User($this->db);
$usertmp->fetch($arrayidcontact[0]);
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $langs->transnoentities("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
}
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
if (count($arrayidcontact) > 0)
{
$usertmp = new User($this->db);
$usertmp->fetch($arrayidcontact[0]);
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $langs->transnoentities("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
}
}
$posy += 1;
@ -2203,7 +2172,7 @@ class pdf_sponge extends ModelePDFFactures
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
*
* @param PDF $pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
@ -2222,28 +2191,28 @@ class pdf_sponge extends ModelePDFFactures
*
* @param object $object common object
* @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return null
*/
public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $conf, $hookmanager;
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return null
*/
public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $conf, $hookmanager;
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
$this->defaultTitlesFieldsStyle = array(
'align' => 'C', // R,C,L
'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
$this->defaultTitlesFieldsStyle = array(
'align' => 'C', // R,C,L
'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
/*
/*
* For exemple
$this->cols['theColKey'] = array(
'rank' => $rank, // int : use for ordering columns
@ -2261,165 +2230,165 @@ class pdf_sponge extends ModelePDFFactures
);
*/
$rank = 0; // do not use negative rank
$this->cols['desc'] = array(
'rank' => $rank,
'width' => false, // only for desc
'status' => true,
'title' => array(
'textkey' => 'Designation', // use lang key is usefull in somme case with module
'align' => 'L',
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
// 'label' => ' ', // the final label
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'content' => array(
'align' => 'L',
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);
$rank = 0; // do not use negative rank
$this->cols['desc'] = array(
'rank' => $rank,
'width' => false, // only for desc
'status' => true,
'title' => array(
'textkey' => 'Designation', // use lang key is usefull in somme case with module
'align' => 'L',
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
// 'label' => ' ', // the final label
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'content' => array(
'align' => 'L',
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);
// PHOTO
$rank = $rank + 10;
$this->cols['photo'] = array(
'rank' => $rank,
'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH), // in mm
'status' => false,
'title' => array(
'textkey' => 'Photo',
'label' => ' '
),
'content' => array(
'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'border-left' => false, // remove left line separator
);
// PHOTO
$rank = $rank + 10;
$this->cols['photo'] = array(
'rank' => $rank,
'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH), // in mm
'status' => false,
'title' => array(
'textkey' => 'Photo',
'label' => ' '
),
'content' => array(
'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'border-left' => false, // remove left line separator
);
if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE) && !empty($this->atleastonephoto))
{
$this->cols['photo']['status'] = true;
}
if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE) && !empty($this->atleastonephoto))
{
$this->cols['photo']['status'] = true;
}
$rank = $rank + 10;
$this->cols['vat'] = array(
'rank' => $rank,
'status' => false,
'width' => 16, // in mm
'title' => array(
'textkey' => 'VAT'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['vat'] = array(
'rank' => $rank,
'status' => false,
'width' => 16, // in mm
'title' => array(
'textkey' => 'VAT'
),
'border-left' => true, // add left line separator
);
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
{
$this->cols['vat']['status'] = true;
}
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
{
$this->cols['vat']['status'] = true;
}
$rank = $rank + 10;
$this->cols['subprice'] = array(
'rank' => $rank,
'width' => 19, // in mm
'status' => true,
'title' => array(
'textkey' => 'PriceUHT'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['subprice'] = array(
'rank' => $rank,
'width' => 19, // in mm
'status' => true,
'title' => array(
'textkey' => 'PriceUHT'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['qty'] = array(
'rank' => $rank,
'width' => 16, // in mm
'status' => true,
'title' => array(
'textkey' => 'Qty'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['qty'] = array(
'rank' => $rank,
'width' => 16, // in mm
'status' => true,
'title' => array(
'textkey' => 'Qty'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['progress'] = array(
'rank' => $rank,
'width' => 19, // in mm
'status' => false,
'title' => array(
'textkey' => 'Progress'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['progress'] = array(
'rank' => $rank,
'width' => 19, // in mm
'status' => false,
'title' => array(
'textkey' => 'Progress'
),
'border-left' => true, // add left line separator
);
if ($this->situationinvoice)
{
$this->cols['progress']['status'] = true;
}
if ($this->situationinvoice)
{
$this->cols['progress']['status'] = true;
}
$rank = $rank + 10;
$this->cols['unit'] = array(
'rank' => $rank,
'width' => 11, // in mm
'status' => false,
'title' => array(
'textkey' => 'Unit'
),
'border-left' => true, // add left line separator
);
if ($conf->global->PRODUCT_USE_UNITS) {
$this->cols['unit']['status'] = true;
}
$rank = $rank + 10;
$this->cols['unit'] = array(
'rank' => $rank,
'width' => 11, // in mm
'status' => false,
'title' => array(
'textkey' => 'Unit'
),
'border-left' => true, // add left line separator
);
if ($conf->global->PRODUCT_USE_UNITS) {
$this->cols['unit']['status'] = true;
}
$rank = $rank + 10;
$this->cols['discount'] = array(
'rank' => $rank,
'width' => 13, // in mm
'status' => false,
'title' => array(
'textkey' => 'ReductionShort'
),
'border-left' => true, // add left line separator
);
if ($this->atleastonediscount) {
$this->cols['discount']['status'] = true;
}
$rank = $rank + 10;
$this->cols['discount'] = array(
'rank' => $rank,
'width' => 13, // in mm
'status' => false,
'title' => array(
'textkey' => 'ReductionShort'
),
'border-left' => true, // add left line separator
);
if ($this->atleastonediscount) {
$this->cols['discount']['status'] = true;
}
$rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100
$this->cols['totalexcltax'] = array(
'rank' => $rank,
'width' => 26, // in mm
'status' => true,
'title' => array(
'textkey' => 'TotalHT'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100
$this->cols['totalexcltax'] = array(
'rank' => $rank,
'width' => 26, // in mm
'status' => true,
'title' => array(
'textkey' => 'TotalHT'
),
'border-left' => true, // add left line separator
);
// Add extrafields cols
if (!empty($object->lines)) {
$line = reset($object->lines);
$this->defineColumnExtrafield($line, $outputlangs, $hidedetails);
}
// Add extrafields cols
if (!empty($object->lines)) {
$line = reset($object->lines);
$this->defineColumnExtrafield($line, $outputlangs, $hidedetails);
}
$parameters = array(
'object' => $object,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'hidedesc' => $hidedesc,
'hideref' => $hideref
);
$parameters = array(
'object' => $object,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'hidedesc' => $hidedesc,
'hideref' => $hideref
);
$reshook = $hookmanager->executeHooks('defineColumnField', $parameters, $this); // Note that $object may have been modified by hook
if ($reshook < 0)
{
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
elseif (empty($reshook))
{
$this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys
}
else
{
$this->cols = $hookmanager->resArray;
}
$reshook = $hookmanager->executeHooks('defineColumnField', $parameters, $this); // Note that $object may have been modified by hook
if ($reshook < 0)
{
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
elseif (empty($reshook))
{
$this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys
}
else
{
$this->cols = $hookmanager->resArray;
}
}
}

View File

@ -1,5 +1,7 @@
<?php
print '<!-- extrafields_list_search_input.tpl.php -->'."\n";
// Protection to avoid direct call of template
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+... -->
<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" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
<input type="submit" class="button buttongen marginbottomonly" id="savelinebutton marginbottomonly" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
<input type="submit" class="button buttongen marginbottomonly" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
</td>
</tr>

View File

@ -151,7 +151,7 @@ class InterfaceLogevents extends DolibarrTriggers
}
// Groupes
elseif ($action == 'GROUP_CREATE')
elseif ($action == 'USERGROUP_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
@ -159,7 +159,7 @@ class InterfaceLogevents extends DolibarrTriggers
$text = $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);
$langs->load("users");
@ -167,7 +167,7 @@ class InterfaceLogevents extends DolibarrTriggers
$text = $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);
$langs->load("users");

View File

@ -269,7 +269,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
}
// Groupes
elseif ($action == 'GROUP_CREATE')
elseif ($action == 'USERGROUP_CREATE')
{
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')
@ -293,7 +293,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
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);
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;
}
}
elseif ($action == 'GROUP_DELETE')
elseif ($action == 'USERGROUP_DELETE')
{
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')

View File

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

View File

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

View File

@ -729,7 +729,7 @@ class Fichinter extends CommonObject
*/
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
@ -783,7 +783,7 @@ class Fichinter extends CommonObject
$label = '<u>'.$langs->trans("ShowIntervention").'</u>';
$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);
}

View File

@ -57,11 +57,12 @@ if ($user->socid > 0)
$fichinterstatic = new Fichinter($db);
$form = new Form($db);
$formfile = new FormFile($db);
$help_url = "EN:ModuleFichinters|FR:Module_Fiche_Interventions|ES:Módulo_FichaInterventiones";
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">';

View File

@ -202,7 +202,7 @@ foreach ($arrayfields as $tmpkey => $tmpval)
}
$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,";
$sql .= " s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus";
if (!empty($conf->projet->enabled)) {
@ -249,7 +249,7 @@ if ($search_desc) {
else $sql .= natural_search(array('f.description'), $search_desc);
}
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))
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
@ -476,7 +476,8 @@ if ($resql)
$objectstatic->id = $obj->rowid;
$objectstatic->ref = $obj->ref;
$objectstatic->statut = $obj->fk_statut;
$objectstatic->statut = $obj->status;
$objectstatic->status = $obj->status;
$companystatic->name = $obj->name;
$companystatic->id = $obj->socid;
@ -587,7 +588,7 @@ if ($resql)
// Status
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']++;
}
// Fields of detail of line

View File

@ -1057,7 +1057,8 @@ class ProductFournisseur extends Product
$label = '<u>'.$langs->trans("SupplierRef").'</u>';
$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
if (is_array($logPrices) && count($logPrices) > 0) {
@ -1095,7 +1096,7 @@ class ProductFournisseur extends Product
$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 != 2) $result .= $this->fourn_ref;
if ($withpicto != 2) $result .= $this->ref.($this->ref_supplier ? ' ('.$this->ref_supplier.')' : '');
$result .= $linkend;
//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;
clip-path: inset(50%) !important;
height: 1px !important;
margin: -1px !important;
overflow: hidden !important;
padding: 0 !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,17 +152,18 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
// Class file containing the method load_state_board for each line
$includes = array(
DOL_DOCUMENT_ROOT."/user/class/user.class.php",
DOL_DOCUMENT_ROOT."/societe/class/client.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."/fourn/class/fournisseur.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."/comm/propal/class/propal.class.php",
DOL_DOCUMENT_ROOT."/commande/class/commande.class.php",
DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",
DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
DOL_DOCUMENT_ROOT."/don/class/don.class.php",
DOL_DOCUMENT_ROOT."/contrat/class/contrat.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.facture.class.php",
@ -170,116 +171,119 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
DOL_DOCUMENT_ROOT."/projet/class/project.class.php",
DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.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"
);
// Name class containing the method load_state_board for each line
$classes = array('User',
'Client',
'Client',
'Fournisseur',
'Contact',
'Adherent',
'Product',
'Product',
'Propal',
'Commande',
'Facture',
'Contrat',
'Fichinter',
'CommandeFournisseur',
'FactureFournisseur',
'SupplierProposal',
'Project',
'ExpenseReport',
'Holiday',
'Don',
'Ticket',
$classes = array(
'User',
'Adherent',
'Client',
'Client',
'Fournisseur',
'Contact',
'Product',
'Product',
'Propal',
'Commande',
'Facture',
'Don',
'Contrat',
'Fichinter',
'CommandeFournisseur',
'FactureFournisseur',
'SupplierProposal',
'Project',
'ExpenseReport',
'Holiday',
'Ticket',
);
// Cle array returned by the method load_state_board for each line
$keys = array('users',
'customers',
'prospects',
'suppliers',
'contacts',
'members',
'products',
'services',
'proposals',
'orders',
'invoices',
'contracts',
'interventions',
'supplier_orders',
'supplier_invoices',
'askprice',
'projects',
'expensereports',
'holidays',
'donations',
'ticket'
$keys = array(
'users',
'members',
'customers',
'prospects',
'suppliers',
'contacts',
'products',
'services',
'proposals',
'orders',
'invoices',
'donations',
'contracts',
'interventions',
'supplier_orders',
'supplier_invoices',
'askprice',
'projects',
'expensereports',
'holidays',
'ticket'
);
// Dashboard Icon lines
$icons = array('user',
'company',
'company',
'company',
'contact',
'user',
'product',
'service',
'propal',
'order',
'bill',
'contract',
'intervention',
'order',
'bill',
'propal',
'projectpub',
'trip',
'holiday',
'generic',
'ticket',
$icons = array(
'user',
'user',
'company',
'company',
'company',
'contact',
'product',
'service',
'propal',
'order',
'bill',
'generic',
'contract',
'intervention',
'order',
'bill',
'propal',
'project',
'trip',
'holiday',
'ticket',
);
// Translation keyword
$titres = array("Users",
"ThirdPartyCustomersStats",
"ThirdPartyProspectsStats",
"Suppliers",
"Contacts",
"Members",
"Products",
"Services",
"CommercialProposalsShort",
"CustomersOrders",
"BillsCustomers",
"Contracts",
"Interventions",
"SuppliersOrders",
"SuppliersInvoices",
"SupplierProposalShort",
"Projects",
"ExpenseReports",
"Holidays",
"Donations",
"Ticket",
$titres = array(
"Users",
"Members",
"ThirdPartyCustomersStats",
"ThirdPartyProspectsStats",
"Suppliers",
"Contacts",
"Products",
"Services",
"CommercialProposalsShort",
"CustomersOrders",
"BillsCustomers",
"Donations",
"Contracts",
"Interventions",
"SuppliersOrders",
"SuppliersInvoices",
"SupplierProposalShort",
"Projects",
"ExpenseReports",
"Holidays",
"Ticket",
);
// Dashboard Link lines
$links = array(
DOL_URL_ROOT.'/user/list.php',
DOL_URL_ROOT.'/societe/list.php?type=c&mainmenu=companies',
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=p&mainmenu=companies',
DOL_URL_ROOT.'/societe/list.php?type=f&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=1&mainmenu=products',
DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals',
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.'/contrat/list.php?mainmenu=commercial&leftmenu=contracts',
DOL_URL_ROOT.'/don/list.php?leftmenu=donations',
DOL_URL_ROOT.'/contrat/list.php?mainmenu=commercial&leftmenu=contracts',
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/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills',
@ -287,23 +291,23 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
DOL_URL_ROOT.'/projet/list.php?mainmenu=project',
DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport',
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'
);
// Translation lang files
$langfile = array(
"users",
"companies",
"members",
"companies",
"prospects",
"suppliers",
"companies",
"members",
"products",
"products",
"propal",
"orders",
"bills",
"contracts",
"donations",
"contracts",
"interventions",
"bills",
"bills",
@ -311,7 +315,6 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
"projects",
"trips",
"holiday",
"donations",
"ticket"
);
@ -588,7 +591,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
'groupName' => 'Members',
'globalStatsKey' => 'members',
'stats' =>
array('member_shift', 'member_expired'),
array('member_shift', 'member_expired'),
),
'ExpenseReport' =>
array(
@ -721,7 +724,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$openedDashBoard .= '<div class="box-flex-item">'."\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";
// 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)) {
$boxstat .= '<!-- Database statistics -->'."\n";
$boxstat .= '<div class="box">';
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">';
$boxstat .= '<tr class="liste_titre">';

View File

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

View File

@ -45,6 +45,11 @@ UPDATE llx_accounting_system SET fk_country = NULL, active = 0 WHERE pcg_version
-- 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';
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 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_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 fk_user_creat 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_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
ALTER TABLE llx_stock_mouvement ADD fk_origin integer;
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_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
UseSituationInvoicesCreditNote=Allow situation invoice credit note
Retainedwarranty=Retained warranty
AllowedInvoiceForRetainedWarranty=Retained warranty usable on the following types of invoices
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
RetainedWarranty=Retained Warranty

View File

@ -446,6 +446,7 @@ SaleRepresentativeFirstname=First 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.
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
PaymentTypeCustomer=Payment Type - 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>'
ErrorFailedToUpdateLink= Failed to update link '<b>%s</b>'
URLToLink=URL to link
OverwriteIfExists=Overwrite file if exists

View File

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

View File

@ -100,11 +100,6 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view';
// Load object
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;
$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
$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

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 (!$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
$search_all = trim(GETPOST("search_all", 'alpha'));
$search = array();
@ -161,6 +151,18 @@ $permissiontoread = $user->rights->mymodule->myobject->read;
$permissiontoadd = $user->rights->mymodule->myobject->write;
$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

View File

@ -4734,7 +4734,7 @@ class Product extends CommonObject
$op[1] = "-".trim($nbpiece);
$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);
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/stock/class/productlot.class.php';
$langs->load("errors");
$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);
@ -408,13 +408,13 @@ class MouvementStock extends CommonObject
$sql .= " ".($batch ? "'".$batch."'" : "null").", ";
$sql .= " ".($eatby ? "'".$this->db->idate($eatby)."'" : "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 .= " '".$this->db->escape($label)."',";
$sql .= " ".($inventorycode ? "'".$this->db->escape($inventorycode)."'" : "null").",";
$sql .= " '".price2num($price)."',";
$sql .= " '".$fk_origin."',";
$sql .= " '".$origintype."',";
$sql .= " ".price2num($price).",";
$sql .= " ".$fk_origin.",";
$sql .= " '".$this->db->escape($origintype)."',";
$sql .= " ".$fk_project;
$sql .= ")";
@ -438,7 +438,7 @@ class MouvementStock extends CommonObject
$oldpmp = $product->pmp;
$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;
if (!$error)
{
@ -486,7 +486,7 @@ class MouvementStock extends CommonObject
}
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;
}
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.= " 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
$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 .= " WHERE rowid = ".$fk_product;

View File

@ -1046,9 +1046,12 @@ class Project extends CommonObject
$result = '';
$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('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))
$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))

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
$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 .= ", s.rowid as socid, s.nom as name, s.email";
$sql .= ", cls.code as opp_status_code";
@ -713,7 +713,9 @@ while ($i < min($num, $limit))
$object->public = $obj->public;
$object->ref = $obj->ref;
$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->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
*/
public $picto = 'propal';
public $picto = 'supplier_proposal';
/**
* 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)
{
return $this->LibStatut($this->statut, $mode);
return $this->LibStatut((isset($this->statut) ? $this->statut : $this->status), $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -2555,17 +2555,16 @@ class SupplierProposal extends CommonObject
$url = '';
$result = '';
$label = '<u>'.$langs->trans("ShowSupplierProposal").'</u>';
if (!empty($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->total_ht))
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
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_ttc))
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
$label = '<u>'.$langs->trans("SupplierProposal").'</u>';
if (!empty($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->total_ht)) $label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
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_ttc)) $label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
if (isset($this->status)) {
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
}
if ($option == '') {
$url = DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$this->id.$get_params;
}
@ -2597,8 +2596,6 @@ class SupplierProposal extends CommonObject
$linkstart .= $linkclose.'>';
$linkend = '</a>';
$picto = 'supplier_proposal';
$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 != 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 .= " typent.code as typent_code,";
$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.datec as date_creation, sp.tms as date_update,';
$sql .= " p.rowid as project_id, p.ref as project_ref,";
@ -695,6 +695,13 @@ if ($resql)
$objectstatic->ref = $obj->ref;
$objectstatic->note_public = $obj->note_public;
$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">';
@ -728,14 +735,6 @@ if ($resql)
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
if (!empty($arrayfields['s.nom']['checked']))
{
@ -901,7 +900,7 @@ if ($resql)
// Status
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']++;
}

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>';
?>
</a></div>
<!-- section for customer and open sales -->
<div class="inline-block valignmiddle" id="customerandsales">
</div>
<!-- More info about customer -->
<div class="inline-block valignmiddle" id="moreinfo"></div>
<div class="inline-block valignmiddle" id="infowarehouse"></div>
</div>

View File

@ -733,7 +733,7 @@ function DolibarrTakeposPrinting(id) {
$( document ).ready(function() {
console.log("Set customer info in header");
console.log("Set customer info and sales in header");
<?php
$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
$sql = "SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX."facture";
@ -752,12 +754,13 @@ $( document ).ready(function() {
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
echo '$("#customerandsales").append(\'';
if ($placeid == $obj->rowid) echo "<b>";
echo '<a class="valignmiddle" onclick="place=\\\'';
$num_sale = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
echo $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>";
echo '</a>\');';
}
@ -787,7 +790,7 @@ $( document ).ready(function() {
<?php
// Module Adherent
$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">';
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))
{
print '<!-- Show lines of invoices -->'."\n";
$tmplines = array_reverse($invoice->lines);
foreach ($tmplines as $line)
{
@ -990,11 +994,14 @@ if ($placeid > 0)
else $htmlforlines .= img_object('', 'service').' ';
}
if (empty($conf->global->TAKEPOS_SHOW_N_FIRST_LINES)) {
$tooltiptext = '<b>'.$langs->trans("Ref").'</b> : '.$line->product_ref.'<br>';
$tooltiptext .= '<b>'.$langs->trans("Label").'</b> : '.$line->product_label.'<br>';
if ($line->product_label != $line->desc) {
if ($line->desc) $tooltiptext .= '<br>';
$tooltiptext .= $line->desc;
$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>';
if ($line->product_label != $line->desc) {
if ($line->desc) $tooltiptext .= '<br>';
$tooltiptext .= $line->desc;
}
}
$htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : ($line->product_ref ? $line->product_ref : dolGetFirstLineOfText($line->desc, 1)), $tooltiptext);
} else {

View File

@ -1695,8 +1695,8 @@ div.statusrefbis {
}
img.photoref, div.photoref {
/* 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);
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 5px rgba(0, 0, 0, 0.2);
padding: 4px;
height: 80px;
width: 80px;

View File

@ -204,35 +204,35 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
opacity: 0.95;
}
.bg-infoxbox-project{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#6c6a98', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
.bg-infobox-project{
<?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;
}
.bg-infoxbox-propal,
.bg-infoxbox-facture,
.bg-infoxbox-commande{
.bg-infobox-propal,
.bg-infobox-facture,
.bg-infobox-commande{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#99a17d', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
}
.bg-infoxbox-supplier_proposal,
.bg-infoxbox-invoice_supplier,
.bg-infoxbox-order_supplier{
.bg-infobox-supplier_proposal,
.bg-infobox-invoice_supplier,
.bg-infobox-order_supplier{
<?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;
}
.bg-infoxbox-bank_account{
.bg-infobox-bank_account{
<?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;
}
.bg-infoxbox-expensereport{
.bg-infobox-expensereport{
<?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;
}
@ -242,7 +242,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
}
.fa-dol-propal:before,
.fa-dol-supplier_proposal:before {
content: "\f2b5";
content: "\f573";
}
.fa-dol-facture: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 (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;
}
.bg-infoxbox-action i.fa{
.bg-infobox-action i.fa{
color: <?php print colorAgressiveness('#d84b80', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
}
.bg-infoxbox-propal i.fa,
.bg-infoxbox-facture i.fa,
.bg-infoxbox-commande i.fa{
.bg-infobox-propal i.fa,
.bg-infobox-facture i.fa,
.bg-infobox-commande i.fa{
color: <?php print colorAgressiveness('#abb87b', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
}
.bg-infoxbox-supplier_proposal i.fa,
.bg-infoxbox-invoice_supplier i.fa,
.bg-infoxbox-order_supplier i.fa{
.bg-infobox-supplier_proposal i.fa,
.bg-infobox-invoice_supplier i.fa,
.bg-infobox-order_supplier i.fa{
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;
}
.bg-infoxbox-bank_account i.fa{
.bg-infobox-bank_account i.fa{
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;
}
.bg-infoxbox-expensereport i.fa{
.bg-infobox-expensereport i.fa{
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;
}

View File

@ -2808,7 +2808,7 @@ class Ticket extends CommonObject
$clause = " AND";
}
$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;
$resql = $this->db->query($sql);

View File

@ -1618,7 +1618,9 @@ else
// Hierarchy
print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</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 {
$huser = new User($db);
$huser->fetch($object->fk_user);
@ -1993,6 +1995,8 @@ else
if ($canreadgroup)
{
print '<!-- Group section -->'."\n";
print load_fiche_titre($langs->trans("ListOfGroupsForUser"), '', '');
// 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 ' &nbsp; ';
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";
/*
* Groups assigned to user
*/
// List of groups of user
if (!empty($groupslist))
{
foreach ($groupslist as $group)
@ -2046,7 +2048,7 @@ else
print '<td>';
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
{
@ -2085,7 +2087,7 @@ else
}
/*
* Fiche en mode edition
* Card in edit mode
*/
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 $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
@ -125,47 +150,25 @@ class UserGroup extends CommonObject
{
global $conf;
$sql = "SELECT g.rowid, g.entity, g.nom as name, g.note, g.datec, g.tms as datem";
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
if ($groupname)
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
if (!empty($groupname))
{
$sql .= " WHERE g.nom = '".$this->db->escape($groupname)."'";
$result = $this->fetchCommon(0, '', ' AND nom = \''.$this->db->escape($groupname).'\'');
}
else
{
$sql .= " WHERE g.rowid = ".$id;
$result = $this->fetchCommon($id);
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
$this->name = $this->nom; // For compatibility with field name
if($result)
{
if ($this->db->num_rows($result))
if ($load_members)
{
$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 ($load_members)
$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->members = $this->listUsersForGroup();
}
$this->db->free($result);
return 1;
}
else
@ -403,7 +406,7 @@ class UserGroup extends CommonObject
$this->context = array('audit'=>$langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : ''));
// Call trigger
$result = $this->call_trigger('GROUP_MODIFY', $user);
$result = $this->call_trigger('USERGROUP_MODIFY', $user);
if ($result < 0) { $error++; }
// End call triggers
}
@ -527,7 +530,7 @@ class UserGroup extends CommonObject
$this->context = array('audit'=>$langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : ''));
// Call trigger
$result = $this->call_trigger('GROUP_MODIFY', $user);
$result = $this->call_trigger('USERGROUP_MODIFY', $user);
if ($result < 0) { $error++; }
// End call triggers
}
@ -637,50 +640,7 @@ class UserGroup extends CommonObject
*/
public function delete(User $user)
{
global $conf, $langs;
$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;
}
return $this->deleteCommon($user);
}
/**
@ -691,67 +651,15 @@ class UserGroup extends CommonObject
*/
public function create($notrigger = 0)
{
global $user, $conf, $langs, $hookmanager;
global $user, $conf;
$error = 0;
$now = dol_now();
$this->datec = dol_now();
if (!isset($this->entity)) $this->entity = $conf->entity; // If not defined, we use default value
$entity = $this->entity;
if (!empty($conf->multicompany->enabled) && $conf->entity == 1) $entity = $this->entity;
$this->db->begin();
$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;
}
return $this->createCommon($user, $notrigger);
}
/**
@ -762,9 +670,7 @@ class UserGroup extends CommonObject
*/
public function update($notrigger = 0)
{
global $user, $conf, $langs, $hookmanager;
$error = 0;
global $user, $conf;
$entity = $conf->entity;
if (!empty($conf->multicompany->enabled) && $conf->entity == 1)
@ -772,55 +678,7 @@ class UserGroup extends CommonObject
$entity = $this->entity;
}
$this->db->begin();
$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;
}
return $this->updateCommon($user, $notrigger);
}

View File

@ -54,6 +54,7 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'groupcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$userid = GETPOST('user', 'int');
@ -67,16 +68,14 @@ if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->
}
$object = new Usergroup($db);
if ($id > 0)
{
$object->fetch($id);
$object->getrights();
}
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$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
$hookmanager->initHooks(array('groupcard', 'globalcard'));
@ -91,19 +90,19 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
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 (!empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
else
{
header("Location: ".DOL_URL_ROOT.'/user/group/list.php');
exit;
}
$action = '';
header("Location: ".$backtopage);
exit;
}
// Action remove group
@ -215,7 +214,7 @@ if (empty($reshook)) {
$object->oldcopy = clone $object;
$object->name = trim(GETPOST("group", 'nohtml'));
$object->name = trim(GETPOST("nom", 'nohtml'));
$object->nom = $object->name; // For backward compatibility
$object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'none')));
@ -273,14 +272,11 @@ if ($action == 'create')
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head('', '', '', 0, '');
print '<table class="border centpercent">';
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>';
print '<table class="border centpercent tableforfieldcreate">';
// Multicompany
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>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('note', '', '', 240, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%');
$doleditor->Create();
print "</td></tr>\n";
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
// Other attributes
$parameters = array('object' => $object);
$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');
}
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
print "</table>\n";
print "</table>\n";
dol_fiche_end();
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 '<input class="button" value="'.$langs->trans("Cancel").'" name="cancel" type="submit">';
print '</div>';
@ -335,6 +322,8 @@ else
{
if ($id)
{
$res = $object->fetch_optionals();
$head = group_prepare_head($object);
$title = $langs->trans("Group");
@ -359,6 +348,7 @@ else
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
@ -384,19 +374,20 @@ else
print "</td></tr>\n";
}
// Note
print '<tr><td class="titlefield tdtop">'.$langs->trans("Description").'</td>';
print '<td class="valeur sensiblehtmlcontent"">';
print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note));
print '</td>';
print "</tr>\n";
unset($object->fields['nom']); // Name already displayed in banner
// Common attributes
$keyforbreak = '';
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
// Other attributes
$parameters = array('colspan' => ' colspan="2"');
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print "</table>\n";
print '</div>';
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
@ -407,6 +398,10 @@ else
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)
{
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
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
$exclude = array();
@ -452,7 +447,7 @@ else
print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'maxwidth300');
print ' &nbsp; ';
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 '</table></form>'."\n";
print '<br>';
@ -461,6 +456,7 @@ else
/*
* Group members
*/
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("Login").'</td>';
@ -485,7 +481,7 @@ else
print '</td>';
print '<td>'.$useringroup->lastname.'</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">';
if (!empty($user->admin)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=removeuser&amp;user='.$useringroup->id.'">';
@ -542,53 +538,44 @@ else
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="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');
print '<table class="border centpercent">';
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";
print '<table class="border centpercent tableforfieldedit">'."\n";
// Multicompany
if (!empty($conf->multicompany->enabled) && is_object($mc))
{
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity)
{
print "<tr>".'<td class="tdtop">'.$langs->trans("Entity").'</td>';
print "<td>".$mc->select_entities($object->entity);
print "</td></tr>\n";
}
else
{
// Multicompany
if (!empty($conf->multicompany->enabled) && is_object($mc))
{
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity)
{
print "<tr>".'<td class="tdtop">'.$langs->trans("Entity").'</td>';
print "<td>".$mc->select_entities($object->entity);
print "</td></tr>\n";
}
else
{
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
}
}
}
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
print '<td class="valeur">';
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');
}
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
print "</table>\n";
print '</table>';
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>';
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.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) 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.'/core/lib/usergroups.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
$langs->loadLangs(array('users', 'admin'));
@ -39,9 +40,9 @@ $module = GETPOST('module', 'alpha');
$rights = GETPOST('rights', 'int');
$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);
// Defini si peux modifier les permissions
// Define if user can modify group permissions
$caneditperms = ($user->admin || $user->rights->user->user->creer);
// Advanced permissions
$advancedpermsactive = false;
@ -76,7 +77,12 @@ if (empty($reshook)) {
$editgroup = new Usergroup($db);
$result = $editgroup->fetch($id);
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);
$result = $editgroup->fetch($id);
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)
{
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
$handle = @opendir(dol_osencode($dir));
if (is_resource($handle))
{
@ -130,7 +139,7 @@ if ($object->id > 0)
if ($modName)
{
include_once $dir."/".$file;
include_once $dir.$file;
$objMod = new $modName($db);
// Load all lang files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
@ -154,7 +163,7 @@ if ($object->id > 0)
$db->commit();
// Lecture des droits groupes
// Read permissions of group
$permsgroupbyentity = array();
$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
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 '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>';
if ($caneditperms)
{
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 '<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 class="center" width="24">&nbsp;</td>';
print '<td>'.$langs->trans("Permissions").'</td>';
print '</tr>';
print '</tr>'."\n";
$sql = "SELECT r.id, r.libelle as label, r.module";
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
@ -250,16 +261,15 @@ if ($object->id > 0)
$result = $db->query($sql);
if ($result)
{
$i = 0;
$num = $db->num_rows($result);
$i = 0;
$oldmod = '';
$num = $db->num_rows($result);
while ($i < $num)
{
$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]))
{
$i++;
@ -270,29 +280,37 @@ if ($object->id > 0)
{
$oldmod = $obj->module;
// Rupture detectee, on recupere objMod
// Break detected, we get objMod
$objMod = $modules[$obj->module];
$picto = ($objMod->picto ? $objMod->picto : 'generic');
// Show break line
print '<tr class="oddeven trforbreak">';
print '<td class="nowrap">'.img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName();
print '<a name="'.$objMod->getName().'">&nbsp;</a></td>';
print '<td class="center nowrap">';
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
print '<a name="'.$objMod->getName().'"></a>';
print '</td>';
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 '<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>';
} else {
print '<td>&nbsp;</td>';
}
print '</td>';
print '<td colspan="2">&nbsp;</td>';
print '</tr>';
}
print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n";
print '<tr class="oddeven">';
// Module
print '<td class="nowrap">'.img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName().'</td>';
// Picto and label of module
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
//print img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName();
print '</td>';
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">';
print '<td class="center nowrap">';
print img_picto($langs->trans("Active"), 'tick');
print '</td>';
}
@ -327,15 +345,16 @@ if ($object->id > 0)
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)));
print '<td>'.$perm_libelle.'</td>';
$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 class="maxwidthonsmartphone">'.$permlabel.'</td>';
print '</tr>';
print '</tr>'."\n";
$i++;
}
}
print '</table>';
print '</div>';
print '</div>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.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) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* 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();
// Defini si peux lire les permissions
// Define if user can read permissions
$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);
// Advanced permissions
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
@ -132,10 +132,10 @@ if (empty($reshook)) {
* View
*/
llxHeader('', $langs->trans("Permissions"));
$form = new Form($db);
llxHeader('', $langs->trans("Permissions"));
$head = user_prepare_head($object);
$title = $langs->trans("User");

View File

@ -327,6 +327,8 @@ if ($cancel)
$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
if ($sortfield) $backtopage.='&sortfield='.$sortfield;
if ($sortorder) $backtopage.='&sortorder='.$sortorder;
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
$backtopage = $savbacktopage;
@ -3326,6 +3328,8 @@ if ($action == 'editmeta' || $action == 'createcontainer')
{
$fuser->fetch($pageauthorid);
print $fuser->getNomUrl(1);
} else {
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
}
print '</td></tr>';