Merge remote-tracking branch 'upstream/develop' into free_email

This commit is contained in:
Frédéric FRANCE 2020-05-23 21:44:14 +02:00
commit a7e0fe24ff
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
84 changed files with 2777 additions and 2940 deletions

View File

@ -3,7 +3,7 @@ FROM php:7.2-apache
ENV HOST_USER_ID 33 ENV HOST_USER_ID 33
ENV PHP_INI_DATE_TIMEZONE 'UTC' ENV PHP_INI_DATE_TIMEZONE 'UTC'
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev libzip-dev zlib1g-dev libicu-dev g++\ RUN apt-get update && apt-get install -y libpng16-16 libpng-dev libjpeg62-turbo libjpeg62-turbo-dev libldap2-dev zlib1g-dev libicu-dev g++\
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd \ && docker-php-ext-install gd \
@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev lib
&& docker-php-ext-install calendar \ && docker-php-ext-install calendar \
&& docker-php-ext-configure intl \ && docker-php-ext-configure intl \
&& docker-php-ext-install intl \ && docker-php-ext-install intl \
&& apt-get autoremove --purge -y libjpeg-dev libldap2-dev zlib1g-dev libicu-dev g++ && apt-get autoremove --purge -y libpng-dev libjpeg62-turbo-dev libldap2-dev zlib1g-dev libicu-dev g++
RUN mkdir /var/documents RUN mkdir /var/documents
RUN chown www-data /var/documents RUN chown www-data /var/documents

View File

@ -21,5 +21,12 @@ web:
- ../../htdocs:/var/www/html - ../../htdocs:/var/www/html
links: links:
- mariadb - mariadb
- mail
ports: ports:
- "80:80" - "80:80"
mail:
image: maildev/maildev
ports:
- "8081:80"
- "25:25"

View File

@ -267,7 +267,7 @@ if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$param = ''; $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
if ($search_account) $param .= '&search_account='.urlencode($search_account); if ($search_account) $param .= '&search_account='.urlencode($search_account);

View File

