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

This commit is contained in:
Regis Houssin 2019-05-20 16:10:47 +02:00
commit 2cf630c213
313 changed files with 7354 additions and 18309 deletions

View File

@ -1,7 +1,8 @@
# EditorConfig is awesome: http://EditorConfig.org
# EditorConfig is awesome: https://editorconfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
@ -11,9 +12,10 @@ insert_final_newline = true
# PHP PSR-2 Coding Standards
# http://www.php-fig.org/psr/psr-2/
[*.php]
indent_style = space
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
[*.js]
indent_style = tab
[*.css]

View File

@ -19,7 +19,7 @@ PHPDebugBar 1.15.0 MIT License Yes Used only by
EvalMath 1.0 BSD Yes Safe math expressions evaluation
Escpos-php ? MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
Mobiledetect 2.8.17 MIT License Yes Detect mobile devices browsers
Mobiledetect 2.8.83 MIT License Yes Detect mobile devices browsers
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
odtPHP 1.0.1 GPL-2+ Yes Library to build/edit ODT files
@ -35,7 +35,7 @@ Restler 3.0.0RC6 LGPL-3+ Yes
TCPDF 6.2.25 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
Stripe 4.7.0 MIT licence Yes Library for Stripe module
Stripe 6.34.5 MIT licence Yes Library for Stripe module
JS libraries:
jQuery 3.3.1 MIT License Yes JS library

View File

@ -112,6 +112,7 @@ NEW: When you create product or service, sell accountancy account by default is
NEW: Widget birthdays of the month.
NEW: Option in workflow module to set a reception billed on validate supplier bill.
NEW: Autocompletion on lists should be available on mobile applications.
NEW: Add mass action to close several members.
For Developers:
NEW: Module "DebugBar" is available as a stable module.
@ -121,7 +122,7 @@ NEW: Add constant XFRAMEOPTIONS_ALLOWALL
NEW: Add function isValidVATID()
NEW: ADD document's product support in APIs
NEW: REST API: get the list of objects in a category.
NEW: Update Stripe library to 6.34.3
NEW: Update Stripe library to 6.35
NEW: Upgrade jquery lib to 3.3.1
NEW: Add hook 'addHtmlHeader()'
NEW: Add hook 'createRecurringInvoices()'
@ -174,6 +175,7 @@ Following changes may create regressions for some external modules, but were nec
* Removed deprecated use of string in dol_print_date(). Only date allowed.
* Deprecated property ->fk_departement is now ->state_id everywhere.
* Removed the method 4 of GETPOST (to get $_COOKIE). It was not used and not recommanded to use in Dolibarr.
* Column llx_facture.facnumber change to llx_facture.ref
***** ChangeLog for 9.0.3 compared to 9.0.2 *****
@ -429,6 +431,90 @@ Following changes may create regressions for some external modules, but were nec
* Remove the no more used and deprecated dol_print_graph function
***** ChangeLog for 8.0.5 compared to 8.0.4 *****
FIX: #10381
FIX: #10460 compatibility with MariaDB 10.4
FIX: #11025
FIX: Accountancy - Add transaction with multicompany use all the time 1st entity
FIX: Accountancy - Format EBP import
FIX: actioncomm export: ORDER BY clause is in wrong export property + event type filter does not work
FIX: actioncomm: sort events by date after external calendars and hook
FIX: action list: add printFieldListSelect and printFieldListWhere hooks
FIX: add fk_unit on addline action
FIX: avoid php warning
FIX: bad sql request
FIX: better method
FIX: better test
FIX: better test on fetch
FIX: broken external authentication module feature and avoid warning
FIX: Can not create contract with numbering module without autogen rule
FIX: can't add lines on invoices
FIX: Can't generate invoice pdf
FIX: Can't insert if there is extrafields mandatory on another entity.
FIX: Can't insert if there is extrafields mandatory on another entity. FIX: Can't set default value of extrafield of type varchar
FIX: Check for old picture name if the new one was not found
FIX: Civility not saved when creating a member.
FIX: $conf->fournisseur->commande->enabled doesn't exist, we must use $conf->fournisseur->enabled
FIX: could not create several superadmin in transversal mode
FIX: credit note can have negative value
FIX: Default value on sales representative on third party creation
FIX: Don't show journal:getNomUrl without data
FIX: Erreur dans le Total
FIX: error messages not displayed
FIX: expedition: reset status on rollback + replace hardcoded status with const
FIX: Fix PHP warning "count(): Parameter must be an array..."
FIX: fk_default_warehouse missing in group by
FIX: function sendEmailsReminder isn't completely developed, then MAIN_FEATURES_LEVEL must be 2 to "use" it
FIX: holidays get natural_search if search params are set only
FIX: if empty error message, we just see "error" displayed
FIX: if(!method_exists(dol_loginfunction))
FIX: If we build one invoice for several orders, we must put the ref of order on the line to not lose information.
FIX: in fact expensereport must be in $check array
FIX: Interface regression for bind people. Fix option MAIN_OPTIMIZEFORTEXTBROWSER
FIX: line edit template: keep fk_parent_line
FIX: Loan impossible to account
FIX: Mark credit note as available for credit note in other currency
FIX: missing access security checking with multicompany
FIX: missing entity filter and wrong var name
FIX: missing entity filter in function "build_filterField()" (export)
FIX: Missing field in import/export of users
FIX: missing hook completeTabsHead in margins module
FIX: missing $ismultientitymanaged for previous/next ref
FIX: Missing province in export of invoice
FIX: multicompany compatibility
FIX: must fetch member in current entity
FIX: need an order by in case we found other invoice with same number but not same date
FIX: need to round with 2 decimals to avoid movements not correctly balanced
FIX: no need to test anything to display documents tabs on expense report
FIX: positive values creating diff on addline rounding
FIX: problem with multicompany transverse mode
FIX: Product accountancey sell intra code must be visible if main feature level 1
FIX: project_title for display of getNomUrl()
FIX: quick search for supplier orders
FIX: Remane of project
FIX: same thing here
FIX: Selection of email recipient with option MAIN_OPTIMIZEFORTEXTBROWSER
FIX: several hooks in shipping/delivery cards
FIX: shipping default warehouse if only one warehouse
FIX: SQL injection on rowid of dict.php
FIX: 'statut' is ignored when updating a user with the REST API.
FIX: supplier invoice payment total dont care about deposit or credit
FIX: supplier invoice product stats total ht is line total not invoice total
FIX: The minimum amount filter does not work in the VAT report per customer
FIX: Total per day shows 00:00 if the total time spent is equal to 12:00
FIX: Update/delete currency on same languages
FIX: [URGENT] broken feature, "$usercancreate" is for Dolibarr 9
FIX: useless join
FIX: we need to keep originline special_code
FIX: we want to be able to reopen fourn credit note
FIX: when 2 extra fields are mandatory in 2 different entities
FIX: when we add a payment on an invoice which already has payments with credit note or deposit amount, and then we get an excess received, discount amount must be $total_paiements + $total_creditnote_and_deposit - $object->total_ttc;
FIX: when we create deposit with multi tva, we mustn't add line if amount = 0 (example when we have a 100% reduc on one of origin invoice line)
FIX: wrong redirect link on holiday refuse
FIX: wrong test enabled
FIX: Wrong variable name
FIX: XSS
***** ChangeLog for 8.0.4 compared to 8.0.3 *****
FIX: #10030 better german chart
FIX: #10036

View File

@ -0,0 +1,14 @@
<?php
// Example to use PHPStan
// cd git/dolibarr
// /usr/bin/php7.2 ../phpstan.phar -l1 analyze htdocs/societe/website.php --memory-limit 2G
// Defined some constants and load Dolibarr env to reduce PHPStan bootstrap that fails to load a lot of things.
define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
define('DOL_URL_ROOT', '/');
// Load the main.inc.php file to have finctions llx_Header and llx_Footer defined
if (! defined("NOLOGIN")) define("NOLOGIN", '1');
global $conf, $langs, $user, $db;
include_once __DIR__ . '/../../htdocs/main.inc.php';

View File

@ -191,7 +191,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ftp
%_datadir/dolibarr/htdocs/holiday
%_datadir/dolibarr/htdocs/hrm
%_datadir/dolibarr/htdocs/ifttt
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install

View File

@ -271,7 +271,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ftp
%_datadir/dolibarr/htdocs/holiday
%_datadir/dolibarr/htdocs/hrm
%_datadir/dolibarr/htdocs/ifttt
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install

View File

@ -188,7 +188,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ftp
%_datadir/dolibarr/htdocs/holiday
%_datadir/dolibarr/htdocs/hrm
%_datadir/dolibarr/htdocs/ifttt
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install

View File

@ -199,7 +199,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ftp
%_datadir/dolibarr/htdocs/holiday
%_datadir/dolibarr/htdocs/hrm
%_datadir/dolibarr/htdocs/ifttt
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install

View File

@ -247,11 +247,10 @@ if ($resql)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton = '<a class="butActionNew" href="./card.php?action=create"><span class="valignmiddle text-plus-circle">' . $langs->trans("Addanaccount").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create');
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
// Box to select active chart of account
print $langs->trans("Selectchartofaccounts") . " : ";
@ -298,7 +297,7 @@ if ($resql)
if (! empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="' . $search_pcgtype . '"></td>';
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>';
if (! empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
print $searchpicto;
print '</td>';

View File

@ -111,14 +111,9 @@ if ($result)
$i = 0;
if (! empty($user->rights->accounting->fiscalyear))
{
$addbutton = '<a class="butActionNew" href="fiscalyear_card.php?action=create"><span class="valignmiddle text-plus-circle">' . $langs->trans("NewFiscalYear") .'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
else
{
$addbutton = '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'"><span class="valignmiddle text-plus-circle">' . $langs->trans("NewFiscalYear") .'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
$addbutton.= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear);
$title = $langs->trans('AccountingPeriods');
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1);

View File

@ -443,19 +443,18 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
$listofformat=AccountancyExport::getType();
$button = '<a class="butAction" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
if (count($filter)) $button.= $langs->trans("ExportFilteredList");
else $button.= $langs->trans("ExportList");
//$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')';
$button.= '</a>';
if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList");
else $buttonLabel = $langs->trans("ExportList");
$newcardbutton = dolGetButtonTitle($buttonLabel, '', 'fa fa-file-export', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''));
$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-object-group', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle', './card.php?action=create');
$groupby = ' <a class="nohover marginrightonly" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param.'">' . $langs->trans("GroupByAccountAccounting") . '</a>';
$newcardbutton = '<a class="butActionNew" href="./card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewAccountingMvt").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby.$newcardbutton, '', $limit);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields

View File

@ -256,10 +256,8 @@ if ($action == 'delbookkeepingyear') {
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
$viewflat = ' <a class="nohover marginrightonly" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param.'">' . $langs->trans("ViewFlatList") . '</a>';
$newcardbutton = '<a class="butActionNew" href="./card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewAccountingMvt").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle', './card.php?action=create');
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);

View File