@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -342,37 +343,41 @@ if ($result) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
$clickpicto = $form->showCheckAddButtons(); $clickpicto = $form->showCheckAddButtons();
print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center '); print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
$thirdpartystatic=new Societe($db); $thirdpartystatic=new Societe($db);
$facture_static = new Facture($db); $facturestatic = new Facture($db);
$product_static = new Product($db); $productstatic = new Product($db);
$accountingaccountstatic = new AccountingAccount($db);
while ($objp = $db->fetch_object($result)) { while ($objp = $db->fetch_object($result))
$codecompta = length_accountg($objp->account_number).' - <span class="opacitymedium">'.$objp->label_compte.'</span>'; {
$accountingaccountstatic->account_number = $objp->account_number;
$accountingaccountstatic->label = $objp->label_account;
$accountingaccountstatic->labelshort = $objp->labelshort_account;
$facture_static->ref = $objp->ref; $facturestatic->ref = $objp->ref;
$facture_static->id = $objp->facid; $facturestatic->id = $objp->facid;
$facture_static->type = $objp->ftype; $facturestatic->type = $objp->ftype;
$thirdpartystatic->id = $objp->socid; $thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name; $thirdpartystatic->name = $objp->name;
$thirdpartystatic->client = $objp->client; $thirdpartystatic->client = $objp->client;
$thirdpartystatic->fournisseur = $objp->fournisseur; $thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->code_client = $objp->code_client; $thirdpartystatic->code_client = $objp->code_client;
$thirdpartystatic->code_compta_client = $objp->code_compta_client; $thirdpartystatic->code_compta_client = $objp->code_compta_client;
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur; $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = $objp->country_code;
$product_static->ref = $objp->product_ref; $productstatic->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $productstatic->id = $objp->product_id;
$product_static->label = $objp->product_label; $productstatic->label = $objp->product_label;
$product_static->type = $objp->line_type; $productstatic->type = $objp->line_type;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -380,15 +385,15 @@ if ($result) {
print '<td>'.$objp->rowid.'</td>'; print '<td>'.$objp->rowid.'</td>';
// Ref Invoice // Ref Invoice
print '<td class="nowraponall">'.$facture_static->getNomUrl(1).'</td>'; print '<td class="nowraponall">'.$facturestatic->getNomUrl(1).'</td>';
// Date invoice // Date invoice
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>'; print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>';
// Ref Product // Ref Product
print '<td>'; print '<td>';
if ($product_static->id > 0) print $product_static->getNomUrl(1); if ($productstatic->id > 0) print $productstatic->getNomUrl(1);
if ($product_static->id > 0 && $objp->product_label) print '<br>'; if ($productstatic->id > 0 && $objp->product_label) print '<br>';
if ($objp->product_label) print '<span class="opacitymedium">'.$objp->product_label.'</span>'; if ($objp->product_label) print '<span class="opacitymedium">'.$objp->product_label.'</span>';
print '</td>'; print '</td>';
@ -415,8 +420,9 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>'; print '<td>'.$objp->tva_intra.'</td>';
print '<td>'; print '<td class="center">';
print $codecompta.' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">'; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';
print '</td>'; print '</td>';

View File

@ -28,19 +28,22 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch")); $langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch", "hrm"));
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$account_parent = GETPOST('account_parent', 'int'); $account_parent = GETPOST('account_parent', 'int');
$changeaccount = GETPOST('changeaccount'); $changeaccount = GETPOST('changeaccount');
// Search Getpost // Search Getpost
$search_login = GETPOST('search_login', 'alpha');
$search_expensereport = GETPOST('search_expensereport', 'alpha'); $search_expensereport = GETPOST('search_expensereport', 'alpha');
$search_label = GETPOST('search_label', 'alpha'); $search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha'); $search_desc = GETPOST('search_desc', 'alpha');
@ -84,7 +87,8 @@ $formaccounting = new FormAccounting($db);
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
{ {
$search_expensereport = ''; $search_login = '';
$search_expensereport = '';
$search_label = ''; $search_label = '';
$search_desc = ''; $search_desc = '';
$search_amount = ''; $search_amount = '';
@ -162,14 +166,21 @@ print '<script type="text/javascript">
*/ */
$sql = "SELECT er.ref, er.rowid as erid,"; $sql = "SELECT er.ref, er.rowid as erid,";
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,"; $sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,";
$sql .= " aa.label, aa.account_number,"; $sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label,";
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label"; $sql .= " u.rowid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,";
$sql .= " aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er";
$sql .= " , ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport";
$sql .= " , ".MAIN_DB_PREFIX."expensereport_det as erd"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees";
$sql .= " WHERE er.rowid = erd.fk_expensereport and er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <> 0 "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author";
$sql .= " AND aa.rowid = erd.fk_code_ventilation"; $sql .= " WHERE erd.fk_code_ventilation > 0";
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
// Add search filter like
if (strlen(trim($search_login))) {
$sql .= natural_search("u.login", $search_login);
}
if (strlen(trim($search_expensereport))) { if (strlen(trim($search_expensereport))) {
$sql .= natural_search("er.ref", $search_expensereport); $sql .= natural_search("er.ref", $search_expensereport);
} }
@ -218,6 +229,7 @@ if ($result) {
$param = ''; $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_login) $param .= '&search_login='.urlencode($search_login);
if ($search_expensereport) $param .= "&search_expensereport=".urlencode($search_expensereport); if ($search_expensereport) $param .= "&search_expensereport=".urlencode($search_expensereport);
if ($search_label) $param .= "&search_label=".urlencode($search_label); if ($search_label) $param .= "&search_label=".urlencode($search_label);
if ($search_desc) $param .= "&search_desc=".urlencode($search_desc); if ($search_desc) $param .= "&search_desc=".urlencode($search_desc);
@ -250,7 +262,8 @@ if ($result) {
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
print '<td class="liste_titre"></td>';
print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>'; print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>';
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
@ -265,7 +278,6 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>'; print '<td class="liste_titre right"><input type="text" class="flat maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="'.dol_escape_htmltag($search_vat).'"></td>'; print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
print '<td class="liste_titre right"></td>';
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
$searchpicto = $form->showFilterButtons(); $searchpicto = $form->showFilterButtons();
print $searchpicto; print $searchpicto;
@ -273,7 +285,8 @@ if ($result) {
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Employees", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
print_liste_field_titre("DateValidation", $_SERVER["PHP_SELF"], "er.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("DateValidation", $_SERVER["PHP_SELF"], "er.date_valid", "", $param, '', $sortfield, $sortorder, 'center ');
@ -283,27 +296,48 @@ if ($result) {
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre('');
$checkpicto = $form->showCheckAddButtons(); $checkpicto = $form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
$expensereport_static = new ExpenseReport($db); $expensereportstatic = new ExpenseReport($db);
$accountingaccountstatic = new AccountingAccount($db);
$userstatic = new User($db);
while ($i < min($num_lines, $limit)) { while ($i < min($num_lines, $limit)) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$codeCompta = length_accountg($objp->account_number).' - <span class="opacitymedium">'.$objp->label.'</span>';
$expensereport_static->ref = $objp->ref; $accountingaccountstatic->account_number = $objp->account_number;
$expensereport_static->id = $objp->erid; $accountingaccountstatic->label = $objp->label_account;
$accountingaccountstatic->labelshort = $objp->labelshort_account;
$expensereportstatic->ref = $objp->ref;
$expensereportstatic->id = $objp->erid;
$userstatic->id = $objp->rowid;
$userstatic->ref = $objp->label;
$userstatic->login = $objp->login;
$userstatic->statut = $objp->statut;
$userstatic->email = $objp->email;
$userstatic->gender = $objp->gender;
$userstatic->firstname = $objp->firstname;
$userstatic->lastname = $objp->lastname;
$userstatic->employee = $objp->employee;
$userstatic->photo = $objp->photo;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Login
print '<td class="nowraponall">';
print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
print '</td>';
// Line id
print '<td>'.$objp->rowid.'</td>'; print '<td>'.$objp->rowid.'</td>';
// Ref Invoice // Ref Expense report
print '<td>'.$expensereport_static->getNomUrl(1).'</td>'; print '<td>'.$expensereportstatic->getNomUrl(1).'</td>';
// Date validation // Date validation
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
@ -312,21 +346,26 @@ if ($result) {
print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>'; print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>';
// Fees label
print '<td class="tdoverflow">'.($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))).'</td>'; print '<td class="tdoverflow">'.($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))).'</td>';
// Fees description -- Can be null
print '<td>'; print '<td>';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments); print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
print '</td>'; print '</td>';
// Amount without taxes
print '<td class="nowrap right">'.price($objp->total_ht).'</td>'; print '<td class="nowrap right">'.price($objp->total_ht).'</td>';
// Vat rate
print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>'; print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
print '<td>'.$codeCompta.'</td>'; // Accounting account affected
print '<td class="center">';
print '<td class="left"><a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">'; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit(); print img_edit();
print '</a></td>'; print '</a></td>';

View File

@ -28,6 +28,7 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -35,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "trips", "productbatch")); $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "trips", "productbatch", "hrm"));
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
@ -50,6 +51,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always ''
$mesCasesCochees = GETPOST('toselect', 'array'); $mesCasesCochees = GETPOST('toselect', 'array');
// Search Getpost // Search Getpost
$search_login = GETPOST('search_login', 'alpha');
$search_lineid = GETPOST('search_lineid', 'alpha'); $search_lineid = GETPOST('search_lineid', 'alpha');
$search_expensereport = GETPOST('search_expensereport', 'alpha'); $search_expensereport = GETPOST('search_expensereport', 'alpha');
$search_label = GETPOST('search_label', 'alpha'); $search_label = GETPOST('search_label', 'alpha');
@ -100,6 +102,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
{ {
$search_login = '';
$search_expensereport = ''; $search_expensereport = '';
$search_label = ''; $search_label = '';
$search_desc = ''; $search_desc = '';
@ -189,13 +192,18 @@ if (empty($chartaccountcode))
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut, er.date_valid,"; $sql = "SELECT er.ref, er.rowid as erid, er.date_debut, er.date_valid,";
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,"; $sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,"; $sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
$sql .= " u.rowid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,";
$sql .= " aa.rowid as aarowid"; $sql .= " aa.rowid as aarowid";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
$sql .= " WHERE er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0"; $sql .= " WHERE er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
// Add search filter like // Add search filter like
if (strlen(trim($search_login))) {
$sql .= natural_search("u.login", $search_login);
}
if (strlen(trim($search_expensereport))) { if (strlen(trim($search_expensereport))) {
$sql .= natural_search("er.ref", $search_expensereport); $sql .= natural_search("er.ref", $search_expensereport);
} }
@ -245,6 +253,7 @@ if ($result) {
$param = ''; $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_login) $param .= '&search_login='.urlencode($search_login);
if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid); if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid);
if ($search_day) $param .= '&search_day='.urlencode($search_day); if ($search_day) $param .= '&search_day='.urlencode($search_day);
if ($search_month) $param .= '&search_month='.urlencode($search_month); if ($search_month) $param .= '&search_month='.urlencode($search_month);
@ -289,6 +298,7 @@ if ($result) {
// We add search filter // We add search filter
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>';
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
@ -312,6 +322,7 @@ if ($result) {
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
@ -331,6 +342,7 @@ if ($result) {
$expensereport_static = new ExpenseReport($db); $expensereport_static = new ExpenseReport($db);
$userstatic = new User($db);
$form = new Form($db); $form = new Form($db);
while ($i < min($num_lines, $limit)) { while ($i < min($num_lines, $limit)) {
@ -342,7 +354,23 @@ if ($result) {
$expensereport_static->ref = $objp->ref; $expensereport_static->ref = $objp->ref;
$expensereport_static->id = $objp->erid; $expensereport_static->id = $objp->erid;
print '<tr class="oddeven">'; $userstatic->id = $objp->rowid;
$userstatic->ref = $objp->label;
$userstatic->login = $objp->login;
$userstatic->statut = $objp->statut;
$userstatic->email = $objp->email;
$userstatic->gender = $objp->gender;
$userstatic->firstname = $objp->firstname;
$userstatic->lastname = $objp->lastname;
$userstatic->employee = $objp->employee;
$userstatic->photo = $objp->photo;
print '<tr class="oddeven">';
// Login
print '<td class="nowraponall">';
print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
print '</td>';
// Line id // Line id
print '<td>'.$objp->rowid.'</td>'; print '<td>'.$objp->rowid.'</td>';
@ -370,6 +398,7 @@ if ($result) {
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments); print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
print '</td>'; print '</td>';
// Amount without taxes
print '<td class="nowrap right">'; print '<td class="nowrap right">';
print price($objp->price); print price($objp->price);
print '</td>'; print '</td>';

View File

@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -346,38 +347,42 @@ if ($result) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
$checkpicto = $form->showCheckAddButtons(); $checkpicto = $form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
$thirdpartystatic = new Societe($db); $thirdpartystatic = new Societe($db);
$facturefournisseur_static = new FactureFournisseur($db); $facturefournisseur_static = new FactureFournisseur($db);
$product_static = new ProductFournisseur($db); $productstatic = new ProductFournisseur($db);
$accountingaccountstatic = new AccountingAccount($db);
while ($i < min($num_lines, $limit)) { while ($i < min($num_lines, $limit))
{
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$codecompta = length_accountg($objp->account_number).' - <span class="opacitymedium">'.$objp->label.'</span>'; $accountingaccountstatic->account_number = $objp->account_number;
$accountingaccountstatic->label = $objp->label_account;
$accountingaccountstatic->labelshort = $objp->labelshort_account;
$facturefournisseur_static->ref = $objp->ref; $facturefournisseur_static->ref = $objp->ref;
$facturefournisseur_static->id = $objp->facid; $facturefournisseur_static->id = $objp->facid;
$thirdpartystatic->id = $objp->socid; $thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name; $thirdpartystatic->name = $objp->name;
$thirdpartystatic->client = $objp->client; $thirdpartystatic->client = $objp->client;
$thirdpartystatic->fournisseur = $objp->fournisseur; $thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->code_client = $objp->code_client; $thirdpartystatic->code_client = $objp->code_client;
$thirdpartystatic->code_compta_client = $objp->code_compta_client; $thirdpartystatic->code_compta_client = $objp->code_compta_client;
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur; $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = $objp->country_code;
$product_static->ref = $objp->product_ref; $productstatic->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $productstatic->id = $objp->product_id;
$product_static->label = $objp->product_label; $productstatic->label = $objp->product_label;
$product_static->type = $objp->line_type; $productstatic->type = $objp->line_type;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -425,8 +430,9 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>'; print '<td>'.$objp->tva_intra.'</td>';
print '<td>'; print '<td class="center">';
print $codecompta.' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">'; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit(); print img_edit();
print '</a></td>'; print '</a></td>';
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>'; print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>';

View File

@ -320,7 +320,7 @@ if ($result) {
$param = ''; $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_societe) $param.='&search_societe='.urlencode($search_societe); if ($search_societe) $param .= '&search_societe='.urlencode($search_societe);
if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid); if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid);
if ($search_day) $param .= '&search_day='.urlencode($search_day); if ($search_day) $param .= '&search_day='.urlencode($search_day);
if ($search_month) $param .= '&search_month='.urlencode($search_month); if ($search_month) $param .= '&search_month='.urlencode($search_month);

View File

@ -458,7 +458,17 @@ if ($conf->use_javascript_ajax) {
} }
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AlwaysShowFullArbo").'</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_ALWAYS_SHOW_FULL_ARBO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_ALWAYS_SHOW_FULL_ARBO", $arrval, $conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO);
}
print "</td>\n";
print "</tr>\n";
print '</table>'; print '</table>';
/* /*

View File

@ -523,7 +523,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$keyforbreak = 'duration'; $keyforbreak = 'duration';
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
print '<tr><td>'.$langs->trans("TotalCost").'</td><td>'.price($object->total_cost).'</td></tr>'; print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td>'.price($object->total_cost).'</td></tr>';
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>'; print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
// Other attributes // Other attributes

View File

@ -1013,11 +1013,20 @@ class BOM extends CommonObject
$this->unit_cost = 0; $this->unit_cost = 0;
$this->total_cost = 0; $this->total_cost = 0;
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
foreach ($this->lines as &$line) { foreach ($this->lines as &$line) {
$tmpproduct = new Product($this->db); $tmpproduct = new Product($this->db);
$tmpproduct->fetch($line->fk_product); $tmpproduct->fetch($line->fk_product);
$line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
if (empty($line->unit_cost)) {
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0)
{
$line->unit_cost = $productFournisseur->fourn_unitprice;
}
}
$line->unit_cost = (!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp; // TODO : add option to work with cost_price or pmp
$line->total_cost = price2num($line->qty * $line->unit_cost, 'MT'); $line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
$this->total_cost += $line->total_cost; $this->total_cost += $line->total_cost;
} }

View File

@ -64,9 +64,7 @@ class Categorie extends CommonObject
/** /**
* @var array ID mapping from type string * @var array Table of mapping between type string and ID used for field 'type' in table llx_categories
*
* @note This array should be removed in future, once previous constants are moved to the string value. Deprecated
*/ */
protected $MAP_ID = array( protected $MAP_ID = array(
'product' => 0, 'product' => 0,
@ -79,7 +77,8 @@ class Categorie extends CommonObject
'user' => 7, 'user' => 7,
'bank_line' => 8, 'bank_line' => 8,
'warehouse' => 9, 'warehouse' => 9,
'actioncomm' => 10 'actioncomm' => 10,
'website_page' => 11
); );
/** /**
@ -1113,6 +1112,10 @@ class Categorie extends CommonObject
global $conf, $langs; global $conf, $langs;
if (!is_numeric($type)) $type = $this->MAP_ID[$type]; if (!is_numeric($type)) $type = $this->MAP_ID[$type];
if (is_null($type)) {
$this->error = 'BadValueForParameterType';
return -1;
}
if (is_string($markafterid)) if (is_string($markafterid))
{ {

View File

@ -54,6 +54,7 @@ $typetext = $type;
if ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans('AccountsCategoriesArea'); if ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans('AccountsCategoriesArea');
elseif ($type == Categorie::TYPE_WAREHOUSE) $title = $langs->trans('StocksCategoriesArea'); elseif ($type == Categorie::TYPE_WAREHOUSE) $title = $langs->trans('StocksCategoriesArea');
elseif ($type == Categorie::TYPE_ACTIONCOMM) $title = $langs->trans('ActionCommCategoriesArea'); elseif ($type == Categorie::TYPE_ACTIONCOMM) $title = $langs->trans('ActionCommCategoriesArea');
elseif ($type == Categorie::TYPE_WEBSITE_PAGE) $title = $langs->trans('WebsitePagesCategoriesArea');
else $title = $langs->trans(ucfirst($type).'sCategoriesArea'); else $title = $langs->trans(ucfirst($type).'sCategoriesArea');
$arrayofjs = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofjs = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
@ -69,8 +70,6 @@ if (!empty($user->rights->categorie->creer)) {
print load_fiche_titre($title, $newcardbutton, 'object_category'); print load_fiche_titre($title, $newcardbutton, 'object_category');
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
@ -88,20 +87,9 @@ print '<td colspan="3">'.$langs->trans("Search").'</td>';
print '</tr>'; print '</tr>';
print '<tr class="oddeven nohover"><td>'; print '<tr class="oddeven nohover"><td>';
print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.$catname.'"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>'; print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.$catname.'"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
/*
// faire une rech dans une sous categorie uniquement
print '<tr '.$bc[0].'><td>';
print $langs->trans("SubCatOf").':</td><td>';
print $form->select_all_categories('','subcatof');
print '</td>';
print '<td><input type="submit" class="button" value="'.$langs->trans ("Search").'"></td></tr>';
*/
print '</table></form>'; print '</table></form>';
//print '</td><td valign="top" width="70%">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
@ -138,7 +126,6 @@ if ($catname || $id > 0)
else print '&nbsp;'; else print '&nbsp;';
//print '</td></tr></table>';
print '</div></div></div>'; print '</div></div></div>';
print '<div class="fichecenter"><br>'; print '<div class="fichecenter"><br>';

View File

@ -177,12 +177,6 @@ class ActionComm extends CommonObject
*/ */
public $fulldayevent = 0; public $fulldayevent = 0;
/**
* @var int Milestone
* @deprecated Milestone is already event with end date = start date
*/
public $punctual = 1;
/** /**
* @var integer Percentage * @var integer Percentage
*/ */
@ -343,6 +337,20 @@ class ActionComm extends CommonObject
*/ */
public $errors_to; public $errors_to;
/**
* Typical value for a event that is in a todo state
*/
const EVENT_TODO = 0;
/**
* Typical value for a event that is in a progress state
*/
const EVENT_IN_PROGRESS = 50;
/**
* Typical value for a event that is in a finished state
*/
const EVENT_FINISHED = 100;
/** /**
* Constructor * Constructor
@ -384,7 +392,6 @@ class ActionComm extends CommonObject
if (empty($this->percentage)) $this->percentage = 0; if (empty($this->percentage)) $this->percentage = 0;
if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0; if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0;
if (empty($this->fulldayevent)) $this->fulldayevent = 0; if (empty($this->fulldayevent)) $this->fulldayevent = 0;
if (empty($this->punctual)) $this->punctual = 0;
if (empty($this->transparency)) $this->transparency = 0; if (empty($this->transparency)) $this->transparency = 0;
if ($this->percentage > 100) $this->percentage = 100; if ($this->percentage > 100) $this->percentage = 100;
//if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; //if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date;
@ -462,7 +469,7 @@ class ActionComm extends CommonObject
$sql .= "fk_user_author,"; $sql .= "fk_user_author,";
$sql .= "fk_user_action,"; $sql .= "fk_user_action,";
$sql .= "fk_user_done,"; $sql .= "fk_user_done,";
$sql .= "label,percent,priority,fulldayevent,location,punctual,"; $sql .= "label,percent,priority,fulldayevent,location,";
$sql .= "transparency,"; $sql .= "transparency,";
$sql .= "fk_element,"; $sql .= "fk_element,";
$sql .= "elementtype,"; $sql .= "elementtype,";
@ -492,7 +499,7 @@ class ActionComm extends CommonObject
$sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", "; $sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", ";
$sql .= ($userownerid > 0 ? $userownerid : "null").", "; $sql .= ($userownerid > 0 ? $userownerid : "null").", ";
$sql .= ($userdoneid > 0 ? $userdoneid : "null").", "; $sql .= ($userdoneid > 0 ? $userdoneid : "null").", ";
$sql .= "'".$this->db->escape($this->label)."','".$this->db->escape($this->percentage)."','".$this->db->escape($this->priority)."','".$this->db->escape($this->fulldayevent)."','".$this->db->escape($this->location)."','".$this->db->escape($this->punctual)."', "; $sql .= "'".$this->db->escape($this->label)."','".$this->db->escape($this->percentage)."','".$this->db->escape($this->priority)."','".$this->db->escape($this->fulldayevent)."','".$this->db->escape($this->location)."', ";
$sql .= "'".$this->db->escape($this->transparency)."', "; $sql .= "'".$this->db->escape($this->transparency)."', ";
$sql .= (!empty($this->fk_element) ? $this->fk_element : "null").", "; $sql .= (!empty($this->fk_element) ? $this->fk_element : "null").", ";
$sql .= (!empty($this->elementtype) ? "'".$this->db->escape($this->elementtype)."'" : "null").", "; $sql .= (!empty($this->elementtype) ? "'".$this->db->escape($this->elementtype)."'" : "null").", ";
@ -693,7 +700,7 @@ class ActionComm extends CommonObject
$sql .= " a.fk_user_action, a.fk_user_done,"; $sql .= " a.fk_user_action, a.fk_user_done,";
$sql .= " a.fk_contact, a.percent as percentage,"; $sql .= " a.fk_contact, a.percent as percentage,";
$sql .= " a.fk_element as elementid, a.elementtype,"; $sql .= " a.fk_element as elementid, a.elementtype,";
$sql .= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; $sql .= " a.priority, a.fulldayevent, a.location, a.transparency,";
$sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,"; $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,";
$sql .= " s.nom as socname,"; $sql .= " s.nom as socname,";
$sql .= " u.firstname, u.lastname as lastname"; $sql .= " u.firstname, u.lastname as lastname";
@ -758,7 +765,6 @@ class ActionComm extends CommonObject
$this->fulldayevent = $obj->fulldayevent; $this->fulldayevent = $obj->fulldayevent;
$this->location = $obj->location; $this->location = $obj->location;
$this->transparency = $obj->transparency; $this->transparency = $obj->transparency;
$this->punctual = $obj->punctual; // deprecated
$this->socid = $obj->fk_soc; // To have fetch_thirdparty method working $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working
$this->contactid = $obj->fk_contact; // To have fetch_contact method working $this->contactid = $obj->fk_contact; // To have fetch_contact method working
@ -1612,7 +1618,7 @@ class ActionComm extends CommonObject
$sql .= " a.fk_user_action,"; $sql .= " a.fk_user_action,";
$sql .= " a.fk_contact, a.percent as percentage,"; $sql .= " a.fk_contact, a.percent as percentage,";
$sql .= " a.fk_element, a.elementtype,"; $sql .= " a.fk_element, a.elementtype,";
$sql .= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; $sql .= " a.priority, a.fulldayevent, a.location, a.transparency,";
$sql .= " u.firstname, u.lastname, u.email,"; $sql .= " u.firstname, u.lastname, u.email,";
$sql .= " s.nom as socname,"; $sql .= " s.nom as socname,";
$sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label"; $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label";
@ -1719,7 +1725,6 @@ class ActionComm extends CommonObject
$event['fulldayevent'] = $obj->fulldayevent; $event['fulldayevent'] = $obj->fulldayevent;
$event['location'] = $obj->location; $event['location'] = $obj->location;
$event['transparency'] = (($obj->transparency > 0) ? 'OPAQUE' : 'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy) $event['transparency'] = (($obj->transparency > 0) ? 'OPAQUE' : 'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy)
$event['punctual'] = $obj->punctual;
$event['category'] = $obj->type_label; $event['category'] = $obj->type_label;
$event['email'] = $obj->email; $event['email'] = $obj->email;
// Define $urlwithroot // Define $urlwithroot
@ -1929,11 +1934,7 @@ class ActionComm extends CommonObject
$this->datem = $now; $this->datem = $now;
$this->datep = $now; $this->datep = $now;
$this->datef = $now; $this->datef = $now;
$this->author = $user;
$this->usermod = $user;
$this->usertodo = $user;
$this->fulldayevent = 0; $this->fulldayevent = 0;
$this->punctual = 0;
$this->percentage = 0; $this->percentage = 0;
$this->location = 'Location'; $this->location = 'Location';
$this->transparency = 1; // 1 means opaque $this->transparency = 1; // 1 means opaque
@ -2021,4 +2022,32 @@ class ActionComm extends CommonObject
return $error; return $error;
} }
/**
* Udpate the percent value of a event with the given id
*
* @param int $id The id of the event
* @param int $percent The new percent value for the event
* @return int 1 when update of the event was suscessfull, otherwise -1
*/
public function updatePercent($id, $percent)
{
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
$sql .= " SET percent = ".(int) $percent;
$sql .= " WHERE id=".$id;
if ($this->db->query($sql))
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
$this->error = $this->db->lasterror();
return -1;
}
}
} }

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Open-DSI <support@open-dsi.fr> * Copyright (C) 2017 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -40,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->loadLangs(array("users", "companies", "agenda", "commercial", "other")); $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other"));
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$massaction = GETPOST('massaction', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
$resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid", "int") : GETPOST("resourceid", "int"); $resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid", "int") : GETPOST("resourceid", "int");
$pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3); $pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3);
@ -49,6 +51,8 @@ $optioncss = GETPOST('optioncss', 'alpha');
$year = GETPOST("year", 'int'); $year = GETPOST("year", 'int');
$month = GETPOST("month", 'int'); $month = GETPOST("month", 'int');
$day = GETPOST("day", 'int'); $day = GETPOST("day", 'int');
$toselect = GETPOST('toselect', 'array');
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('search_actioncode', 'array')) if (GETPOST('search_actioncode', 'array'))
{ {
@ -185,9 +189,42 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$datestart = ''; $datestart = '';
$dateend = ''; $dateend = '';
$search_status = ''; $search_status = '';
$toselect = '';
$search_array_options = array(); $search_array_options = array();
} }
if (empty($reshook) && !empty($massaction))
{
unset($percent);
switch ($massaction)
{
case 'set_all_events_to_todo':
$percent = ActionComm::EVENT_TODO;
break;
case 'set_all_events_to_in_progress':
$percent = ActionComm::EVENT_IN_PROGRESS;
break;
case 'set_all_events_to_finished':
$percent = ActionComm::EVENT_FINISHED;
break;
}
if(isset($percent))
{
foreach ($toselect as $toselectid)
{
$result = $object->updatePercent($toselectid, $percent);
if($result < 0)
{
dol_print_error($db);
break;
}
}
}
}
/* /*
* View * View
@ -239,6 +276,15 @@ if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
'set_all_events_to_todo' => $langs->trans("SetAllEventsToTodo"),
'set_all_events_to_in_progress' => $langs->trans("SetAllEventsToInProgress"),
'set_all_events_to_finished' => $langs->trans("SetAllEventsToFinished"),
);
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$sql = "SELECT"; $sql = "SELECT";
if ($usergroup > 0) $sql .= " DISTINCT"; if ($usergroup > 0) $sql .= " DISTINCT";
$sql .= " s.nom as societe, s.rowid as socid, s.client, s.email as socemail,"; $sql .= " s.nom as societe, s.rowid as socid, s.client, s.email as socemail,";
@ -366,6 +412,8 @@ if ($resql)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$arrayofselected = is_array($toselect) ? $toselect : array();
// Local calendar // Local calendar
$newtitle = '<div class="nowrap clear inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; </div>'; $newtitle = '<div class="nowrap clear inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; </div>';
//$newtitle=$langs->trans($title); //$newtitle=$langs->trans($title);
@ -436,7 +484,7 @@ if ($resql)
$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 : ''))); $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, 0, 0, 1); print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1 * $nbtotalofrecords, '', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1);
$moreforfilter = ''; $moreforfilter = '';
@ -740,7 +788,15 @@ if ($resql)
$datep = $db->jdate($obj->datep); $datep = $db->jdate($obj->datep);
print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent, 5, 0, $datep).'</td>'; print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent, 5, 0, $datep).'</td>';
} }
print '<td></td>'; // Action column
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected = 0;
if (in_array($obj->id, $arrayofselected)) $selected = 1;
print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;

View File

@ -557,14 +557,17 @@ if (empty($reshook))
} }
} }
elseif ($action == 'setdate_livraison' && $usercancreate) { elseif ($action == 'setdate_livraison' && $usercancreate)
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; {
$datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
$datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
$result = $object->set_date_livraison($user, $datelivraison); $object->fetch($id);
if ($result < 0) { $result = $object->set_date_livraison($user, $datedelivery);
setEventMessages($object->error, $object->errors, 'errors'); if ($result < 0)
} {
setEventMessages($object->error, $object->errors, 'errors');
}
} }
elseif ($action == 'setmode' && $usercancreate) { elseif ($action == 'setmode' && $usercancreate) {
@ -1681,15 +1684,14 @@ if ($action == 'create' && $usercancreate)
print $form->selectDate('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date print $form->selectDate('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date
print '</td></tr>'; print '</td></tr>';
// Delivery date planed // Date delivery planned
print "<tr><td>".$langs->trans("DateDeliveryPlanned").'</td><td>'; print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
if (empty($datedelivery)) print '<td colspan="3">';
{ //print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed.
if (!empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST
else $datedelivery = empty($conf->global->MAIN_AUTOFILL_DATE_DELIVERY) ?-1 : ''; print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1);
} print "</td>\n";
print $form->selectDate($datedelivery, 'liv_', '', '', '', "crea_commande", 1, 1); print '</tr>';
print "</td></tr>";
// terms of the settlement // terms of the settlement
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>'; print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
@ -2209,11 +2211,11 @@ if ($action == 'create' && $usercancreate)
print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">'; print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setdate_livraison">'; print '<input type="hidden" name="action" value="setdate_livraison">';
print $form->selectDate($object->date_livraison ? $object->date_livraison : - 1, 'liv_', '', '', '', "setdate_livraison"); print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0);
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">'; print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>'; print '</form>';
} else { } else {
print $object->date_livraison ? dol_print_date($object->date_livraison, 'daytext') : '&nbsp;'; print $object->date_livraison ? dol_print_date($object->date_livraison, 'dayhour') : '&nbsp;';
if ($object->hasDelay() && !empty($object->date_livraison)) { if ($object->hasDelay() && !empty($object->date_livraison)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
} }

View File

@ -2018,7 +2018,7 @@ class Commande extends CommonOrder
/** /**
* Load array lines * Load array lines
* *
* @param int $only_product Return only physical products * @param int $only_product Return only physical products, not services
* @param int $loadalsotranslation Return translation for products * @param int $loadalsotranslation Return translation for products
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */

View File

@ -1147,7 +1147,7 @@ if ($resql)
if (!empty($arrayfields['c.date_delivery']['checked'])) if (!empty($arrayfields['c.date_delivery']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
print dol_print_date($db->jdate($obj->date_delivery), 'day'); print dol_print_date($db->jdate($obj->date_delivery), 'dayhour');
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }

View File

@ -1025,7 +1025,7 @@ if (empty($reshook))
// Replacement invoice // Replacement invoice
if ($_POST['type'] == Facture::TYPE_REPLACEMENT) if ($_POST['type'] == Facture::TYPE_REPLACEMENT)
{ {
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) if (empty($dateinvoice))
{ {
$error++; $error++;
@ -1086,7 +1086,7 @@ if (empty($reshook))
$action = 'create'; $action = 'create';
} }
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) if (empty($dateinvoice))
{ {
$error++; $error++;
@ -1269,7 +1269,7 @@ if (empty($reshook))
// Standard invoice or Deposit invoice, created from a Predefined template invoice // Standard invoice or Deposit invoice, created from a Predefined template invoice
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0)
{ {
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) if (empty($dateinvoice))
{ {
$error++; $error++;
@ -1320,7 +1320,7 @@ if (empty($reshook))
$action = 'create'; $action = 'create';
} }
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) if (empty($dateinvoice))
{ {
$error++; $error++;
@ -1745,7 +1745,7 @@ if (empty($reshook))
// Situation invoices // Situation invoices
if (GETPOST('type') == Facture::TYPE_SITUATION && (!empty($_POST['situations']))) if (GETPOST('type') == Facture::TYPE_SITUATION && (!empty($_POST['situations'])))
{ {
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($datefacture)) { if (empty($datefacture)) {
$error++; $error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
@ -2907,6 +2907,18 @@ if ($action == 'create')
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
} }
// when payment condition is empty (means not override by payment condition form a other object, like third-party), try to use default value
if(empty($cond_reglement_id))
{
$cond_reglement_id = GETPOST("cond_reglement_id");
}
// when payment mode is empty (means not override by payment mode form a other object, like third-party), try to use default value
if(empty($mode_reglement_id))
{
$mode_reglement_id = GETPOST("mode_reglement_id");
}
if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts();
$note_public = $object->getDefaultCreateValueFor('note_public', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_public : null)); $note_public = $object->getDefaultCreateValueFor('note_public', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_public : null));
$note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_private : null)); $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_private : null));

View File

@ -358,7 +358,6 @@ if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax)
if (!empty($conf->socialnetworks->enabled)) { if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) { foreach ($socialnetworks as $key => $value) {
if ($value['active'] && strlen($search_{$key})) { if ($value['active'] && strlen($search_{$key})) {
//$sql.= natural_search("p.socialnetworks->'$.".$key."'", $search_{$key});
$sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\''; $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\'';
} }
} }

View File

@ -43,7 +43,7 @@ $number = strlen($letters);
$string = ''; $string = '';
for ($i = 0; $i < $length; $i++) for ($i = 0; $i < $length; $i++)
{ {
$string .= $letters{mt_rand(0, $number - 1)}; $string .= $letters[mt_rand(0, $number - 1)];
} }
//print $string; //print $string;

View File

@ -1,4 +1,6 @@
<?php <?php
use Splash\Tests\WsObjects\O00ObjectBaseTest;
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com> * Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
@ -37,7 +39,7 @@ class Conf
public $file; public $file;
/** /**
* @var DoliDB Database handler. * @var Object Associative array with some properties ->type, ->db, ...
*/ */
public $db; public $db;

View File

@ -43,7 +43,7 @@ class ExtraFields
public $db; public $db;
/** /**
* @var string type of element (for what object is the extrafield) * @var array Array with type of element (for what object is the extrafield)
* @deprecated * @deprecated
*/ */
public $attribute_elementtype; public $attribute_elementtype;

File diff suppressed because it is too large Load Diff

View File

@ -368,6 +368,8 @@ class Form
$s = picto_from_langcode($langcode, 'class="pictoforlang paddingright"'); $s = picto_from_langcode($langcode, 'class="pictoforlang paddingright"');
$resultforextrlang .= $s; $resultforextrlang .= $s;
// TODO Use the showInputField() method of ExtraLanguages object
if ($typeofdata == 'textarea') { if ($typeofdata == 'textarea') {
$resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">'; $resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';
$resultforextrlang .= $valuetoshow; $resultforextrlang .= $valuetoshow;

View File

@ -1966,7 +1966,7 @@ class Lessc {
$this->pushEnv(); $this->pushEnv();
$parser = new lessc_parser($this, __METHOD__); $parser = new lessc_parser($this, __METHOD__);
foreach ($args as $name => $strValue) { foreach ($args as $name => $strValue) {
if ($name{0} !== '@') { if ($name[0] !== '@') {
$name = '@'.$name; $name = '@'.$name;
} }
$parser->count = 0; $parser->count = 0;
@ -2638,7 +2638,7 @@ class lessc_parser {
$hidden = true; $hidden = true;
if (!isset($block->args)) { if (!isset($block->args)) {
foreach ($block->tags as $tag) { foreach ($block->tags as $tag) {
if (!is_string($tag) || $tag{0} != $this->lessc->mPrefix) { if (!is_string($tag) || $tag[0] != $this->lessc->mPrefix) {
$hidden = false; $hidden = false;
break; break;
} }
@ -2692,7 +2692,7 @@ class lessc_parser {
protected function fixTags($tags) { protected function fixTags($tags) {
// move @ tags out of variable namespace // move @ tags out of variable namespace
foreach ($tags as &$tag) { foreach ($tags as &$tag) {
if ($tag{0} == $this->lessc->vPrefix) if ($tag[0] == $this->lessc->vPrefix)
$tag[0] = $this->lessc->mPrefix; $tag[0] = $this->lessc->mPrefix;
} }
return $tags; return $tags;

View File

@ -3170,7 +3170,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench',
'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top',
'home', 'companies', 'products', 'commercial', 'invoicing', 'preview', 'project', 'projectpub', 'supplier_invoice', 'hrm', 'members', 'ticket', 'generic', 'home', 'companies', 'products', 'commercial', 'invoicing', 'pencil-ruler', 'preview', 'project', 'projectpub', 'supplier_invoice', 'hrm', 'members', 'ticket', 'generic',
'error', 'warning', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'error', 'warning', 'supplier_proposal', 'supplier_order', 'supplier_invoice',
'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda' 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda'
) )

View File

@ -463,15 +463,15 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
{ {
$max = strlen($lowercase) - 1; $max = strlen($lowercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) { for ($x = 0; $x < $nbofchar; $x++) {
$randomCode .= $lowercase{random_int(0, $max)}; $randomCode .= $lowercase[random_int(0, $max)];
} }
$max = strlen($uppercase) - 1; $max = strlen($uppercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) { for ($x = 0; $x < $nbofchar; $x++) {
$randomCode .= $uppercase{random_int(0, $max)}; $randomCode .= $uppercase[random_int(0, $max)];
} }
$max = strlen($numbers) - 1; $max = strlen($numbers) - 1;
for ($x = 0; $x < $nbofcharlast; $x++) { for ($x = 0; $x < $nbofcharlast; $x++) {
$randomCode .= $numbers{random_int(0, $max)}; $randomCode .= $numbers[random_int(0, $max)];
} }
$generated_password = str_shuffle($randomCode); $generated_password = str_shuffle($randomCode);
@ -480,15 +480,15 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
{ {
$max = strlen($lowercase) - 1; $max = strlen($lowercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) { for ($x = 0; $x < $nbofchar; $x++) {
$randomCode .= $lowercase{mt_rand(0, $max)}; $randomCode .= $lowercase[mt_rand(0, $max)];
} }
$max = strlen($uppercase) - 1; $max = strlen($uppercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) { for ($x = 0; $x < $nbofchar; $x++) {
$randomCode .= $uppercase{mt_rand(0, $max)}; $randomCode .= $uppercase[mt_rand(0, $max)];
} }
$max = strlen($numbers) - 1; $max = strlen($numbers) - 1;
for ($x = 0; $x < $nbofcharlast; $x++) { for ($x = 0; $x < $nbofcharlast; $x++) {
$randomCode .= $numbers{mt_rand(0, $max)}; $randomCode .= $numbers[mt_rand(0, $max)];
} }
$generated_password = str_shuffle($randomCode); $generated_password = str_shuffle($randomCode);
@ -512,11 +512,11 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
$max = strlen($numbers) - 1; $max = strlen($numbers) - 1;
if (function_exists('random_int')) // Cryptographic random if (function_exists('random_int')) // Cryptographic random
{ {
$generated_password = str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password); $generated_password = str_replace($replaceambiguouschars, $numbers[random_int(0, $max)], $generated_password);
} }
else else
{ {
$generated_password = str_replace($replaceambiguouschars, $numbers{mt_rand(0, $max)}, $generated_password); $generated_password = str_replace($replaceambiguouschars, $numbers[mt_rand(0, $max)], $generated_password);
} }
} }

View File

@ -157,10 +157,15 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
$tplcontent .= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n"; $tplcontent .= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
$tplcontent .= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.' (https://www.dolibarr.org)" />'."\n"; $tplcontent .= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.' (https://www.dolibarr.org)" />'."\n";
$tplcontent .= '<meta name="dolibarr:pageid" content="'.dol_string_nohtmltag($objectpage->id).'" />'."\n"; $tplcontent .= '<meta name="dolibarr:pageid" content="'.dol_string_nohtmltag($objectpage->id).'" />'."\n";
// Add canonical reference
if ($object->virtualhost) {
$tplcontent .= '<link rel="canonical" href="'.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php')).'" />'."\n";
}
// Add translation reference (main language) // Add translation reference (main language)
if ($object->isMultiLang()) { if ($object->isMultiLang()) {
// Add myself // Add myself
$tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '')).'/'.$objectpage->pageurl.'.php').'" />'."\n"; $tplcontent .= '<?php if ($_SERVER["PHP_SELF"] == "'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '')).'/'.$objectpage->pageurl.'.php") { ?>'."\n";
$tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php').'" />'."\n";
// Add page "translation of" // Add page "translation of"
$translationof = $objectpage->fk_page; $translationof = $objectpage->fk_page;
@ -171,7 +176,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
$tmpshortlangcode = ''; $tmpshortlangcode = '';
if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en
if ($tmpshortlangcode != $shortlangcode) { if ($tmpshortlangcode != $shortlangcode) {
$tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="'.($object->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2) ? '/'.$tmpshortlangcode : '')).'/'.$tmppage->pageurl.'.php').'" />'."\n"; $tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="'.($object->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php').'" />'."\n";
} }
} }
} }
@ -194,10 +199,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
} }
} }
else dol_print_error($db); else dol_print_error($db);
} $tplcontent .= '<?php } ?>'."\n";
// Add canonical reference
if ($object->virtualhost) {
$tplcontent .= '<link rel="canonical" href="'.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php')).'" />'."\n";
} }
// Add manifest.json on homepage // Add manifest.json on homepage
$tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n"; $tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n";
@ -229,11 +231,11 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
/** /**
* Save content of the index.php and wrapper.php page * Save content of the index.php and/or wrapper.php page
* *
* @param string $pathofwebsite Path of website root * @param string $pathofwebsite Path of website root
* @param string $fileindex Full path of file index.php * @param string $fileindex Full path of file index.php
* @param string $filetpl File tpl to index.php page redirect to * @param string $filetpl File tpl the index.php page redirect to
* @param string $filewrapper Full path of file wrapper.php * @param string $filewrapper Full path of file wrapper.php
* @return boolean True if OK * @return boolean True if OK
*/ */
@ -246,29 +248,39 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
dol_mkdir($pathofwebsite); dol_mkdir($pathofwebsite);
dol_delete_file($fileindex); if ($fileindex) {
$indexcontent = '<?php'."\n"; dol_delete_file($fileindex);
$indexcontent .= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n"; $indexcontent = '<?php'."\n";
$indexcontent .= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n"; $indexcontent .= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n";
$indexcontent .= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n"; $indexcontent .= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$indexcontent .= 'if (! empty($_GET[\'pageref\']) || ! empty($_GET[\'pagealiasalt\']) || ! empty($_GET[\'pageid\'])) {'."\n"; $indexcontent .= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$indexcontent .= " require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $indexcontent .= 'if (! empty($_GET[\'pageref\']) || ! empty($_GET[\'pagealiasalt\']) || ! empty($_GET[\'pageid\'])) {'."\n";
$indexcontent .= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $indexcontent .= " require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$indexcontent .= ' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'."\n"; $indexcontent .= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$indexcontent .= "}\n"; $indexcontent .= ' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'."\n";
$indexcontent .= "include_once './".basename($filetpl)."'\n"; $indexcontent .= "}\n";
$indexcontent .= '// END PHP ?>'."\n"; $indexcontent .= "include_once './".basename($filetpl)."'\n";
$result1 = file_put_contents($fileindex, $indexcontent); $indexcontent .= '// END PHP ?>'."\n";
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($fileindex, octdec($conf->global->MAIN_UMASK)); $result1 = file_put_contents($fileindex, $indexcontent);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($fileindex, octdec($conf->global->MAIN_UMASK));
}
}
else {
$result1 = true;
} }
dol_delete_file($filewrapper);
$wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.php'); if ($filewrapper) {
dol_delete_file($filewrapper);
$wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.php');
$result2 = file_put_contents($filewrapper, $wrappercontent); $result2 = file_put_contents($filewrapper, $wrappercontent);
if (!empty($conf->global->MAIN_UMASK)) { if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filewrapper, octdec($conf->global->MAIN_UMASK)); @chmod($filewrapper, octdec($conf->global->MAIN_UMASK));
}
} else {
$result2 = true;
} }
return ($result1 && $result2); return ($result1 && $result2);

View File