@ -50,6 +50,7 @@ class AccountancyExport
public static $EXPORT_TYPE_COGILOG = 8;
public static $EXPORT_TYPE_AGIRIS = 9;
public static $EXPORT_TYPE_FEC = 11;
public static $EXPORT_TYPE_OPENCONCERTO = 12;
/**
@ -103,6 +104,7 @@ class AccountancyExport
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
);
}
@ -126,6 +128,7 @@ class AccountancyExport
self::$EXPORT_TYPE_EBP => 'ebp',
self::$EXPORT_TYPE_COGILOG => 'cogilog',
self::$EXPORT_TYPE_AGIRIS => 'agiris',
self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto',
self::$EXPORT_TYPE_FEC => 'fec',
);
@ -187,6 +190,10 @@ class AccountancyExport
'label' => $langs->trans('Modelcsv_FEC'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
),
self::$EXPORT_TYPE_OPENCONCERTO => array(
'label' => $langs->trans('Modelcsv_openconcerto'),
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
),
),
'cr'=> array (
'1' => $langs->trans("Unix"),
@ -248,6 +255,9 @@ class AccountancyExport
case self::$EXPORT_TYPE_AGIRIS :
$this->exportAgiris($TData);
break;
case self::$EXPORT_TYPE_OPENCONCERTO :
$this->exportOpenConcerto($TData);
break;
case self::$EXPORT_TYPE_FEC :
$this->exportFEC($TData);
break;
@ -588,6 +598,39 @@ class AccountancyExport
}
}
/**
* Export format : OpenConcerto
*
* @param array $objectLines data
*
* @return void
*/
public function exportOpenConcerto($objectLines)
{
$separator = ';';
$end_line = "\n";
foreach ($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $separator;
print $line->code_journal;
if (empty($line->subledger_account)) {
print length_accountg($line->numero_compte) . $separator;
} else {
print length_accounta($line->subledger_account) . $separator;
}
print $line->doc_ref . $separator;
print $line->label_operation . $separator;
print price($line->debit) . $separator;
print price($line->credit) . $separator;
print $end_line;
}
}
/**
* Export format : Configurable
*

View File

@ -151,9 +151,7 @@ if ($object->id > 0)
$newcardbutton = '';
if (! empty($conf->agenda->enabled))
{
$newcardbutton.='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddAction").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id);
}
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))

View File

@ -1567,7 +1567,7 @@ else
$formquestion=array();
if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false'));
if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ResiliateMember"), $langs->trans("ConfirmResiliateMember"), "confirm_resign", $formquestion, 'no', 1, 220);
print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ResiliateMember"), $langs->trans("ConfirmResiliateMember"), "confirm_resign", $formquestion, 'no', 1, 240);
}
// Confirm remove member

View File

@ -189,6 +189,42 @@ if (empty($reshook))
$search_array_options=array();
}
// Close
if ($massaction == 'close' && $user->rights->adherent->creer)
{
$tmpmember = new Adherent($db);
$error=0;
$nbclose=0;
$db->begin();
foreach($toselect as $idtoclose)
{
$tmpmember->fetch($idtoclose);
$result=$tmpmember->resiliate($user);
if ($result < 0 && ! count($tmpmember->errors))
{
setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
}
else
{
if ($result > 0) $nbclose++;
}
}
if (! $error)
{
setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs');
$db->commit();
}
else
{
$db->rollback();
}
}
// Mass actions
$objectclass='Adherent';
$objectlabel='Members';
@ -326,12 +362,11 @@ if ($search_type > 0)
}
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($sall != "") $param.="&sall=".urlencode($sall);
if ($statut != "") $param.="&statut=".urlencode($statut);
if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
if ($search_nom) $param.="&search_nom=".urlencode($search_nom);
if ($search_civility) $param.="&search_civility=".urlencode($search_civility);
if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname);
if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
@ -358,6 +393,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->adherent->creer) $arrayofmassactions['close']=$langs->trans("Resiliate");
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
@ -365,9 +401,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->adherent->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewMember').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create');
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -457,7 +491,7 @@ if (! empty($arrayfields['d.lastname']['checked']))
if (! empty($arrayfields['d.gender']['checked']))
{
print '<td class="liste_titre">';
$arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman"));
$arraygender=array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
print '</td>';
}

View File

@ -247,9 +247,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->adherent->cotisation->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/list.php?status=-1,1"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewSubscription').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1');
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -236,10 +236,8 @@ if (! $rowid && $action != 'create' && $action != 'edit')
$newcardbutton='';
if ($user->rights->adherent->configurer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/type.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewMemberType').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
$newcardbutton.= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create');
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';

View File

@ -143,7 +143,7 @@ print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" name="search_event" value="'.dol_escape_htmltag($search_event).'"></td>';
print '<td class="liste_titre"></td>';
// Action column
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';

View File

@ -77,10 +77,17 @@ $form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("DebugBarSetup"), $linkback, 'title_setup');
print '<br>';
//print load_fiche_titre($langs->trans("DebugBar"));
if (! function_exists('mb_check_encoding'))
{
$langs->load("errors");
print info_admin($langs->trans("ErrorPHPNeedModule", 'mbstring'), 0, 0, 'error');
}
print '<br>';
// Level
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -120,6 +120,12 @@ $modules=array(
'img' => 'trip'
)*/
),
'holiday' => array(
array(
'code' => 'MAIN_DELAY_HOLIDAYS',
'img' => 'holiday'
),
),
);
$labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly"));

View File

@ -322,9 +322,7 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton='';
//if ($user->rights->emailcollector->creer)
//{
$newcardbutton='<a class="butActionNew" href="emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle text-plus-circle">'.$langs->trans('New').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']));
//}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
@ -386,7 +384,7 @@ $parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';

View File

@ -356,7 +356,7 @@ $parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';

View File

@ -256,9 +256,7 @@ if ($action == 'delete')
$newcardbutton='';
if ($user->admin)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/admin/menus/edit.php?menuId=0&action=create&menu_handler='.urlencode($menu_handler).'&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle text-plus-circle">'.$langs->trans('New').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/admin/menus/edit.php?menuId=0&action=create&menu_handler='.urlencode($menu_handler).'&backtopage='.urlencode($_SERVER['PHP_SELF']));
}
print '<form name="newmenu" class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -61,6 +61,8 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", $_POST["MAIN_PROFID5_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", $_POST["MAIN_PROFID6_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
@ -177,76 +179,25 @@ if ($action == 'edit') // Edit
print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS', (! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0, 1);
print '</td></tr>';
// Show prof id 1 in address into pdf
if (! $noCountryCode)
// Show prof id in address into pdf
for($i=1; $i<=6; $i++)
{
$pid1=$langs->transcountry("ProfId1", $mysoc->country_code);
if ($pid1 == '-') $pid1=false;
}
else
{
$pid1 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
}
if ($pid1)
{
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
print $form->selectyesno('MAIN_PROFID1_IN_ADDRESS', isset($conf->global->MAIN_PROFID1_IN_ADDRESS)?$conf->global->MAIN_PROFID1_IN_ADDRESS:0, 1, $noCountryCode);
print '</td></tr>';
}
// Show prof id 2 in address into pdf
if (! $noCountryCode)
{
$pid2=$langs->transcountry("ProfId2", $mysoc->country_code);
if ($pid2 == '-') $pid2=false;
}
else
{
$pid2 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
}
if ($pid2)
{
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
print $form->selectyesno('MAIN_PROFID2_IN_ADDRESS', isset($conf->global->MAIN_PROFID2_IN_ADDRESS)?$conf->global->MAIN_PROFID2_IN_ADDRESS:0, 1, $noCountryCode);
print '</td></tr>';
}
// Show prof id 3 in address into pdf
if (! $noCountryCode)
{
$pid3=$langs->transcountry("ProfId3", $mysoc->country_code);
if ($pid3 == '-') $pid3=false;
}
else
{
$pid3 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
}
if ($pid3)
{
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
print $form->selectyesno('MAIN_PROFID3_IN_ADDRESS', isset($conf->global->MAIN_PROFID3_IN_ADDRESS)?$conf->global->MAIN_PROFID3_IN_ADDRESS:0, 1, $noCountryCode);
print '</td></tr>';
}
// Show prof id 4 in address into pdf
if (! $noCountryCode)
{
$pid4=$langs->transcountry("ProfId4", $mysoc->country_code);
if ($pid4 == '-') $pid4=false;
}
else
{
$pid4 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
}
if ($pid4)
{
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
print $form->selectyesno('MAIN_PROFID4_IN_ADDRESS', isset($conf->global->MAIN_PROFID4_IN_ADDRESS)?$conf->global->MAIN_PROFID4_IN_ADDRESS:0, 1, $noCountryCode);
print '</td></tr>';
if (! $noCountryCode)
{
$pid=$langs->transcountry("ProfId".$i, $mysoc->country_code);
if ($pid == '-') $pid=false;
}
else
{
$pid = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
}
if ($pid)
{
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.'</td><td>';
$keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant)?$conf->global->$keyforconstant:0, 1, $noCountryCode);
print '</td></tr>';
}
}
print '</table>';
@ -419,77 +370,26 @@ else // Show
print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS, 1);
print '</td></tr>';
// Show prof id 1 in address into pdf
if (! $noCountryCode)
{
$pid1=$langs->transcountry("ProfId1", $mysoc->country_code);
if ($pid1 == '-') $pid1=false;
}
else
{
$pid1 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
}
if ($pid1)
{
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
print yn($conf->global->MAIN_PROFID1_IN_ADDRESS, 1);
print '</td></tr>';
}
// Show prof id 2 in address into pdf
if (! $noCountryCode)
{
$pid2=$langs->transcountry("ProfId2", $mysoc->country_code);
if ($pid2 == '-') $pid2=false;
}
else
{
$pid2 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
}
if ($pid2)
{
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
print yn($conf->global->MAIN_PROFID2_IN_ADDRESS, 1);
print '</td></tr>';
}
// Show prof id 3 in address into pdf
if (! $noCountryCode)
{
$pid3=$langs->transcountry("ProfId3", $mysoc->country_code);
if ($pid3 == '-') $pid3=false;
}
else
{
$pid3 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
}
if ($pid3)
{
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
print yn($conf->global->MAIN_PROFID3_IN_ADDRESS, 1);
print '</td></tr>';
}
// Show prof id 4 in address into pdf
if (! $noCountryCode)
{
$pid4=$langs->transcountry("ProfId4", $mysoc->country_code);
if ($pid4 == '-') $pid4=false;
}
else
{
$pid4 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
}
if ($pid4)
{
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
print yn($conf->global->MAIN_PROFID4_IN_ADDRESS, 1);
print '</td></tr>';
}
// Show prof id in address into pdf
for ($i=1; $i<=6; $i++)
{
if (! $noCountryCode)
{
$pid=$langs->transcountry("ProfId".$i, $mysoc->country_code);
if ($pid == '-') $pid=false;
}
else
{
$pid = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
}
if ($pid)
{
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.'</td><td>';
$keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
print yn($conf->global->$keyforconstant, 1);
print '</td></tr>';
}
}
print '</table>'."\n";
print '</div>';

View File

@ -255,7 +255,7 @@ if ($result)
//print '<input class="flat" type="text" size="10" name="search_desc" value="'.$search_desc.'">';
print '</td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';

View File

@ -372,7 +372,7 @@ $parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';

261
htdocs/bom/bom_agenda.php Normal file
View File

@ -0,0 +1,261 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/modulebuilder/template/myobject_agenda.php
* \ingroup bom
* \brief Page of MyObject events
*/
// Load Dolibarr environment
$res=0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
dol_include_once('/bom/class/bom.class.php');
dol_include_once('/bom/lib/bom.lib.php');
// Load translation files required by the page
$langs->loadLangs(array("mrp","other"));
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
if (GETPOST('actioncode', 'array'))
{
$actioncode=GETPOST('actioncode', 'array', 3);
if (! count($actioncode)) $actioncode='0';
}
else
{
$actioncode=GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
}
$search_agenda_label=GETPOST('search_agenda_label');
// Security check - Protection if external user
//if ($user->societe_id > 0) access_forbidden();
//if ($user->societe_id > 0) $socid = $user->societe_id;
//$result = restrictedArea($user, 'bom', $id);
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield='a.datep,a.id';
if (! $sortorder) $sortorder='DESC';
// Initialize technical objects
$object=new BOM($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomagenda','globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('bom');
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity] . "/" . $object->id;
/*
* Actions
*/
$parameters=array('id'=>$socid);
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// Cancel
if (GETPOST('cancel', 'alpha') && ! empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$actioncode='';
$search_agenda_label='';
}
}
/*
* View
*/
$contactstatic = new Contact($db);
$form = new Form($db);
if ($object->id > 0)
{
$title=$langs->trans("Agenda");
//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
$help_url = '';
llxHeader('', $title, $help_url);
if (! empty($conf->notification->enabled)) $langs->load("mails");
$head = bomPrepareHead($object);
dol_fiche_head($head, 'agenda', $langs->trans("BillOfMaterials"), -1, 'bom');
// Object card
// ------------------------------------------------------------
$linkback = '<a href="' .dol_buildpath('/bom/myobject_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">';
/*
// Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->bom->creer)
{
if ($action != 'classify')
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}*/
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$object->info($object->id);
print dol_print_object_info($object, 1);
print '</div>';
dol_fiche_end();
// Actions buttons
$objthirdparty=$object;
$objcon=new stdClass();
$out='';
$permok=$user->rights->agenda->myactions->create;
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
{
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') $out.='&amp;socid='.$objthirdparty->id;
$out.=(! empty($objcon->id)?'&amp;contactid='.$objcon->id:'').'&amp;backtopage=1&amp;percentage=-1';
//$out.=$langs->trans("AddAnAction").' ';
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
//$out.="</a>";
}
print '<div class="tabsAction">';
if (! empty($conf->agenda->enabled))
{
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
}
else
{
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("AddAction").'</a>';
}
}
print '</div>';
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
$param='&socid='.$socid;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
//print load_fiche_titre($langs->trans("ActionsOnBom"), '', '');
// List of all actions
$filters=array();
$filters['search_agenda_label']=$search_agenda_label;
// TODO Replace this with same code than into list.php
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
}
}
// End of page
llxFooter();
$db->close();

View File

@ -307,10 +307,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'."\n";
print '<table class="border centpercent tableforfield">'."\n";
// Common attributes
//$keyforbreak='fieldkeytoswithonsecondcolumn';
$keyforbreak='description';
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
// Other attributes
@ -325,6 +325,62 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
dol_fiche_end();
/*
* Lines
*/
if (! empty($object->table_element_line))
{
// Show object lines
$result = $object->getLinesArray();
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="' . $object->id . '">
';
if (! empty($conf->use_javascript_ajax) && $object->status == 0) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
}
print '<div class="div-table-responsive-no-min">';
if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
{
print '<table id="tablelines" class="noborder noshadow" width="100%">';
}
if (! empty($object->lines))
{
// $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
}
// Form to add new line
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines')
{
if ($action != 'editline')
{
// Add products/services form
// $object->formAddObjectLine(1, $mysoc, $soc);
$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
}
}
if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
{
print '</table>';
}
print '</div>';
print "</form>\n";
}
// Buttons for actions
if ($action != 'presend' && $action != 'editline') {
print '<div class="tabsAction">'."\n";
@ -335,7 +391,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook))
{
// Send
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
//print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
// Modify
if ($user->rights->bom->write)

View File

@ -68,8 +68,8 @@ $extralabels = $extrafields->fetch_name_optionals_label('bom');
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/bom/" . dol_sanitizeFileName($object->id);
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/bom/" . dol_sanitizeFileName($object->ref);
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity?$object->entity:1] . "/bom/" . dol_sanitizeFileName($object->id);
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity?$object->entity:1] . "/bom/" . dol_sanitizeFileName($object->ref);
/*
@ -117,7 +117,7 @@ if ($object->id)
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
// Number of files
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
@ -132,10 +132,8 @@ if ($object->id)
dol_fiche_end();
$modulepart = 'bom';
//$permission = $user->rights->bom->create;
$permission = 1;
//$permtoedit = $user->rights->bom->create;
$permtoedit = 1;
$permission = $user->rights->bom->write;
$permtoedit = $user->rights->bom->write;
$param = '&id=' . $object->id;
//$relativepathwithnofile='bom/' . dol_sanitizeFileName($object->id).'/';

View File

@ -387,7 +387,7 @@ $parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';

View File

@ -16,7 +16,7 @@
*/
/**
* \file class/bom.class.php
* \file bom/class/bom.class.php
* \ingroup bom
* \brief This file is a CRUD class file for BOM (Create/Read/Update/Delete)
*/
@ -98,7 +98,7 @@ class BOM extends CommonObject
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
'date_valid' => array('type'=>'datetime', 'label'=>'DateValid', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,),
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,),
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',),
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,),
@ -850,6 +850,31 @@ class BOM extends CommonObject
}
}
/**
* Create an array of lines
*
* @return array|int array of lines if OK, <0 if KO
*/
public function getLinesArray()
{
$this->lines=array();
$objectline = new BOMLine($this->db);
$result = $objectline->fetchAll('', '', 0, 0, array('fk_bom'=>$this->id));
if (is_numeric($result))
{
$this->error = $this->error;
$this->errors = $this->errors;
return $result;
}
else
{
$this->lines = $result;
return $this->lines();
}
}
/**
* Initialise object with example values
* Id must be 0 if object instance is a specimen

View File

@ -82,12 +82,8 @@ $userstatic=new User($db);
llxHeader('', $langs->trans("ListOfBookmarks"));
$newcardbutton='';
if ($user->rights->bookmark->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewBookmark').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
$newcardbutton.= dolGetButtonTitle($langs->trans('NewBookmark'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer));
print_barre_liste($langs->trans("ListOfBookmarks"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', -1, '', 'title_generic.png', 0, $newcardbutton);

View File

@ -65,9 +65,7 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css')
llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss);
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewCategory").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type));
print load_fiche_titre($title, $newcardbutton);

View File

@ -95,6 +95,20 @@ class ActionComm extends CommonObject
*/
public $datec;
/**
* Date end record (datef)
*
* @var integer
*/
public $datef;
/**
* Duration (duree)
*
* @var integer
*/
public $duree;
/**
* Date modification record (tms)
*

View File

@ -435,9 +435,7 @@ if ($resql)
//$param='month='.$monthshown.'&year='.$year;
$hourminsec='100000';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddAction").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')));
}
print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, $nav.$newcardbutton, '', $limit);

View File

@ -367,9 +367,7 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction
//$param='month='.$monthshown.'&year='.$year;
$hourminsec='100000';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddAction").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')));
}
$link='';

View File

@ -505,7 +505,7 @@ if ($object->fetch($id) >= 0)
print $formmailing->selectDestinariesStatus($search_dest_status, 'search_dest_status', 1);
print '</td>';
// Action column
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
print $searchpicto;
print '</td>';

View File

@ -156,9 +156,7 @@ if ($result)
$newcardbutton='';
if ($user->rights->mailing->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/mailing/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewMailing').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('NewMailing'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/mailing/card.php?action=create');
}
$i = 0;
@ -193,7 +191,7 @@ if ($result)
if (! $filteremail) print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';

View File

@ -2421,10 +2421,15 @@ $formquestion = array_merge($formquestion, array(
}
print '<div class="div-table-responsive-no-min">';
print '<table id="tablelines" class="noborder noshadow" width="100%">';
if (! empty($object->lines) || ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline'))
{
print '<table id="tablelines" class="noborder noshadow" width="100%">';
}
if (! empty($object->lines))
{
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
}
// Form to add new line
if ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines')
@ -2439,16 +2444,21 @@ $formquestion = array_merge($formquestion, array(
}
}
print '</table>';
if (! empty($object->lines) || ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline'))
{
print '</table>';
}
print '</div>';
print "</form>\n";
dol_fiche_end();
/*
* Boutons Actions
* Button Actions
*/
if ($action != 'presend') {
print '<div class="tabsAction">';

View File

@ -441,10 +441,8 @@ if ($resql)
$newcardbutton='';
if ($user->rights->propal->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/propal/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewPropal').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
$newcardbutton.= dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/propal/card.php?action=create');
}
// Lignes des champs de filtre
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -499,7 +499,7 @@ class Commande extends CommonOrder
return -1;
}
dol_syslog(get_class($this)."::set_draft", LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$this->db->begin();
@ -1687,7 +1687,7 @@ class Commande extends CommonOrder
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = ca.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = dr.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
if ($id) $sql.= " WHERE c.rowid=".$id;

View File

@ -443,10 +443,8 @@ if ($resql)
$newcardbutton='';
if ($contextpage == 'orderlist' && $user->rights->commande->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/commande/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewOrder').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
$newcardbutton.= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/commande/card.php?action=create');
}
// Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Andreu Bisquerra Gaya <jove@bisquerra.com>
@ -50,14 +50,14 @@ $id = (GETPOST('id')?GETPOST('id', 'int'):GETPOST("facid", "int")); // For b
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$sref = GETPOST('sref');
$sref_client = GETPOST('sref_client');
$sref = GETPOST('sref', 'alpha');
$sref_client = GETPOST('sref_client', 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$socid = GETPOST('socid', 'int');
$selected = GETPOST('orders_to_invoice');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$viewstatut = GETPOST('viewstatut');
$viewstatut = GETPOST('viewstatut', 'alpha');
$error = 0;
@ -290,32 +290,32 @@ if (($action == 'create' || $action == 'add') && !$error)
$array_options = $lines[$i]->array_options;
}
$result = $object->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$date_start,
$date_end,
0,
$lines[$i]->info_bits,
$lines[$i]->fk_remise_except,
'HT',
0,
$product_type,
$ii,
$lines[$i]->special_code,
$object->origin,
$lines[$i]->rowid,
$fk_parent_line,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$lines[$i]->label,
$array_options
$result = $object->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$date_start,
$date_end,
0,
$lines[$i]->info_bits,
$lines[$i]->fk_remise_except,
'HT',
0,
$product_type,
$ii,
$lines[$i]->special_code,
$object->origin,
$lines[$i]->rowid,
$fk_parent_line,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$lines[$i]->label,
$array_options
);
if ($result > 0)
{
@ -578,9 +578,9 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
{
$sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\'';
}
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder;
$resql = $db->query($sql);
$sql.= $db->order($sortfield, $sortorder);
$resql = $db->query($sql);
if ($resql)
{
if ($socid)
@ -604,6 +604,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
print '<h3>'.$companystatic->getNomUrl(1, 'customer').'</h3>';
}
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.ref', '', '&amp;socid='.$socid, '', $sortfield, $sortorder);
@ -618,8 +619,9 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
print '<form method="get" action="orderstoinvoice.php">';
print '<input type="hidden" name="socid" value="'.$socid.'">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
//REF
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="sref" value="'.$sref.'">';
print '</td>';
@ -668,11 +670,11 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
$generic_commande->date_livraison = $db->jdate($objp->date_livraison);
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">';
print '<td class="nobordernopadding nowraponall">';
print $generic_commande->getNomUrl(1, 0);
print '</td>';
print '<td width="20" class="nobordernopadding nowrap">';
print '<td width="20" class="nobordernopadding nowraponall">';
if ($generic_commande->hasDelay()) {
print img_picto($langs->trans("Late"), "warning");
}
@ -713,10 +715,9 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
$i++;
}
print '</table>';
print '</div>';
/*
* Boutons actions
*/
// Buttons actions
print '<br><div class="center"><input type="checkbox" '.(empty($conf->global->INVOICE_CLOSE_ORDERS_OFF_BY_DEFAULT_FORMASSINVOICE)?' checked="checked"':'').' name="autocloseorders"> '.$langs->trans("CloseProcessedOrdersAutomatically");
print '<div class="right">';
print '<input type="hidden" name="socid" value="'.$socid.'">';
@ -726,7 +727,9 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
print '<input type="submit" class="butAction" value="'.$langs->trans("GenerateBill").'">';
print '</div>';
print '</div>';
print '</form>';
$db->free($resql);
}
else

View File

@ -756,34 +756,16 @@ if ($resql)
{
if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments
{
if ($user->rights->banque->modifier) {
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddBankRecord").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
} else {
$newcardbutton = '<a class="butActionNewRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddBankRecord").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
$newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)), '', $user->rights->banque->modifier);
}
else // If direct entries is not done using miscellaneous payments
else // If direct entries is not done using miscellaneous payments
{
if ($user->rights->banque->modifier) {
$newcardbutton = '<a class="butActionNew" href="'.$_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param.'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddBankRecord").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
} else {
$newcardbutton = '<a class="butActionNewRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddBankRecord").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
$newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', $user->rights->banque->modifier);
}
}
else
{
$newcardbutton = '<a class="butActionNewRefused" title="'.$langs->trans("FeatureDisabled").'" href="#"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddBankRecord").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', -1);
}
}
@ -924,7 +906,7 @@ if ($resql)
}
if (! empty($arrayfields['balance']['checked']))
{
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
print $form->textwithpicto('', $htmltext, 1);
print '</td>';

View File

@ -227,9 +227,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->banque->configurer)
{
$newcardbutton.='<a class="butActionNew" href="card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("NewFinancialAccount").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create');
}

View File

@ -223,7 +223,7 @@ if ($result)
// Credit
print '<td class="liste_titre right"><input name="search_amount_cred" class="flat" type="text" size="8" value="'.$search_amount_cred.'"></td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';

View File

@ -402,7 +402,7 @@ $parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';

View File