@ -334,9 +334,10 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
* @param string $outputfile Output file * @param string $outputfile Output file
* @param string $filter (optional) Filter * @param string $filter (optional) Filter
* @param string $url Url (If empty, forge URL for agenda RSS export) * @param string $url Url (If empty, forge URL for agenda RSS export)
* @param string $langcode Language code to show in header
* @return int < 0 if ko, Nb of events in file if ok * @return int < 0 if ko, Nb of events in file if ok
*/ */
function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '') function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '', $langcode = '')
{ {
global $user, $conf, $langs; global $user, $conf, $langs;
global $dolibarr_main_url_root; global $dolibarr_main_url_root;
@ -362,7 +363,9 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt
fwrite($fichier, '<rss version="2.0">'); fwrite($fichier, '<rss version="2.0">');
fwrite($fichier, "\n"); fwrite($fichier, "\n");
fwrite($fichier, "<channel>\n<title>".$title."</title>\n"); fwrite($fichier, "<channel>\n");
fwrite($fichier, "<title>".$title."</title>\n");
if ($langcode) fwrite($fichier, "<language>".$langcode."</language>\n");
/* /*
fwrite($fichier, "<description><![CDATA[".$desc.".]]></description>"."\n". fwrite($fichier, "<description><![CDATA[".$desc.".]]></description>"."\n".

View File

@ -255,7 +255,6 @@ class CommActionRapport
$eventstatic->id = $obj->id; $eventstatic->id = $obj->id;
$eventstatic->percentage = $obj->percent; $eventstatic->percentage = $obj->percent;
$eventstatic->fulldayevent = $obj->fulldayevent; $eventstatic->fulldayevent = $obj->fulldayevent;
$eventstatic->punctual = $obj->punctual;
$y = max($y, $pdf->GetY(), $y0, $y1, $y2, $y3); $y = max($y, $pdf->GetY(), $y0, $y1, $y2, $y3);

View File

@ -212,8 +212,10 @@ class modFacture extends DolibarrModules
$this->export_fields_array[$r] = array( $this->export_fields_array[$r] = array(
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 'cd.nom'=>'State', 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 'cd.nom'=>'State',
's.phone'=>'Phone', 's.phone'=>'Phone',
's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4',
's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', 's.code_compta'=>'CustomerAccountancyCode',
's.code_compta_fournisseur'=>'SupplierAccountancyCode',
's.tva_intra'=>'VATIntra',
'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT", 'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT",
'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LT1', 'f.localtax2'=>'LT2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LT1', 'f.localtax2'=>'LT2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment',

View File

@ -1052,11 +1052,11 @@ class pdf_azur extends ModelePDFPropales
* Show total to pay * Show total to pay
* *
* @param PDF $pdf Object PDF * @param PDF $pdf Object PDF
* @param Facture $object Object invoice * @param Propal $object Object propal
* @param int $deja_regle Montant deja regle * @param int $deja_regle Amount already paid
* @param int $posy Position depart * @param int $posy Start position
* @param Translate $outputlangs Objet langs * @param Translate $outputlangs Objet langs
* @return int Position pour suite * @return int Position for continuation
*/ */
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{ {
@ -1068,7 +1068,7 @@ class pdf_azur extends ModelePDFPropales
$tab2_hl = 4; $tab2_hl = 4;
$pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
// Tableau total // Total table
$col1x = 120; $col2x = 170; $col1x = 120; $col2x = 170;
if ($this->page_largeur < 210) // To work with US executive format if ($this->page_largeur < 210) // To work with US executive format
{ {

View File

@ -83,7 +83,7 @@ print '<td class="linecoldiscount right">'.$langs->trans('ReductionShort').'</td
// Fields for situation invoice // Fields for situation invoice
if ($this->situation_cycle_ref) { if ($this->situation_cycle_ref) {
print '<td class="linecolcycleref right">'.$langs->trans('Progress').'</td>'; print '<td class="linecolcycleref right">'.$langs->trans('Progress').'</td>';
print '<td class="linecolcycleref2 right">'.$langs->trans('TotalHT100Short').'</td>'; print '<td class="linecolcycleref2 right">'.$form->textwithpicto($langs->trans('TotalHT100Short'), $langs->trans('UnitPriceXQtyLessDiscount')).'</td>';
} }
if ($usemargins && !empty($conf->margin->enabled) && empty($user->socid)) if ($usemargins && !empty($conf->margin->enabled) && empty($user->socid))

View File

@ -898,7 +898,6 @@ class InterfaceActionsAuto extends DolibarrTriggers
$actioncomm->datep = $now; $actioncomm->datep = $now;
$actioncomm->datef = $now; $actioncomm->datef = $now;
$actioncomm->durationp = 0; $actioncomm->durationp = 0;
$actioncomm->punctual = 1;
$actioncomm->percentage = -1; // Not applicable $actioncomm->percentage = -1; // Not applicable
$actioncomm->socid = $societeforaction->id; $actioncomm->socid = $societeforaction->id;
$actioncomm->contactid = $contactforaction->id; $actioncomm->contactid = $contactforaction->id;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> /* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -482,7 +482,7 @@ class DataPolicyCron
while ($i < $num && !$error) while ($i < $num && !$error)
{ {
$obj = $db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$object->fetch($obj->rowid); $object->fetch($obj->rowid);
$object->id = $obj->rowid; $object->id = $obj->rowid;

View File

@ -56,6 +56,7 @@ $search_ref_exp = GETPOST("search_ref_exp", 'alpha');
$search_ref_liv = GETPOST('search_ref_liv', 'alpha'); $search_ref_liv = GETPOST('search_ref_liv', 'alpha');
$search_ref_customer = GETPOST('search_ref_customer', 'alpha'); $search_ref_customer = GETPOST('search_ref_customer', 'alpha');
$search_company = GETPOST("search_company", 'alpha'); $search_company = GETPOST("search_company", 'alpha');
$search_tracking = GETPOST("search_tracking", 'alpha');
$search_town = GETPOST('search_town', 'alpha'); $search_town = GETPOST('search_town', 'alpha');
$search_zip = GETPOST('search_zip', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha');
$search_state = trim(GETPOST("search_state")); $search_state = trim(GETPOST("search_state"));
@ -106,6 +107,7 @@ $fieldstosearchall = array(
'e.ref'=>"Ref", 'e.ref'=>"Ref",
's.nom'=>"ThirdParty", 's.nom'=>"ThirdParty",
'e.note_public'=>'NotePublic', 'e.note_public'=>'NotePublic',
'e.tracking_number'=>"TrackingNumber",
); );
if (empty($user->socid)) $fieldstosearchall["e.note_private"] = "NotePrivate"; if (empty($user->socid)) $fieldstosearchall["e.note_private"] = "NotePrivate";
@ -120,6 +122,7 @@ $arrayfields = array(
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
'e.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1), 'e.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1),
'e.tracking_number'=>array('label'=>$langs->trans("TrackingNumber"), 'checked'=>1),
'e.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0), 'e.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0),
'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
@ -172,6 +175,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_state = ""; $search_state = "";
$search_type = ''; $search_type = '';
$search_country = ''; $search_country = '';
$search_tracking='';
$search_type_thirdparty = ''; $search_type_thirdparty = '';
$search_billed = ''; $search_billed = '';
$search_datedelivery_start = ''; $search_datedelivery_start = '';
@ -214,7 +218,7 @@ llxHeader('', $langs->trans('ListOfSendings'), $helpurl);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,"; $sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,";
$sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, "; $sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ";
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";
@ -273,6 +277,7 @@ if ($search_town) $sql .= natural_search('s.town', $search_town);
if ($search_zip) $sql .= natural_search("s.zip", $search_zip); if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
if ($search_state) $sql .= natural_search("state.nom", $search_state); if ($search_state) $sql .= natural_search("state.nom", $search_state);
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_tracking) $sql.= natural_search("e.tracking_number", $search_tracking);
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale; if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp);
@ -330,6 +335,7 @@ if ($resql)
if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale); if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
if ($search_company) $param .= "&amp;search_company=".urlencode($search_company); if ($search_company) $param .= "&amp;search_company=".urlencode($search_company);
if ($search_tracking) $param.= "&amp;search_tracking=".urlencode($search_tracking);
if ($search_town) $param .= '&search_town='.urlencode($search_town); if ($search_town) $param .= '&search_town='.urlencode($search_town);
if ($search_zip) $param .= '&search_zip='.urlencode($search_zip); if ($search_zip) $param .= '&search_zip='.urlencode($search_zip);
@ -507,6 +513,13 @@ if ($resql)
print '</div>'; print '</div>';
print '</td>'; print '</td>';
} }
// Tracking number
if (! empty($arrayfields['e.tracking_number']['checked']))
{
print '<td class="liste_titre center">';
print '<input class="flat" size="6" type="text" name="search_tracking" value="'.dol_escape_htmltag($search_tracking).'">';
print '</td>';
}
if (!empty($arrayfields['l.ref']['checked'])) if (!empty($arrayfields['l.ref']['checked']))
{ {
// Delivery ref // Delivery ref
@ -579,6 +592,7 @@ if ($resql)
if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['e.weight']['checked'])) print_liste_field_titre($arrayfields['e.weight']['label'], $_SERVER["PHP_SELF"], "e.weight", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['e.weight']['checked'])) print_liste_field_titre($arrayfields['e.weight']['label'], $_SERVER["PHP_SELF"], "e.weight", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['e.tracking_number']['checked'])) print_liste_field_titre($arrayfields['e.tracking_number']['label'], $_SERVER["PHP_SELF"], "e.tracking_number", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['l.ref']['checked'])) print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['l.ref']['checked'])) print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
// Extra fields // Extra fields
@ -699,13 +713,19 @@ if ($resql)
if (!empty($arrayfields['e.date_delivery']['checked'])) if (!empty($arrayfields['e.date_delivery']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
print dol_print_date($db->jdate($obj->date_livraison), "day"); print dol_print_date($db->jdate($obj->date_livraison), "dayhour");
/*$now = time(); /*$now = time();
if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 ) if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 )
{ {
}*/ }*/
print "</td>\n"; print "</td>\n";
} }
// Tracking number
if (! empty($arrayfields['e.tracking_number']['checked']))
{
print '<td class="center">'.$obj->tracking_number."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked']))
{ {

View File

@ -103,16 +103,17 @@ if (empty($reshook))
} }
if ($action == 'setdatedelivery' && $user->rights->commande->creer) if ($action == 'setdatedelivery' && $user->rights->commande->creer)
{ {
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
$datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
$object = new Commande($db); $object->fetch($id);
$object->fetch($id); $result = $object->set_date_livraison($user, $datedelivery);
$result = $object->set_date_livraison($user, $datelivraison); if ($result < 0)
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
}
/* /*
if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) if ($action == 'setdeliveryaddress' && $user->rights->commande->creer)
{ {
@ -352,7 +353,7 @@ if ($id > 0 || !empty($ref))
// Date // Date
print '<tr><td>'.$langs->trans('Date').'</td>'; print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
print dol_print_date($object->date, 'daytext'); print dol_print_date($object->date, 'day');
if ($object->hasDelay() && empty($object->date_livraison)) { if ($object->hasDelay() && empty($object->date_livraison)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
} }
@ -373,13 +374,13 @@ if ($id > 0 || !empty($ref))
print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">'; print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setdatedelivery">'; print '<input type="hidden" name="action" value="setdatedelivery">';
print $form->selectDate($object->date_livraison > 0 ? $object->date_livraison : -1, 'liv_', '', '', '', "setdatedelivery"); print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0);
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">'; print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>'; print '</form>';
} }
else else
{ {
print dol_print_date($object->date_livraison, 'daytext'); print dol_print_date($object->date_livraison, 'dayhour');
if ($object->hasDelay() && !empty($object->date_livraison)) { if ($object->hasDelay() && !empty($object->date_livraison)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
} }

View File

@ -8,7 +8,7 @@
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr> * Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Christophe Battarel <christophe@altairis.fr> * Copyright (C) 2019-2020 Christophe Battarel <christophe@altairis.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -38,6 +38,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/stock/class/mouvementstock.class.php';
if (!empty($conf->projet->enabled)) if (!empty($conf->projet->enabled))
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
@ -53,6 +55,8 @@ $ref = GETPOST('ref');
$lineid = GETPOST('lineid', 'int'); $lineid = GETPOST('lineid', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$fk_default_warehouse = GETPOST('fk_default_warehouse', 'int'); $fk_default_warehouse = GETPOST('fk_default_warehouse', 'int');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
if ($user->socid) if ($user->socid)
$socid = $user->socid; $socid = $user->socid;
@ -366,6 +370,126 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
} }
} }
// Remove a dispatched line
if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->fournisseur->commande->receptionner)
{
$db->begin();
$supplierorderdispatch = new CommandeFournisseurDispatch($db);
$result = $supplierorderdispatch->fetch($lineid);
if ($result > 0)
{
$qty = $supplierorderdispatch->qty;
$entrepot = $supplierorderdispatch->fk_entrepot;
$product = $supplierorderdispatch->fk_product;
$price = GETPOST('price');
$comment = $supplierorderdispatch->comment;
$eatby = $supplierorderdispatch->fk_product;
$sellby = $supplierorderdispatch->sellby;
$batch = $supplierorderdispatch->batch;
$result = $supplierorderdispatch->delete($user);
}
if ($result < 0)
{
$errors = $object->errors;
$error++;
}
else
{
// If module stock is enabled and the stock increase is done on purchase order dispatching
if ($entrepot > 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER))
{
$mouv = new MouvementStock($db);
if ($product > 0)
{
$mouv->origin = &$object;
$result=$mouv->livraison($user, $product, $entrepot, $qty, $price, $comment, '', $eatby, $sellby, $batch);
if ($result < 0)
{
$errors=$mouv->errors;
$error++;
}
}
}
}
if ($error > 0)
{
$db->rollback();
setEventMessages($error, $errors, 'errors');
}
else
{
$db->commit();
}
}
// Update a dispatched line
if ($action == 'updateline' && $user->rights->fournisseur->commande->receptionner)
{
$db->begin();
$error = 0;
$supplierorderdispatch = new CommandeFournisseurDispatch($db);
$result = $supplierorderdispatch->fetch($lineid);
if ($result > 0)
{
$qty = $supplierorderdispatch->qty;
$entrepot = $supplierorderdispatch->fk_entrepot;
$product = $supplierorderdispatch->fk_product;
$price = GETPOST('price');
$comment = $supplierorderdispatch->comment;
$eatby = $supplierorderdispatch->fk_product;
$sellby = $supplierorderdispatch->sellby;
$batch = $supplierorderdispatch->batch;
$supplierorderdispatch->qty = GETPOST('qty', 'int');
$supplierorderdispatch->fk_entrepot = GETPOST('fk_entrepot');
$result = $supplierorderdispatch->update($user);
}
if ($result < 0)
{
$error++;
$errors=$supplierorderdispatch->errors;
}
else
{
// If module stock is enabled and the stock increase is done on purchase order dispatching
if ($entrepot > 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER))
{
$mouv = new MouvementStock($db);
if ($product > 0)
{
$mouv->origin = &$object;
$result=$mouv->livraison($user, $product, $entrepot, $qty, $price, $comment, '', $eatby, $sellby, $batch);
if ($result < 0)
{
$errors=$mouv->errors;
$error++;
}
else
{
$mouv->origin = &$object;
$result=$mouv->reception($user, $product, $supplierorderdispatch->fk_entrepot, $supplierorderdispatch->qty, $price, $comment, $eatby, $sellby, $batch);
if ($result < 0)
{
$errors=$mouv->errors;
$error++;
}
}
}
}
}
if ($error > 0)
{
$db->rollback();
setEventMessages($error, $errors, 'errors');
}
else
{
$db->commit();
}
}
/* /*
* View * View
@ -379,7 +503,7 @@ $warehouse_static = new Entrepot($db);
$supplierorderdispatch = new CommandeFournisseurDispatch($db); $supplierorderdispatch = new CommandeFournisseurDispatch($db);
$help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; $help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
llxHeader('', $langs->trans("Order"), $help_url, '', 0, 0, array('/fourn/js/lib_dispatch.js.php')); llxHeader('', $langs->trans("OrderDispatch"), $help_url, '', 0, 0, array('/fourn/js/lib_dispatch.js.php'));
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
$soc = new Societe($db); $soc = new Societe($db);
@ -393,6 +517,23 @@ if ($id > 0 || !empty($ref)) {
$title = $langs->trans("SupplierOrder"); $title = $langs->trans("SupplierOrder");
dol_fiche_head($head, 'dispatch', $title, -1, 'order'); dol_fiche_head($head, 'dispatch', $title, -1, 'order');
$formconfirm='';
// Confirmation to delete line
if ($action == 'ask_deleteline')
{
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
}
// Call Hook formConfirm
$parameters = array('lineid' => $lineid);
// Note that $action and $object may be modified by hook
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action);
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
// Print form confirm
print $formconfirm;
// Supplier order card // Supplier order card
@ -493,6 +634,9 @@ if ($id > 0 || !empty($ref)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
$formproduct->loadWarehouses(); $formproduct->loadWarehouses();
$entrepot = new Entrepot($db);
$listwarehouses=$entrepot->list_array(1);
if (empty($conf->reception->enabled))print '<form method="POST" action="dispatch.php?id='.$object->id.'">'; if (empty($conf->reception->enabled))print '<form method="POST" action="dispatch.php?id='.$object->id.'">';
else print '<form method="post" action="'.dol_buildpath('/reception/card.php', 1).'?originid='.$object->id.'&origin=supplierorder">'; else print '<form method="post" action="'.dol_buildpath('/reception/card.php', 1).'?originid='.$object->id.'&origin=supplierorder">';
@ -567,9 +711,6 @@ if ($id > 0 || !empty($ref)) {
$i = 0; $i = 0;
if ($num) { if ($num) {
$entrepot = new Entrepot($db);
$listwarehouses = $entrepot->list_array(1);
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
@ -931,9 +1072,11 @@ if ($id > 0 || !empty($ref)) {
$sql = "SELECT p.ref, p.label,"; $sql = "SELECT p.ref, p.label,";
$sql .= " e.rowid as warehouse_id, e.ref as entrepot,"; $sql .= " e.rowid as warehouse_id, e.ref as entrepot,";
$sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec"; $sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec";
$sql.=" ,cd.rowid, cd.subprice";
if ($conf->reception->enabled)$sql .= " ,cfd.fk_reception, r.date_delivery"; if ($conf->reception->enabled)$sql .= " ,cfd.fk_reception, r.date_delivery";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p,"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p,";
$sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "commande_fournisseurdet as cd ON cd.rowid = cfd.fk_commandefourndet";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid";
if ($conf->reception->enabled)$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."reception as r ON cfd.fk_reception = r.rowid"; if ($conf->reception->enabled)$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."reception as r ON cfd.fk_reception = r.rowid";
$sql .= " WHERE cfd.fk_commande = ".$object->id; $sql .= " WHERE cfd.fk_commande = ".$object->id;
@ -965,7 +1108,6 @@ if ($id > 0 || !empty($ref)) {
print '<td class="dispatch_dlc_title">'.$langs->trans("SellByDate").'</td>'; print '<td class="dispatch_dlc_title">'.$langs->trans("SellByDate").'</td>';
} }
print '<td class="right">'.$langs->trans("QtyDispatched").'</td>'; print '<td class="right">'.$langs->trans("QtyDispatched").'</td>';
print '<td></td>';
print '<td>'.$langs->trans("Warehouse").'</td>'; print '<td>'.$langs->trans("Warehouse").'</td>';
print '<td>'.$langs->trans("Comment").'</td>'; print '<td>'.$langs->trans("Comment").'</td>';
@ -977,14 +1119,23 @@ if ($id > 0 || !empty($ref)) {
print '<td class="center"></td>'; print '<td class="center"></td>';
} }
print '<td class="center"></td>'; print '<td class="center" colspan="2"></td>';
print "</tr>\n"; print "</tr>\n";
while ($i < $num) { while ($i < $num) {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
print "<tr ".$bc[$var].">"; if ($action == 'editline' && $lineid == $objp->dispatchlineid)
{
print '<form name="editdispatchedlines" id="editdispatchedlines" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#line_' . GETPOST('lineid') . '" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
<input type="hidden" name="action" value="updateline">
<input type="hidden" name="mode" value="">
<input type="hidden" name="lineid" value="' . $objp->dispatchlineid . '">';
}
print '<tr ' . $bc[$var] . ' id="line_'.$objp->dispatchlineid.'" >';
if (!empty($conf->reception->enabled)) { if (!empty($conf->reception->enabled)) {
print '<td>'; print '<td>';
@ -1011,14 +1162,37 @@ if ($id > 0 || !empty($ref)) {
} }
// Qty // Qty
print '<td class="right">'.$objp->qty.'</td>'; print '<td class="right">';
print '<td>&nbsp;</td>'; if ($action == 'editline' && $lineid == $objp->dispatchlineid)
{
print '<input style="width: 50px;" type="number" min="1" name="qty" value="' . $objp->qty . '" />';
}
else
{
print $objp->qty;
}
print '<input type="hidden" name="price" value="'.$objp->subprice.'" />';
print '</td>';
// Warehouse // Warehouse
print '<td>'; print '<td>';
$warehouse_static->id = $objp->warehouse_id; if ($action == 'editline' && $lineid == $objp->dispatchlineid)
$warehouse_static->libelle = $objp->entrepot; {
print $warehouse_static->getNomUrl(1); if (count($listwarehouses) > 1) {
print $formproduct->selectWarehouses(GETPOST("fk_entrepot")?GETPOST("fk_entrepot"):($objp->warehouse_id?$objp->warehouse_id:''), "fk_entrepot", '', 1, 0, $objp->fk_product, '', 1, 1, null, 'csswarehouse');
} elseif (count($listwarehouses) == 1) {
print $formproduct->selectWarehouses(GETPOST("fk_entrepot")?GETPOST("fk_entrepot"):($objp->warehouse_id?$objp->warehouse_id:''), "fk_entrepot", '', 0, 0, $objp->fk_product, '', 1, 1, null, 'csswarehouse');
} else {
$langs->load("errors");
print $langs->trans("ErrorNoWarehouseDefined");
}
}
else
{
$warehouse_static->id = $objp->warehouse_id;
$warehouse_static->libelle = $objp->entrepot;
print $warehouse_static->getNomUrl(1);
}
print '</td>'; print '</td>';
// Comment // Comment
@ -1069,9 +1243,33 @@ if ($id > 0 || !empty($ref)) {
print '</td>'; print '</td>';
} }
print '<td class="center"></td>'; if ($action != 'editline' ||  && $lineid != $objp->dispatchlineid)
{
print '<td class="linecoledit center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=editline&amp;lineid=' . $objp->dispatchlineid .'#line_'. $objp->dispatchlineid . '">';
print img_edit();
print '</a>';
print '</td>';
print '<td class="linecoldelete center">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=ask_deleteline&amp;lineid=' . $objp->dispatchlineid . '#dispatch_received_products">';
print img_delete();
print '</a>';
print '</td>';
}
else
{
print '<td class="center valignmiddle">';
print '<input type="submit" class="button" id="savelinebutton" name="save" value="'.$langs->trans("Save").'" />';
print '</td>';
print '<td class="center valignmiddle">';
print '<input type="submit" class="button" id="cancellinebutton" name="cancel" value="'. $langs->trans("Cancel").'" />';
print '</td>';
}
print "</tr>\n"; print "</tr>\n";
if ($action == 'editline' && $lineid == $objp->dispatchlineid) print '</form>';
$i++; $i++;
} }

View File

@ -644,7 +644,7 @@ if (empty($reshook))
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++; if ($ret < 0) $error++;
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$datedue = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); $datedue = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
// Replacement invoice // Replacement invoice
@ -1758,7 +1758,7 @@ if ($action == 'create')
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
} }
$datetmp = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp);
$datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); $datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
$datedue = ($datetmp == '' ?-1 : $datetmp); $datedue = ($datetmp == '' ?-1 : $datetmp);
@ -1772,7 +1772,7 @@ if ($action == 'create')
$cond_reglement_id = $societe->cond_reglement_supplier_id; $cond_reglement_id = $societe->cond_reglement_supplier_id;
$mode_reglement_id = $societe->mode_reglement_supplier_id; $mode_reglement_id = $societe->mode_reglement_supplier_id;
$fk_account = $societe->fk_account; $fk_account = $societe->fk_account;
$datetmp = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp);
$datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); $datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
$datedue = ($datetmp == '' ?-1 : $datetmp); $datedue = ($datetmp == '' ?-1 : $datetmp);
@ -1780,6 +1780,18 @@ if ($action == 'create')
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
} }
// when payment condition is empty (means not override by payment condition form a other object, like third-party), try to use default value
if(empty($cond_reglement_id))
{
$cond_reglement_id = GETPOST("cond_reglement_id");
}
// when payment mode is empty (means not override by payment condition form a other object, like third-party), try to use default value
if(empty($mode_reglement_id))
{
$mode_reglement_id = GETPOST("mode_reglement_id");
}
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';

View File

@ -80,7 +80,7 @@ llxHeader('', $title);
$resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) $resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
print load_fiche_titre($langs->trans("HomeArea"), $resultboxes['selectboxlist'], 'home', 0, '', 'titleforhome'); print load_fiche_titre('&nbsp;', $resultboxes['selectboxlist'], '', 0, '', 'titleforhome');
if (!empty($conf->global->MAIN_MOTD)) if (!empty($conf->global->MAIN_MOTD))
{ {
@ -437,7 +437,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) { if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
$board = new RemiseCheque($db); $board = new RemiseCheque($db);
$dashboardlines['RemiseCheque'] = $board->load_board($user); $dashboardlines[$board->element] = $board->load_board($user);
} }
// Number of foundation members // Number of foundation members
@ -452,21 +452,21 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) { if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) {
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$board = new ExpenseReport($db); $board = new ExpenseReport($db);
$dashboardlines['ExpenseReport'] = $board->load_board($user, 'toapprove'); $dashboardlines[$board->element . '_toapprove'] = $board->load_board($user, 'toapprove');
} }
// Number of expense reports to pay // Number of expense reports to pay
if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) { if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) {
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$board = new ExpenseReport($db); $board = new ExpenseReport($db);
$dashboardlines['ExpenseReport'] = $board->load_board($user, 'topay'); $dashboardlines[$board->element . '_topay'] = $board->load_board($user, 'topay');
} }
// Number of holidays to approve // Number of holidays to approve
if (!empty($conf->holiday->enabled) && $user->rights->holiday->approve) { if (!empty($conf->holiday->enabled) && $user->rights->holiday->approve) {
include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
$board = new Holiday($db); $board = new Holiday($db);
$dashboardlines['Holiday'] = $board->load_board($user); $dashboardlines[$board->element] = $board->load_board($user);
} }
$object = new stdClass(); $object = new stdClass();
@ -551,28 +551,28 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
array( array(
'groupName' => 'BankAccount', 'groupName' => 'BankAccount',
'stats' => 'stats' =>
array('bank_account', 'RemiseCheque'), array('bank_account', 'chequereceipt'),
), ),
'Adherent' => 'member' =>
array( array(
'groupName' => 'Members', 'groupName' => 'Members',
'globalStatsKey' => 'members', 'globalStatsKey' => 'members',
'stats' => 'stats' =>
array('member_shift', 'member_expired'), array('member_shift', 'member_expired'),
), ),
'ExpenseReport' => 'expensereport' =>
array( array(
'groupName' => 'ExpenseReport', 'groupName' => 'ExpenseReport',
'globalStatsKey' => 'expensereports', 'globalStatsKey' => 'expensereports',
'stats' => 'stats' =>
array('ExpenseReport'), array('expensereport_toapprove', 'expensereport_topay'),
), ),
'Holiday' => 'holiday' =>
array( array(
'groupName' => 'Holidays', 'groupName' => 'Holidays',
'globalStatsKey' => 'holidays', 'globalStatsKey' => 'holidays',
'stats' => 'stats' =>
array('Holiday'), array('holiday'),
), ),
); );
@ -689,7 +689,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
} }
} }
$openedDashBoard .= '<div class="box-flex-item">'."\n"; $openedDashBoard .= '<div class="box-flex-item"><div class="box-flex-item-with-margin">'."\n";
$openedDashBoard .= ' <div class="info-box '.$openedDashBoardSize.'">'."\n"; $openedDashBoard .= ' <div class="info-box '.$openedDashBoardSize.'">'."\n";
$openedDashBoard .= ' <span class="info-box-icon bg-infobox-'.$groupKeyLowerCase.'">'."\n"; $openedDashBoard .= ' <span class="info-box-icon bg-infobox-'.$groupKeyLowerCase.'">'."\n";
$openedDashBoard .= ' <i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n"; $openedDashBoard .= ' <i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n";
@ -736,6 +736,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$openedDashBoard .= ' </div><!-- /.info-box-content -->'."\n"; $openedDashBoard .= ' </div><!-- /.info-box-content -->'."\n";
$openedDashBoard .= ' </div><!-- /.info-box -->'."\n"; $openedDashBoard .= ' </div><!-- /.info-box -->'."\n";
$openedDashBoard .= '</div><!-- /.box-flex-item-with-margin -->'."\n";
$openedDashBoard .= '</div><!-- /.box-flex-item -->'."\n"; $openedDashBoard .= '</div><!-- /.box-flex-item -->'."\n";
$openedDashBoard .= "\n"; $openedDashBoard .= "\n";
} }
@ -754,7 +755,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
} }
$text .= '. '.$langs->transnoentitiesnoconv("LateDesc"); $text .= '. '.$langs->transnoentitiesnoconv("LateDesc");
$weatherDashBoard = '<div class="box-flex-item '.$appendClass.'">'."\n"; $weatherDashBoard = '<div class="box-flex-item '.$appendClass.'"><div class="box-flex-item-with-margin">'."\n";
$weatherDashBoard .= ' <div class="info-box '.$openedDashBoardSize.' info-box-weather info-box-weather-level'.$weather->level.'">'."\n"; $weatherDashBoard .= ' <div class="info-box '.$openedDashBoardSize.' info-box-weather info-box-weather-level'.$weather->level.'">'."\n";
$weatherDashBoard .= ' <span class="info-box-icon">'; $weatherDashBoard .= ' <span class="info-box-icon">';
$weatherDashBoard .= img_weather('', $weather->level, '', 0, 'valignmiddle width50'); $weatherDashBoard .= img_weather('', $weather->level, '', 0, 'valignmiddle width50');
@ -778,6 +779,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$weatherDashBoard .= ' </div><!-- /.info-box-content -->'."\n"; $weatherDashBoard .= ' </div><!-- /.info-box-content -->'."\n";
$weatherDashBoard .= ' </div><!-- /.info-box -->'."\n"; $weatherDashBoard .= ' </div><!-- /.info-box -->'."\n";
$weatherDashBoard .= '</div><!-- /.box-flex-item-with-margin -->'."\n";
$weatherDashBoard .= '</div><!-- /.box-flex-item -->'."\n"; $weatherDashBoard .= '</div><!-- /.box-flex-item -->'."\n";
$weatherDashBoard .= "\n"; $weatherDashBoard .= "\n";

View File

@ -74,6 +74,8 @@ delete from llx_const where name = 'PROJECT_HIDE_TASKS' and entity = 0;
-- VMYSQL4.1 DROP INDEX ix_fk_product_stock on llx_product_batch; -- VMYSQL4.1 DROP INDEX ix_fk_product_stock on llx_product_batch;
-- VPGSQL8.2 DROP INDEX ix_fk_product_stock -- VPGSQL8.2 DROP INDEX ix_fk_product_stock
ALTER TABLE llx_actioncomm DROP COLUMN punctual;
DELETE FROM llx_menu where module='supplier_proposal'; DELETE FROM llx_menu where module='supplier_proposal';
UPDATE llx_website SET lang = 'en' WHERE lang like 'en_%'; UPDATE llx_website SET lang = 'en' WHERE lang like 'en_%';
@ -250,6 +252,7 @@ ALTER TABLE llx_blockedlog ADD COLUMN object_version varchar(32) DEFAULT '';
ALTER TABLE llx_product_lot MODIFY COLUMN batch varchar(128); ALTER TABLE llx_product_lot MODIFY COLUMN batch varchar(128);
ALTER TABLE llx_product_batch MODIFY COLUMN batch varchar(128); ALTER TABLE llx_product_batch MODIFY COLUMN batch varchar(128);
ALTER TABLE llx_expeditiondet_batch MODIFY COLUMN batch varchar(128);
ALTER TABLE llx_commande_fournisseur_dispatch MODIFY COLUMN batch varchar(128); ALTER TABLE llx_commande_fournisseur_dispatch MODIFY COLUMN batch varchar(128);
ALTER TABLE llx_stock_mouvement MODIFY COLUMN batch varchar(128); ALTER TABLE llx_stock_mouvement MODIFY COLUMN batch varchar(128);
ALTER TABLE llx_mrp_production MODIFY COLUMN batch varchar(128); ALTER TABLE llx_mrp_production MODIFY COLUMN batch varchar(128);

View File

@ -33,4 +33,7 @@
-- For v13 -- For v13
ALTER TABLE llx_commande MODIFY COLUMN date_livraison DATETIME;
ALTER TABLE llx_website ADD COLUMN position integer DEFAULT 0; ALTER TABLE llx_website ADD COLUMN position integer DEFAULT 0;

View File

@ -491,8 +491,13 @@ UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS
-- UPDATE llx_facturedet_rec set label = NULL WHERE label IS NOT NULL; -- UPDATE llx_facturedet_rec set label = NULL WHERE label IS NOT NULL;
UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NULL AND fk_prev_id IS NULL; UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NULL AND fk_prev_id IS NULL;
-- Test inconsistency of data into situation invoices: If it differs, it may be the total_ht that is wrong and situation_percent that is good.
-- select f.rowid, f.type, qty, subprice, situation_percent, total_ht, total_ttc, total_tva, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc, (situation_percent / 100 * subprice * qty * (1 - (fd.remise_percent / 100)))
-- from llx_facturedet as fd, llx_facture as f where fd.fk_facture = f.rowid AND (total_ht - situation_percent / 100 * subprice * qty * (1 - (fd.remise_percent / 100))) > 0.01 and f.type = 5;
-- Note to make all deposit as payed when there is already a discount generated from it. -- Note to make all deposit as payed when there is already a discount generated from it.
--drop table tmp_invoice_deposit_mark_as_available; --drop table tmp_invoice_deposit_mark_as_available;
@ -501,6 +506,7 @@ UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NUL
-- Note to migrate from old counter aquarium to new one -- Note to migrate from old counter aquarium to new one
-- drop table tmp; -- drop table tmp;
-- create table tmp select rowid, code_client, concat(substr(code_client, 1, 6),'-0',substr(code_client, 8, 5)) as code_client2 from llx_societe where code_client like 'CU____-____'; -- create table tmp select rowid, code_client, concat(substr(code_client, 1, 6),'-0',substr(code_client, 8, 5)) as code_client2 from llx_societe where code_client like 'CU____-____';

View File

@ -48,7 +48,6 @@ create table llx_actioncomm
priority smallint, -- priority (ical standard) priority smallint, -- priority (ical standard)
visibility varchar(12) DEFAULT 'default', -- visibility (ical standard) - 'default', 'public', 'private', 'confidential' visibility varchar(12) DEFAULT 'default', -- visibility (ical standard) - 'default', 'public', 'private', 'confidential'
fulldayevent smallint NOT NULL default 0, -- full day (ical standard) fulldayevent smallint NOT NULL default 0, -- full day (ical standard)
punctual smallint NOT NULL default 1, -- deprecated. milestone is event with date start (datep) = date end (datep2)
percent smallint NOT NULL default 0, percent smallint NOT NULL default 0,
location varchar(128), location varchar(128),
durationp real, -- planed duration durationp real, -- planed duration

View File

@ -64,8 +64,8 @@ create table llx_commande
fk_currency varchar(3), -- currency code fk_currency varchar(3), -- currency code
fk_cond_reglement integer, -- condition de reglement fk_cond_reglement integer, -- condition de reglement
fk_mode_reglement integer, -- mode de reglement fk_mode_reglement integer, -- mode de reglement
date_livraison date default NULL, date_livraison datetime default NULL,
fk_shipping_method integer, -- shipping method id fk_shipping_method integer, -- shipping method id
fk_warehouse integer default NULL, fk_warehouse integer default NULL,
fk_availability integer NULL, fk_availability integer NULL,

View File

@ -58,8 +58,8 @@ AccountancyAreaDescActionOnceBis=Next steps should be done to save you time in f
AccountancyAreaDescActionFreq=The following actions are usually executed every month, week or day for very large companies... AccountancyAreaDescActionFreq=The following actions are usually executed every month, week or day for very large companies...
AccountancyAreaDescJournalSetup=STEP %s: Create or check content of your journal list from menu %s AccountancyAreaDescJournalSetup=STEP %s: Create or check content of your journal list from menu %s
AccountancyAreaDescChartModel=STEP %s: Create a model of chart of account from menu %s AccountancyAreaDescChartModel=STEP %s: Check that a model of chart of account exists or create one from menu %s
AccountancyAreaDescChart=STEP %s: Create or check content of your chart of account from menu %s AccountancyAreaDescChart=STEP %s: Select and|or complete your chart of account from menu %s
AccountancyAreaDescVat=STEP %s: Define accounting accounts for each VAT Rates. For this, use the menu entry %s. AccountancyAreaDescVat=STEP %s: Define accounting accounts for each VAT Rates. For this, use the menu entry %s.
AccountancyAreaDescDefault=STEP %s: Define default accounting accounts. For this, use the menu entry %s. AccountancyAreaDescDefault=STEP %s: Define default accounting accounts. For this, use the menu entry %s.

View File

@ -112,8 +112,10 @@ BOM_CLOSEInDolibarr=BOM disabled
BOM_REOPENInDolibarr=BOM reopen BOM_REOPENInDolibarr=BOM reopen
BOM_DELETEInDolibarr=BOM deleted BOM_DELETEInDolibarr=BOM deleted
MRP_MO_VALIDATEInDolibarr=MO validated MRP_MO_VALIDATEInDolibarr=MO validated
MRP_MO_UNVALIDATEInDolibarr=MO set to draft status
MRP_MO_PRODUCEDInDolibarr=MO produced MRP_MO_PRODUCEDInDolibarr=MO produced
MRP_MO_DELETEInDolibarr=MO deleted MRP_MO_DELETEInDolibarr=MO deleted
MRP_MO_CANCELInDolibarr=MO canceled
##### End agenda events ##### ##### End agenda events #####
AgendaModelModule=Document templates for event AgendaModelModule=Document templates for event
DateActionStart=Start date DateActionStart=Start date
@ -152,3 +154,6 @@ EveryMonth=Every month
DayOfMonth=Day of month DayOfMonth=Day of month
DayOfWeek=Day of week DayOfWeek=Day of week
DateStartPlusOne=Date start + 1 hour DateStartPlusOne=Date start + 1 hour
SetAllEventsToTodo=Set all events to todo
SetAllEventsToInProgress=Set all events to in progress
SetAllEventsToFinished=Set all events to finished

View File

@ -574,3 +574,4 @@ AutoFillDateToShort=Set end date
MaxNumberOfGenerationReached=Max number of gen. reached MaxNumberOfGenerationReached=Max number of gen. reached
BILL_DELETEInDolibarr=Invoice deleted BILL_DELETEInDolibarr=Invoice deleted
BILL_SUPPLIER_DELETEInDolibarr=Supplier invoice deleted BILL_SUPPLIER_DELETEInDolibarr=Supplier invoice deleted
UnitPriceXQtyLessDiscount=Unit price x Qty - Discount

View File

@ -86,4 +86,5 @@ ByDefaultInList=By default in list
ChooseCategory=Choose category ChooseCategory=Choose category
StocksCategoriesArea=Warehouses Categories Area StocksCategoriesArea=Warehouses Categories Area
ActionCommCategoriesArea=Events Categories Area ActionCommCategoriesArea=Events Categories Area
WebsitePagesCategoriesArea=Page-Container Categories Area
UseOrOperatorForCategories=Use or operator for categories UseOrOperatorForCategories=Use or operator for categories

View File

@ -187,6 +187,8 @@ ShowCardHere=Show card
Search=Search Search=Search
SearchOf=Search SearchOf=Search
SearchMenuShortCut=Ctrl + shift + f SearchMenuShortCut=Ctrl + shift + f
QuickAdd=Quick add
QuickAddMenuShortCut=Ctrl + shift + l
Valid=Valid Valid=Valid
Approve=Approve Approve=Approve
Disapprove=Disapprove Disapprove=Disapprove
@ -1032,4 +1034,4 @@ DeleteFileHeader=Confirm file delete
DeleteFileText=Do you really want delete this file? DeleteFileText=Do you really want delete this file?
ShowOtherLanguages=Show other languages ShowOtherLanguages=Show other languages
SwitchInEditModeToAddTranslation=Switch in edit mode to add translations for this language SwitchInEditModeToAddTranslation=Switch in edit mode to add translations for this language
NotUsedForThisCustomer=Not used for this customer NotUsedForThisCustomer=Not used for this customer

View File

@ -74,3 +74,4 @@ ProductsToConsume=Products to consume
ProductsToProduce=Products to produce ProductsToProduce=Products to produce
UnitCost=Unit cost UnitCost=Unit cost
TotalCost=Total cost TotalCost=Total cost
BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price)

View File

@ -218,3 +218,4 @@ InventoryForASpecificWarehouse=Inventory for a specific warehouse
InventoryForASpecificProduct=Inventory for a specific product InventoryForASpecificProduct=Inventory for a specific product
StockIsRequiredToChooseWhichLotToUse=Stock is required to choose which lot to use StockIsRequiredToChooseWhichLotToUse=Stock is required to choose which lot to use
ForceTo=Force to ForceTo=Force to
AlwaysShowFullArbo=Display full tree of warehouse on popup of warehouse links (Warning: This may decrease dramatically performances)

View File

@ -127,4 +127,6 @@ OtherLanguages=Other languages
UseManifest=Provide a manifest.json file UseManifest=Provide a manifest.json file
PublicAuthorAlias=Public author alias PublicAuthorAlias=Public author alias
AvailableLanguagesAreDefinedIntoWebsiteProperties=Available languages are defined into website properties AvailableLanguagesAreDefinedIntoWebsiteProperties=Available languages are defined into website properties
ReplacementDoneInXPages=Replacement done in %s pages or containers ReplacementDoneInXPages=Replacement done in %s pages or containers
RSSFeed=RSS Feed
RSSFeedDesc=You can get a RSS feed of latest articles with type 'blogpost' using this URL

View File

@ -218,3 +218,4 @@ InventoryForASpecificWarehouse=Inventaire pour un entrepôt spécifique
InventoryForASpecificProduct=Inventaire pour un produit spécifique InventoryForASpecificProduct=Inventaire pour un produit spécifique
StockIsRequiredToChooseWhichLotToUse=Le module Stock est requis pour choisir une lot StockIsRequiredToChooseWhichLotToUse=Le module Stock est requis pour choisir une lot
ForceTo=Forcer à ForceTo=Forcer à
AlwaysShowFullArbo=Toujours afficher l'arborescence complète dans le lien vers la fiche

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> /* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2018 Frederic France <frederic.france@netlogic.fr> * Copyright (C) 2015-2020 Frederic France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -40,6 +40,11 @@ class PaymentLoan extends CommonObject
*/ */
public $table_element = 'payment_loan'; public $table_element = 'payment_loan';
/**
* @var string String with name of icon for PaymentLoan
*/
public $picto = 'money-bill-alt';
/** /**
* @var int Loan ID * @var int Loan ID
*/ */

View File

@ -1722,6 +1722,11 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
$toprightmenu .= top_menu_search(); $toprightmenu .= top_menu_search();
} }
if (!empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) {
// Add search dropdown
$toprightmenu .= top_menu_quickadd();
}
// Add bookmark dropdown // Add bookmark dropdown
$toprightmenu .= top_menu_bookmark(); $toprightmenu .= top_menu_bookmark();
@ -1934,6 +1939,226 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
return $btnUser; return $btnUser;
} }
/**
* Build the tooltip on top menu quick add
*
* @return string HTML content
*/
function top_menu_quickadd()
{
global $langs, $conf, $db, $hookmanager, $user;
global $menumanager;
$html = '';
// Define $dropDownQuickAddHtml
$dropDownQuickAddHtml = '<div class="dropdown-header bookmark-header center">';
$dropDownQuickAddHtml.= $langs->trans('QuickAdd');
$dropDownQuickAddHtml.= '</div>';
$dropDownQuickAddHtml.= '<div class="quickadd-body dropdown-body">';
$dropDownQuickAddHtml.= '<div class="quickadd">';
if (! empty($conf->societe->enabled) && $user->rights->societe->creer) {
$langs->load("companies");
$dropDownQuickAddHtml.= '
<!-- Thirdparty link -->
<div class="quickaddblock center">
<a class="quickadddropdown-icon-link" href="'.DOL_URL_ROOT.'/societe/card.php?action=create" title="'.$langs->trans("MenuNewThirdParty").'">
<i class="fal fa-building fa-2x"></i><br>
'.$langs->trans("ThirdParty").'
</a>
</div>
';
}
if (! empty($conf->societe->enabled) && $user->rights->societe->contact->creer) {
$langs->load("companies");
$dropDownQuickAddHtml.= '
<!-- Contact link -->
<div class="quickaddblock center">
<a class="quickadddropdown-icon-link" href="'.DOL_URL_ROOT.'/contact/card.php?action=create" title="'.$langs->trans("NewContactAddress").'">
<i class="fal fa-address-book fa-2x"></i><br>
'.$langs->trans("Contact").'
</a>
</div>
';
}
if (! empty($conf->propal->enabled) && $user->rights->propale->creer) {
$langs->load("propal");
$dropDownQuickAddHtml.= '
<!-- Propal link -->
<div class="quickaddblock center">
<a class="quickadddropdown-icon-link" href="'.DOL_URL_ROOT.'/comm/propal/card.php?action=create" title="'.$langs->trans("NewPropal").'">
<i class="fal fa-suitcase fa-2x"></i><br>
'.$langs->trans("Proposal").'
</a>
</div>
';
}
if (! empty($conf->commande->enabled) && $user->rights->commande->creer) {
$langs->load("orders");
$dropDownQuickAddHtml.= '
<!-- Order link -->
<div class="quickaddblock center">
<a class="quickadddropdown-icon-link" href="'.DOL_URL_ROOT.'/commande/card.php?action=create" title="'.$langs->trans("NewOrder").'">
<i class="fal fa-file-alt fa-2x"></i><br>
'.$langs->trans("Order").'
</a>
</div>
';
}
if (! empty($conf->facture->enabled) && $user->rights->facture->creer) {
$langs->load("bills");
$dropDownQuickAddHtml.= '
<!-- Invoice link -->
<div class="quickaddblock center">
<a class="quickadddropdown-icon-link" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create" title="'.$langs->trans("NewBill").'">
<i class="fal fa-coins fa-2x"></i><br>
'.$langs->trans("Bill").'
</a>
</div>
';
}
if (! empty($conf->contrat->enabled) && $user->rights->contrat->creer) {
$langs->load("contracts");
$dropDownQuickAddHtml.= '
<!-- Contract link -->
<div class="quickaddblock center">
<a class="quickadddropdown-icon-link" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create" title="'.$langs->trans("NewContractSubscription").'">
<i class="fal fa-file-contract fa-2x"></i><br>
'.$langs->trans("Contract").'
</a>
</div>
';
}
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer) {
$langs->load("supplier_proposal");
$dropDownQuickAddHtml.= '
<!-- Supplier proposal link -->
<div class="quickaddblock center">
<a class="quickadddropdown-icon-link" href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?action=create" title="'.$langs->trans("NewAskPrice").'">
<i class="fal fa-suitcase fa-2x"></i><br>
'.$langs->trans("AskPrice").'
</a>
</div>
';
}
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->creer) {
$langs->load("orders");
$dropDownQuickAddHtml.= '
<!-- Supplier order link -->
<div class="quickaddblock center">
<a class="quickadddropdown-icon-link" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create" title="'.$langs->trans("NewOrder").'">
<i class="fal fa-file-alt fa-2x"></i><br>
'.$langs->trans("SupplierOrder").'
</a>
</div>
';
}
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->creer) {
$langs->load("bills");
$dropDownQuickAddHtml.= '
<!-- Supplier invoice link -->
<div class="quickaddblock center">
<a class="quickadddropdown-icon-link" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create" title="'.$langs->trans("NewBill").'">
<i class="fal fa-coins fa-2x"></i><br>
'.$langs->trans("SupplierBill").'
</a>
</div>
';
}
if (! empty($conf->product->enabled) && $user->rights->produit->creer) {
$langs->load("products");
$dropDownQuickAddHtml.= '
<!-- Product link -->
<div class="quickaddblock center">
<a class="quickadddropdown-icon-link" href="'.DOL_URL_ROOT.'/product/card.php?action=create&amp;type=0" title="'.$langs->trans("NewProduct").'">
<i class="fal fa-cube fa-2x"></i><br>
'.$langs->trans("Product").'
</a>
</div>
';
}
if (! empty($conf->service->enabled) && $user->rights->service->creer) {
$langs->load("products");
$dropDownQuickAddHtml.= '
<!-- Service link -->
<div class="quickaddblock center">
<a class="quickadddropdown-icon-link" href="'.DOL_URL_ROOT.'/product/card.php?action=create&amp;type=1" title="'.$langs->trans("NewService").'">
<i class="fal fa-concierge-bell fa-2x"></i><br>
'.$langs->trans("Service").'
</a>
</div>
';
}
// Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>')
$parameters = array();
$result = $hookmanager->executeHooks('printQuickAddBlock', $parameters); // Note that $action and $object may have been modified by some hooks
if (is_numeric($result))
{
if ($result == 0)
$dropDownQuickAddHtml.= $hookmanager->resPrint; // add
else
$dropDownQuickAddHtml = $hookmanager->resPrint; // replace
}
else
{
$dropDownQuickAddHtml.= $result; // For backward compatibility
}
$dropDownQuickAddHtml.= '</div>';
$dropDownQuickAddHtml.= '</div>';
$html.= '<!-- div for quick add link -->
<div id="topmenu-quickadd-dropdown" class="atoplogin dropdown inline-block">
<a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('QuickAdd').' ('.$langs->trans('QuickAddMenuShortCut').')">
<i class="fal fa-plus-circle" ></i>
</a>
<div class="dropdown-menu">
'.$dropDownQuickAddHtml.'
</div>
</div>';
$html .= '
<!-- Code to show/hide the user drop-down -->
<script>
$( document ).ready(function() {
$(document).on("click", function(event) {
if (!$(event.target).closest("#topmenu-quickadd-dropdown").length) {
// Hide the menus.
$("#topmenu-quickadd-dropdown").removeClass("open");
}
});
$("#topmenu-quickadd-dropdown .dropdown-toggle").on("click", function(event) {
openQuickAddDropDown();
});
// Key map shortcut
$(document).keydown(function(e){
if( e.which === 76 && e.ctrlKey && e.shiftKey ){
console.log(\'control + shift + l : trigger open quick add dropdown\');
openQuickAddDropDown();
}
});
var openQuickAddDropDown = function() {
event.preventDefault();
$("#topmenu-quickadd-dropdown").toggleClass("open");
//$("#top-quickadd-search-input").focus();
}
});
</script>
';
return $html;
}
/** /**
* Build the tooltip on top menu bookmark * Build the tooltip on top menu bookmark

View File

@ -122,7 +122,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
{ {
global $db, $conf; global $db, $conf;
// D'abord on recupere la valeur max // First we get the max value
$posindice = 9; $posindice = 9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql .= " FROM ".MAIN_DB_PREFIX."mymodule_myobject"; $sql .= " FROM ".MAIN_DB_PREFIX."mymodule_myobject";

View File

@ -929,7 +929,7 @@ class Mo extends CommonObject
return -1; return -1;
}*/ }*/
return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'MO_UNVALIDATE'); return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'MRP_MO_UNVALIDATE');
} }
/** /**
@ -954,7 +954,7 @@ class Mo extends CommonObject
return -1; return -1;
}*/ }*/
return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'MO_CLOSE'); return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'MRP_MO_CANCEL');
} }
/** /**
@ -967,7 +967,7 @@ class Mo extends CommonObject
public function reopen($user, $notrigger = 0) public function reopen($user, $notrigger = 0)
{ {
// Protection // Protection
if ($this->status != self::STATUS_CANCELED) if ($this->status != self::STATUS_PRODUCED && $this->status != self::STATUS_CANCELED)
{ {
return 0; return 0;
} }
@ -979,7 +979,7 @@ class Mo extends CommonObject
return -1; return -1;
}*/ }*/
return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'MO_REOPEN'); return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'MRP_MO_REOPEN');
} }
/** /**

View File

@ -169,6 +169,35 @@ if (empty($reshook))
{ {
$object->setProject(GETPOST('projectid', 'int')); $object->setProject(GETPOST('projectid', 'int'));
} }
// Action close produced
if ($action == 'confirm_produced' && $confirm == 'yes' && $permissiontoadd)
{
$result = $object->setStatut($object::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED');
if ($result >= 0)
{
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$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
$object->generateDocument($model, $outputlangs, 0, 0, 0);
}
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
} }
@ -630,10 +659,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{ {
if ($object->status == $object::STATUS_VALIDATED || $object->status == $object::STATUS_INPROGRESS) if ($object->status == $object::STATUS_VALIDATED || $object->status == $object::STATUS_INPROGRESS)
{ {
// TODO If production is already > 1, show only close, else show cancel
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_produced&confirm=yes">'.$langs->trans("Close").'</a>'."\n";
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_close&confirm=yes">'.$langs->trans("Cancel").'</a>'."\n"; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_close&confirm=yes">'.$langs->trans("Cancel").'</a>'."\n";
} }
if ($object->status == $object::STATUS_CANCELED) if ($object->status == $object::STATUS_PRODUCED || $object->status == $object::STATUS_CANCELED)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_reopen&confirm=yes">'.$langs->trans("Re-Open").'</a>'."\n"; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_reopen&confirm=yes">'.$langs->trans("Re-Open").'</a>'."\n";
} }

View File

@ -383,6 +383,35 @@ if (empty($reshook))
exit; exit;
} }
} }
// Action close produced
if ($action == 'confirm_produced' && $confirm == 'yes' && $permissiontoadd)
{
$result = $object->setStatut($object::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED');
if ($result >= 0)
{
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$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
$object->generateDocument($model, $outputlangs, 0, 0, 0);
}
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
} }
@ -599,6 +628,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{ {
if ($object->status == $object::STATUS_VALIDATED || $object->status == $object::STATUS_INPROGRESS) if ($object->status == $object::STATUS_VALIDATED || $object->status == $object::STATUS_INPROGRESS)
{ {
// TODO If production is already > 1, show only close, else show cancel
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_produced&confirm=yes">'.$langs->trans("Close").'</a>'."\n";
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_close&confirm=yes">'.$langs->trans("Cancel").'</a>'."\n"; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_close&confirm=yes">'.$langs->trans("Cancel").'</a>'."\n";
} }

View File

@ -818,7 +818,7 @@ class Product extends CommonObject
} }
/** /**
* Update a record into database. * Update a record into database.
* If batch flag is set to on, we create records into llx_product_batch * If batch flag is set to on, we create records into llx_product_batch
* *
* @param int $id Id of product * @param int $id Id of product

View File

@ -97,7 +97,7 @@ if (empty($reshook))
{ {
$object->ref = GETPOST("ref"); $object->ref = GETPOST("ref");
$object->fk_parent = GETPOST("fk_parent"); $object->fk_parent = GETPOST("fk_parent");
$object->libelle = GETPOST("libelle"); $object->label = GETPOST("libelle");
$object->description = GETPOST("desc"); $object->description = GETPOST("desc");
$object->statut = GETPOST("statut"); $object->statut = GETPOST("statut");
$object->lieu = GETPOST("lieu"); $object->lieu = GETPOST("lieu");
@ -108,8 +108,7 @@ if (empty($reshook))
$object->phone = GETPOST("phone"); $object->phone = GETPOST("phone");
$object->fax = GETPOST("fax"); $object->fax = GETPOST("fax");
if (!empty($object->libelle)) if (!empty($object->label)) {
{
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) { if ($ret < 0) {
@ -167,7 +166,7 @@ if (empty($reshook))
{ {
if ($object->fetch($id)) if ($object->fetch($id))
{ {
$object->libelle = GETPOST("libelle"); $object->label = GETPOST("libelle");
$object->fk_parent = GETPOST("fk_parent"); $object->fk_parent = GETPOST("fk_parent");
$object->description = GETPOST("desc"); $object->description = GETPOST("desc");
$object->statut = GETPOST("statut"); $object->statut = GETPOST("statut");

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2008 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2008 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Francis Appels <francis.appels@yahoo.com> * Copyright (C) 2016 Francis Appels <francis.appels@yahoo.com>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -48,7 +48,11 @@ class Entrepot extends CommonObject
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/ */
public $picto = 'stock'; public $picto = 'stock';
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
/**
* @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
public $ismultientitymanaged = 1;
/** /**
* @var string Label * @var string Label
@ -184,11 +188,10 @@ class Entrepot extends CommonObject
$error = 0; $error = 0;
if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility $this->label = trim(!empty($this->label) ? $this->label : $this->libelle);
$this->label = trim($this->label); // Error if label not defined
if ($this->label == '') if ($this->label == '') {
{
$this->error = "ErrorFieldRequired"; $this->error = "ErrorFieldRequired";
return 0; return 0;
} }
@ -286,7 +289,8 @@ class Entrepot extends CommonObject
} }
} }
$this->label = trim($this->label); $this->label = trim(!empty($this->label) ? $this->label : $this->libelle);
$this->description = trim($this->description); $this->description = trim($this->description);
$this->lieu = trim($this->lieu); $this->lieu = trim($this->lieu);
@ -745,7 +749,7 @@ class Entrepot extends CommonObject
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
if ($withpicto != 2) $result .= ($showfullpath ? $this->get_full_arbo() : (empty($this->label) ? $this->libelle : $this->label)); if ($withpicto != 2) $result .= (($showfullpath || !empty($conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO)) ? $this->get_full_arbo() : (empty($this->label)?$this->libelle:$this->label));
$result .= $linkend; $result .= $linkend;
return $result; return $result;

View File

@ -41,7 +41,14 @@ class MouvementStock extends CommonObject
public $table_element = 'stock_mouvement'; public $table_element = 'stock_mouvement';
/**
* @var int ID product
*/
public $product_id; public $product_id;
/**
* @var int ID warehouse
*/
public $warehouse_id; public $warehouse_id;
public $qty; public $qty;
@ -58,7 +65,7 @@ class MouvementStock extends CommonObject
public $price; public $price;
/** /**
* @var int ID * @var int ID user author
*/ */
public $fk_user_author; public $fk_user_author;
@ -896,13 +903,13 @@ class MouvementStock extends CommonObject
} }
else else
{ {
dol_syslog(get_class($this)."::createBatch array param dluo must contain at least key fk_product_stock".$error, LOG_ERR); dol_syslog(get_class($this)."::createBatch array param dluo must contain at least key fk_product_stock", LOG_ERR);
$result = -1; $result = -1;
} }
} }
else else
{ {
dol_syslog(get_class($this)."::createBatch error invalid param dluo".$error, LOG_ERR); dol_syslog(get_class($this)."::createBatch error invalid param dluo", LOG_ERR);
$result = -1; $result = -1;
} }