@ -41,7 +41,7 @@ include_once 'class/cashcontrol.class.php';
$cashcontrol= new CashControl($db);
$cashcontrol->fetch($id);
$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit;
//$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortorder='ASC';
$sortfield='b.datev,b.dateo,b.rowid';
@ -152,7 +152,7 @@ if ($resql)
$cash=$bank=$cheque=$other=0;
$totalarray=array();
while ($i < min($num, $limit))
while ($i < $num)
{
$objp = $db->fetch_object($resql);

View File

@ -153,7 +153,7 @@ if ($resql)
print '<td class="liste_titre right">';
// print '<input class="flat" size="10" type="text" name="search_amount" value="'.$search_amount.'">';
print '</td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';

View File

@ -477,7 +477,7 @@ if (empty($reshook))
// Check parameters
// Check for mandatory fields defined into setup
// Check for mandatory fields in thirdparty (defined into setup)
$array_to_check=array('IDPROF1','IDPROF2','IDPROF3','IDPROF4','IDPROF5','IDPROF6','EMAIL');
foreach($array_to_check as $key)
{
@ -518,20 +518,40 @@ if (empty($reshook))
}
}
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2);
} else {
$qualified_for_stock_change = $object->hasProductsOrServices(1);
// Check for mandatory fields in invoice
$array_to_check=array('REF_CUSTOMER'=>'RefCustomer');
foreach($array_to_check as $key => $val)
{
$keymin=strtolower($key);
$vallabel=$object->$keymin;
// Check for mandatory
$keymandatory ='INVOICE_'.$key.'_MANDATORY_FOR_VALIDATION';
if (! $vallabel && ! empty($conf->global->$keymandatory))
{
$langs->load("errors");
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors');
}
}
// Check for warehouse
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change)
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
{
if (! $idwarehouse || $idwarehouse == - 1) {
$error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$action = '';
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2);
} else {
$qualified_for_stock_change = $object->hasProductsOrServices(1);
}
if ($qualified_for_stock_change)
{
if (! $idwarehouse || $idwarehouse == - 1) {
$error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$action = '';
}
}
}
@ -575,20 +595,23 @@ if (empty($reshook))
$object->fetch($id);
$object->fetch_thirdparty();
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2);
} else {
$qualified_for_stock_change = $object->hasProductsOrServices(1);
}
// Check parameters
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change)
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
{
if (! $idwarehouse || $idwarehouse == - 1) {
$error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$action = '';
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2);
} else {
$qualified_for_stock_change = $object->hasProductsOrServices(1);
}
if ($qualified_for_stock_change)
{
if (! $idwarehouse || $idwarehouse == - 1) {
$error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$action = '';
}
}
}
@ -1920,7 +1943,7 @@ if (empty($reshook))
if ($result > 0)
{
// Define output language
// Define output language and generate document
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
@ -2032,7 +2055,7 @@ if (empty($reshook))
$line->fetch(GETPOST('lineid'));
$percent = $line->get_prev_progress($object->id);
if($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref>0)
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref>0)
{
// in case of situation credit note
if(GETPOST('progress') >= 0 )
@ -2124,7 +2147,7 @@ if (empty($reshook))
}
}
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'),
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'),
$date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type,
GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('progress'),
$_POST['units'], $pu_ht_devise);
@ -3426,28 +3449,35 @@ elseif ($id > 0 || ! empty($ref))
$text = $langs->trans('ConfirmDeleteBill', $object->ref);
$formquestion = array();
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2);
} else {
$qualified_for_stock_change = $object->hasProductsOrServices(1);
}
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut >= 1)
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->statut >= 1)
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db);
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
$forcecombo=0;
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"), 0, $forcecombo))
);
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1);
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2);
} else {
$qualified_for_stock_change = $object->hasProductsOrServices(1);
}
if ($qualified_for_stock_change)
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db);
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
$forcecombo=0;
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"), 0, $forcecombo))
);
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1);
}
else
{
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1);
}
} else {
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1);
}
@ -3496,35 +3526,38 @@ elseif ($id > 0 || ! empty($ref))
}
$formquestion = array();
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2);
} else {
$qualified_for_stock_change = $object->hasProductsOrServices(1);
}
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change)
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
$formproduct = new FormProduct($db);
$warehouse = new Entrepot($db);
$warehouse_array = $warehouse->list_array();
if (count($warehouse_array) == 1) {
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockIncrease", current($warehouse_array)) : $langs->trans("WarehouseForStockDecrease", current($warehouse_array));
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="' . key($warehouse_array) . '">';
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2);
} else {
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockIncrease") : $langs->trans("SelectWarehouseForStockDecrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1);
$qualified_for_stock_change = $object->hasProductsOrServices(1);
}
if ($qualified_for_stock_change)
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
$formproduct = new FormProduct($db);
$warehouse = new Entrepot($db);
$warehouse_array = $warehouse->list_array();
if (count($warehouse_array) == 1) {
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockIncrease", current($warehouse_array)) : $langs->trans("WarehouseForStockDecrease", current($warehouse_array));
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="' . key($warehouse_array) . '">';
} else {
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockIncrease") : $langs->trans("SelectWarehouseForStockDecrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1);
}
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' =>
// 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value'
// => 1),
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $value));
}
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' =>
// 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value'
// => 1),
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $value));
}
if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) // Can happen only if $conf->global->FACTURE_ENABLE_NEGATIVE is on
{
@ -3538,33 +3571,38 @@ elseif ($id > 0 || ! empty($ref))
$text = $langs->trans('ConfirmUnvalidateBill', $object->ref);
$formquestion = array();
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2);
} else {
$qualified_for_stock_change = $object->hasProductsOrServices(1);
}
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) {
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
$formproduct = new FormProduct($db);
$warehouse = new Entrepot($db);
$warehouse_array = $warehouse->list_array();
if (count($warehouse_array) == 1) {
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array));
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="' . key($warehouse_array) . '">';
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
{
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2);
} else {
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1);
$qualified_for_stock_change = $object->hasProductsOrServices(1);
}
if ($qualified_for_stock_change)
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
$formproduct = new FormProduct($db);
$warehouse = new Entrepot($db);
$warehouse_array = $warehouse->list_array();
if (count($warehouse_array) == 1) {
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array));
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="' . key($warehouse_array) . '">';
} else {
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1);
}
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' =>
// 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value'
// => 1),
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $value));
}
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' =>
// 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value'
// => 1),
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $value));
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('UnvalidateBill'), $text, 'confirm_modif', $formquestion, "yes", 1);
@ -4656,6 +4694,14 @@ elseif ($id > 0 || ! empty($ref))
}
}
// POS Ticket
if (! empty($conf->takepos->enabled) && $object->module_source == 'takepos')
{
$langs->load("cashdesk");
$receipt_url=DOL_URL_ROOT."/takepos/receipt.php";
print '<div class="inline-block divButAction"><a target="_blank" class="butAction" href="' . $receipt_url . '?facid=' . $object->id.'">' . $langs->trans('POSTicket') .'</a></div>';
}
// Create payment
if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercanissuepayment) {
if ($objectidnext) {
@ -4700,13 +4746,6 @@ elseif ($id > 0 || ! empty($ref))
}
}
// POS Ticket
if (! empty($conf->takepos->enabled) && $object->module_source != '')
{
$receipt_url=DOL_URL_ROOT."/takepos/receipt.php";
print '<div class="inline-block divButAction"><a target="_blank" class="butAction" href="' . $receipt_url . '?facid=' . $object->id.'">' . $langs->trans('POSTicket') .'</a></div>';
}
// Classify paid
if ($object->statut == 1 && $object->paye == 0 && $usercanissuepayment && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0))
|| ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $usercanissuepayment && empty($discount->id))

View File

@ -73,10 +73,10 @@ class Invoices extends DolibarrApi
}
// Get payment details
$this->invoice->totalpaye = $this->invoice->getSommePaiement();
$this->invoice->totalpaid = $this->invoice->getSommePaiement();
$this->invoice->totalcreditnotes = $this->invoice->getSumCreditNotesUsed();
$this->invoice->totaldeposits = $this->invoice->getSumDepositsUsed();
$this->invoice->resteapayer = price2num($this->invoice->total_ttc - $this->invoice->totalpaye - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT');
$this->invoice->remaintopay = price2num($this->invoice->total_ttc - $this->invoice->totalpaid - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT');
if (! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);

View File

@ -527,7 +527,7 @@ class FactureRec extends CommonInvoice
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx, ';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,';
$sql.= ' l.info_bits, l.date_start_fill, l.date_end_fill, l.total_ht, l.total_tva, l.total_ttc,';
$sql.= ' l.info_bits, l.date_start_fill, l.date_end_fill, l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
//$sql.= ' l.situation_percent, l.fk_prev_id,';
//$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql.= ' l.rang, l.special_code,';
@ -583,6 +583,11 @@ class FactureRec extends CommonInvoice
$line->total_tva = $objp->total_tva;
$line->total_ttc = $objp->total_ttc;
$line->code_ventilation = $objp->fk_code_ventilation;
$line->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
$line->pa_ht = $marginInfos[0];
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
$line->rang = $objp->rang;
$line->special_code = $objp->special_code;
$line->fk_unit = $objp->fk_unit;
@ -695,15 +700,17 @@ class FactureRec extends CommonInvoice
* @param double $pu_ht_devise Unit price in currency
* @param int $date_start_fill 1=Flag to fill start date when generating invoice
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
* @param int $fk_fournprice Supplier price id (to calculate margin) or ''
* @param int $pa_ht Buying price of line (to calculate margin) or ''
* @return int <0 if KO, Id of line if OK
*/
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0)
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0)
{
global $mysoc;
$facid=$this->id;
dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit,pu_ht_devise=$pu_ht_devise,date_start_fill=$date_start_fill,date_end_fill=$date_end_fill", LOG_DEBUG);
dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit,pu_ht_devise=$pu_ht_devise,date_start_fill=$date_start_fill,date_end_fill=$date_end_fill,pa_ht=$pa_ht", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Check parameters
@ -795,6 +802,8 @@ class FactureRec extends CommonInvoice
$sql.= ", total_ttc";
$sql.= ", date_start_fill";
$sql.= ", date_end_fill";
$sql.= ", fk_product_fournisseur_price";
$sql.= ", buy_price_ht";
$sql.= ", info_bits";
$sql.= ", rang";
$sql.= ", special_code";
@ -824,6 +833,8 @@ class FactureRec extends CommonInvoice
$sql.= ", ".price2num($total_ttc);
$sql.= ", ".(int) $date_start_fill;
$sql.= ", ".(int) $date_end_fill;
$sql.= ", ".($fk_fournprice > 0 ? $fk_fournprice : 'null');
$sql.= ", ".($pa_ht ? price2num($pa_ht) : 0);
$sql.= ", ".$info_bits;
$sql.= ", ".$rang;
$sql.= ", ".$special_code;
@ -877,9 +888,11 @@ class FactureRec extends CommonInvoice
* @param int $notrigger disable line update trigger
* @param int $date_start_fill 1=Flag to fill start date when generating invoice
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
* @param int $fk_fournprice Id of origin supplier price
* @param int $pa_ht Price (without tax) of product when it was bought
* @return int <0 if KO, Id of line if OK
*/
public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0)
public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0)
{
global $mysoc;
@ -894,16 +907,6 @@ class FactureRec extends CommonInvoice
// Check parameters
if ($type < 0) return -1;
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
if ($this->brouillon)
{
// Clean parameters
@ -932,10 +935,20 @@ class FactureRec extends CommonInvoice
$pu=$pu_ttc;
}
// Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva
// Calculate total with, without tax and tax from qty, pu, remise_percent and txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
$total_ht = $tabprice[0];
@ -984,6 +997,8 @@ class FactureRec extends CommonInvoice
$sql.= ", total_ttc='".price2num($total_ttc)."'";
$sql.= ", date_start_fill=".((int) $date_start_fill);
$sql.= ", date_end_fill=".((int) $date_end_fill);
$sql.= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : 'null');
$sql.= ", buy_price_ht=".($pa_ht ? price2num($pa_ht) : 0);
$sql.= ", info_bits=".$info_bits;
$sql.= ", rang=".$rang;
$sql.= ", special_code=".$special_code;

View File

@ -2532,7 +2532,6 @@ class Facture extends CommonInvoice
return true;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set draft status
*
@ -2540,7 +2539,7 @@ class Facture extends CommonInvoice
* @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK
*/
public function setDraft($user, $idwarehouse = -1)
public function setDraft($user, $idwarehouse = -1)
{
// phpcs:enable
global $conf,$langs;
@ -2549,11 +2548,11 @@ class Facture extends CommonInvoice
if ($this->statut == self::STATUS_DRAFT)
{
dol_syslog(get_class($this)."::set_draft already draft status", LOG_WARNING);
dol_syslog(__METHOD__." already draft status", LOG_WARNING);
return 0;
}
dol_syslog(get_class($this)."::set_draft", LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$this->db->begin();
@ -2564,10 +2563,10 @@ class Facture extends CommonInvoice
$result=$this->db->query($sql);
if ($result)
{
if (! $error)
{
$this->oldcopy= clone $this;
}
if (! $error)
{
$this->oldcopy= clone $this;
}
// Si on decremente le produit principal et ses composants a la validation de facture, on réincrement
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
@ -2595,15 +2594,15 @@ class Facture extends CommonInvoice
$this->brouillon = 1;
$this->statut = self::STATUS_DRAFT;
// Call trigger
$result=$this->call_trigger('BILL_UNVALIDATE', $user);
if ($result < 0)
// Call trigger
$result=$this->call_trigger('BILL_UNVALIDATE', $user);
if ($result < 0)
{
$error++;
$this->statut=$old_statut;
$this->brouillon=0;
}
// End call triggers
// End call triggers
} else {
$this->db->rollback();
return -1;
@ -4628,7 +4627,7 @@ class FactureLigne extends CommonInvoiceLine
$sql.= " '".$this->db->escape($this->localtax1_type)."',";
$sql.= " '".$this->db->escape($this->localtax2_type)."',";
$sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").',';
$sql.= " ".$this->product_type.",";
$sql.= " ".((int) $this->product_type).",";
$sql.= " ".price2num($this->remise_percent).",";
$sql.= " ".price2num($this->subprice).",";
$sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").',';

View File

@ -100,6 +100,20 @@ $permissionnote = $user->rights->facture->creer; // Used by the include of actio
$permissiondellink=$user->rights->facture->creer; // Used by the include of actions_dellink.inc.php
$permissiontoedit = $user->rights->facture->creer; // Used by the include of actions_lineupdonw.inc.php
$usercanread = $user->rights->facture->lire;
$usercancreate = $user->rights->facture->creer;
$usercanissuepayment = $user->rights->facture->paiement;
$usercandelete = $user->rights->facture->supprimer;
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate)));
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send);
$usercanreopen = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->reopen);
$usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($usercancreate)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)));
$usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
$usercancreatemargin = $user->rights->margins->creer;
$usercanreadallmargin = $user->rights->margins->liretous;
$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer;
$now = dol_now();
@ -267,6 +281,141 @@ if (empty($reshook))
// Set mode
elseif ($action == 'setmode' && $user->rights->facture->creer)
{
// Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
{
$tmptxt = '(';
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs;
$newlang = '';
if (empty($newlang) && GETPOST('lang_id', 'alpha')) $newlang = GETPOST('lang_id', 'alpha');
if (empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
}
if (! empty($prod->customcode)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt .= ' - ';
if (! empty($prod->country_code)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
} else {
if (! empty($prod->customcode)) $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt .= ' - ';
if (! empty($prod->country_code)) $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
}
$tmptxt .= ')';
$desc = dol_concatdesc($desc, $tmptxt);
}
$type = $prod->type;
$fk_unit = $prod->fk_unit;
}
else
{
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
$tva_tx = str_replace('*', '', $tva_tx);
if (empty($tva_tx)) $tva_npr=0;
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
$desc = $product_desc;
$type = GETPOST('type');
$fk_unit= GETPOST('units', 'alpha');
}
$date_start_fill = GETPOST('date_start_fill', 'int');
$date_end_fill = GETPOST('date_end_fill', 'int');
// Margin
$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
$info_bits = 0;
if ($tva_npr)
$info_bits |= 0x01;
if ($usercanproductignorepricemin && (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
setEventMessages($mesg, null, 'errors');
}
else
{
// Insert line
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice);
if ($result > 0)
{
// Define output language and generate document
/*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}*/
$object->fetch($object->id); // Reload lines
unset($_POST['prod_entry_mode']);
unset($_POST['qty']);
unset($_POST['type']);
unset($_POST['remise_percent']);
unset($_POST['price_ht']);
unset($_POST['multicurrency_price_ht']);
unset($_POST['price_ttc']);
unset($_POST['tva_tx']);
unset($_POST['product_ref']);
unset($_POST['product_label']);
unset($_POST['product_desc']);
unset($_POST['fournprice']);
unset($_POST['buying_price']);
unset($_POST['np_marginRate']);
unset($_POST['np_markRate']);
unset($_POST['dp_desc']);
unset($_POST['idprod']);
unset($_POST['units']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
unset($_POST['date_start_fill']);
unset($_POST['date_end_fill']);
unset($_POST['situations']);
unset($_POST['progress']);
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
}
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
}
// Set project
@ -435,10 +584,12 @@ if (empty($reshook))
$predef='';
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$price_ht = GETPOST('price_ht');
if (GETPOST('prod_entry_mode') == 'free')
$price_ht_devise = GETPOST('multicurrency_price_ht');
$prod_entry_mode = GETPOST('prod_entry_mode', 'alpha');
if ($prod_entry_mode == 'free')
{
$idprod=0;
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
}
else
{
@ -466,11 +617,11 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) {
if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
if ($prod_entry_mode == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error ++;
@ -479,7 +630,7 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) {
if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors');
$error ++;
}
@ -491,257 +642,239 @@ if (empty($reshook))
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod)))
{
$ret = $object->fetch($id);
if ($ret < 0) {
dol_print_error($db, $object->error);
exit();
}
$ret = $object->fetch_thirdparty();
// Clean parameters
$date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
$date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
// Define special_code for special lines
$special_code = 0;
// if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $tva_tx par celui du produit
// Ecrase $base_price_type par celui du produit
// Replaces $fk_unit with the product's
if (! empty($idprod))
{
$prod = new Product($db);
$prod->fetch($idprod);
$label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : '');
// Update if prices fields are defined
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
if (empty($tva_tx)) $tva_npr=0;
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min;
$price_base_type = $prod->price_base_type;
// We define price for product
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level))
{
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
{
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
if (empty($tva_tx)) $tva_npr=0;
}
$ret = $object->fetch($id);
if ($ret < 0) {
dol_print_error($db, $object->error);
exit();
}
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
$ret = $object->fetch_thirdparty();
// Clean parameters
$date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
$date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
// Define special_code for special lines
$special_code = 0;
// if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $tva_tx par celui du produit
// Ecrase $base_price_type par celui du produit
// Replaces $fk_unit with the product's
if (! empty($idprod))
{
include_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$prod = new Product($db);
$prod->fetch($idprod);
$prodcustprice = new Productcustomerprice($db);
$label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : '');
$filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id);
// Update if prices fields are defined
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
if (empty($tva_tx)) $tva_npr=0;
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
if ($result)
// Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp'].
$pqp = (GETPOST('pbq', 'int') ? GETPOST('pbq', 'int') : 0);
$datapriceofproduct = $prod->getSellPrice($mysoc, $object->thirdparty, $pqp);
$pu_ht = $datapriceofproduct['pu_ht'];
$pu_ttc = $datapriceofproduct['pu_ttc'];
$price_min = $datapriceofproduct['price_min'];
$price_base_type = $datapriceofproduct['price_base_type'];
$tva_tx = $datapriceofproduct['tva_tx'];
$tva_npr = $datapriceofproduct['tva_npr'];
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
// if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ?
if (! empty($price_ht))
{
if (count($prodcustprice->lines) > 0)
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
}
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
elseif ($tmpvat != $tmpprodvat)
{
if ($price_base_type != 'HT')
{
$pu_ht = price($prodcustprice->lines[0]->price);
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
$price_base_type = $prodcustprice->lines[0]->price_base_type;
$tva_tx = $prodcustprice->lines[0]->tva_tx;
if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
if (empty($tva_tx)) $tva_npr=0;
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
}
else
{
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
}
}
}
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
$desc = '';
// if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ?
if (! empty($price_ht))
{
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
}
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
elseif ($tmpvat != $tmpprodvat)
{
if ($price_base_type != 'HT')
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
$outputlangs = $langs;
$newlang = '';
if (empty($newlang) && GETPOST('lang_id', 'aZ09'))
$newlang = GETPOST('lang_id', 'aZ09');
if (empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description;
}
else
{
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
$desc = $prod->description;
}
}
$desc = '';
$desc = dol_concatdesc($desc, $product_desc);
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$outputlangs = $langs;
$newlang = '';
if (empty($newlang) && GETPOST('lang_id', 'aZ09'))
$newlang = GETPOST('lang_id', 'aZ09');
if (empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (! empty($newlang))
// Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
{
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
$tmptxt = '(';
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs;
$newlang = '';
if (empty($newlang) && GETPOST('lang_id', 'alpha')) $newlang = GETPOST('lang_id', 'alpha');
if (empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
}
if (! empty($prod->customcode)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt .= ' - ';
if (! empty($prod->country_code)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
} else {
if (! empty($prod->customcode)) $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt .= ' - ';
if (! empty($prod->country_code)) $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
}
$tmptxt .= ')';
$desc = dol_concatdesc($desc, $tmptxt);
}
$desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description;
$type = $prod->type;
$fk_unit = $prod->fk_unit;
}
else
{
$desc = $prod->description;
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
$tva_tx = str_replace('*', '', $tva_tx);
if (empty($tva_tx)) $tva_npr=0;
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
$desc = $product_desc;
$type = GETPOST('type');
$fk_unit= GETPOST('units', 'alpha');
}
$desc = dol_concatdesc($desc, $product_desc);
$date_start_fill = GETPOST('date_start_fill', 'int');
$date_end_fill = GETPOST('date_end_fill', 'int');
// Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
{
$tmptxt = '(';
if (! empty($prod->customcode))
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code))
$tmptxt .= ' - ';
if (! empty($prod->country_code))
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
$tmptxt .= ')';
$desc = dol_concatdesc($desc, $tmptxt);
}
// Margin
$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value
$type = $prod->type;
$fk_unit = $prod->fk_unit;
}
else
{
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
$tva_tx = str_replace('*', '', $tva_tx);
if (empty($tva_tx)) $tva_npr=0;
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
$desc = $product_desc;
$type = GETPOST('type');
$fk_unit= GETPOST('units', 'alpha');
}
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
$date_start_fill = GETPOST('date_start_fill', 'int');
$date_end_fill = GETPOST('date_end_fill', 'int');
$info_bits = 0;
if ($tva_npr)
$info_bits |= 0x01;
// Margin
$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
$info_bits = 0;
if ($tva_npr)
$info_bits |= 0x01;
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))))
{
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
setEventMessages($mesg, null, 'errors');
}
else
{
// Insert line
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill);
if ($result > 0)
{
/*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}*/
$object->fetch($object->id); // Reload lines
unset($_POST['prod_entry_mode']);
unset($_POST['qty']);
unset($_POST['type']);
unset($_POST['remise_percent']);
unset($_POST['price_ht']);
unset($_POST['multicurrency_price_ht']);
unset($_POST['price_ttc']);
unset($_POST['tva_tx']);
unset($_POST['product_ref']);
unset($_POST['product_label']);
unset($_POST['product_desc']);
unset($_POST['fournprice']);
unset($_POST['buying_price']);
unset($_POST['np_marginRate']);
unset($_POST['np_markRate']);
unset($_POST['dp_desc']);
unset($_POST['idprod']);
unset($_POST['units']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
unset($_POST['date_start_fill']);
unset($_POST['date_end_fill']);
unset($_POST['situations']);
unset($_POST['progress']);
if ($usercanproductignorepricemin && (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
setEventMessages($mesg, null, 'errors');
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
// Insert line
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice);
$action = '';
}
if ($result > 0)
{
// Define output language and generate document
/*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}*/
$object->fetch($object->id); // Reload lines
unset($_POST['prod_entry_mode']);
unset($_POST['qty']);
unset($_POST['type']);
unset($_POST['remise_percent']);
unset($_POST['price_ht']);
unset($_POST['multicurrency_price_ht']);
unset($_POST['price_ttc']);
unset($_POST['tva_tx']);
unset($_POST['product_ref']);
unset($_POST['product_label']);
unset($_POST['product_desc']);
unset($_POST['fournprice']);
unset($_POST['buying_price']);
unset($_POST['np_marginRate']);
unset($_POST['np_markRate']);
unset($_POST['dp_desc']);
unset($_POST['idprod']);
unset($_POST['units']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
unset($_POST['date_start_fill']);
unset($_POST['date_end_fill']);
unset($_POST['situations']);
unset($_POST['progress']);
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
}
}
}
elseif ($action == 'updateline' && $user->rights->facture->creer && ! GETPOST('cancel', 'alpha'))
elseif ($action == 'updateline' && $usercancreate && ! GETPOST('cancel', 'alpha'))
{
if (! $object->fetch($id) > 0) dol_print_error($db);
$object->fetch_thirdparty();
@ -855,7 +988,7 @@ if (empty($reshook))
// Update line
if (! $error)
{
$result = $object->updateline(
$result = $object->updateline(
GETPOST('lineid'),
$description,
$pu_ht,
@ -877,7 +1010,9 @@ $result = $object->updateline(
$pu_ht_devise,
0,
$date_start_fill,
$date_end_fill
$date_end_fill,
$fournprice,
$buyingprice
);
if ($result >= 0)

View File

@ -607,9 +607,7 @@ if ($resql)
$newcardbutton='';
if($user->rights->facture->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewBill').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/facture/card.php?action=create');
}
$i = 0;

View File

@ -45,9 +45,7 @@ $localtax_static = new Localtax($db);
$newcardbutton='';
if ($user->rights->tax->charges->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt.'"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewLocalTaxPayment', ($ltt+1)).'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt+1)), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt);
}
print load_fiche_titre($langs->transcountry($ltt==2?"LT2Payments":"LT1Payments", $mysoc->country_code), $newcardbutton);

View File

@ -222,19 +222,26 @@ if (empty($reshook))
if ($socid > 0) $thirdparty->fetch($socid);
// Clean parameters amount if payment is for a credit note
if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE)
foreach ($amounts as $key => $value) // How payment is dispatched
{
foreach ($amounts as $key => $value) // How payment is dispatch
{
$newvalue = price2num($value, 'MT');
$amounts[$key] = -$newvalue;
}
$tmpinvoice = new Facture($db);
$tmpinvoice->fetch($key);
if ($tmpinvoice->type == Facture::TYPE_CREDIT_NOTE)
{
$newvalue = price2num($value, 'MT');
$amounts[$key] = - abs($newvalue);
}
}
foreach ($multicurrency_amounts as $key => $value) // How payment is dispatch
{
$newvalue = price2num($value, 'MT');
$multicurrency_amounts[$key] = -$newvalue;
}
foreach ($multicurrency_amounts as $key => $value) // How payment is dispatched
{
$tmpinvoice = new Facture($db);
$tmpinvoice->fetch($key);
if ($tmpinvoice->type == Facture::TYPE_CREDIT_NOTE)
{
$newvalue = price2num($value, 'MT');
$multicurrency_amounts[$key] = - abs($newvalue);
}
}
if (! empty($conf->banque->enabled))
@ -544,7 +551,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
$sql.= ') AND f.paye = 0';
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
if ($facture->type != 2)
if ($facture->type != Facture::TYPE_CREDIT_NOTE)
{
$sql .= ' AND type IN (0,1,3,5)'; // Standard invoice, replacement, deposit, situation
}
@ -552,7 +559,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
{
$sql .= ' AND type = 2'; // If paying back a credit note, we show all credit notes
}
// Sort invoices by date and serial number: the older one comes first
$sql.=' ORDER BY f.datef ASC, f.ref ASC';
@ -562,9 +568,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$num = $db->num_rows($resql);
if ($num > 0)
{
$sign=1;
if ($facture->type == 2) $sign=-1;
$arraytitle=$langs->trans('Invoice');
if ($facture->type == 2) $arraytitle=$langs->trans("CreditNotes");
$alreadypayedlabel=$langs->trans('Received');
@ -606,6 +609,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
{
$objp = $db->fetch_object($resql);
$sign=1;
if ($facture->type == Facture::TYPE_CREDIT_NOTE) $sign=-1;
$soc = new Societe($db);
$soc->fetch($objp->socid);
@ -631,7 +637,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td>';
print $invoice->getNomUrl(1, '');
if($objp->socid != $facture->thirdparty->id) print ' - '.$soc->getNomUrl(1).' ';
if ($objp->socid != $facture->thirdparty->id) print ' - '.$soc->getNomUrl(1).' ';
print "</td>\n";
// Date

View File

@ -138,9 +138,7 @@ if ($resql)
$newcardbutton='';
if ($user->rights->banque->cheque)
{
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewCheckDeposit').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new');
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -177,7 +175,7 @@ if ($resql)
print '<input class="flat maxwidth50" type="text" name="search_amount" value="'.$search_amount.'">';
print '</td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';

View File

@ -255,7 +255,7 @@ if ($resql)
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
print '</td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';

View File

@ -108,9 +108,7 @@ if ($result)
$newcardbutton='';
if ($user->rights->prelevement->bons->creer)
{
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/prelevement/create.php"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewStandingOrder').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php');
}
// Lines of title fields
@ -136,7 +134,7 @@ if ($result)
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'. dol_escape_htmltag($search_amount).'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';

View File

@ -146,7 +146,7 @@ if ($result)
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'. dol_escape_htmltag($search_code).'" size="6"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';

View File

@ -196,7 +196,7 @@ if ($result)
// Amount
print '<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$db->escape($search_amount).'"></td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';

View File

@ -236,7 +236,7 @@ if ($resql)
print $form->selectarray('search_status', $liststatus, $search_status, 1);
print '</td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';

View File

@ -150,10 +150,8 @@ if ($result)
$newcardbutton='';
if ($user->rights->tax->charges->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/tva/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewVATPayment').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
$newcardbutton.= dolGetButtonTitle($langs->trans('NewVATPayment', ($ltt+1)), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/tva/card.php?action=create');
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -189,7 +187,7 @@ if ($result)
print '</td>';
}
print '<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';

View File

@ -261,9 +261,7 @@ else
{
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
{
$newcardbutton.='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddAction").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
}
}

View File

@ -698,9 +698,9 @@ class Contact extends CommonObject
$langs->load("dict");
dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG);
dol_syslog(get_class($this) . "::fetch id=" . $id . " ref_ext=" . $ref_ext . " email=" . $email, LOG_DEBUG);
if (empty($id) && empty($ref_ext))
if (empty($id) && empty($ref_ext) && empty($email))
{
$this->error='BadParameter';
return -1;

View File

@ -390,7 +390,7 @@ if ($sql_select)
print '</td>';
print '<td class="liste_titre center">';
print '</td>';
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';

View File

@ -455,9 +455,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->societe->contact->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/contact/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewContactAddress').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('NewContactAddress'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create');
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
@ -695,8 +693,8 @@ if (! empty($arrayfields['p.import_key']['checked']))
print '</td>';
}
// Action column
print '<td class="liste_titre right">';
$searchpicto=$form->showFilterButtons();
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
@ -785,7 +783,7 @@ while ($i < min($num, $limit))
// Name
if (! empty($arrayfields['p.lastname']['checked']))
{
print '<td valign="middle">';
print '<td class="middle tdoverflowmax200">';
print $contactstatic->getNomUrl(1, '', 0);
print '</td>';
if (! $i) $totalarray['nbfield']++;
@ -793,7 +791,7 @@ while ($i < min($num, $limit))
// Firstname
if (! empty($arrayfields['p.firstname']['checked']))
{
print '<td>'.$obj->firstname.'</td>';
print '<td class="tdoverflowmax200">'.$obj->firstname.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Job position

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014-2019 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
@ -46,19 +46,19 @@ $confirm=GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'contractlist'; // To manage different context of search
$search_name=GETPOST('search_name');
$search_email=GETPOST('search_email');
$search_name=GETPOST('search_name', 'alpha');
$search_email=GETPOST('search_email', 'alpha');
$search_town=GETPOST('search_town', 'alpha');
$search_zip=GETPOST('search_zip', 'alpha');
$search_state=trim(GETPOST("search_state"));
$search_state=trim(GETPOST("search_state", 'alpha'));
$search_country=GETPOST("search_country", 'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty", 'int');
$search_contract=GETPOST('search_contract');
$search_contract=GETPOST('search_contract', 'alpha');
$search_ref_customer=GETPOST('search_ref_customer', 'alpha');
$search_ref_supplier=GETPOST('search_ref_supplier', 'alpha');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_status=GETPOST('search_status');
$socid=GETPOST('socid');
$search_status=GETPOST('search_status', 'alpha');
$socid=GETPOST('socid', 'int');
$search_user=GETPOST('search_user', 'int');
$search_sale=GETPOST('search_sale', 'int');
$search_product_category=GETPOST('search_product_category', 'int');
@ -376,9 +376,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->contrat->creer)
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewContractSubscription').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contrat/card.php?action=create');
}
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
@ -709,8 +707,8 @@ while ($i < min($num, $limit))
$listsalesrepresentatives=$socstatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) dol_print_error($db);
$nbofsalesrepresentative=count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 3) {
// We print only number
if ($nbofsalesrepresentative > 3) {
// We print only number
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$socstatic->id.'">';
print $nbofsalesrepresentative;
print '</a>';

View File

@ -5,6 +5,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -47,11 +48,11 @@ if (! $sortorder) $sortorder="ASC";
$mode = GETPOST("mode");
$filter=GETPOST("filter");
$search_name=GETPOST("search_name");
$search_contract=GETPOST("search_contract");
$search_service=GETPOST("search_service");
$search_status=GETPOST("search_status", "alpha");
$statut=GETPOST('statut')?GETPOST('statut'):1;
$search_name=GETPOST("search_name", 'alpha');
$search_contract=GETPOST("search_contract", 'alpha');
$search_service=GETPOST("search_service", 'alpha');
$search_status=GETPOST("search_status", 'alpha');
$statut=GETPOST('statut', 'int')?GETPOST('statut', 'int'):1;
$search_product_category=GETPOST('search_product_category', 'int');
$socid=GETPOST('socid', 'int');
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'contractservicelist'.$mode;
@ -61,20 +62,20 @@ $opouvertureprevueday=GETPOST('opouvertureprevueday');
$opouvertureprevueyear=GETPOST('opouvertureprevueyear');
$filter_opouvertureprevue=GETPOST('filter_opouvertureprevue');
$op1month=GETPOST('op1month');
$op1day=GETPOST('op1day');
$op1year=GETPOST('op1year');
$filter_op1=GETPOST('filter_op1');
$op1month=GETPOST('op1month', 'int');
$op1day=GETPOST('op1day', 'int');
$op1year=GETPOST('op1year', 'int');
$filter_op1=GETPOST('filter_op1', 'alpha');
$op2month=GETPOST('op2month');
$op2day=GETPOST('op2day');
$op2year=GETPOST('op2year');
$filter_op2=GETPOST('filter_op2');
$op2month=GETPOST('op2month', 'int');
$op2day=GETPOST('op2day', 'int');
$op2year=GETPOST('op2year', 'int');
$filter_op2=GETPOST('filter_op2', 'alpha');
$opcloturemonth=GETPOST('opcloturemonth');
$opclotureday=GETPOST('opclotureday');
$opclotureyear=GETPOST('opclotureyear');
$filter_opcloture=GETPOST('filter_opcloture');
$opcloturemonth=GETPOST('opcloturemonth', 'int');
$opclotureday=GETPOST('opclotureday', 'int');
$opclotureyear=GETPOST('opclotureyear', 'int');
$filter_opcloture=GETPOST('filter_opcloture', 'alpha');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -523,7 +524,7 @@ if (! empty($arrayfields['status']['checked']))
print '</td>';
}
// Action column
print '<td class="liste_titre right">';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';

View File

@ -43,7 +43,7 @@ if (GETPOST('addfile', 'alpha'))
$vardir=$conf->user->dir_output."/".$user->id;
$upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid, 0);
dol_add_file_process($upload_dir_tmp, 1, 0, 'addedfile', '', null, $trackid, 0);
$action='presend';
}