View File

@ -975,7 +975,6 @@ if ($resql)
$productlot->sellby = $objp->sellby; $productlot->sellby = $objp->sellby;
$warehousestatic->id = $objp->entrepot_id; $warehousestatic->id = $objp->entrepot_id;
$warehousestatic->libelle = $objp->warehouse_ref; // deprecated
$warehousestatic->label = $objp->warehouse_ref; $warehousestatic->label = $objp->warehouse_ref;
$warehousestatic->lieu = $objp->lieu; $warehousestatic->lieu = $objp->lieu;

View File

@ -1012,7 +1012,6 @@ if ($resql)
$warehousestatic->id = $objp->entrepot_id; $warehousestatic->id = $objp->entrepot_id;
$warehousestatic->ref = $objp->warehouse_ref; $warehousestatic->ref = $objp->warehouse_ref;
$warehousestatic->libelle = $objp->warehouse_ref; // deprecated
$warehousestatic->label = $objp->warehouse_ref; $warehousestatic->label = $objp->warehouse_ref;
$warehousestatic->lieu = $objp->lieu; $warehousestatic->lieu = $objp->lieu;
$warehousestatic->fk_parent = $objp->fk_parent; $warehousestatic->fk_parent = $objp->fk_parent;

View File

@ -867,7 +867,6 @@ if (!$variants) {
$entrepotstatic->id = $obj->rowid; $entrepotstatic->id = $obj->rowid;
$entrepotstatic->ref = $obj->ref; $entrepotstatic->ref = $obj->ref;
$entrepotstatic->libelle = $obj->ref;
$entrepotstatic->label = $obj->ref; $entrepotstatic->label = $obj->ref;
$entrepotstatic->lieu = $obj->lieu; $entrepotstatic->lieu = $obj->lieu;
$entrepotstatic->fk_parent = $obj->fk_parent; $entrepotstatic->fk_parent = $obj->fk_parent;

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@ html,body {
margin:0; margin:0;
height:100%; height:100%;
width:100%; width:100%;
background-color: #FFF !important;
} }
.container{ .container{
@ -17,14 +18,14 @@ html,body {
.phonerow1{ .phonerow1{
margin: 0 auto; margin: 0 auto;
width: 100%; width: 100%;
height: 40%; height: auto;
min-height: 40%; min-height: 40%;
} }
.phonerow2{ .phonerow2{
margin: 0 auto; margin: 0 auto;
width: 100%; width: 100%;
height: 40%; height: auto;
} }
.phonebuttonsrow{ .phonebuttonsrow{
@ -90,7 +91,71 @@ button.publicphonebutton {
text-align: center; text-align: center;
overflow: visible; /* removes extra width in IE */ overflow: visible; /* removes extra width in IE */
width:33%; width:33%;
height:90%; height:50px;
font-weight: bold;
color: #fff;
}
.phoneblue{
color: #fff;
background-color: #428bca;
border-color: #357ebd;
}
.phonegreen{
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
font-size:20px;
text-align:center;
width:20px;
}
.phonetable{
width:130px;
}
.phoneqty{
font-size:24px;
font-weight: bold;
}
.phonered{
color: #fff;
background-color: #dc3545;
border-color: #dc3545;
font-size:20px;
text-align:center;
width:20px;
}
.phoneorange{
color: #fff;
background-color: #f0ad4e;
border-color: #eea236;
}
.total{
width:100% !important;
font-size:24px;
}
.width24{
font-size:24px;
}
.leftcat{
margin-top:15px;
float:left;
width: 50%;
text-align:center;
height:150px;;
overflow:hidden;
margin-bottom:5px;
font-size:18px;
color:#5B5858;
font-weight: bold; font-weight: bold;
} }
@ -107,3 +172,28 @@ button.publicphonebutton2 {
font-weight: bold; font-weight: bold;
padding: 8px 16px; padding: 8px 16px;
} }
.div-table-responsive-no-min{
margin-top:20px;
}
.comment {
float: left;
width: 100%;
height: auto;
}
.comment-text-area {
float: left;
width: 80%;
height: auto;
}
.textinput {
float: left;
width: 100%;
min-height: 75px;
outline: none;
resize: none;
border: 1px solid grey;
}

View File

@ -77,7 +77,10 @@ elseif ($query == "pro")
preg_match('@src="([^"]+)"@', $image, $match); preg_match('@src="([^"]+)"@', $image, $match);
$file = array_pop($match); $file = array_pop($match);
if ($file == "") header('Location: ../../public/theme/common/nophoto.png'); if ($file == "") header('Location: ../../public/theme/common/nophoto.png');
else header('Location: '.$file.'&cache=1&publictakepos=1&modulepart=product'); else{
if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) header('Location: '.$file.'&cache=1');
else header('Location: '.$file.'&cache=1&publictakepos=1&modulepart=product');
}
} }
else else
{ {

View File

@ -70,10 +70,12 @@ if (($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout ==
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes"> <meta name="mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>'; <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
$arrayofcss = array(
'/takepos/css/pos.css.php',
'/takepos/js/jquery.colorbox-min.js'
);
$arrayofjs = array('/takepos/js/jquery.colorbox-min.js');
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
print '<link rel="stylesheet" href="css/pos.css.php">
<link rel="stylesheet" href="css/colorbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="js/jquery.colorbox-min.js"></script>';
} }
/** /**
@ -877,6 +879,7 @@ if ($_SESSION["basiclayout"] != 1)
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>'; print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
print '<td class="linecolht right nowraponall">'.$langs->trans('TotalTTCShort').'</td>'; print '<td class="linecolht right nowraponall">'.$langs->trans('TotalTTCShort').'</td>';
} }
else print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
print "</tr>\n"; print "</tr>\n";
@ -889,12 +892,11 @@ if ($_SESSION["basiclayout"] == 1)
$categories = $categorie->get_full_arbo('product'); $categories = $categorie->get_full_arbo('product');
$htmlforlines = ''; $htmlforlines = '';
foreach ($categories as $row) { foreach ($categories as $row) {
$htmlforlines .= '<tr class="drag drop oddeven posinvoiceline'; $htmlforlines .= '<div class="leftcat';
$htmlforlines .= '" onclick="LoadProducts('.$row['id'].');">'; $htmlforlines .= '" onclick="LoadProducts('.$row['id'].');">';
$htmlforlines .= '<td class="left">'; $htmlforlines .= '<img class="imgwrapper" width="33%" src="'.DOL_URL_ROOT.'/takepos/public/auto_order.php?genimg=cat&query=cat&id='.$row['id'].'"><br>';
$htmlforlines .= $row['label']; $htmlforlines .= $row['label'];
$htmlforlines .= '</td>'; $htmlforlines .= '</div>'."\n";
$htmlforlines .= '</tr>'."\n";
} }
$htmlforlines .= '</table>'; $htmlforlines .= '</table>';
$htmlforlines .= '</table>'; $htmlforlines .= '</table>';
@ -910,12 +912,11 @@ if ($_SESSION["basiclayout"] == 1)
$prods = $object->getObjectsInCateg("product"); $prods = $object->getObjectsInCateg("product");
$htmlforlines = ''; $htmlforlines = '';
foreach ($prods as $row) { foreach ($prods as $row) {
$htmlforlines .= '<tr class="drag drop oddeven posinvoiceline'; $htmlforlines .= '<div class="leftcat';
$htmlforlines .= '" onclick="AddProduct(\''.$place.'\', '.$row->id.')">'; $htmlforlines .= '" onclick="AddProduct(\''.$place.'\', '.$row->id.')">';
$htmlforlines .= '<td class="left">'; $htmlforlines .= '<img class="imgwrapper" width="33%" src="'.DOL_URL_ROOT.'/takepos/public/auto_order.php?genimg=pro&query=pro&id='.$row->id.'"><br>';
$htmlforlines .= $row->label; $htmlforlines .= $row->label.''.price($row->price_ttc, 1, $langs, 1, -1, -1, $conf->currency);
$htmlforlines .= '<div class="right">'.price($row->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).'</div>'; $htmlforlines .= '</div>'."\n";
$htmlforlines .= '</tr>'."\n";
} }
$htmlforlines .= '</table>'; $htmlforlines .= '</table>';
print $htmlforlines; print $htmlforlines;
@ -991,7 +992,7 @@ if ($placeid > 0)
} }
$htmlforlines .= '" id="'.$line->id.'">'; $htmlforlines .= '" id="'.$line->id.'">';
$htmlforlines .= '<td class="left">'; $htmlforlines .= '<td class="left">';
if ($_SESSION["basiclayout"] == 1) $htmlforlines .= $line->qty." x "; if ($_SESSION["basiclayout"] == 1) $htmlforlines .= '<span class="phoneqty">'.$line->qty."</span> x ";
//if ($line->product_label) $htmlforlines.= '<b>'.$line->product_label.'</b>'; //if ($line->product_label) $htmlforlines.= '<b>'.$line->product_label.'</b>';
if (isset($line->product_type)) if (isset($line->product_type))
{ {
@ -1026,7 +1027,8 @@ if ($placeid > 0)
} }
} }
if (!empty($line->array_options['options_order_notes'])) $htmlforlines .= "<br>(".$line->array_options['options_order_notes'].")"; if (!empty($line->array_options['options_order_notes'])) $htmlforlines .= "<br>(".$line->array_options['options_order_notes'].")";
if ($_SESSION["basiclayout"] != 1) if ($_SESSION["basiclayout"] == 1) $htmlforlines .= '</td><td class="right phonetable"><button type="button" onclick="SetQty(place, '.$line->rowid.', '.($line->qty-1).');" class="publicphonebutton2 phonered">-</button>&nbsp;&nbsp;<button type="button" onclick="SetQty(place, '.$line->rowid.', '.($line->qty+1).');" class="publicphonebutton2 phonegreen">+</button>';
if ($_SESSION["basiclayout"] != 1)
{ {
$moreinfo = ''; $moreinfo = '';
$moreinfo .= $langs->transcountry("TotalHT", $mysoc->country_code).': '.price($line->total_ht); $moreinfo .= $langs->transcountry("TotalHT", $mysoc->country_code).': '.price($line->total_ht);

View File

@ -62,26 +62,34 @@ if (empty($user->rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLI
* View * View
*/ */
// Title
$title = 'TakePOS - Dolibarr '.DOL_VERSION;
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
$head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/takepos/css/phone.css">';
if ($action == "productinfo") { if ($action == "productinfo") {
$prod = new Product($db); $prod = new Product($db);
$prod->fetch($idproduct); $prod->fetch($idproduct);
print "<b>".$prod->label."</b><br>"; print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="AddProductConfirm(place, '.$idproduct.');">'.$langs->trans('Add').'</button>';
print "<br><b>".$prod->label."</b><br>";
print '<img class="imgwrapper" width="60%" src="'.DOL_URL_ROOT.'/takepos/public/auto_order.php?genimg=pro&query=pro&id='.$idproduct.'">'; print '<img class="imgwrapper" width="60%" src="'.DOL_URL_ROOT.'/takepos/public/auto_order.php?genimg=pro&query=pro&id='.$idproduct.'">';
print "<br>".$prod->description; print "<br>".$prod->description;
print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency)."</b>"; print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency)."</b>";
print '<br>'; print '<br>';
print '<button type="button" class="publicphonebutton2" onclick="AddProductConfirm(place, '.$idproduct.');">'.$langs->trans('Add').'</button>'; }
elseif ($action == "publicpreorder") {
print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="TakeposPrintingOrder();">'.$langs->trans('Confirm').'</button>';
print "<br><br>";
print '<div class="comment">
<textarea class="textinput" placeholder="'.$langs->trans('Note').'"></textarea>
</div>';
print '<br>';
}
elseif ($action == "publicpayment") {
$langs->loadLangs(array("orders"));
print '<h1>'.$langs->trans('StatusOrderDelivered').'</h1>';
print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="CheckPlease();">'.$langs->trans('Payment').'</button>';
print '<br>';
}
elseif ($action == "checkplease") {
print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="CheckPlease();">'.$langs->trans('Cash').'</button>';
print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="CheckPlease();">'.$langs->trans('CreditCard').'</button>';
print '<br>';
} }
elseif ($action == "editline") { elseif ($action == "editline") {
$placeid = GETPOST('placeid', 'int'); $placeid = GETPOST('placeid', 'int');
@ -99,13 +107,22 @@ elseif ($action == "editline") {
print "<br>".$prod->description; print "<br>".$prod->description;
print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency)."</b>"; print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency)."</b>";
print '<br>'; print '<br>';
print '<button type="button" class="publicphonebutton2" onclick="SetQty(place, '.$selectedline.', '.($line->qty - 1).');">-</button>'; print '<button type="button" class="publicphonebutton2 phonered width24" onclick="SetQty(place, '.$selectedline.', '.($line->qty - 1).');">-</button>';
print '<button type="button" class="publicphonebutton2" onclick="SetQty(place, '.$selectedline.', '.($line->qty + 1).');">+</button>'; print '<button type="button" class="publicphonebutton2 phonegreen width24" onclick="SetQty(place, '.$selectedline.', '.($line->qty + 1).');">+</button>';
print '<button type="button" class="publicphonebutton2" onclick="SetNote(place, '.$selectedline.');">'.$langs->trans('Note').'</button>'; print '<button type="button" class="publicphonebutton2 phoneblue width24" onclick="SetNote(place, '.$selectedline.');">'.$langs->trans('Note').'</button>';
} }
} }
} }
else { else {
// Title
$title = 'TakePOS - Dolibarr '.DOL_VERSION;
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
$head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
$arrayofcss = array('/takepos/css/phone.css');
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
?> ?>
<script language="javascript"> <script language="javascript">
<?php <?php
@ -194,6 +211,11 @@ function AddProduct(placeid, productid){
?> ?>
} }
function PublicPreOrder(){
$("#phonediv1").load("auto_order.php?action=publicpreorder&place="+place, function() {
});
}
function AddProductConfirm(placeid, productid){ function AddProductConfirm(placeid, productid){
place=placeid; place=placeid;
<?php <?php
@ -221,7 +243,7 @@ function SetQty(place, selectedline, qty){
} }
function SetNote(place, selectedline){ function SetNote(place, selectedline){
var note = prompt("<?php $langs->trans('Note'); ?>", "Harry Potter"); var note = prompt("<?php $langs->trans('Note'); ?>", "");
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&place="+place+"&idline="+selectedline+"&number="+qty, function() { $("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&place="+place+"&idline="+selectedline+"&number="+qty, function() {
}); });
LoadCats(); LoadCats();
@ -263,7 +285,9 @@ function TakeposPrintingOrder(){
console.log("TakeposPrintingOrder"); console.log("TakeposPrintingOrder");
<?php <?php
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
echo '$("#phonediv2").load("auto_order.php?action=order&place="+place, function() { echo '$("#phonediv2").load("auto_order.php?action=order&mobilepage=order&place="+place, function() {
});';
echo '$("#phonediv1").load("auto_order.php?action=publicpayment&place="+place, function() {
});'; });';
} }
else { else {
@ -278,6 +302,8 @@ function Exit(){
} }
function CheckPlease(){ function CheckPlease(){
$("#phonediv1").load("auto_order.php?action=checkplease&place="+place, function() {
});
console.log("Request the check to the waiter"); console.log("Request the check to the waiter");
$.ajax({ $.ajax({
type: "GET", type: "GET",
@ -287,7 +313,7 @@ function CheckPlease(){
</script> </script>
<body style="overflow: hidden; background-color:#D1D1D1;"> <body style="background-color:#D1D1D1;">
<?php <?php
if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '<div class="dialog-info-takepos-terminal" id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>'; if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '<div class="dialog-info-takepos-terminal" id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>';
?> ?>
@ -301,18 +327,18 @@ function CheckPlease(){
print '<button type="button" class="phonebutton" onclick="Exit();">'.strtoupper(substr($langs->trans('Logout'), 0, 3)).'</button>'; print '<button type="button" class="phonebutton" onclick="Exit();">'.strtoupper(substr($langs->trans('Logout'), 0, 3)).'</button>';
} }
else { else {
print '<button type="button" class="publicphonebutton" onclick="LoadCats();">'.strtoupper(substr($langs->trans('Categories'), 0, 5)).'</button>'; print '<button type="button" class="publicphonebutton phoneblue" onclick="LoadCats();">'.strtoupper(substr($langs->trans('Categories'), 0, 5)).'</button>';
print '<button type="button" class="publicphonebutton" onclick="TakeposPrintingOrder();">'.strtoupper(substr($langs->trans('Order'), 0, 5)).'</button>'; print '<button type="button" class="publicphonebutton phoneorange" onclick="PublicPreOrder();">'.strtoupper(substr($langs->trans('Order'), 0, 5)).'</button>';
print '<button type="button" class="publicphonebutton" onclick="CheckPlease();">'.strtoupper(substr($langs->trans('Payment'), 0, 5)).'</button>'; print '<button type="button" class="publicphonebutton phonegreen" onclick="CheckPlease();">'.strtoupper(substr($langs->trans('Payment'), 0, 5)).'</button>';
} }
?> ?>
</div> </div>
<div class="row1"> <div class="phonerow2">
<div id="phonediv1" class="phonediv1"></div>
</div>
<div class="row2">
<div id="phonediv2" class="phonediv2"></div> <div id="phonediv2" class="phonediv2"></div>
</div> </div>
<div class="phonerow1">
<div id="phonediv1" class="phonediv1"></div>
</div>
</div> </div>
</body> </body>
<?php <?php

View File

@ -9,7 +9,7 @@ button.dropdown-item.global-search-item {
outline: none; outline: none;
} }
.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu, .dropdown dd ul.open { .open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-quickadd, .open>.dropdown-menu, .dropdown dd ul.open {
display: block; display: block;
} }
@ -59,6 +59,29 @@ button.dropdown-item.global-search-item {
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175); box-shadow: 0 6px 12px rgba(0,0,0,.175);
} }
.dropdown-quickadd {
border-color: #eee;
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 240px;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.dropdown-menu { .dropdown-menu {
border-color: #eee; border-color: #eee;
@ -163,7 +186,7 @@ button.dropdown-item.global-search-item {
max-width: 100%; max-width: 100%;
} }
div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown { div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown, div#topmenu-quickadd-dropdown {
<?php if (empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { ?> <?php if (empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { ?>
line-height: 46px; line-height: 46px;
<?php } ?> <?php } ?>
@ -383,6 +406,58 @@ a.top-menu-dropdown-link {
display: none !important; display: none !important;
} }
/*
* QUICK ADD
*/
#topmenu-quickadd-dropdown .dropdown-menu {
width: 300px !important;
color: #444;
}
.quickadd-header {
color: #444 !important;
}
div.quickadd {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-content: center;
-ms-flex-line-pack: center;
align-content: center;
-webkit-align-items: flex-start;
-ms-flex-align: start;
align-items: flex-start;
}
div.quickadd a {
color: #444;
}
div.quickadd a:hover, div.quickadd a:active {
color: #000000;
}
div.quickaddblock {
width: 80px;
display: block ruby;
}
div.quickaddblock:hover,
div.quickaddblock:active,
div.quickaddblock:focus {
background: <?php print $colorbacklinepair1; ?>;
}
/* smartphone */ /* smartphone */
@media only screen and (max-width: 767px) @media only screen and (max-width: 767px)
{ {

View File

@ -665,10 +665,10 @@ body[class*="colorblind-"] .text-success{
color : <?php print $textDanger; ?> color : <?php print $textDanger; ?>
} }
.editfielda span.fa-pencil-alt, .editfielda span.fa-trash, .editfieldlang { .editfielda span.fa-pencil-alt, .editfielda span.fa-pencil-ruler, .editfielda span.fa-trash, .editfieldlang {
color: #ccc !important; color: #ccc !important;
} }
.editfielda span.fa-pencil-alt:hover, .editfielda span.fa-trash:hover, .editfieldlang:hover { .editfielda span.fa-pencil-alt:hover, .editfielda span.fa-pencil-ruler:hover, .editfielda span.fa-trash:hover, .editfieldlang:hover {
color: var(--colortexttitle) !important; color: var(--colortexttitle) !important;
} }
.fawidth30 { .fawidth30 {
@ -1339,7 +1339,7 @@ td.showDragHandle {
#id-left { #id-left {
padding-top: 20px; padding-top: 20px;
padding-bottom: 5px; padding-bottom: 5px;
<?php if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { ?> <?php if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN) && ! empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) { ?>
padding-top: 8px; padding-top: 8px;
<?php } ?> <?php } ?>
} }

View File

@ -235,7 +235,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
.bg-infobox-bank_account{ .bg-infobox-bank_account{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#b0a53e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#b0a53e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infobox-adherent{ .bg-infobox-adherent, .bg-infobox-member {
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#79633f', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#79633f', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infobox-expensereport{ .bg-infobox-expensereport{
@ -273,7 +273,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
.fa-dol-bank_account:before { .fa-dol-bank_account:before {
content: "\f19c"; content: "\f19c";
} }
.fa-dol-adherent:before { .fa-dol-member:before {
content: "\f0c0"; content: "\f0c0";
} }
.fa-dol-expensereport:before { .fa-dol-expensereport:before {
@ -314,8 +314,8 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
display: flex; /* or inline-flex */ display: flex; /* or inline-flex */
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
width: 100%; width: calc(100% + 14px);
margin: 0 0 0 -8px; margin: 0 -8px 0 -8px;
/*justify-content: space-between;*/ /*justify-content: space-between;*/
} }
@ -348,7 +348,8 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
@media only screen and (max-width: 767px) @media only screen and (max-width: 767px)
{ {
.box-flex-container { .box-flex-container {
margin: 0 0 0 0 !important; margin: 0 0 0 0px !important;
width: 100% !important;
} }
.info-box-module { .info-box-module {

View File

@ -203,7 +203,7 @@ $disableimages = 0;
$maxwidthloginblock = 180; $maxwidthloginblock = 180;
if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu = 0; } if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu = 0; }
if (!empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; } if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
if (!empty($conf->bookmark->enabled)) { $maxwidthloginblock = $maxwidthloginblock + 55; } if (!empty($conf->bookmark->enabled)) { $maxwidthloginblock = $maxwidthloginblock + 55; }

View File

@ -34,7 +34,7 @@ if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) $prefix = 'backgro
.bg-infobox-bank_account{ .bg-infobox-bank_account{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#b0a53e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#b0a53e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infobox-adherent{ .bg-infobox-adherent, .bg-infobox-member{
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#79633f', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; <?php echo $prefix; ?>color: <?php print colorAgressiveness('#79633f', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infobox-expensereport{ .bg-infobox-expensereport{
@ -258,7 +258,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
.bg-infobox-bank_account i.fa{ .bg-infobox-bank_account i.fa{
color: <?php print colorAgressiveness('#b0a53e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; color: <?php print colorAgressiveness('#b0a53e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infobox-adherent i.fa{ .bg-infobox-adherent i.fa, .bg-infobox-member i.fa{
color: <?php print colorAgressiveness('#f39c12', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important; color: <?php print colorAgressiveness('#f39c12', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
} }
.bg-infobox-expensereport i.fa{ .bg-infobox-expensereport i.fa{
@ -296,7 +296,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
.fa-dol-bank_account:before { .fa-dol-bank_account:before {
content: "\f19c"; content: "\f19c";
} }
.fa-dol-adherent:before { .fa-dol-member:before {
content: "\f0c0"; content: "\f0c0";
} }
.fa-dol-expensereport:before { .fa-dol-expensereport:before {

View File

@ -71,12 +71,12 @@ class ProductCombination
*/ */
public $entity; public $entity;
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
public function __construct(DoliDB $db) public function __construct(DoliDB $db)
{ {
global $conf; global $conf;
@ -189,16 +189,16 @@ class ProductCombination
*/ */
public function countNbOfCombinationForFkProductParent($fk_product_parent) public function countNbOfCombinationForFkProductParent($fk_product_parent)
{ {
$nb = 0; $nb = 0;
$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".(int) $fk_product_parent." AND entity IN (".getEntity('product').")"; $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".(int) $fk_product_parent." AND entity IN (".getEntity('product').")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($obj) $nb = $obj->nb; if ($obj) $nb = $obj->nb;
} }
return $nb; return $nb;
} }
/** /**
@ -326,11 +326,20 @@ class ProductCombination
$child = new Product($this->db); $child = new Product($this->db);
$child->fetch($this->fk_product_child); $child->fetch($this->fk_product_child);
$child->price_autogen = $parent->price_autogen; $child->price_autogen = $parent->price_autogen;
$child->weight = $parent->weight + $this->variation_weight; $child->weight = $parent->weight;
$child->weight_units = $parent->weight_units; if ($this->variation_weight) { // If we must add a delta on weight
$varlabel = $this->getCombinationLabel($this->fk_product_child); $child->weight = ($child->weight ? $child->weight : 0) + $this->variation_weight;
$child->label = $parent->label.$varlabel; }
$child->weight_units = $parent->weight_units;
// Don't update the child label if the user has already modified it.
if ($child->label == $parent->label) {
// This will trigger only at variant creation time
$varlabel = $this->getCombinationLabel($this->fk_product_child);
$child->label = $parent->label.$varlabel;;
}
if ($child->update($child->id, $user) > 0) { if ($child->update($child->id, $user) > 0) {
$new_vat = $parent->tva_tx; $new_vat = $parent->tva_tx;
@ -527,9 +536,9 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
$newproduct->ref = $forced_refvar; $newproduct->ref = $forced_refvar;
} }
} else { } else {
$forced_refvar = false; $forced_refvar = false;
$existingProduct = false; $existingProduct = false;
$newproduct = clone $product; $newproduct = clone $product;
} }
//Final weight impact //Final weight impact
@ -590,11 +599,11 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
} }
if ($forced_refvar === false) { if ($forced_refvar === false) {
if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
$newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR.$prodattrval->ref; $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR.$prodattrval->ref;
} else { } else {
$newproduct->ref .= '_'.$prodattrval->ref; $newproduct->ref .= '_'.$prodattrval->ref;
} }
} }
//The first one should not contain a linebreak //The first one should not contain a linebreak
@ -613,62 +622,62 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
// Now create the product // Now create the product
//print 'Create prod '.$newproduct->ref.'<br>'."\n"; //print 'Create prod '.$newproduct->ref.'<br>'."\n";
if ($existingProduct === false) { if ($existingProduct === false) {
//To avoid wrong information in price history log //To avoid wrong information in price history log
$newproduct->price = 0; $newproduct->price = 0;
$newproduct->price_ttc = 0; $newproduct->price_ttc = 0;
$newproduct->price_min = 0; $newproduct->price_min = 0;
$newproduct->price_min_ttc = 0; $newproduct->price_min_ttc = 0;
// A new variant must use a new barcode (not same product) // A new variant must use a new barcode (not same product)
$newproduct->barcode = -1; $newproduct->barcode = -1;
$result = $newproduct->create($user); $result = $newproduct->create($user);
if ($result < 0) if ($result < 0)
{ {
//In case the error is not related with an already existing product //In case the error is not related with an already existing product
if ($newproduct->error != 'ErrorProductAlreadyExists') { if ($newproduct->error != 'ErrorProductAlreadyExists') {
$this->error[] = $newproduct->error; $this->error[] = $newproduct->error;
$this->errors = $newproduct->errors; $this->errors = $newproduct->errors;
$db->rollback(); $db->rollback();
return -1; return -1;
} }
/** /**
* If there is an existing combination, then we update the prices and weight * If there is an existing combination, then we update the prices and weight
* Otherwise, we try adding a random number to the ref * Otherwise, we try adding a random number to the ref
*/ */
if ($newcomb->fk_product_child) { if ($newcomb->fk_product_child) {
$res = $newproduct->fetch($existingCombination->fk_product_child); $res = $newproduct->fetch($existingCombination->fk_product_child);
} else { } else {
$orig_prod_ref = $newproduct->ref; $orig_prod_ref = $newproduct->ref;
$i = 1; $i = 1;
do { do {
$newproduct->ref = $orig_prod_ref.$i; $newproduct->ref = $orig_prod_ref.$i;
$res = $newproduct->create($user); $res = $newproduct->create($user);
if ($newproduct->error != 'ErrorProductAlreadyExists') { if ($newproduct->error != 'ErrorProductAlreadyExists') {
$this->errors[] = $newproduct->error; $this->errors[] = $newproduct->error;
break; break;
} }
$i++; $i++;
} while ($res < 0); } while ($res < 0);
} }
if ($res < 0) { if ($res < 0) {
$db->rollback(); $db->rollback();
return -1; return -1;
} }
} }
} else { } else {
$result = $newproduct->update($newproduct->id, $user); $result = $newproduct->update($newproduct->id, $user);
if ($result < 0) if ($result < 0)
{ {
$db->rollback(); $db->rollback();
return -1; return -1;
} }
} }
$newcomb->fk_product_child = $newproduct->id; $newcomb->fk_product_child = $newproduct->id;
@ -683,14 +692,14 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
return $newproduct->id; return $newproduct->id;
} }
/** /**
* Copies all product combinations from the origin product to the destination product * Copies all product combinations from the origin product to the destination product
* *
* @param User $user Object user * @param User $user Object user
* @param int $origProductId Origin product id * @param int $origProductId Origin product id
* @param Product $destProduct Destination product * @param Product $destProduct Destination product
* @return int >0 OK <0 KO * @return int >0 OK <0 KO
*/ */
public function copyAll(User $user, $origProductId, Product $destProduct) public function copyAll(User $user, $origProductId, Product $destProduct)
{ {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php';
@ -712,7 +721,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
$variations[$tmp_pc2v->fk_prod_attr] = $tmp_pc2v->fk_prod_attr_val; $variations[$tmp_pc2v->fk_prod_attr] = $tmp_pc2v->fk_prod_attr_val;
} }
if ($this->createProductCombination( if ($this->createProductCombination(
$user, $user,
$destProduct, $destProduct,
$variations, $variations,
@ -720,7 +729,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
$combination->variation_price_percentage, $combination->variation_price_percentage,
$combination->variation_price, $combination->variation_price,
$combination->variation_weight $combination->variation_weight
) < 0) ) < 0)
{ {
return -1; return -1;
} }

View File

@ -197,6 +197,7 @@ $fileindex = $pathofwebsite.'/index.php';
$filewrapper = $pathofwebsite.'/wrapper.php'; $filewrapper = $pathofwebsite.'/wrapper.php';
$filemanifestjson = $pathofwebsite.'/manifest.json.php'; $filemanifestjson = $pathofwebsite.'/manifest.json.php';
$filereadme = $pathofwebsite.'/README.md'; $filereadme = $pathofwebsite.'/README.md';
$filemaster = $pathofwebsite.'/master.inc.php';
// Define $urlwithroot // Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
@ -1189,8 +1190,6 @@ if ($action == 'updatecss')
if (!$error) if (!$error)
{ {
// Save master.inc.php file // Save master.inc.php file
$filemaster = $pathofwebsite.'/master.inc.php';
dol_syslog("Save master file ".$filemaster); dol_syslog("Save master file ".$filemaster);
dol_mkdir($pathofwebsite); dol_mkdir($pathofwebsite);
@ -1384,6 +1383,10 @@ if ($action == 'updatecss')
} }
// Save wrapper.php
$result = dolSaveIndexPage($pathofwebsite, '', '', $filewrapper);
// Message if no error // Message if no error
if (!$error) if (!$error)
{ {
@ -1727,8 +1730,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
} }
else else
{ {
$fileindex = $pathofwebsitenew.'/index.php';
$filetpl = $pathofwebsitenew.'/page'.$resultpage->id.'.tpl.php'; $filetpl = $pathofwebsitenew.'/page'.$resultpage->id.'.tpl.php';
$fileindex = $pathofwebsitenew.'/index.php';
$filewrapper = $pathofwebsitenew.'/wrapper.php'; $filewrapper = $pathofwebsitenew.'/wrapper.php';
//var_dump($pathofwebsitenew); //var_dump($pathofwebsitenew);
@ -2270,6 +2273,11 @@ if (!GETPOST('hide_websitemenu'))
*/ */
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=replacesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'"><span class="fa fa-search"><span></a>'; print '<a href="'.$_SERVER["PHP_SEFL"].'?action=replacesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'"><span class="fa fa-search"><span></a>';
if (! empty($conf->categorie->enabled)) {
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=website&type=website_page&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("Categories")).'"><span class="fa fa-tags"><span></a>';
}
if (! empty($conf->global->WEBSITE_ADD_REGENERATE_BUTTON)) { if (! empty($conf->global->WEBSITE_ADD_REGENERATE_BUTTON)) {
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=regeneratesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'"><span class="fa fa-cogs"><span></a>'; print '<a href="'.$_SERVER["PHP_SEFL"].'?action=regeneratesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'"><span class="fa fa-cogs"><span></a>';
} }
@ -2977,6 +2985,14 @@ if ($action == 'editcss')
print '</td></tr>'; print '</td></tr>';
// RSS
print '<tr><td class="tdtop">';
$htmlhelp = $langs->trans('RSSFeedDesc');
print $form->textwithpicto($langs->trans('RSSFeed'), $htmlhelp, 1, 'help', '', 0, 2, '');
print '</td><td>';
print '/wrapper.php?rss=1[&l=XX][&limit=123]';
print '</td></tr>';
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
@ -3629,6 +3645,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
print getTitleFieldOfList("Page", 0, $_SERVER['PHP_SELF'], 'pageurl', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList("Page", 0, $_SERVER['PHP_SELF'], 'pageurl', '', $param, '', $sortfield, $sortorder, '')."\n";
//print getTitleFieldOfList("Description", 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '')."\n"; //print getTitleFieldOfList("Description", 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']); print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']);
print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']);
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
print '</tr>'; print '</tr>';
@ -3651,6 +3668,24 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
print '<span class="opacitymedium">'.$answerrecord->description.'</span>'; print '<span class="opacitymedium">'.$answerrecord->description.'</span>';
print '</td>'; print '</td>';
// Edit properties
print '<td>';
$param = '?action=replacesiteconfirm';
$param .= '&websiteid='.$website->id;
$param .= '&optioncontent='.GETPOST('optioncontent');
$param .= '&optionmeta='.GETPOST('optionmeta');
$param .= '&optionsitefiles='.GETPOST('optionsitefiles');
$param .= '&searchstring='.$searchkey;
$disabled = '';
$urltoedithtmlsource = $_SERVER["PHP_SELF"].'?action=editmeta&websiteid='.$website->id.'&pageid='.$answerrecord->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].$param);
if (empty($user->rights->website->write)) {
$disabled = ' disabled';
$urltoedithtmlsource = '';
}
print '<a class="editfielda '.$disabled.'" href="'.$urltoedithtmlsource.'" title="'.$langs->trans("EditPageMeta").'">'.img_picto($langs->trans("EditPageMeta"), 'pencil-ruler').'</a>';
print '</td>';
// Edit HTML source
print '<td>'; print '<td>';
$param = '?action=replacesiteconfirm'; $param = '?action=replacesiteconfirm';
$param .= '&websiteid='.$website->id; $param .= '&websiteid='.$website->id;

View File

@ -12,6 +12,8 @@ $hashp = GETPOST('hashp', 'aZ09');
$modulepart = GETPOST('modulepart', 'aZ09'); $modulepart = GETPOST('modulepart', 'aZ09');
$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity; $entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity;
$original_file = GETPOST("file", "alpha"); $original_file = GETPOST("file", "alpha");
$l = GETPOST('l', 'aZ09');
$limit = GETPOST('limit', 'int');
// Parameters for RSS // Parameters for RSS
$rss = GETPOST('rss', 'aZ09'); $rss = GETPOST('rss', 'aZ09');
@ -90,8 +92,8 @@ if ($rss) {
$type = ''; $type = '';
$cachedelay = 0; $cachedelay = 0;
$filename = $original_file; $filename = $original_file;
$filters = array('type_container'=>'blogpost', 'lang'=>'en_US');
$dir_temp = $conf->website->dir_temp; $dir_temp = $conf->website->dir_temp;
include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
$website = new Website($db); $website = new Website($db);
@ -99,7 +101,10 @@ if ($rss) {
$website->fetch('', $websitekey); $website->fetch('', $websitekey);
$MAXNEWS = 20; $filters = array('type_container'=>'blogpost');
if ($l) $filters['lang'] = $l;
$MAXNEWS = ($limit ? $limit : 20);
$arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters); $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters);
$eventarray = array(); $eventarray = array();
if (is_array($arrayofblogs)) { if (is_array($arrayofblogs)) {
@ -151,7 +156,7 @@ if ($rss) {
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK)); @chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
// Write file // Write file
$result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'); $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l);
if ($result >= 0) if ($result >= 0)
{ {

View File

@ -204,7 +204,7 @@ class AccountingAccountTest extends PHPUnit\Framework\TestCase
$localobject->label='New label'; $localobject->label='New label';
$result=$localobject->update($user); $result=$localobject->update($user);
print __METHOD__." id=".$id." result=".$result."\n"; print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
return $localobject->id; return $localobject->id;

View File

@ -223,7 +223,7 @@ class ActionCommTest extends PHPUnit\Framework\TestCase
$result=$localobject->update($user); $result=$localobject->update($user);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." id=".$id." result=".$result."\n"; print __METHOD__." id=".$localobject->id." result=".$result."\n";
return $localobject->id; return $localobject->id;
} }

View File

@ -196,7 +196,7 @@ class CommandeTest extends PHPUnit\Framework\TestCase
$result=$localobject->update($user); $result=$localobject->update($user);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." id=".$id." result=".$result."\n"; print __METHOD__." id=".$localobject->id." result=".$result."\n";
return $localobject; return $localobject;
} }