View File

@ -1227,12 +1227,12 @@ abstract class CommonObject
$result=array();
$i=0;
//cas particulier pour les expeditions
if($this->element=='shipping' && $this->origin_id != 0) {
if ($this->element=='shipping' && $this->origin_id != 0) {
$id=$this->origin_id;
$element='commande';
} elseif($this->element=='reception' && $this->origin_id != 0) {
$id=$this->origin_id;
$element='order_supplier';
} elseif ($this->element=='reception' && $this->origin_id != 0) {
$id=$this->origin_id;
$element='order_supplier';
} else {
$id=$this->id;
$element=$this->element;
@ -2086,25 +2086,25 @@ abstract class CommonObject
* Change the shipping method
*
* @param int $shipping_method_id Id of shipping method
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @param User $userused Object user
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @param User $userused Object user
*
* @return int 1 if OK, 0 if KO
*/
public function setShippingMethod($shipping_method_id, $notrigger = false, $userused = null)
{
global $user;
global $user;
if (empty($userused)) $userused=$user;
if (empty($userused)) $userused=$user;
$error = 0;
$error = 0;
if (! $this->table_element) {
dol_syslog(get_class($this)."::setShippingMethod was called on objet with property table_element not defined", LOG_ERR);
return -1;
}
$this->db->begin();
$this->db->begin();
if ($shipping_method_id<0) $shipping_method_id='NULL';
dol_syslog(get_class($this).'::setShippingMethod('.$shipping_method_id.')');
@ -2112,30 +2112,30 @@ abstract class CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET fk_shipping_method = ".$shipping_method_id;
$sql.= " WHERE rowid=".$this->id;
$resql = $this->db->query($sql);
$resql = $this->db->query($sql);
if (! $resql) {
dol_syslog(get_class($this).'::setShippingMethod Error ', LOG_DEBUG);
$this->error = $this->db->lasterror();
$error++;
} else {
if (!$notrigger)
{
// Call trigger
$this->context=array('shippingmethodupdate'=>1);
$result = $this->call_trigger(strtoupper(get_class($this)) . '_MODIFY', $userused);
if ($result < 0) $error++;
// End call trigger
}
}
if ($error)
{
$this->db->rollback();
return -1;
} else {
$this->shipping_method_id = ($shipping_method_id=='NULL')?null:$shipping_method_id;
$this->db->commit();
return 1;
}
} else {
if (!$notrigger)
{
// Call trigger
$this->context=array('shippingmethodupdate'=>1);
$result = $this->call_trigger(strtoupper(get_class($this)) . '_MODIFY', $userused);
if ($result < 0) $error++;
// End call trigger
}
}
if ($error)
{
$this->db->rollback();
return -1;
} else {
$this->shipping_method_id = ($shipping_method_id=='NULL')?null:$shipping_method_id;
$this->db->commit();
return 1;
}
}
@ -2217,17 +2217,17 @@ abstract class CommonObject
*/
public function setBankAccount($fk_account, $notrigger = false, $userused = null)
{
global $user;
global $user;
if (empty($userused)) $userused=$user;
if (empty($userused)) $userused=$user;
$error = 0;
$error = 0;
if (! $this->table_element) {
dol_syslog(get_class($this)."::setBankAccount was called on objet with property table_element not defined", LOG_ERR);
return -1;
}
$this->db->begin();
$this->db->begin();
if ($fk_account<0) $fk_account='NULL';
dol_syslog(get_class($this).'::setBankAccount('.$fk_account.')');
@ -2236,36 +2236,36 @@ abstract class CommonObject
$sql.= " SET fk_account = ".$fk_account;
$sql.= " WHERE rowid=".$this->id;
$resql = $this->db->query($sql);
if (! $resql)
{
dol_syslog(get_class($this).'::setBankAccount Error '.$sql.' - '.$this->db->error());
$this->error = $this->db->lasterror();
$error++;
}
else
{
if (!$notrigger)
{
// Call trigger
$this->context=array('bankaccountupdate'=>1);
$result = $this->call_trigger(strtoupper(get_class($this)) . '_MODIFY', $userused);
if ($result < 0) $error++;
// End call trigger
}
}
if ($error)
{
$this->db->rollback();
return -1;
}
else
{
$this->fk_account = ($fk_account=='NULL')?null:$fk_account;
$this->db->commit();
return 1;
}
}
$resql = $this->db->query($sql);
if (! $resql)
{
dol_syslog(get_class($this).'::setBankAccount Error '.$sql.' - '.$this->db->error());
$this->error = $this->db->lasterror();
$error++;
}
else
{
if (!$notrigger)
{
// Call trigger
$this->context=array('bankaccountupdate'=>1);
$result = $this->call_trigger(strtoupper(get_class($this)) . '_MODIFY', $userused);
if ($result < 0) $error++;
// End call trigger
}
}
if ($error)
{
$this->db->rollback();
return -1;
}
else
{
$this->fk_account = ($fk_account=='NULL')?null:$fk_account;
$this->db->commit();
return 1;
}
}
// TODO: Move line related operations to CommonObjectLine?
@ -2967,7 +2967,7 @@ abstract class CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add objects linked in llx_element_element.
*
@ -2978,7 +2978,7 @@ abstract class CommonObject
*/
public function add_object_linked($origin = null, $origin_id = null)
{
// phpcs:enable
// phpcs:enable
$origin = (! empty($origin) ? $origin : $this->origin);
$origin_id = (! empty($origin_id) ? $origin_id : $this->origin_id);
@ -2986,7 +2986,7 @@ abstract class CommonObject
if ($origin == 'order') $origin='commande';
if ($origin == 'invoice') $origin='facture';
if ($origin == 'invoice_template') $origin='facturerec';
if ($origin == 'supplierorder') $origin='order_supplier';
if ($origin == 'supplierorder') $origin='order_supplier';
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
@ -3003,16 +3003,16 @@ abstract class CommonObject
dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG);
if ($this->db->query($sql))
{
$this->db->commit();
return 1;
}
else
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return 0;
}
{
$this->db->commit();
return 1;
}
else
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return 0;
}
}
/**
@ -3649,10 +3649,11 @@ abstract class CommonObject
{
if (empty($totalToShip)) $totalToShip=0; // Avoid warning because $totalToShip is ''
$totalToShip+=$line->qty_shipped; // defined for shipment only
}elseif ($line->element == 'commandefournisseurdispatch' && isset($line->qty))
{
if (empty($totalToShip)) $totalToShip=0;
$totalToShip+=$line->qty; // defined for reception only
}
elseif ($line->element == 'commandefournisseurdispatch' && isset($line->qty))
{
if (empty($totalToShip)) $totalToShip=0;
$totalToShip+=$line->qty; // defined for reception only
}
// Define qty, weight, volume, weight_units, volume_units
@ -3912,7 +3913,7 @@ abstract class CommonObject
// Define usemargins
$usemargins=0;
if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element, array('facture','propal','commande'))) $usemargins=1;
if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element, array('facture','facturerec','propal','commande'))) $usemargins=1;
$num = count($this->lines);
@ -4271,7 +4272,7 @@ abstract class CommonObject
$productstatic->id = $line->fk_product;
$productstatic->ref = $line->ref;
$productstatic->type = $line->fk_product_type;
if(empty($productstatic->ref)){
if (empty($productstatic->ref)) {
$line->fetch_product();
$productstatic = $line->product;
}
@ -4637,14 +4638,14 @@ abstract class CommonObject
if (! empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
}
if ($this->element == 'commande' && ! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD)) {
$setsharekey=true;
}
$setsharekey=true;
}
if ($this->element == 'facture' && ! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD)) {
$setsharekey=true;
}
$setsharekey=true;
}
if ($this->element == 'bank_account' && ! empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) {
$setsharekey=true;
}
$setsharekey=true;
}
if ($setsharekey)
{
@ -4807,7 +4808,7 @@ abstract class CommonObject
/* For triggers */
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Call trigger based on this instance.
* Some context information may also be provided into array property this->context.
@ -4818,9 +4819,9 @@ abstract class CommonObject
* @param User $user Object user
* @return int Result of run_triggers
*/
public function call_trigger($trigger_name, $user)
public function call_trigger($trigger_name, $user)
{
// phpcs:enable
// phpcs:enable
global $langs,$conf;
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
@ -4845,7 +4846,7 @@ abstract class CommonObject
/* Functions for extrafields */
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to get extra fields of an object into $this->array_options
* This method is in most cases called by method fetch of objects but you can call it separately.
@ -4854,9 +4855,9 @@ abstract class CommonObject
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters.
* @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded
*/
public function fetch_optionals($rowid = null, $optionsArray = null)
public function fetch_optionals($rowid = null, $optionsArray = null)
{
// phpcs:enable
// phpcs:enable
if (empty($rowid)) $rowid=$this->id;
// To avoid SQL errors. Probably not the better solution though
@ -5484,7 +5485,7 @@ abstract class CommonObject
elseif (in_array($type, array('int','integer','price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/', $type))
{
$morecss = 'maxwidth75';
} elseif ($type == 'url') {
} elseif ($type == 'url') {
$morecss='minwidth400';
}
elseif ($type == 'boolean')
@ -7178,8 +7179,8 @@ abstract class CommonObject
* @param array $fieldsentry Properties of field
* @return string
*/
protected function quote($value, $fieldsentry)
{
protected function quote($value, $fieldsentry)
{
if (is_null($value)) return 'NULL';
elseif (preg_match('/^(int|double|real)/i', $fieldsentry['type'])) return $this->db->escape("$value");
else return "'".$this->db->escape($value)."'";

View File

@ -640,6 +640,10 @@ class Conf
$this->expensereport->payment = new stdClass();
$this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60;
}
if (isset($this->holiday)) {
$this->holiday->approve = new stdClass();
$this->holiday->approve->warning_delay=(isset($this->global->MAIN_DELAY_HOLIDAYS)?$this->global->MAIN_DELAY_HOLIDAYS:0)*24*60*60;
}
if (! empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT))
{

View File

@ -91,7 +91,7 @@ class DolGraph
public function __construct($library = 'jflot')
{
global $conf;
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor;
// To use old feature
if ($library == 'artichow')
@ -883,7 +883,6 @@ class DolGraph
private function draw_jflot($file, $fileurl)
{
// phpcs:enable
global $artichow_defaultfont;
dol_syslog(get_class($this)."::draw_jflot this->type=".join(',', $this->type)." this->MaxValue=".$this->MaxValue);

View File

@ -1276,14 +1276,16 @@ class ExtraFields
$labeltoshow = dol_trunc($labeltoshow, 45);
if ($value == $obj->rowid) {
foreach ($fields_label as $field_toshow) {
$translabel = $langs->trans($obj->$field_toshow);
if ($translabel != $obj->$field_toshow) {
$labeltoshow = dol_trunc($translabel, 18) . ' ';
} else {
$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
}
}
if (!$notrans) {
foreach ($fields_label as $field_toshow) {
$translabel = $langs->trans($obj->$field_toshow);
if ($translabel != $obj->$field_toshow) {
$labeltoshow = dol_trunc($translabel, 18) . ' ';
} else {
$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
}
}
}
$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
} else {
if (!$notrans) {

View File

@ -103,7 +103,7 @@ class Form
* @return string HTML edit field
*/
public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id')
{
{
global $conf,$langs;
$ret='';
@ -144,7 +144,7 @@ class Form
}
return $ret;
}
}
/**
* Output value of a field for an editable field

View File

@ -205,9 +205,7 @@ class FormActions
$newcardbutton='';
if (! empty($conf->agenda->enabled))
{
$newcardbutton = '<a class="butActionNew" href="'.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).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddEvent").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$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));
}
print '<!-- formactions->showactions -->'."\n";

View File

@ -1830,7 +1830,7 @@ class FormFile
print '<td class="center">' . dol_print_date($link->datea, "dayhour", "tzuser") . '</td>';
print '<td class="center"></td>';
print '<td class="right">';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=update&linkid=' . $link->id . $param . '" class="editfilelink" >' . img_edit() . '</a>'; // id= is included into $param
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=update&linkid=' . $link->id . $param . '" class="editfilelink reposition" >' . img_edit() . '</a>'; // id= is included into $param
if ($permtodelete) {
print ' &nbsp; <a href="'. $_SERVER['PHP_SELF'] .'?action=delete&linkid=' . $link->id . $param . '" class="deletefilelink">' . img_delete() . '</a>'; // id= is included into $param
} else {

View File

@ -96,7 +96,7 @@ class FormMargin
$line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100));
}
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
$pv = $line->total_ht;
$pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign
$pa = $line->qty * $pa_ht;

View File

@ -1044,9 +1044,9 @@ function unActivateModule($value, $requiredby = 1)
$result=$objMod->remove();
if ($result <= 0) $ret=$objMod->error;
}
else
else // We come here when we try to unactivate a module when module does not exists anymore in sources
{
//print $dir.$modFile;
//print $dir.$modFile;exit;
// TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
$genericMod = new DolibarrModules($db);
@ -1054,11 +1054,11 @@ function unActivateModule($value, $requiredby = 1)
$genericMod->rights_class=strtolower(preg_replace('/^mod/i', '', $modName));
$genericMod->const_name='MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', $modName));
dol_syslog("modules::unActivateModule Failed to find module file, we use generic function with name " . $modName);
$genericMod->_remove(array());
$genericMod->remove('');
}
// Desactivation des modules qui dependent de lui
if (! $ret && $requiredby)
// Disable modules that depends on module we disable
if (! $ret && $requiredby && is_object($objMod) && is_array($objMod->requiredby))
{
$countrb=count($objMod->requiredby);
for ($i = 0; $i < $countrb; $i++)

View File

@ -730,9 +730,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
$newcardbutton='';
if (! empty($conf->projet->enabled) && $user->rights->projet->creer && empty($nocreatelink))
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($langs->trans('AddProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage));
}
print "\n";
@ -934,9 +932,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
if ($user->rights->societe->contact->creer)
{
$addcontact = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'"><span class="valignmiddle text-plus-circle">'.$addcontact.'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
$newcardbutton.= dolGetButtonTitle($addcontact, '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage));
}
print "\n";

View File

@ -1557,7 +1557,13 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
$info = pathinfo($destfull);
$destfull = $info['dirname'].'/'.dol_sanitizeFileName($info['filename'].($info['extension']!='' ? ('.'.strtolower($info['extension'])) : ''));
$info = pathinfo($destfile);
$destfile = dol_sanitizeFileName($info['filename'].($info['extension']!='' ? ('.'.strtolower($info['extension'])) : ''));
// We apply dol_string_nohtmltag also to clean file names (this remove duplicate spaces) because
// this function is also applied when we make try to download file (by the GETPOST(filename, 'alphanohtml') call).
$destfile = dol_string_nohtmltag($destfile);
$destfull = dol_string_nohtmltag($destfull);
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
if (is_numeric($resupload) && $resupload > 0) // $resupload can be 'ErrorFileAlreadyExists'

View File

@ -660,16 +660,19 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
if (empty($type)) // For a filesystem path
{
$res = DOL_DOCUMENT_ROOT.'/'.$path; // Standard default path
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
if (is_array($conf->file->dol_document_root))
{
if ($key == 'main')
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array("main"=>"/home/main/htdocs", "alt0"=>"/home/dirmod/htdocs", ...)
{
continue;
}
if (file_exists($dirroot.'/'.$path))
{
$res=$dirroot.'/'.$path;
return $res;
if ($key == 'main')
{
continue;
}
if (file_exists($dirroot.'/'.$path))
{
$res=$dirroot.'/'.$path;
return $res;
}
}
}
if ($returnemptyifnotfound) // Not found into alternate dir
@ -6582,7 +6585,7 @@ function dol_htmloutput_errors($mesgstring = '', $mesgarray = array(), $keepembe
* or descending output and uses optionally natural case insensitive sorting (which
* can be optionally case sensitive as well).
*
* @param array $array Array to sort (array of array('key','otherkey1','otherkey2'...))
* @param array $array Array to sort (array of array('key1'=>val1,'key2'=>val2,'key3'...) or array of objects)
* @param string $index Key in array to use for sorting criteria
* @param int $order Sort order ('asc' or 'desc')
* @param int $natsort 1=use "natural" sort (natsort), 0=use "standard" sort (asort)
@ -6601,7 +6604,17 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen
if ($sizearray>0)
{
$temp = array();
foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index];
foreach(array_keys($array) as $key)
{
if (is_object($array[$key]))
{
$temp[$key]=$array[$key]->$index;
}
else
{
$temp[$key]=$array[$key][$index];
}
}
if (! $natsort) {
($order=='asc') ? asort($temp) : arsort($temp);
@ -8004,6 +8017,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
{
global $conf;
$return = '';
// image's filename are still in French
$statusImg=array(
'status0' => 'statut0'
@ -8140,3 +8155,117 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
return '<div class="inline-block divButAction"><'.$tag.' '.$compiledAttributes.'>'.$html.'</'.$tag.'></div>';
}
/**
* Function dolGetButtonTitle : this kind of buttons are used in title in list
*
* @param string $label label of button
* @param string $helpText optional : content for help tooltip
* @param string $iconClass class for icon element
* @param string $url the url for link
* @param string $id attribute id of button
* @param int $status 0 no user rights, 1 active, -1 Feature Disabled, -2 disable Other reason use helpText as tooltip
* @param array $params various params for future : recommended rather than adding more function arguments
* @return string html button
*/
function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $url = '', $id = '', $status = 1, $params = array())
{
global $langs, $conf, $user;
// Actually this conf is used in css too for external module compatibility and smooth transition to this function
if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin) && $status <= 0) {
return '';
}
$class = 'btnTitle' ;
// hidden conf keep during button transition TODO: remove this block
if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){
$class = 'butActionNew';
}
$attr=array(
'class' => $class
,'href' => empty($url)?'':$url
);
if(!empty($helpText)){
$attr['title'] = dol_escape_htmltag($helpText);
}
if($status <= 0){
$attr['class'] .= ' refused';
// hidden conf keep during button transition TODO: remove this block
if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){
$attr['class'] = 'butActionNewRefused';
}
$attr['href'] = '';
if($status == -1){ // Not enough permissions
$attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("FeatureDisabled"));
}
elseif($status == 0){ // disable
$attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions"));
}
}
if(!empty($attr['title'])){
$attr['class'] .= ' classfortooltip';
}
if(empty($id)){
$attr['id'] = $id;
}
// Override attr
if(!empty($params['attr']) && is_array($params['attr'])){
foreach($params['attr'] as $key => $value){
if($key == 'class'){
$attr['class'].= ' '.$value;
}
elseif($key == 'classOverride'){
$attr['class'] = $value;
}
else{
$attr[$key] = $value;
}
}
}
if(isset($attr['href']) && empty($attr['href'])){
unset($attr['href']);
}
// TODO : add a hook
// escape all attribute
$attr = array_map('dol_escape_htmltag', $attr);
$TCompiledAttr = array();
foreach($attr as $key => $value){
$TCompiledAttr[] = $key.'="'.$value.'"';
}
$compiledAttributes = !empty($TCompiledAttr)?implode(' ', $TCompiledAttr):'';
$tag = !empty($attr['href'])?'a':'span';
$button ='<'.$tag.' '.$compiledAttributes.' >';
$button.= '<span class="'.$iconClass.' valignmiddle btnTitle-icon"></span>';
$button.= '<span class="valignmiddle text-plus-circle btnTitle-label">'.$label.'</span>';
$button.= '</'.$tag.'>';
// hidden conf keep during button transition TODO: remove this block
if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){
$button='<'.$tag.' '.$compiledAttributes.' ><span class="text-plus-circle">'.$label.'</span>';
$button.= '<span class="'.$iconClass.' valignmiddle"></span>';
$button.= '</'.$tag.'>';
}
return $button;
}

View File

@ -1282,6 +1282,10 @@ function check_value($mask, $value)
if (! empty($reg[3]) && preg_match('/^@/', $reg[3])) $maskraz=preg_replace('/^@/', '', $reg[3]);
if ($maskraz >= 0)
{
if ($maskraz == 99) {
$maskraz = date('m');
$resetEveryMonth = true;
}
if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth';
// Define reg

View File

@ -1374,6 +1374,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
if (! empty($object->lines[$i]->date_start) || ! empty($object->lines[$i]->date_end))
{
$format='day';
$period = '';
// Show duration if exists
if ($object->lines[$i]->date_start && $object->lines[$i]->date_end)
{

View File

@ -145,8 +145,8 @@ function user_prepare_head($object)
if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|| (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))
|| (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && $user->id == $object->id)
|| (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && $user->id == $object->id )
|| (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall))
|| (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->read_all))
)
{
// Bank

View File

@ -540,10 +540,10 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname,
global $langs;
if ($showmode == 1) {
print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').' title="'.dol_escape_htmltag($text).'">';
print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').' title="'.dol_escape_htmltag($text).'">';
print '<span class="mainmenuaspan">';
print $text;
print '</span>';
@ -1659,9 +1659,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
{
$langs->load("hrm");
$newmenu->add("/user/list.php?leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm');
$newmenu->add("/user/card.php?action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->hrm->employee->write);
$newmenu->add("/user/list.php?leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->hrm->employee->read);
$newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm');
$newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->hrm->employee->write);
$newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->hrm->employee->read);
}
// Leave/Holiday/Vacation module
@ -1670,19 +1670,19 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Load translation files required by the page
$langs->loadLangs(array("holiday","trips"));
$newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm');
$newmenu->add("/holiday/card.php?action=request", $langs->trans("New"), 1, $user->rights->holiday->write);
$newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("List"), 1, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm');
$newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("New"), 1, $user->rights->holiday->write);
$newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") {
$newmenu->add("/holiday/list.php?search_statut=1&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=2&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=3&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=4&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=5&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=1&mainmenu=hrm&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=2&mainmenu=hrm&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=3&mainmenu=hrm&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=4&mainmenu=hrm&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read);
}
$newmenu->add("/holiday/define_holiday.php?action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read);
$newmenu->add("/holiday/month_report.php", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all);
$newmenu->add("/holiday/view_log.php?action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday);
$newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read);
$newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all);
$newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday);
}
// Trips and expenses (old module)

View File

@ -667,7 +667,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
array(
'doc/' => dol_buildpath(strtolower($this->name).'/doc/', 1),
'img/' => dol_buildpath(strtolower($this->name).'/img/', 1),
'images/' => dol_buildpath(strtolower($this->name).'/imgages/', 1),
'images/' => dol_buildpath(strtolower($this->name).'/images/', 1),
)
);
}
@ -746,7 +746,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$filefound= false;
// Define path to file README.md.
// First check README-la_LA.md then README.md
// First check ChangeLog-la_LA.md then ChangeLog.md
$pathoffile = dol_buildpath(strtolower($this->name).'/ChangeLog-'.$langs->defaultlang.'.md', 0);
if (dol_is_file($pathoffile)) {
$filefound = true;

View File

@ -353,11 +353,17 @@ class pdf_strato extends ModelePDFContract
$desc=dol_htmlentitiesbr($objectligne->desc, 1); // Desc (not empty for free lines)
$txt='';
$txt.=$outputlangs->transnoentities("Quantity").' : <strong>'.$objectligne->qty.'</strong> - '.$outputlangs->transnoentities("UnitPrice").' : <strong>'.price($objectligne->subprice).'</strong>'; // Desc (not empty for free lines)
$txt.='<br>';
$txt.=$outputlangs->transnoentities("DateStartPlannedShort")." : <strong>".$datei."</strong> - ".$outputlangs->transnoentities("DateEndPlanned")." : <strong>".$datee.'</strong>';
$txt.='<br>';
$txt.=$outputlangs->transnoentities("DateStartRealShort")." : <strong>".$daters.'</strong>';
if ($objectligne->date_cloture) $txt.=" - ".$outputlangs->transnoentities("DateEndRealShort")." : '<strong>'".$datere.'</strong>';
if (empty($conf->global->CONTRACT_HIDE_PLANNED_DATE_ON_PDF))
{
$txt.='<br>';
$txt.=$outputlangs->transnoentities("DateStartPlannedShort")." : <strong>".$datei."</strong> - ".$outputlangs->transnoentities("DateEndPlanned")." : <strong>".$datee.'</strong>';
}
if (empty($conf->global->CONTRACT_HIDE_REAL_DATE_ON_PDF))
{
$txt.='<br>';
$txt.=$outputlangs->transnoentities("DateStartRealShort")." : <strong>".$daters.'</strong>';
if ($objectligne->date_cloture) $txt.=" - ".$outputlangs->transnoentities("DateEndRealShort")." : '<strong>'".$datere.'</strong>';
}
$pdf->startTransaction();
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txtpredefinedservice, dol_concatdesc($txt, $desc)), 0, 1, 0);

View File

@ -243,11 +243,12 @@ class modAccounting extends DolibarrModules
$this->export_icon[$r]='Accounting';
$this->export_permission[$r]=array(array("accounting","chartofaccount"));
$this->export_fields_array[$r]=array('ac.rowid'=>'ChartofaccountsId','ac.pcg_version'=>'Chartofaccounts','aa.rowid'=>'Id','aa.account_number'=>"AccountAccounting",'aa.label'=>"Label",'aa.account_parent'=>"Accountparent",'aa.pcg_type'=>"Pcgtype",'aa.pcg_subtype'=>'Pcgsubtype','aa.active'=>'Status');
$this->export_TypeFields_array[$r]=array('ac.rowid'=>'List:accounting_system:pcg_version','aa.account_number'=>"Text",'aa.label'=>"Text",'aa.pcg_type'=>'Text','aa.pcg_subtype'=>'Text','aa.active'=>'Status');
$this->export_TypeFields_array[$r]=array('ac.rowid'=>'List:accounting_system:pcg_version','aa.account_number'=>"Text",'aa.label'=>"Text",'aa.account_parent'=>"Text",'aa.pcg_type'=>'Text','aa.pcg_subtype'=>'Text','aa.active'=>'Status');
$this->export_entities_array[$r]=array('ac.rowid'=>"Accounting",'ac.pcg_version'=>"Accounting",'aa.rowid'=>'Accounting','aa.account_number'=>"Accounting",'aa.label'=>"Accounting",'aa.accountparent'=>"Accounting",'aa.pcg_type'=>"Accounting",'aa.pcgsubtype'=>"Accounting",'aa_active'=>"Accounting");
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'accounting_account as aa, '.MAIN_DB_PREFIX.'accounting_system as ac';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'accounting_account as aa';
$this->export_sql_end[$r] .=' ,'.MAIN_DB_PREFIX.'accounting_system as ac';
$this->export_sql_end[$r] .=' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').') ';

View File

@ -134,7 +134,7 @@ class modCron extends DolibarrModules
$this->menu[$r] = array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'CronList',
'url'=>'/cron/list.php?status=-2&leftmenu=admintools',
'url'=>'/cron/list.php?leftmenu=admintools',
'langs'=>'cron', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>200,
'enabled'=>'$conf->cron->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.

View File

@ -169,6 +169,7 @@ class modProduct extends DolibarrModules
$this->export_permission[$r]=array(array("produit","export"));
$this->export_fields_array[$r]=array(
'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",
'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode", 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode",
'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",
'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",
'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'
@ -184,7 +185,8 @@ class modProduct extends DolibarrModules
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
$this->export_TypeFields_array[$r]=array(
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",
'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
'p.note'=>"Text",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",
'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",
'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'
@ -289,7 +291,8 @@ class modProduct extends DolibarrModules
$this->export_permission[$r]=array(array("produit","export"));
$this->export_fields_array[$r]=array(
'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",
'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",
'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",
'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode',
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",
'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'
@ -298,7 +301,8 @@ class modProduct extends DolibarrModules
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
$this->export_TypeFields_array[$r]=array(
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",
'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text',
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
'p.datec'=>'Date','p.tms'=>'Date'
@ -308,7 +312,8 @@ class modProduct extends DolibarrModules
$this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
$this->export_entities_array[$r]=array(
'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",
'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_sell_intra'=>'virtualproduct','p.accountancy_code_sell_export'=>'virtualproduct',
'p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct',
'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",
'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
@ -492,6 +497,8 @@ class modProduct extends DolibarrModules
'p.duration' => "eg. 365d/12m/1y",
'p.url' => 'link to product (no https)',
'p.accountancy_code_sell' => "",
'p.accountancy_code_sell_intra' => "",
'p.accountancy_code_sell_export' => "",
'p.accountancy_code_buy' => "",
'p.weight' => "",
'p.weight_units' => 'use a unit of measure from the dictionary. g/Kg/T etc....matches field "Short Label" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units',

View File

@ -65,7 +65,7 @@ class modTakePos extends DolibarrModules
$this->descriptionlong = "Point Of Sales (compliant with touch screen)";
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
$this->version = 'experimental';
$this->version = 'dolibarr';
// Key used in llx_const table to save module status enabled/disabled (where TAKEPOS is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of image file used for this module.

View File

@ -301,7 +301,7 @@ class pdf_beluga extends ModelePDFProjects
'table'=>'commande',
'datefieldname'=>'date_commande',
'test'=>$conf->commande->enabled && $user->rights->commande->lire,
'lang'=>'order'),
'lang'=>'orders'),
'invoice'=>array(
'name'=>"CustomersInvoices",
'title'=>"ListInvoicesAssociatedProject",

View File

@ -1810,7 +1810,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders
global $hookmanager;
$parameters=array(
'object' => $object,
'curY' =>& $curY,
'columnText' => $columnText,
'colKey' => $colKey

View File

@ -48,7 +48,7 @@ foreach($object->fields as $key => $val)
$value=$object->$key;
print '<tr><td';
print ' class="titlefield';
print ' class="titlefield fieldname_'.$key;
//if ($val['notnull'] > 0) print ' fieldrequired'; // No fieldrequired on the view output
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
print '">';
@ -65,11 +65,13 @@ foreach($object->fields as $key => $val)
}
print '</table>';
// We close div and reopen for second column
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
$alreadyoutput = 1;
foreach($object->fields as $key => $val)
@ -87,7 +89,7 @@ foreach($object->fields as $key => $val)
$value=$object->$key;
print '<tr><td';
print ' class="titlefield';
print ' class="titlefield fieldname_'.$key;
if ($val['notnull'] > 0) print ' fieldrequired';
if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
print '">';

View File

@ -155,7 +155,6 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
print '<input type="hidden" name="'.$fieldid.'" value="' . $object->id . '">';
print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id);
print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">';
print '</form>';

View File

@ -70,7 +70,7 @@ $colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normal
if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
// For example $conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND = 'https://source.unsplash.com/random'
?>
<body class="body bodylogin" style="background-image: url('<?php echo $conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND; ?>'); background-repeat: no-repeat; background-position: center center; background-attachment: fixed; background-size: cover; background-color: #ffffff;">
<body class="body bodylogin" style="background-image: url('<?php echo dol_escape_htmltag($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND); ?>'); background-repeat: no-repeat; background-position: center center; background-attachment: fixed; background-size: cover; background-color: #ffffff;">
<?php
} else {
?>

View File

@ -40,7 +40,7 @@ if (empty($object) || ! is_object($object)) {
$usemargins=0;
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','propal','commande')))
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','facturerec','propal','commande')))
{
$usemargins=1;
}
@ -55,7 +55,7 @@ if (empty($senderissupplier)) $senderissupplier=0;
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
// Define colspan for button Add
// Define colspan for the button 'Add'
$colspan = 3; // Columns: total ht + col edit + col delete
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan++;//Add column for Total (currency) if required
if (in_array($object->element, array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button

Some files were not shown because too many files have changed in this diff Show More