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

This commit is contained in:
Rui Strecht 2017-09-11 11:52:47 +01:00
commit bddf292881
108 changed files with 1434 additions and 1418 deletions

File diff suppressed because one or more lines are too long

View File

@ -383,8 +383,8 @@ class AccountancyCategory
/** /**
* Return list of personalized groups * Return list of personalized groups
* *
* @return int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
* @return array|int Array of personalized groups or < 0 if KO * @return array Array of groups
*/ */
public function getCats($categorytype=-1) public function getCats($categorytype=-1)
{ {
@ -429,7 +429,7 @@ class AccountancyCategory
'position' => $obj->position, 'position' => $obj->position,
'category_type' => $obj->category_type 'category_type' => $obj->category_type
); );
$i ++; $i++;
} }
} }
return $data; return $data;
@ -506,9 +506,9 @@ class AccountancyCategory
* Get all accounting account of a group. * Get all accounting account of a group.
* You must choose between first parameter (personalized group) or the second (free criteria filter) * You must choose between first parameter (personalized group) or the second (free criteria filter)
* *
* @param int $cat_id Id if personalized accounting group/category * @param int $cat_id Id if personalized accounting group/category
* @param string $predefinedgroup Sql criteria filter to select accounting accounts * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts
* @return array Array of accounting accounts * @return array Array of accounting accounts
*/ */
public function getCptsCat($cat_id, $predefinedgroupwhere='') public function getCptsCat($cat_id, $predefinedgroupwhere='')
{ {

View File

@ -72,13 +72,13 @@ print "<br>\n";
// STEPS // STEPS
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>');
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>');
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
@ -87,15 +87,15 @@ print "<br>\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>'; $textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
print "<br>\n"; print "<br>\n";
if (! empty($conf->tax->enabled)) if (! empty($conf->tax->enabled))
{ {
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>'; $textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>';
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
print "<br>\n"; print "<br>\n";
@ -111,25 +111,25 @@ if (! empty($conf->tax->enabled))
if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>');
print "<br>\n"; print "<br>\n";
} }
/* /*
if (! empty($conf->loan->enabled)) if (! empty($conf->loan->enabled))
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n"; print "<br>\n";
} }
if (! empty($conf->don->enabled)) if (! empty($conf->don->enabled))
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>');
print "<br>\n"; print "<br>\n";
}*/ }*/
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>');
print "<br>\n"; print "<br>\n";
$step++; $step++;
@ -150,15 +150,15 @@ $step = 0;
$langs->loadLangs(array('bills', 'trips')); $langs->loadLangs(array('bills', 'trips'));
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;

View File

@ -249,8 +249,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -390,13 +390,13 @@ if ($rowid > 0)
} }
if ($status != '') if ($status != '')
{ {
$sql.= " AND d.statut IN (".$status.")"; // Peut valoir un nombre ou liste de nombre separes par virgules $sql.= " AND d.statut IN (".$db->escape($status).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
} }
if ($action == 'search') if ($action == 'search')
{ {
if (GETPOST('search')) if (GETPOST('search'))
{ {
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search')); $sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
} }
} }
if (! empty($search_lastname)) if (! empty($search_lastname))

View File

@ -243,6 +243,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" id="action" name="action" value="">'; print '<input type="hidden" id="action" name="action" value="">';
print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">'; print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Page // Page
@ -301,13 +302,13 @@ print '<input type="text" class="flat minwidth200 maxwidthonsmartphone" name="de
print '</td>'."\n"; print '</td>'."\n";
// Field // Field
print '<td>'; print '<td>';
print '<input type="text" class="flat maxwidth100" name="defaultkey" value="">'; print '<input type="text" class="flat maxwidth100onsmartphone" name="defaultkey" value="">';
print '</td>'; print '</td>';
// Value // Value
if ($mode != 'focus') if ($mode != 'focus')
{ {
print '<td>'; print '<td>';
print '<input type="text" class="flat maxwidthonsmartphone" name="defaultvalue" value="">'; print '<input type="text" class="flat maxwidth100onsmartphone" name="defaultvalue" value="">';
print '</td>'; print '</td>';
} }
// Limit to superadmin // Limit to superadmin
@ -409,6 +410,7 @@ else
print '</table>'; print '</table>';
print '</div>';
dol_fiche_end(); dol_fiche_end();

View File

@ -67,7 +67,7 @@ $actl[0] = img_picto($langs->trans("Disabled"),'switch_off');
$actl[1] = img_picto($langs->trans("Activated"),'switch_on'); $actl[1] = img_picto($langs->trans("Activated"),'switch_on');
$listoffset=GETPOST('listoffset'); $listoffset=GETPOST('listoffset');
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000; $listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000; // To avoid too long dictionaries
$active = 1; $active = 1;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -1155,11 +1155,6 @@ if ($id)
print '</table>'; print '</table>';
print '</div>'; print '</div>';
/*if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of *
{
print '* '.$langs->trans("LabelUsedByDefault").'.<br>';
}*/
} }
print '</form>'; print '</form>';
@ -1179,9 +1174,10 @@ if ($id)
$i = 0; $i = 0;
// There is several pages // There is several pages
if ($num > $listlimit) if ($num > $listlimit || $page)
{ {
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>'); print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
print '<div class="clearboth"></div>';
} }
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
@ -1645,6 +1641,8 @@ else
*/ */
$lastlineisempty=false; $lastlineisempty=false;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
//print '<td>'.$langs->trans("Module").'</td>'; //print '<td>'.$langs->trans("Module").'</td>';
@ -1697,6 +1695,7 @@ else
} }
} }
print '</table>'; print '</table>';
print '</div>';
} }
print '<br>'; print '<br>';

View File

@ -221,9 +221,38 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') {
$val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '',
$conf->entity);
if (!$res > 0) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') {
$val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '',
$conf->entity);
if (!$res > 0) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} }
/* /*
* View * View
*/ */
@ -575,6 +604,40 @@ print '<input type="submit" class="button" value="' . $langs->trans("Modify") .
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '</form>'; print '</form>';
// Use duration
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="set_FICHINTER_WITHOUT_DURATION">';
print '<tr class="oddeven">';
print '<td>';
print $langs->trans("UseDurationOnFichinter");
print '</td>';
print '<td align="center">';
print '<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"' . ($conf->global->FICHINTER_WITHOUT_DURATION?' checked':'') . '>';
print '</td>';
print '<td align="right">';
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
print '</td>';
print '</tr>';
print '</form>';
// use date without hour
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="set_FICHINTER_DATE_WITHOUT_HOUR">';
print '<tr class="oddeven">';
print '<td>';
print $langs->trans("UseDateWithoutHourOnFichinter");
print '</td>';
print '<td align="center">';
print '<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"' . ($conf->global->FICHINTER_DATE_WITHOUT_HOUR?' checked':'') . '>';
print '</td>';
print '<td align="right">';
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
print '</td>';
print '</tr>';
print '</form>';
print '</table>'; print '</table>';

View File

@ -28,8 +28,8 @@
/** /**
* \file htdocs/admin/mails_templates.php * \file htdocs/admin/mails_templates.php
* \ingroup setup * \ingroup core
* \brief Page to administer data tables * \brief Page to administer emails templates
*/ */
require '../main.inc.php'; require '../main.inc.php';
@ -52,8 +52,13 @@ $confirm=GETPOST('confirm','alpha');
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$rowid=GETPOST('rowid','alpha'); $rowid=GETPOST('rowid','alpha');
$search_label=GETPOST('search_label','alpha'); $search_label=GETPOST('search_label','alpha');
$search_type_template=GETPOST('search_type_template','alpha');
$search_topic=GETPOST('search_topic','alpha');
$search_lang=GETPOST('search_lang','alpha');
$search_fk_user=GETPOST('search_fk_user','intcomma');
$search_topic=GETPOST('search_topic','alpha');
$allowed=$user->admin; $allowed=1;
if (! $allowed) accessforbidden(); if (! $allowed) accessforbidden();
$acts[0] = "activate"; $acts[0] = "activate";
@ -86,17 +91,17 @@ $tabsqlsort[25]="label ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire // Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array(); $tabfield=array();
$tabfield[25]= "label,type_template,lang,private,position,topic,content"; $tabfield[25]= "label,type_template,lang,fk_user,private,position,topic,content";
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines'; if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines';
// Nom des champs d'edition pour modification d'un enregistrement // Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array(); $tabfieldvalue=array();
$tabfieldvalue[25]= "label,type_template,lang,private,position,topic,content"; $tabfieldvalue[25]= "label,type_template,fk_user,lang,private,position,topic,content";
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines'; if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines';
// Nom des champs dans la table pour insertion d'un enregistrement // Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array(); $tabfieldinsert=array();
$tabfieldinsert[25]= "label,type_template,lang,private,position,topic,content"; $tabfieldinsert[25]= "label,type_template,fk_user,lang,private,position,topic,content";
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines'; if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines';
$tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays $tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays
@ -155,6 +160,9 @@ if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$lang
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice'); if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty'); if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract'); if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
$elementList['all']=$langs->trans('VisibleEverywhere');
$elementList['none']=$langs->trans('VisibleNowhere');
$parameters=array('elementList'=>$elementList); $parameters=array('elementList'=>$elementList);
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
@ -184,6 +192,10 @@ if (empty($reshook))
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{ {
$search_label=''; $search_label='';
$search_type_template='';
$search_lang='';
$search_fk_user='';
$search_topic='';
$toselect=''; $toselect='';
$search_array_options=array(); $search_array_options=array();
} }
@ -205,7 +217,7 @@ if (empty($reshook))
if ($value == 'content') $value='content-'.$rowid; if ($value == 'content') $value='content-'.$rowid;
if ($value == 'content_lines') $value='content_lines-'.$rowid; if ($value == 'content_lines') $value='content_lines-'.$rowid;
if ((! isset($_POST[$value]) || $_POST[$value]=='') && $value != 'lang') if ((! isset($_POST[$value]) || $_POST[$value]=='' || $_POST[$value]=='-1') && $value != 'lang' && $value != 'fk_user')
{ {
$ok=0; $ok=0;
$fieldnamekey=$listfield[$f]; $fieldnamekey=$listfield[$f];
@ -214,7 +226,11 @@ if (empty($reshook))
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments'; if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
if ($fieldnamekey == 'note') $fieldnamekey = 'Note'; if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
if ($fieldnamekey == 'type') $fieldnamekey = 'Type'; if ($fieldnamekey == 'type_template') $fieldnamekey = 'TypeOfTemplate';
if ($fieldnamekey == 'fk_user') $fieldnamekey = 'Owner';
if ($fieldnamekey == 'private') $fieldnamekey = 'Private';
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
if ($fieldnamekey == 'topic') $fieldnamekey = 'Topic';
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
} }
@ -260,6 +276,7 @@ if (empty($reshook))
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value); //var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
if ($value == 'entity') $_POST[$keycode] = $conf->entity; if ($value == 'entity') $_POST[$keycode] = $conf->entity;
if ($i) $sql.=","; if ($i) $sql.=",";
if ($value == 'fk_user' && ! ($_POST[$keycode] > 0)) $_POST[$keycode]='';
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0'; if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1'; if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = '' if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = ''
@ -306,7 +323,8 @@ if (empty($reshook))
$keycode=$listfieldvalue[$i]; $keycode=$listfieldvalue[$i];
if ($field == 'lang') $keycode='langcode'; if ($field == 'lang') $keycode='langcode';
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid]; if ($field == 'fk_user' && ! ($_POST['fk_user'] > 0)) $_POST['fk_user']='';
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid]; if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
if ($field == 'entity') $_POST[$keycode] = $conf->entity; if ($field == 'entity') $_POST[$keycode] = $conf->entity;
if ($i) $sql.=","; if ($i) $sql.=",";
@ -408,17 +426,21 @@ print load_fiche_titre($titre,$linkback,$titlepicto);
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/mails.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetup");
$head[$h][2] = 'common';
$h++;
if ($conf->mailing->enabled) if ($user->admin && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates'))
{ {
$head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php"; $head[$h][0] = DOL_URL_ROOT."/admin/mails.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing"); $head[$h][1] = $langs->trans("OutGoingEmailSetup");
$head[$h][2] = 'common_emailing'; $head[$h][2] = 'common';
$h++; $h++;
if (! empty($conf->mailing->enabled))
{
$head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing");
$head[$h][2] = 'common_emailing';
$h++;
}
} }
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php"; $head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
@ -437,15 +459,23 @@ if ($action == 'delete')
//var_dump($elementList); //var_dump($elementList);
$sql="SELECT rowid as rowid, label, type_template, lang, private, position, topic, content_lines, content, active"; $sql="SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, content_lines, content, active";
$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates"; $sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
$sql.=" WHERE entity IN (".getEntity('email_template').")"; $sql.=" WHERE entity IN (".getEntity('email_template').")";
if ($search_label) $sql.=natural_search('label', $search_label); if (! $user->admin)
{
$sql.=" AND (private = 0 OR (private = 1 AND fk_user = ".$user->id."))"; // Show only public and private to me
$sql.=" AND (active = 1 OR fk_user = ".$user->id.")"; // Show only active or owned by me
}
if (empty($conf->global->MAIN_MULTILANGS)) if (empty($conf->global->MAIN_MULTILANGS))
{ {
$sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL)"; $sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL)";
} }
if ($search_label) $sql.=natural_search('label', $search_label);
if ($search_type_template != '' && $search_type_template != '-1') $sql.=natural_search('type_template', $search_type_template);
if ($search_lang) $sql.=natural_search('lang', $search_lang);
if ($search_fk_user != '' && $search_fk_user != '-1') $sql.=natural_search('fk_user', $search_fk_user, 2);
if ($search_topic) $sql.=natural_search('topic', $search_topic);
if ($sortfield) if ($sortfield)
{ {
// If sort order is "country", we use country_code instead // If sort order is "country", we use country_code instead
@ -473,25 +503,23 @@ $fieldlist=explode(',',$tabfield[$id]);
$alabelisused=0; $alabelisused=0;
$var=false; $var=false;
$fieldlist=explode(',',$tabfield[$id]); print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
//if ($action != 'edit') print '<div class="div-table-responsive-no-min">';
//{ print '<table class="noborder" width="100%">';
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<table class="noborder" width="100%">'; // Line to enter new values (title)
print '<tr class="liste_titre">';
// Line for title foreach ($fieldlist as $field => $value)
print '<tr class="liste_titre">'; {
foreach ($fieldlist as $field => $value)
{
// Determine le nom du champ par rapport aux noms possibles // Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees // dans les dictionnaires de donnees
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate $valuetoshow=$langs->trans($valuetoshow); // try to translate
$align="left"; $align="left";
if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner");}
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
@ -499,6 +527,8 @@ $fieldlist=explode(',',$tabfield[$id]);
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='content') { $valuetoshow=''; } if ($fieldlist[$field]=='content') { $valuetoshow=''; }
if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; } if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; }
if ($fieldlist[$field]=='private') { $align='center'; }
if ($fieldlist[$field]=='position') { $align='center'; }
if ($valuetoshow != '') if ($valuetoshow != '')
{ {
@ -513,98 +543,96 @@ $fieldlist=explode(',',$tabfield[$id]);
print '</td>'; print '</td>';
} }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
} }
print '<td colspan="3">';
print '<input type="hidden" name="id" value="' . $id . '">';
print '</td>';
print '</tr>';
print '<td colspan="3">'; // Line to enter new values (input fields)
print '<input type="hidden" name="id" value="'.$id.'">'; print "<tr " . $bcnd[$var] . ">";
print '</td>';
print '</tr>';
// Line to enter new values $obj = new stdClass();
print "<tr ".$bcnd[$var].">"; // If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd'))
{
foreach ($fieldlist as $key => $val) {
if (GETPOST($val) != '')
$obj->$val = GETPOST($val);
}
}
$obj = new stdClass(); $tmpaction = 'create';
// If data was already input, we define them in obj to populate input fields. $parameters = array(
if (GETPOST('actionadd')) 'fieldlist' => $fieldlist,
{ 'tabname' => $tabname[$id]
foreach ($fieldlist as $key=>$val) );
{ $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
if (GETPOST($val) != '') $error = $hookmanager->error;
$obj->$val=GETPOST($val); $errors = $hookmanager->errors;
}
}
$tmpaction = 'create'; if (empty($reshook))
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); {
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks if ($tabname[$id] == MAIN_DB_PREFIX . 'c_email_templates' && $action == 'edit') {
$error=$hookmanager->error; $errors=$hookmanager->errors; fieldList($fieldlist, $obj, $tabname[$id], 'hide');
} else {
fieldList($fieldlist, $obj, $tabname[$id], 'add');
}
}
if (empty($reshook)) print '<td align="right" colspan="3">';
{ print '</td>';
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit') print "</tr>";
{
fieldList($fieldlist,$obj,$tabname[$id],'hide');
}
else
{
fieldList($fieldlist,$obj,$tabname[$id],'add');
}
}
print '<td align="right" colspan="3">'; $fieldsforcontent = array('content');
print '</td>'; if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('content','content_lines'); }
print "</tr>"; foreach ($fieldsforcontent as $tmpfieldlist)
{
print '<tr class="impair nodrag nodrop nohover"><td colspan="6">';
if ($tmpfieldlist == 'content')
print '<strong>' . $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong><br>';
if ($tmpfieldlist == 'content_lines')
print '<strong>' . $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong><br>';
$fieldsforcontent = array('content'); if ($context != 'hide') {
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) // print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
{ $okforextended = true;
$fieldsforcontent = array('content', 'content_lines'); if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
} $okforextended = false;
foreach ($fieldsforcontent as $tmpfieldlist) $doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
{ print $doleditor->Create(1);
print '<tr class="impair nodrag nodrop nohover"><td colspan="5">'; } else
if ($tmpfieldlist == 'content') print '<strong>'.$form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong><br>'; print '&nbsp;';
if ($tmpfieldlist == 'content_lines') print '<strong>'.$form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong><br>'; print '</td>';
if ($tmpfieldlist == 'content') {
if ($context != 'hide') print '<td align="center" colspan="3" rowspan="' . (count($fieldsforcontent)) . '">';
{ if ($action != 'edit') {
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>'; print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">';
$okforextended=true; }
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false; print '</td>';
$doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist})?$obj->{$tmpfieldlist}:''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%'); }
print $doleditor->Create(1); // else print '<td></td>';
} print '</tr>';
else print '&nbsp;'; }
print '</td>';
if ($tmpfieldlist == 'content')
{
print '<td align="center" colspan="3" rowspan="'.(count($fieldsforcontent)).'">';
if ($action != 'edit')
{
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
}
print '</td>';
}
//else print '<td></td>';
print '</tr>';
}
$colspan=count($fieldlist)+1; $colspan=count($fieldlist)+1;
//print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height //print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
print '</table>'; print '</table>';
print '</div>';
print '</form>'; print '</form>';
print '<br>';
print '<br>';
//}
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">'; print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// List of available record in database // List of available record in database
@ -637,12 +665,28 @@ if ($resql)
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>'; if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
elseif ($value == 'lang')
{
print '<td class="liste_titre">';
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1);
print '</td>';
}
elseif ($value == 'fk_user')
{
print '<td class="liste_titre">';
$restrictid=array();
if (! $user->admin) $restrictid=array($user->id);
//var_dump($restrictid);
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth200');
print '</td>';
}
elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>'; elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
} }
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>'; if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
// Action column // Action column
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right" width="64">';
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
@ -667,12 +711,15 @@ if ($resql)
*/ */
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut $valuetoshow=ucfirst($fieldlist[$field]); // By defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate $valuetoshow=$langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner"); }
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;} if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;}
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; } if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; }
if ($fieldlist[$field]=='private') { $align='center'; }
if ($fieldlist[$field]=='position') { $align='center'; }
// Affiche nom du champ // Affiche nom du champ
if ($showfield) if ($showfield)
@ -696,14 +743,13 @@ if ($resql)
// Lines with values // Lines with values
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
//print_r($obj);
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">'; print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
{ {
$tmpaction='edit'; $tmpaction='edit';
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors; $error=$hookmanager->error; $errors=$hookmanager->errors;
@ -735,13 +781,14 @@ if ($resql)
if ($showfield) { if ($showfield) {
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">'; print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
print '<td colspan="5">'; // To create an artificial CR for the current tr we are on print '<td colspan="7">'; // To create an artificial CR for the current tr we are on
$okforextended = true; $okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false; if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%'); $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
print '</td>'; print '</td>';
print '<td></td><td></td><td></td>'; print '<td></td>';
print '<td></td>';
print '<td></td>'; print '<td></td>';
} }
} }
@ -770,19 +817,42 @@ if ($resql)
{ {
$valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow); $valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
} }
if ($value == 'fk_user')
{
if ($valuetoshow > 0)
{
$fuser=new User($db);
$fuser->fetch($valuetoshow);
$valuetoshow = $fuser->getNomUrl(1);
}
}
if ($value == 'private')
{
$align="center";
}
if ($value == 'position')
{
$align="center";
}
$class='tddict'; $class='tddict';
// Show value for field // Show value for field
if ($showfield) if ($showfield)
{ {
print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>'; print '<!-- '.$fieldlist[$field].' -->';
print '<td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
} }
} }
} }
// Can an entry be erased or disabled ? // Can an entry be erased or disabled ?
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default $iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
$canbemodified=$iserasable; if (! $user->admin && $obj->fk_user != $user->id)
{
$iserasable=0;
$canbedisabled=0;
$canbemodified=0;
}
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
if ($param) $url .= '&'.$param; if ($param) $url .= '&'.$param;
@ -791,28 +861,21 @@ if ($resql)
// Active // Active
print '<td align="center" class="nowrap">'; print '<td align="center" class="nowrap">';
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>'; if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else
{
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
else print $langs->trans("AlwaysActive");
}
print "</td>"; print "</td>";
// Modify link // Modify link
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>'; if ($canbemodified) print '<td align="center" width="64"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td></td>';
// Delete link // Delete link
if ($iserasable) if ($iserasable)
{ {
print '<td align="center">'; print '<td align="center" width="64">';
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>'; print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
print '</td>'; print '</td>';
} }
else print '<td>&nbsp;</td>'; else print '<td></td>';
/* /*
$fieldsforcontent = array('content'); $fieldsforcontent = array('content');
@ -854,6 +917,7 @@ else {
} }
print '</table>'; print '</table>';
print '</div>';
print '</form>'; print '</form>';
@ -875,7 +939,7 @@ $db->close();
*/ */
function fieldList($fieldlist, $obj='', $tabname='', $context='') function fieldList($fieldlist, $obj='', $tabname='', $context='')
{ {
global $conf,$langs,$db; global $conf, $langs, $user, $db;
global $form; global $form;
global $region_id; global $region_id;
global $elementList,$sourceList,$localtax_typeList; global $elementList,$sourceList,$localtax_typeList;
@ -883,11 +947,43 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
if ($fieldlist[$field] == 'lang') if ($fieldlist[$field] == 'fk_user')
{
print '<td>';
if ($user->admin)
{
print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, '', null, 0, 0, 1, '', 0, '', 'maxwidth200');
}
else
{
if ($context == 'add') // I am not admin and we show the add form
{
print $user->getNomUrl(1); // Me
$forcedvalue=$user->id;
}
else
{
if ($obj && ! empty($obj->{$fieldlist[$field]}) && $obj->{$fieldlist[$field]} > 0)
{
$fuser=new User($db);
$fuser->fetch($obj->{$fieldlist[$field]});
print $fuser->getNomUrl(1);
$forcedvalue=$fuser->id;
}
else
{
$forcedvalue=$obj->{$fieldlist[$field]};
}
}
$keyname=$fieldlist[$field];
print '<input type="hidden" value="'.$forcedvalue.'" name="'.$keyname.'">';
}
print '</td>';
}
elseif ($fieldlist[$field] == 'lang')
{ {
print '<td>'; print '<td>';
if (! empty($conf->global->MAIN_MULTILANGS)) if (! empty($conf->global->MAIN_MULTILANGS))
@ -912,21 +1008,38 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
elseif ($fieldlist[$field] == 'type_template') elseif ($fieldlist[$field] == 'type_template')
{ {
print '<td>'; print '<td>';
print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1); if ($context == 'edit' && ! empty($obj->{$fieldlist[$field]}) && ! in_array($obj->{$fieldlist[$field]}, array_keys($elementList)))
{
// Current tempalte type is an unknown type, so we must keep it as it is.
print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">';
print $obj->{$fieldlist[$field]};
}
else
{
print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1);
}
print '</td>'; print '</td>';
} }
elseif (in_array($fieldlist[$field], array('content','content_lines'))) continue; elseif (in_array($fieldlist[$field], array('content','content_lines'))) continue;
else else
{ {
print '<td>'; $size=''; $class=''; $classtd='';
$size=''; $class='';
if ($fieldlist[$field]=='code') $class='maxwidth100'; if ($fieldlist[$field]=='code') $class='maxwidth100';
if ($fieldlist[$field]=='private') $class='maxwidth50'; if ($fieldlist[$field]=='private') { $class='maxwidth50'; $classtd='center'; }
if ($fieldlist[$field]=='position') $class='maxwidth50'; if ($fieldlist[$field]=='position') { $class='maxwidth50'; $classtd='center'; }
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
if ($fieldlist[$field]=='topic') $class='quatrevingtpercent'; if ($fieldlist[$field]=='topic') $class='quatrevingtpercent';
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" '; if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
print '<td'.($classtd?' class="'.$classtd.'"':'').'>';
if ($fieldlist[$field]=='private' && empty($user->admin))
{
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="1" name="'.$fieldlist[$field].'">';
}
else
{
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
}
print '</td>'; print '</td>';
} }
} }

View File

@ -77,7 +77,7 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["_MAIN_PDF_MAIN_HIDE_THIRD_TAX"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"],'chaine',0,'',$conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit; exit;
@ -134,7 +134,8 @@ if ($action == 'edit') // Edit
// Misc options // Misc options
print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','').'<br>'; print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','').'<br>';
$var=true;
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder" width="100%">'; print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
@ -161,13 +162,15 @@ if ($action == 'edit') // Edit
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</div>';
print '<br>'; print '<br>';
// Addresses // Addresses
print load_fiche_titre($langs->trans("PDFAddressForging"),'','').'<br>'; print load_fiche_titre($langs->trans("PDFAddressForging"),'','').'<br>';
$var=true;
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder" width="100%">'; print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
@ -250,6 +253,7 @@ if ($action == 'edit') // Edit
} }
print '</table>'; print '</table>';
print '</div>';
print '<br>'; print '<br>';
@ -277,7 +281,7 @@ if ($action == 'edit') // Edit
} }
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'',''); print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
$var=true;
print '<table summary="more" class="noborder" width="100%">'; print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print $text; print $text;
@ -289,8 +293,9 @@ if ($action == 'edit') // Edit
// Other // Other
print load_fiche_titre($langs->trans("Other"),'','').'<br>'; print load_fiche_titre($langs->trans("Other"),'','').'<br>';
$var=true;
print '<table summary="more" class="noborder" width="100%">'; print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
// Hide any PDF informations // Hide any PDF informations
@ -329,6 +334,7 @@ if ($action == 'edit') // Edit
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</div>';
print '<br><div class="center">'; print '<br><div class="center">';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">'; print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
@ -341,12 +347,11 @@ if ($action == 'edit') // Edit
} }
else // Show else // Show
{ {
$var=true;
// Misc options // Misc options
print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'',''); print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','');
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder" width="100%">'; print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
@ -391,13 +396,15 @@ else // Show
print empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM; print empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM;
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</div>';
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("PDFAddressForging"),'',''); print load_fiche_titre($langs->trans("PDFAddressForging"),'','');
print '<table class="noborder" width="100%">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
// Hide Intra VAT on address // Hide Intra VAT on address
@ -479,6 +486,7 @@ else // Show
} }
print '</table>'."\n"; print '</table>'."\n";
print '</div>';
print '<br>'; print '<br>';
@ -506,11 +514,10 @@ else // Show
} }
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'',''); print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
$var=true;
print '<table summary="more" class="noborder" width="100%">'; print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print $text; print $text;
print '</table>'; print '</table>';
print '<br>'; print '<br>';
@ -518,11 +525,11 @@ else // Show
// Other // Other
print load_fiche_titre($langs->trans("Other"),'',''); print load_fiche_titre($langs->trans("Other"),'','');
$var=true;
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder" width="100%">'; print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>';
// Encrypt and protect PDF // Encrypt and protect PDF
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -586,14 +593,17 @@ else // Show
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</div>';
/* /*
* Library * Library
*/ */
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("Library")); print load_fiche_titre($langs->trans("Library"));
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'."\n"; print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre">'."\n"; print '<tr class="liste_titre">'."\n";
@ -601,7 +611,6 @@ else // Show
print '<td>'.$langs->trans("Value").'</td>'."\n"; print '<td>'.$langs->trans("Value").'</td>'."\n";
print "</tr>\n"; print "</tr>\n";
$var=false;
if (! empty($dolibarr_pdf_force_fpdf)) if (! empty($dolibarr_pdf_force_fpdf))
{ {
@ -652,6 +661,7 @@ else // Show
print '</tr>'."\n"; print '</tr>'."\n";
print "</table>\n"; print "</table>\n";
print '</div>';
if (! empty($dolibarr_pdf_force_fpdf)) if (! empty($dolibarr_pdf_force_fpdf))
{ {

View File

@ -131,6 +131,7 @@ dol_fiche_head($head, 'file', $langs->trans("Security"), -1);
// Upload options // Upload options
$var=false; $var=false;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("Parameters").'</td>'; print '<td colspan="2">'.$langs->trans("Parameters").'</td>';
@ -193,6 +194,7 @@ print "</td>";
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '</div>';
dol_fiche_end(); dol_fiche_end();

View File

@ -46,6 +46,7 @@ print load_fiche_titre($langs->trans("FileCheckDolibarr"),'','title_setup');
print $langs->trans("FileCheckDesc").'<br><br>'; print $langs->trans("FileCheckDesc").'<br><br>';
// Version // Version
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n"; print '<tr class="liste_titre"><td>'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";
@ -63,6 +64,7 @@ if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) {
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '</table>'; print '</table>';
print '</div>';
print '<br>'; print '<br>';
@ -161,6 +163,7 @@ if ($xml)
{ {
$out.=load_fiche_titre($langs->trans("ForcedConstants")); $out.=load_fiche_titre($langs->trans("ForcedConstants"));
$out.='<div class="div-table-responsive-no-min">';
$out.='<table class="noborder">'; $out.='<table class="noborder">';
$out.='<tr class="liste_titre">'; $out.='<tr class="liste_titre">';
$out.='<td>#</td>'; $out.='<td>#</td>';
@ -196,6 +199,7 @@ if ($xml)
$out.='<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; $out.='<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
$out.='</table>'; $out.='</table>';
$out.='</div>';
$out.='<br>'; $out.='<br>';
} }
@ -227,6 +231,7 @@ if ($xml)
// Files missings // Files missings
$out.=load_fiche_titre($langs->trans("FilesMissing")); $out.=load_fiche_titre($langs->trans("FilesMissing"));
$out.='<div class="div-table-responsive-no-min">';
$out.='<table class="noborder">'; $out.='<table class="noborder">';
$out.='<tr class="liste_titre">'; $out.='<tr class="liste_titre">';
$out.='<td>#</td>'; $out.='<td>#</td>';
@ -252,6 +257,7 @@ if ($xml)
$out.='<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; $out.='<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
$out.='</table>'; $out.='</table>';
$out.='</div>';
$out.='<br>'; $out.='<br>';
@ -259,6 +265,7 @@ if ($xml)
$out.=load_fiche_titre($langs->trans("FilesModified")); $out.=load_fiche_titre($langs->trans("FilesModified"));
$totalsize=0; $totalsize=0;
$out.='<div class="div-table-responsive-no-min">';
$out.='<table class="noborder">'; $out.='<table class="noborder">';
$out.='<tr class="liste_titre">'; $out.='<tr class="liste_titre">';
$out.='<td>#</td>'; $out.='<td>#</td>';
@ -300,6 +307,7 @@ if ($xml)
$out.='<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; $out.='<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
$out.='</table>'; $out.='</table>';
$out.='</div>';
$out.='<br>'; $out.='<br>';
@ -307,6 +315,7 @@ if ($xml)
$out.=load_fiche_titre($langs->trans("FilesAdded")); $out.=load_fiche_titre($langs->trans("FilesAdded"));
$totalsize = 0; $totalsize = 0;
$out.='<div class="div-table-responsive-no-min">';
$out.='<table class="noborder">'; $out.='<table class="noborder">';
$out.='<tr class="liste_titre">'; $out.='<tr class="liste_titre">';
$out.='<td>#</td>'; $out.='<td>#</td>';
@ -348,6 +357,7 @@ if ($xml)
$out.='<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; $out.='<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
$out.='</table>'; $out.='</table>';
$out.='</div>';
// Show warning // Show warning

View File

@ -40,26 +40,27 @@ if (!$user->admin) accessforbidden();
* View * View
*/ */
llxHeader(); llxHeader('', $langs->trans("InfoWebServer"));
print load_fiche_titre($langs->trans("InfoWebServer"),'','title_setup'); print load_fiche_titre($langs->trans("InfoWebServer"),'','title_setup');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\"><td>".$langs->trans("Parameter")."</td><td>".$langs->trans("Value")."</td></tr>\n"; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter")."</td><td>".$langs->trans("Value")."</td></tr>\n";
print "<tr $bc[0]><td width=\"240\">".$langs->trans("Version")."</td><td>".$_SERVER["SERVER_SOFTWARE"]."</td></tr>\n"; print '<tr class="oddeven"><td>'.$langs->trans("Version")."</td><td>".$_SERVER["SERVER_SOFTWARE"]."</td></tr>\n";
print "<tr $bc[1]><td>".$langs->trans("VirtualServerName")."</td><td>" . $_SERVER["SERVER_NAME"] . "</td></tr>\n"; print '<tr class="oddeven"><td>'.$langs->trans("VirtualServerName")."</td><td>" . $_SERVER["SERVER_NAME"] . "</td></tr>\n";
print "<tr $bc[0]><td width=\"240\">".$langs->trans("IP")."</td><td>".$_SERVER["SERVER_ADDR"]."</td></tr>\n"; print '<tr class="oddeven"><td>'.$langs->trans("IP")."</td><td>".$_SERVER["SERVER_ADDR"]."</td></tr>\n";
print "<tr $bc[1]><td>".$langs->trans("Port")."</td><td>" . $_SERVER["SERVER_PORT"] . "</td></tr>\n"; print '<tr><td>'.$langs->trans("Port")."</td><td>" . $_SERVER["SERVER_PORT"] . "</td></tr>\n";
print "<tr $bc[0]><td width=\"240\">".$langs->trans("DocumentRootServer")."</td><td>".$_SERVER["DOCUMENT_ROOT"]."</td></tr>\n"; print '<tr><td>'.$langs->trans("DocumentRootServer")."</td><td>".$_SERVER["DOCUMENT_ROOT"]."</td></tr>\n";
print "<tr $bc[1]><td>".$langs->trans("DataRootServer")."</td><td>" . DOL_DATA_ROOT . "</td></tr>\n"; print '<tr><td>'.$langs->trans("DataRootServer")."</td><td>" . DOL_DATA_ROOT . "</td></tr>\n";
$labeluser=dol_getwebuser('user'); $labeluser=dol_getwebuser('user');
$labelgroup=dol_getwebuser('group'); $labelgroup=dol_getwebuser('group');
if ($labeluser && $labelgroup) if ($labeluser && $labelgroup)
{ {
print "<tr $bc[0]><td>".$langs->trans("WebUserGroup")."</td><td>".$labeluser.'/'.$labelgroup."</td></tr>\n"; print '<tr><td>'.$langs->trans("WebUserGroup")."</td><td>".$labeluser.'/'.$labelgroup."</td></tr>\n";
} }
print '</table>'; print '</table>';
print '</div>';
llxFooter(); llxFooter();

View File

@ -465,13 +465,17 @@ if (! empty($_SESSION["commandbackuplastdone"]))
} }
?> ?>
</div> </div> <!-- end div center button -->
<?php <?php
print '</td></tr></table>'; print '</td></tr>';
print '</table>';
?> ?>
</div> </div> <!-- end div fichehalfleft -->
<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;"> <div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">
<div class="ficheaddleft"> <div class="ficheaddleft">
@ -481,6 +485,7 @@ $result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/
print '<br>'; print '<br>';
?> ?>
</div> </div>
</div> </div>

View File

@ -88,7 +88,45 @@ if ($action == 'setMAIN_ENABLE_OVERWRITE_TRANSLATION')
else dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 0, 'chaine', 0, '', $conf->entity); else dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 0, 'chaine', 0, '', $conf->entity);
} }
if ($action == 'add' || (GETPOST('add') && $action != 'update')) if ($action == 'update')
{
if ($transvalue == '')
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NewTranslationStringToShow")), null, 'errors');
$error++;
}
if (! $error)
{
$db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."overwrite_trans set transvalue = '".$db->escape($transvalue)."' WHERE rowid = ".GETPOST('rowid','int');
$result = $db->query($sql);
if ($result > 0)
{
$db->commit();
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action="";
$transkey="";
$transvalue="";
}
else
{
$db->rollback();
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
setEventMessages($langs->trans("WarningAnEntryAlreadyExistForTransKey"), null, 'warnings');
}
else
{
setEventMessages($db->lasterror(), null, 'errors');
}
$action='';
}
}
}
if ($action == 'add')
{ {
$error=0; $error=0;
@ -162,6 +200,7 @@ if ($action == 'delete')
* View * View
*/ */
$form = new Form($db);
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
$wikihelp='EN:Setup|FR:Paramétrage|ES:Configuración'; $wikihelp='EN:Setup|FR:Paramétrage|ES:Configuración';
@ -208,7 +247,6 @@ print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug)?'?
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
@ -229,10 +267,10 @@ if ($mode == 'overwrite')
print '<br>'; print '<br>';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="action" value="'.($action=='edit'?'update':'add').'">';
print '<input type="hidden" id="action" name="action" value="">';
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">'; print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder); print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder);
@ -246,13 +284,16 @@ if ($mode == 'overwrite')
// Line to add new record // Line to add new record
print "\n"; print "\n";
$disablededit='';
if ($action == 'edit') $disablededit=' disabled';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, 0, 'maxwidthonsmartphone', 1); print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit?1:0, 'maxwidthonsmartphone', 1);
print '</td>'."\n"; print '</td>'."\n";
print '<td>'; print '<td>';
print '<input type="text" class="flat maxwidthonsmartphone" name="transkey" value="">'; print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" value="">';
print '</td><td>'; print '</td><td>';
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="">'; print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" value="">';
print '</td>'; print '</td>';
// Limit to superadmin // Limit to superadmin
/*if (! empty($conf->multicompany->enabled) && !$user->entity) /*if (! empty($conf->multicompany->enabled) && !$user->entity)
@ -268,7 +309,7 @@ if ($mode == 'overwrite')
print '<input type="hidden" name="entity" value="'.$conf->entity.'">'; print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
//} //}
$disabled=''; $disabled='';
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) $disabled=' disabled="disabled"'; if ($action == 'edit' || empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) $disabled=' disabled="disabled"';
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add">'; print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add">';
print "</td>\n"; print "</td>\n";
print '</tr>'; print '</tr>';
@ -306,11 +347,30 @@ if ($mode == 'overwrite')
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">'; print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">'; print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
*/ */
print $obj->transvalue; if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
{
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.$obj->transvalue.'">';
}
else
{
print $obj->transvalue;
}
print '</td>'; print '</td>';
print '<td align="center">'; print '<td align="center">';
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_delete().'</a>'; if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
{
print '<input type="hidden" class="button" name="rowid" value="'.$obj->rowid.'">';
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print ' &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
}
else
{
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=edit'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_edit().'</a>';
print ' &nbsp; ';
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_delete().'</a>';
}
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@ -319,8 +379,8 @@ if ($mode == 'overwrite')
} }
} }
print '</table>'; print '</table>';
print '</div>';
} }
@ -387,10 +447,10 @@ if ($mode == 'searchkey')
if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.')'; if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.')';
print print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n"; print print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" id="action" name="action" value="search">'; print '<input type="hidden" id="action" name="action" value="search">';
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">'; print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder).'</td>'; print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder).'</td>';
@ -465,7 +525,7 @@ if ($mode == 'searchkey')
} }
print '</table>'; print '</table>';
print '</form>'; print '</div>';
} }
dol_fiche_end(); dol_fiche_end();

View File

@ -119,14 +119,12 @@ class Bookmark extends CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_user,dateb,url,target"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_user,dateb,url,target";
$sql.= ",title,favicon,position"; $sql.= ",title,favicon,position";
$sql.= ",entity"; $sql.= ",entity";
if ($this->fk_soc) $sql.=",fk_soc";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= ($this->fk_user > 0?"'".$this->fk_user."'":"0").","; $sql.= ($this->fk_user > 0?"'".$this->fk_user."'":"0").",";
$sql.= " '".$this->db->idate($now)."',"; $sql.= " '".$this->db->idate($now)."',";
$sql.= " '".$this->url."', '".$this->target."',"; $sql.= " '".$this->url."', '".$this->target."',";
$sql.= " '".$this->db->escape($this->title)."', '".$this->favicon."', '".$this->position."'"; $sql.= " '".$this->db->escape($this->title)."', '".$this->favicon."', '".$this->position."'";
$sql.= ", '".$conf->entity."'"; $sql.= ", '".$conf->entity."'";
if ($this->fk_soc) $sql.=",".$this->fk_soc;
$sql.= ")"; $sql.= ")";
dol_syslog("Bookmark::update", LOG_DEBUG); dol_syslog("Bookmark::update", LOG_DEBUG);

View File

@ -35,8 +35,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.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 . '/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
if (! empty($conf->expedition->enabled)) require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; if (! empty($conf->expedition->enabled)) require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
@ -951,6 +952,107 @@ if ($id > 0)
} }
} }
/*
* Last invoices templates
*/
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$invoicetemplate = new FactureRec($db);
$sql = 'SELECT f.rowid as id, f.titre as ref, f.amount';
$sql.= ', f.total as total_ht';
$sql.= ', f.tva as total_tva';
$sql.= ', f.total_ttc';
$sql.= ', f.datec as dc';
$sql.= ', f.date_last_gen';
$sql.= ', f.frequency';
$sql.= ', f.unit_frequency';
$sql.= ', f.suspended as suspended';
$sql.= ', s.nom, s.rowid as socid';
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
$sql.= " AND f.entity = ".$conf->entity;
$sql.= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,';
$sql.= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
$sql.= ' f.suspended,';
$sql.= ' s.nom, s.rowid';
$sql.= " ORDER BY f.date_last_gen, f.datec DESC";
$resql=$db->query($sql);
if ($resql)
{
$var=true;
$num = $db->num_rows($resql);
$i = 0;
if ($num > 0)
{
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LatestCustomerTemplateInvoices",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllCustomerTemplateInvoices").' <span class="badge">'.$num.'</span></a></td>';
print '</tr></table></td>';
print '</tr>';
}
while ($i < $num && $i < $MAXLIST)
{
$objp = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="nowrap">';
$invoicetemplate->id = $objp->id;
$invoicetemplate->ref = $objp->ref;
$invoicetemplate->suspended = $objp->suspended;
$invoicetemplate->frequency = $objp->frequency;
$invoicetemplate->unit_frequency = $objp->unit_frequency;
$invoicetemplate->total_ht = $objp->total_ht;
$invoicetemplate->total_tva = $objp->total_tva;
$invoicetemplate->total_ttc = $objp->total_ttc;
print $invoicetemplate->getNomUrl(1);
print '</td>';
if ($objp->frequency && $objp->date_last_gen > 0)
{
print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->date_last_gen),'day').'</td>';
}
else
{
if ($objp->dc > 0)
{
print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->dc),'day').'</td>';
}
else
{
print '<td align="right"><b>!!!</b></td>';
}
}
print '<td align="right" style="min-width: 60px">';
print price($objp->total_ht);
print '</td>';
if (! empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES))
{
print '<td align="right" style="min-width: 60px">';
print price($objp->total_ttc);
print '</td>';
}
print '<td align="right" class="nowrap" style="min-width: 60px">';
print $langs->trans('FrequencyPer_'.$invoicetemplate->unit_frequency, $invoicetemplate->frequency).' - ';
print ($invoicetemplate->LibStatut($invoicetemplate->frequency,$invoicetemplate->suspended,5,0));
print '</td>';
print "</tr>\n";
$i++;
}
$db->free($resql);
if ($num > 0) print "</table>";
}
else
{
dol_print_error($db);
}
}
/* /*
* Last invoices * Last invoices
*/ */

View File

@ -640,16 +640,16 @@ class AdvanceTargetingMailing extends CommonObject
$sqlwhere[]=$this->transformToSQL('t.firstname',$arrayquery['contact_firstname']); $sqlwhere[]=$this->transformToSQL('t.firstname',$arrayquery['contact_firstname']);
} }
if (!empty($arrayquery['contact_country']) && count($arrayquery['contact_country'])) { if (!empty($arrayquery['contact_country']) && count($arrayquery['contact_country'])) {
$sqlwhere[]= " (t.fk_pays IN (".implode(',',$arrayquery['contact_country'])."))"; $sqlwhere[]= " (t.fk_pays IN (".$db->escape(implode(',',$arrayquery['contact_country']))."))";
} }
if (!empty($arrayquery['contact_status']) && count($arrayquery['contact_status'])>0) { if (!empty($arrayquery['contact_status']) && count($arrayquery['contact_status'])>0) {
$sqlwhere[]= " (t.statut IN (".implode(',',$arrayquery['contact_status'])."))"; $sqlwhere[]= " (t.statut IN (".$db->escape(implode(',',$arrayquery['contact_status']))."))";
} }
if (!empty($arrayquery['contact_civility']) && count($arrayquery['contact_civility'])>0) { if (!empty($arrayquery['contact_civility']) && count($arrayquery['contact_civility'])>0) {
$sqlwhere[]= " (t.civility IN ('".implode("','",$arrayquery['contact_civility'])."'))"; $sqlwhere[]= " (t.civility IN ('".$db->escape(implode("','",$arrayquery['contact_civility']))."'))";
} }
if ($arrayquery['contact_no_email']!='') { if ($arrayquery['contact_no_email']!='') {
$sqlwhere[]= " (t.no_email='".$arrayquery['contact_no_email']."')"; $sqlwhere[]= " (t.no_email='".$db->escape($arrayquery['contact_no_email'])."')";
} }
if ($arrayquery['contact_update_st_dt']!='') { if ($arrayquery['contact_update_st_dt']!='') {
$sqlwhere[]= " (t.tms >= '".$this->db->idate($arrayquery['contact_update_st_dt'])."' AND t.tms <= '".$this->db->idate($arrayquery['contact_update_end_dt'])."')"; $sqlwhere[]= " (t.tms >= '".$this->db->idate($arrayquery['contact_update_st_dt'])."' AND t.tms <= '".$this->db->idate($arrayquery['contact_update_end_dt'])."')";
@ -658,7 +658,7 @@ class AdvanceTargetingMailing extends CommonObject
$sqlwhere[]= " (t.datec >= '".$this->db->idate($arrayquery['contact_create_st_dt'])."' AND t.datec <= '".$this->db->idate($arrayquery['contact_create_end_dt'])."')"; $sqlwhere[]= " (t.datec >= '".$this->db->idate($arrayquery['contact_create_st_dt'])."' AND t.datec <= '".$this->db->idate($arrayquery['contact_create_end_dt'])."')";
} }
if (!empty($arrayquery['contact_categ']) && count($arrayquery['contact_categ'])>0) { if (!empty($arrayquery['contact_categ']) && count($arrayquery['contact_categ'])>0) {
$sqlwhere[]= " (contactcateg.fk_categorie IN (".implode(",",$arrayquery['contact_categ'])."))"; $sqlwhere[]= " (contactcateg.fk_categorie IN (".$db->escape(implode(",",$arrayquery['contact_categ']))."))";
} }
//Standard Extrafield feature //Standard Extrafield feature

View File

@ -320,8 +320,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -92,7 +92,7 @@ dol_mkdir($dir);
$stats = new PropaleStats($db, $socid, ($userid>0?$userid:0), $mode); $stats = new PropaleStats($db, $socid, ($userid>0?$userid:0), $mode);
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND p.fk_statut IN ('.$object_status.')'; if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND p.fk_statut IN ('.$db->escape($object_status).')';
// Build graphic number of object // Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);

View File

@ -546,8 +546,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -88,11 +88,11 @@ dol_mkdir($dir);
$stats = new CommandeStats($db, $socid, $mode, ($userid>0?$userid:0)); $stats = new CommandeStats($db, $socid, $mode, ($userid>0?$userid:0));
if ($mode == 'customer') if ($mode == 'customer')
{ {
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND c.fk_statut IN ('.$object_status.')'; if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND c.fk_statut IN ('.$db->escape($object_status).')';
} }
if ($mode == 'supplier') if ($mode == 'supplier')
{ {
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND c.fk_statut IN ('.$object_status.')'; if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND c.fk_statut IN ('.$db->escape($object_status).')';
} }

View File

@ -508,8 +508,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -165,8 +165,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
/** /**
* Classe de gestion des factures recurrentes/Modeles * Class to manage invoice templates
*/ */
class FactureRec extends CommonInvoice class FactureRec extends CommonInvoice
{ {
@ -59,6 +59,9 @@ class FactureRec extends CommonInvoice
var $nb_gen_done; var $nb_gen_done;
var $nb_gen_max; var $nb_gen_max;
var $frequency;
var $unit_frequency;
var $rang; var $rang;
var $special_code; var $special_code;
@ -248,7 +251,7 @@ class FactureRec extends CommonInvoice
*/ */
function fetch($rowid, $ref='', $ref_ext='', $ref_int='') function fetch($rowid, $ref='', $ref_ext='', $ref_int='')
{ {
$sql = 'SELECT f.rowid, f.entity, f.titre, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc'; $sql = 'SELECT f.rowid, f.entity, f.titre, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
$sql.= ', f.remise_percent, f.remise_absolue, f.remise'; $sql.= ', f.remise_percent, f.remise_absolue, f.remise';
$sql.= ', f.date_lim_reglement as dlr'; $sql.= ', f.date_lim_reglement as dlr';
$sql.= ', f.note_private, f.note_public, f.fk_user_author'; $sql.= ', f.note_private, f.note_public, f.fk_user_author';
@ -281,6 +284,7 @@ class FactureRec extends CommonInvoice
$this->titre = $obj->titre; $this->titre = $obj->titre;
$this->ref = $obj->titre; $this->ref = $obj->titre;
$this->ref_client = $obj->ref_client; $this->ref_client = $obj->ref_client;
$this->suspended = $obj->suspended;
$this->type = $obj->type; $this->type = $obj->type;
$this->datep = $obj->dp; $this->datep = $obj->dp;
$this->date = $obj->df; $this->date = $obj->df;
@ -297,7 +301,6 @@ class FactureRec extends CommonInvoice
$this->close_code = $obj->close_code; $this->close_code = $obj->close_code;
$this->close_note = $obj->close_note; $this->close_note = $obj->close_note;
$this->socid = $obj->fk_soc; $this->socid = $obj->fk_soc;
$this->statut = $obj->fk_statut;
$this->date_lim_reglement = $this->db->jdate($obj->dlr); $this->date_lim_reglement = $this->db->jdate($obj->dlr);
$this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code; $this->mode_reglement_code = $obj->mode_reglement_code;
@ -574,11 +577,14 @@ class FactureRec extends CommonInvoice
if (empty($remise_percent)) $remise_percent=0; if (empty($remise_percent)) $remise_percent=0;
$qty=price2num($qty); $qty=price2num($qty);
if (! $info_bits) $info_bits=0; if (! $info_bits) $info_bits=0;
$pu_ht=price2num($pu_ht); $pu_ht = price2num($pu_ht);
$pu_ttc=price2num($pu_ttc); $pu_ttc = price2num($pu_ttc);
$txtva=price2num($txtva); $txtva = price2num($txtva);
$txlocaltax1 = price2num($txlocaltax1); $txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2); $txlocaltax2 = price2num($txlocaltax2);
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if ($price_base_type=='HT') if ($price_base_type=='HT')
{ {
@ -879,6 +885,7 @@ class FactureRec extends CommonInvoice
$facture->brouillon = 1; $facture->brouillon = 1;
$facture->date = $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. $facture->date = $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
$facture->socid = $facturerec->socid; $facture->socid = $facturerec->socid;
$facture->suspended = 0;
$invoiceidgenerated = $facture->create($user); $invoiceidgenerated = $facture->create($user);
if ($invoiceidgenerated <= 0) if ($invoiceidgenerated <= 0)
@ -956,6 +963,95 @@ class FactureRec extends CommonInvoice
return $result; return $result;
} }
/**
* Return label of object status
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @param integer $alreadypaid Not used
* @return string Label
*/
function getLibStatut($mode=0,$alreadypaid=-1)
{
return $this->LibStatut($this->frequency?1:0, $this->suspended, $mode, $alreadypaid, $this->type);
}
/**
* Renvoi le libelle d'un statut donne
*
* @param int $recur Is it a recurring invoice ?
* @param int $status Id status (suspended or not)
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
* @param int $alreadypaid Not used
* @param int $type Type invoice
* @return string Libelle du statut
*/
function LibStatut($recur,$status,$mode=0,$alreadypaid=-1,$type=0)
{
global $langs;
$langs->load('bills');
//print "$recur,$status,$mode,$alreadypaid,$type";
if ($mode == 0)
{
$prefix='';
if ($recur)
{
if ($status == 1) return $langs->trans('Suspended'); // credit note
else return $langs->trans('Active');
}
else return $langs->trans("Draft");
}
if ($mode == 1)
{
$prefix='Short';
if ($recur)
{
if ($status == 1) return $langs->trans('Suspended');
else return $langs->trans('Active');
}
else return $langs->trans("Draft");
}
if ($mode == 2)
{
if ($recur)
{
if ($status == 1) return img_picto($langs->trans('Suspended'),'statut6').' '.$langs->trans('Suspended');
else return img_picto($langs->trans('Active'),'statut4').' '.$langs->trans('Active');
}
else return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft');
}
if ($mode == 3)
{
if ($recur)
{
$prefix='Short';
if ($status == 1) return img_picto($langs->trans('Suspended'),'statut6');
else return img_picto($langs->trans('Active'),'statut4');
}
else return img_picto($langs->trans('Draft'),'statut0');
}
if ($mode == 4)
{
$prefix='';
if ($recur)
{
if ($type == 1) return img_picto($langs->trans('Suspended'),'statut6').' '.$langs->trans('Suspended');
else return img_picto($langs->trans('Active'),'statut4').' '.$langs->trans('Active');
}
else return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft');
}
if ($mode == 5 || $mode == 6)
{
$prefix='';
if ($mode == 5) $prefix='Short';
if ($recur)
{
if ($status == 1) return '<span class="xhideonsmartphone">'.$langs->trans('Suspended').' </span>'.img_picto($langs->trans('Suspended'),'statut6');
else return '<span class="xhideonsmartphone">'.$langs->trans('Active').' </span>'.img_picto($langs->trans('Active'),'statut4');
}
else return $langs->trans('Draft').' '.img_picto($langs->trans('Active'),'statut0');
}
}
/** /**
* Initialise an instance with random values. * Initialise an instance with random values.
@ -1309,7 +1405,7 @@ class FactureLigneRec extends CommonInvoiceLine
*/ */
function fetch($rowid) function fetch($rowid)
{ {
$sql = 'SELECT l.rowid, l.fk_facture ,l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx, '; $sql = 'SELECT l.rowid, l.fk_facture ,l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,'; $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,';
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc,'; $sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc,';
$sql.= ' l.rang, l.special_code,'; $sql.= ' l.rang, l.special_code,';

View File

@ -286,6 +286,8 @@ class Facture extends CommonInvoice
$result=$_facrec->fetch($this->fac_rec); $result=$_facrec->fetch($this->fac_rec);
$result=$_facrec->fetchObjectLinked(); // This load $_facrec->linkedObjectsIds $result=$_facrec->fetchObjectLinked(); // This load $_facrec->linkedObjectsIds
$originaldatewhen = $_facrec->date_when;
$this->socid = $_facrec->socid; // Invoice created on same thirdparty than template $this->socid = $_facrec->socid; // Invoice created on same thirdparty than template
$this->entity = $_facrec->entity; // Invoice created in same entity than template $this->entity = $_facrec->entity; // Invoice created in same entity than template
@ -361,8 +363,13 @@ class Facture extends CommonInvoice
'__INVOICE_PREVIOUS_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y'), '__INVOICE_PREVIOUS_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y'),
'__INVOICE_YEAR__' => dol_print_date($this->date, '%Y'), '__INVOICE_YEAR__' => dol_print_date($this->date, '%Y'),
'__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'), '__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'),
// Only for tempalte invoice
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__' => dol_print_date($originaldatewhen, 'dayhour'),
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__' => dol_print_date(dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency), 'dayhour')
); );
//var_dump($substitutionarray);exit;
$substitutionisok=true; $substitutionisok=true;
complete_substitutions_array($substitutionarray, $outputlangs); complete_substitutions_array($substitutionarray, $outputlangs);

View File

@ -121,7 +121,8 @@ $arrayfields=array(
'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDone"), 'checked'=>1), 'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDone"), 'checked'=>1),
'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1), 'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1),
'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1), 'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1),
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>100),
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
); );
// Extra fields // Extra fields
@ -934,6 +935,7 @@ $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
$companystatic = new Societe($db); $companystatic = new Societe($db);
$invoicerectmp = new FactureRec($db);
$now = dol_now(); $now = dol_now();
$tmparray=dol_getdate($now); $tmparray=dol_getdate($now);
@ -993,7 +995,10 @@ if ($action == 'create')
'__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')', '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')',
'__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'),'%Y').')', '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'),'%Y').')',
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%Y').')', '__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%Y').')',
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')' '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')',
// Only on template invoices
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__' => $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')',
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__' => $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency),'dayhour').')',
); );
$substitutionarray['__(TransKey)__']=$langs->trans("TransKey"); $substitutionarray['__(TransKey)__']=$langs->trans("TransKey");
@ -1312,7 +1317,10 @@ else
'__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')', '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')',
'__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'),'%Y').')', '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'),'%Y').')',
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')', '__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')',
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')' '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')',
// Only on template invoices
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__' => $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')',
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__' => $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency),'dayhour').')',
); );
$substitutionarray['__(TransKey)__']=$langs->trans("TransKey"); $substitutionarray['__(TransKey)__']=$langs->trans("TransKey");
@ -1409,7 +1417,7 @@ else
{ {
if ($object->frequency > 0) if ($object->frequency > 0)
{ {
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
} }
else else
{ {
@ -1617,7 +1625,7 @@ else
/* /*
* List mode * List mode
*/ */
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency,"; $sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency, f.unit_frequency,";
$sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when,"; $sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when,";
$sql.= " f.datec, f.tms"; $sql.= " f.datec, f.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
@ -1625,7 +1633,7 @@ else
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
} }
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity = ".$conf->entity; $sql.= ' AND f.entity IN ('.getEntity('facture').')';
if (! $user->rights->societe->client->voir && ! $socid) { if (! $user->rights->societe->client->voir && ! $socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
} }
@ -1837,6 +1845,12 @@ else
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
// Status
if (! empty($arrayfields['status']['checked']))
{
print '<td class="liste_titre" align="center">';
print '</td>';
}
// Action column // Action column
print '<td class="liste_titre" align="middle">'; print '<td class="liste_titre" align="middle">';
$searchpicto=$form->showFilterAndCheckAddButtons(0, 'checkforselect', 1); $searchpicto=$form->showFilterAndCheckAddButtons(0, 'checkforselect', 1);
@ -1855,8 +1869,9 @@ else
if (! empty($arrayfields['f.nb_gen_done']['checked'])) print_liste_field_titre($arrayfields['f.nb_gen_done']['label'],$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['f.nb_gen_done']['checked'])) print_liste_field_titre($arrayfields['f.nb_gen_done']['label'],$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['f.date_last_gen']['checked'])) print_liste_field_titre($arrayfields['f.date_last_gen']['label'],$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['f.date_last_gen']['checked'])) print_liste_field_titre($arrayfields['f.date_last_gen']['label'],$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['f.date_when']['checked'])) print_liste_field_titre($arrayfields['f.date_when']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['f.date_when']['checked'])) print_liste_field_titre($arrayfields['f.date_when']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER['PHP_SELF'],"f.datec","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER['PHP_SELF'],"f.tms","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'],$_SERVER['PHP_SELF'],"","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n"; print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
print "</tr>\n"; print "</tr>\n";
@ -1871,6 +1886,11 @@ else
$companystatic->id=$objp->socid; $companystatic->id=$objp->socid;
$companystatic->name=$objp->name; $companystatic->name=$objp->name;
$invoicerectmp->id=$objp->id;
$invoicerectmp->frequency=$objp->frequency;
$invoicerectmp->suspend=$objp->suspend;
$invoicerectmp->unit_frequency=$objp->unit_frequency;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['f.titre']['checked'])) if (! empty($arrayfields['f.titre']['checked']))
@ -1928,6 +1948,12 @@ else
print dol_print_date($db->jdate($objp->tms),'dayhour'); print dol_print_date($db->jdate($objp->tms),'dayhour');
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['status']['checked']))
{
print '<td align="center">';
print $invoicerectmp->getLibStatut(3,0);
print '</td>';
}
// Action column // Action column
print '<td align="center">'; print '<td align="center">';
if ($user->rights->facture->creer) if ($user->rights->facture->creer)

View File

@ -474,8 +474,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -84,11 +84,11 @@ dol_mkdir($dir);
$stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0)); $stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0));
if ($mode == 'customer') if ($mode == 'customer')
{ {
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')'; if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
} }
if ($mode == 'supplier') if ($mode == 'supplier')
{ {
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')'; if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
} }
// Build graphic number of object // Build graphic number of object

View File

@ -328,8 +328,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -30,6 +30,7 @@ require_once (DOL_DOCUMENT_ROOT."/product/class/product.class.php");
$langs->load("products"); $langs->load("products");
$langs->load("companies"); $langs->load("companies");
$langs->load("contracts");
$sortfield=GETPOST('sortfield','alpha'); $sortfield=GETPOST('sortfield','alpha');
$sortorder=GETPOST('sortorder','alpha'); $sortorder=GETPOST('sortorder','alpha');

View File

@ -255,8 +255,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -25,6 +25,7 @@
$maxsizestring=255; $maxsizestring=255;
$maxsizeint=10; $maxsizeint=10;
$mesg=array();
$extrasize=GETPOST('size','int'); $extrasize=GETPOST('size','int');
$type=GETPOST('type','alpha'); $type=GETPOST('type','alpha');

View File

@ -2956,6 +2956,8 @@ abstract class CommonObject
*/ */
function isObjectUsed($id=0) function isObjectUsed($id=0)
{ {
global $langs;
if (empty($id)) $id=$this->id; if (empty($id)) $id=$this->id;
// Check parameters // Check parameters
@ -2965,10 +2967,19 @@ abstract class CommonObject
return -1; return -1;
} }
$arraytoscan = $this->childtables;
// For backward compatibility, we check if array is old format array('table1', 'table2', ...)
$tmparray=array_keys($this->childtables);
if (is_numeric($tmparray[0]))
{
$arraytoscan = array_flip($this->childtables);
}
// Test if child exists // Test if child exists
$haschild=0; $haschild=0;
foreach($this->childtables as $table) foreach($arraytoscan as $table => $elementname)
{ {
//print $id.'-'.$table.'-'.$elementname.'<br>';
// Check if third party can be deleted // Check if third party can be deleted
$sql = "SELECT COUNT(*) as nb from ".MAIN_DB_PREFIX.$table; $sql = "SELECT COUNT(*) as nb from ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE ".$this->fk_element." = ".$id; $sql.= " WHERE ".$this->fk_element." = ".$id;
@ -2976,19 +2987,24 @@ abstract class CommonObject
if ($resql) if ($resql)
{ {
$obj=$this->db->fetch_object($resql); $obj=$this->db->fetch_object($resql);
$haschild+=$obj->nb; if ($obj->nb > 0)
//print 'Found into table '.$table; {
if ($haschild) break; // We found at least on, we stop here $langs->load("errors");
//print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild;
$haschild += $obj->nb;
$this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $langs->transnoentitiesnoconv($elementname));
break; // We found at least one, we stop here
}
} }
else else
{ {
$this->error=$this->db->lasterror(); $this->errors[]=$this->db->lasterror();
return -1; return -1;
} }
} }
if ($haschild > 0) if ($haschild > 0)
{ {
$this->error="ErrorRecordHasChildren"; $this->errors[]="ErrorRecordHasChildren";
return $haschild; return $haschild;
} }
else return 0; else return 0;

View File

@ -836,24 +836,24 @@ class ExtraFields
if (empty($showsize)) if (empty($showsize))
{ {
if ($type == 'date') if ($type == 'date')
{ {
//$showsize=10; //$showsize=10;
$showsize = 'minwidth100imp'; $showsize = 'minwidth100imp';
} }
elseif ($type == 'datetime') elseif ($type == 'datetime')
{ {
//$showsize=19; //$showsize=19;
$showsize = 'minwidth200imp'; $showsize = 'minwidth200imp';
} }
elseif (in_array($type,array('int','double'))) elseif (in_array($type,array('int','double','price')))
{ {
//$showsize=10; //$showsize=10;
$showsize = 'minwidth100imp'; $showsize = 'maxwidth75';
} }
elseif ($type == 'url') elseif ($type == 'url')
{ {
$showsize='minwidth400imp'; $showsize='minwidth400';
} }
elseif ($type == 'boolean') elseif ($type == 'boolean')
{ {
@ -863,16 +863,16 @@ class ExtraFields
{ {
if (round($size) < 12) if (round($size) < 12)
{ {
$showsize = 'minwidth100imp'; $showsize = 'minwidth100';
} }
else if (round($size) <= 48) else if (round($size) <= 48)
{ {
$showsize = 'minwidth200imp'; $showsize = 'minwidth200';
} }
else else
{ {
//$showsize=48; //$showsize=48;
$showsize = 'minwidth400imp'; $showsize = 'minwidth400';
} }
} }
} }

View File

@ -1399,7 +1399,7 @@ class Form
* @param int $enableonly Array list of users id to be enabled. All other must be disabled * @param int $enableonly Array list of users id to be enabled. All other must be disabled
* @param int $force_entity 0 or Id of environment to force * @param int $force_entity 0 or Id of environment to force
* @return void * @return void
* @deprecated * @deprecated Use select_dolusers instead
* @see select_dolusers() * @see select_dolusers()
*/ */
function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude=null,$disabled=0,$include='',$enableonly='',$force_entity=0) function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude=null,$disabled=0,$include='',$enableonly='',$force_entity=0)
@ -1416,7 +1416,7 @@ class Form
* @param array $exclude Array list of users id to exclude * @param array $exclude Array list of users id to exclude
* @param int $disabled If select list must be disabled * @param int $disabled If select list must be disabled
* @param array|string $include Array list of users id to include or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me * @param array|string $include Array list of users id to include or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
* @param array $enableonly Array list of users id to be enabled. All other must be disabled * @param array $enableonly Array list of users id to be enabled. If defined, it means that other must be disabled
* @param int $force_entity 0 or Id of environment to force * @param int $force_entity 0 or Id of environment to force
* @param int $maxlength Maximum length of string into list (0=no limit) * @param int $maxlength Maximum length of string into list (0=no limit)
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
@ -1717,7 +1717,7 @@ class Form
unset($producttmpselect); unset($producttmpselect);
} }
// mode=1 means customers products // mode=1 means customers products
$urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&warehousestatus='.$warehouseStatus; $urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
//Price by customer //Price by customer
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
$urloption.='&socid='.$socid; $urloption.='&socid='.$socid;
@ -1919,7 +1919,7 @@ class Form
$sql.= ' WHERE p.entity IN ('.getEntity('product').')'; $sql.= ' WHERE p.entity IN ('.getEntity('product').')';
if (count($warehouseStatusArray)) if (count($warehouseStatusArray))
{ {
$sql.= ' AND (p.fk_product_type = 1 OR e.statut IN ('.implode(',',$warehouseStatusArray).'))'; $sql.= ' AND (p.fk_product_type = 1 OR e.statut IN ('.$db->escape(implode(',',$warehouseStatusArray)).'))';
} }
if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {

View File

@ -313,7 +313,7 @@ class FormMail extends Form
} }
$result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs); $result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs);
if ($result<0) if ($result < 0)
{ {
setEventMessages($this->error, $this->errors, 'errors'); setEventMessages($this->error, $this->errors, 'errors');
} }
@ -321,6 +321,9 @@ class FormMail extends Form
foreach($this->lines_model as $line) foreach($this->lines_model as $line)
{ {
$modelmail_array[$line->id]=$line->label; $modelmail_array[$line->id]=$line->label;
if ($line->lang) $modelmail_array[$line->id].=' ('.$line->lang.')';
if ($line->private) $modelmail_array[$line->id].=' - '.$langs->trans("Private");
//if ($line->fk_user != $user->id) $modelmail_array[$line->id].=' - '.$langs->trans("By").' ';
} }
// Zone to select its email template // Zone to select its email template
@ -337,11 +340,11 @@ class FormMail extends Form
elseif (! empty($this->param['models']) && in_array($this->param['models'], array( elseif (! empty($this->param['models']) && in_array($this->param['models'], array(
'propal_send','order_send','facture_send', 'propal_send','order_send','facture_send',
'shipping_send','fichinter_send','supplier_proposal_send','order_supplier_send', 'shipping_send','fichinter_send','supplier_proposal_send','order_supplier_send',
'invoice_supplier_send','thirdparty' 'invoice_supplier_send','thirdparty','all'
))) )))
{ {
$out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n"; $out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
$out.= $langs->trans('SelectMailModel').': <select name="modelmailselected" disabled="disabled"><option value="none">'.$langs->trans("NoTemplateDefined").'</option></select>'; // Do not put disabled on option, it is already on select and it makes chrome crazy. $out.= $langs->trans('SelectMailModel').': <select name="modelmailselected" disabled="disabled"><option value="none">'.$langs->trans("NoTemplateDefined").'</option></select>'; // Do not put 'disabled' on 'option' tag, it is already on 'select' and it makes chrome crazy.
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1); if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1);
$out.= ' &nbsp; '; $out.= ' &nbsp; ';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" disabled="disabled" id="modelselected">'; $out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" disabled="disabled" id="modelselected">';
@ -373,7 +376,7 @@ class FormMail extends Form
{ {
$out.= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />'; $out.= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />';
$out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />'; $out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
$out.= '<tr><td width="180">'.$langs->trans("MailFrom").'</td><td>'; $out.= '<tr><td width="180" class="fieldrequired">'.$langs->trans("MailFrom").'</td><td>';
if (! ($this->fromtype === 'user' && $this->fromid > 0) if (! ($this->fromtype === 'user' && $this->fromid > 0)
&& ! ($this->fromtype === 'company') && ! ($this->fromtype === 'company')
@ -939,7 +942,7 @@ class FormMail extends Form
} }
/** /**
* Find if template exists * Find if template exists and are available for current user, then set them into $this->lines_module.
* Search into table c_email_templates * Search into table c_email_templates
* *
* @param string $type_template Get message for key module * @param string $type_template Get message for key module
@ -952,13 +955,13 @@ class FormMail extends Form
{ {
$ret=array(); $ret=array();
$sql = "SELECT rowid, label, topic, content, content_lines, lang, position"; $sql = "SELECT rowid, label, topic, content, content_lines, lang, fk_user, private, position";
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; $sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql.= " WHERE type_template='".$this->db->escape($type_template)."'"; $sql.= " WHERE type_template IN ('".$this->db->escape($type_template)."', 'all')";
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")"; $sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; $sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // See all public templates or templates I own.
if ($active >= 0) $sql.=" AND active = ".$active; if ($active >= 0) $sql.=" AND active = ".$active;
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; //if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; // Return all languages
$sql.= $this->db->order("position,lang,label","ASC"); $sql.= $this->db->order("position,lang,label","ASC");
//print $sql; //print $sql;
@ -972,10 +975,13 @@ class FormMail extends Form
$line = new ModelMail(); $line = new ModelMail();
$line->id=$obj->rowid; $line->id=$obj->rowid;
$line->label=$obj->label; $line->label=$obj->label;
$line->lang=$obj->lang;
$line->fk_user=$obj->fk_user;
$line->private=$obj->private;
$line->position=$obj->position;
$line->topic=$obj->topic; $line->topic=$obj->topic;
$line->content=$obj->content; $line->content=$obj->content;
$line->content_lines=$obj->content_lines; $line->content_lines=$obj->content_lines;
$line->lang=$obj->lang;
$this->lines_model[]=$line; $this->lines_model[]=$line;
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -115,6 +115,8 @@ function getServerTimeZoneInt($refgmtdate='now')
*/ */
function dol_time_plus_duree($time, $duration_value, $duration_unit) function dol_time_plus_duree($time, $duration_value, $duration_unit)
{ {
global $conf;
if ($duration_value == 0) return $time; if ($duration_value == 0) return $time;
if ($duration_unit == 'h') return $time + (3600*$duration_value); if ($duration_unit == 'h') return $time + (3600*$duration_value);
if ($duration_unit == 'w') return $time + (3600*24*7*$duration_value); if ($duration_unit == 'w') return $time + (3600*24*7*$duration_value);
@ -128,7 +130,7 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit)
if ($duration_unit == 'y') { $deltastring.="Y"; } if ($duration_unit == 'y') { $deltastring.="Y"; }
$date = new DateTime(); $date = new DateTime();
$date->setTimezone(new DateTimeZone('UTC')); if (! empty($conf->global->MAIN_DATE_IN_MEMORY_ARE_GMT)) $date->setTimezone(new DateTimeZone('UTC'));
$date->setTimestamp($time); $date->setTimestamp($time);
$interval = new DateInterval($deltastring); $interval = new DateInterval($deltastring);

View File

@ -277,12 +277,14 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
if (empty($method) || $method == 3 || $method == 4) if (empty($method) || $method == 3 || $method == 4)
{ {
$relativepathstring = $_SERVER["PHP_SELF"]; $relativepathstring = $_SERVER["PHP_SELF"];
// Clean $relativepathstring // Clean $relativepathstring
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
$relativepathstring = preg_replace('/^\//', '', $relativepathstring); $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
//var_dump($relativepathstring); //var_dump($relativepathstring);
//var_dump($user->default_values);
// Code for search criteria persistence. // Code for search criteria persistence.
// Retrieve values if restore_lastsearch_values is set and there is saved values // Retrieve values if restore_lastsearch_values is set and there is saved values
@ -319,46 +321,85 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
if (! empty($user->default_values)) // $user->default_values defined from menu default values if (! empty($user->default_values)) // $user->default_values defined from menu default values
{ {
//var_dump($user->default_values[$relativepathstring]); //var_dump($user->default_values[$relativepathstring]);
if ($paramname == 'sortfield') if ($paramname == 'sortfield') // Sorted on which fields ?
{ {
if (isset($user->default_values[$relativepathstring]['sortorder'])) // We will use the key of $user->default_values[path][sortorder] $qualified=1;
{ if (isset($user->default_values[$relativepathstring]['sortorder_queries'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and , {
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val) $tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']);
{ $tmpqueryarraywehave=explode('&', $_SERVER['QUERY_STRING']);
if ($out) $out.=', '; foreach($tmpqueryarraytohave as $tmpquerytohave)
$out.=dol_string_nospecial($key, '', $forbidden_chars_to_replace); {
} if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
} }
}
if ($qualified)
{
if (isset($user->default_values[$relativepathstring]['sortorder'])) // We will use the key of $user->default_values[path][sortorder]
{
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
{
if ($out) $out.=', ';
$out.=dol_string_nospecial($key, '', $forbidden_chars_to_replace);
}
}
}
} }
elseif ($paramname == 'sortorder') elseif ($paramname == 'sortorder') // ASC or DESC ?
{ {
if (isset($user->default_values[$relativepathstring]['sortorder'])) // We will use the val of $user->default_values[path][sortorder] $qualified=1;
{ if (isset($user->default_values[$relativepathstring]['sortorder_queries']))
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and , {
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val) $tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']);
{ $tmpqueryarraywehave=explode('&', $_SERVER['QUERY_STRING']);
if ($out) $out.=', '; foreach($tmpqueryarraytohave as $tmpquerytohave)
$out.=dol_string_nospecial($val, '', $forbidden_chars_to_replace); {
} if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
} }
}
if ($qualified)
{
if (isset($user->default_values[$relativepathstring]['sortorder'])) // We will use the val of $user->default_values[path][sortorder]
{
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
{
if ($out) $out.=', ';
$out.=dol_string_nospecial($val, '', $forbidden_chars_to_replace);
}
}
}
} }
elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname])) elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname]))
{ {
if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) $qualified=1;
if (isset($user->default_values[$relativepathstring]['filters_queries']))
{ {
// We made a search from quick search menu, do we still use default filter ? $tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['filters_queries']);
if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH)) $tmpqueryarraywehave=explode('&', $_SERVER['QUERY_STRING']);
foreach($tmpqueryarraytohave as $tmpquerytohave)
{ {
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and , if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace);
} }
} }
else if ($qualified)
{ {
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and , if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all']))
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace); {
} // We made a search from quick search menu, do we still use default filter ?
if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH))
{
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace);
}
}
else
{
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace);
}
}
} }
} }
} }
@ -1347,6 +1388,11 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($object->statut==0) $morehtmlstatus.=$object->getLibStatut(2); if ($object->statut==0) $morehtmlstatus.=$object->getLibStatut(2);
else $morehtmlstatus.=$object->getLibStatut(4); else $morehtmlstatus.=$object->getLibStatut(4);
} }
elseif ($object->element == 'facturerec')
{
if ($object->frequency==0) $morehtmlstatus.=$object->getLibStatut(2);
else $morehtmlstatus.=$object->getLibStatut(4);
}
else { // Generic case else { // Generic case
$tmptxt=$object->getLibStatut(6); $tmptxt=$object->getLibStatut(6);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5); if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5);
@ -6207,7 +6253,7 @@ function dol_getmypid()
* like "keyword1 keyword2" = We want record field like keyword1 AND field like keyword2 * like "keyword1 keyword2" = We want record field like keyword1 AND field like keyword2
* or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2 * or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2
* If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000" * If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000"
* If param $mode is 2, can contains a list of id separated by comma like "1,3,4" * If param $mode is 2, can contains a list of int id separated by comma like "1,3,4"
* @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4') * @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4')
* @param integer $nofirstand 1=Do not output the first 'AND' * @param integer $nofirstand 1=Do not output the first 'AND'
* @return string $res The statement to append to the SQL query * @return string $res The statement to append to the SQL query

View File

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* *
@ -95,9 +94,12 @@ function payment_supplier_prepare_head(Paiement $object) {
* *
* @param Societe $fromcompany Third party * @param Societe $fromcompany Third party
* @param Translate $langs Output language * @param Translate $langs Output language
* @param int $addformmessage Add the payment form message
* @param string $suffix Suffix to use on constants
* @param Object $object Object related to payment
* @return void * @return void
*/ */
function htmlPrintOnlinePaymentFooter($fromcompany,$langs) function htmlPrintOnlinePaymentFooter($fromcompany,$langs,$addformmessage=0,$suffix='',$object=null)
{ {
global $conf; global $conf;
@ -149,10 +151,32 @@ function htmlPrintOnlinePaymentFooter($fromcompany,$langs)
$line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra; $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
} }
print '<br><br><hr>'."\n"; print '<br>';
print '<div class="center"><font style="font-size: 10px;">'."\n";
print '<div class="center">'."\n";
if ($addformmessage)
{
print '<!-- object = '.$object->element.' -->';
print '<br>';
$parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
else if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
// Add other message if VAT exists
if (! empty($object->total_vat) || ! empty($object->total_tva))
{
$parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
else if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
}
}
print '<font style="font-size: 10px;"><br><hr>'."\n";
print $fromcompany->name.'<br>'; print $fromcompany->name.'<br>';
print $line1.'<br>'; print $line1;
if (strlen($line1+$line2) > 50) print '<br>';
else print ' - ';
print $line2; print $line2;
print '</font></div>'."\n"; print '</font></div>'."\n";
} }

View File

@ -16,7 +16,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&amp;leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 2, 51, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&amp;leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 2, 51, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&amp;leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&amp;leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import|opensurvey|resource', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled || $conf->resource->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&amp;leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read || $user->rights->resource->read', '', 2, 90, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&amp;leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&amp;leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&amp;leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&amp;leftmenu=', 'HRM', -1, 'holiday', '$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&amp;leftmenu=', 'HRM', -1, 'holiday', '$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__);
@ -209,7 +209,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/reglement.php?leftmenu=tax_vat', 'List', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/reglement.php?leftmenu=tax_vat', 'List', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2350__+MAX_llx_menu__, 'billing', 'tax_various', 2200__+MAX_llx_menu__, '/bank/various_payment/index.php?leftmenu=tax_various&amp;mainmenu=billing', 'MenuVariousPayment', 1, 'various_payment', '$user->rights->banque->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2350__+MAX_llx_menu__, 'billing', 'tax_various', 2200__+MAX_llx_menu__, '/bank/various_payment/index.php?leftmenu=tax_various&amp;mainmenu=billing', 'MenuVariousPayment', 1, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2351__+MAX_llx_menu__, 'billing', '', 2350__+MAX_llx_menu__, '/bank/various_payment/card.php?leftmenu=tax_various&amp;action=create', 'MenuNewVariousPayment', 2, 'various_payment', '$user->rights->banque->modifier', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2351__+MAX_llx_menu__, 'billing', '', 2350__+MAX_llx_menu__, '/bank/various_payment/card.php?leftmenu=tax_various&amp;action=create', 'MenuNewVariousPayment', 2, 'various_payment', '$user->rights->banque->modifier', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2352__+MAX_llx_menu__, 'billing', '', 2350__+MAX_llx_menu__, '/bank/various_payment/index.php?leftmenu=tax_various', 'List', 2, 'various_payment', '$user->rights->banque->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2352__+MAX_llx_menu__, 'billing', '', 2350__+MAX_llx_menu__, '/bank/various_payment/index.php?leftmenu=tax_various', 'List', 2, 'various_payment', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
-- Accounting Expert -- Accounting Expert
@ -303,9 +303,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?action=create&amp;type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?action=create&amp;type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
-- Tools -- Tools
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&amp;action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3910__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3902__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/list.php?leftmenu=mailing', 'List', 1, 'mails', '$user->rights->mailing->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3911__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&amp;action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3912__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/list.php?leftmenu=mailing', 'List', 1, 'mails', '$user->rights->mailing->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->export->enabled', __HANDLER__, 'left', 4100__+MAX_llx_menu__, 'tools', 'export', 8__+MAX_llx_menu__, '/exports/index.php?leftmenu=export', 'FormatedExport', 0, 'exports', '$user->rights->export->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->export->enabled', __HANDLER__, 'left', 4100__+MAX_llx_menu__, 'tools', 'export', 8__+MAX_llx_menu__, '/exports/index.php?leftmenu=export', 'FormatedExport', 0, 'exports', '$user->rights->export->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->export->enabled', __HANDLER__, 'left', 4101__+MAX_llx_menu__, 'tools', '', 4100__+MAX_llx_menu__, '/exports/export.php?leftmenu=export', 'NewExport', 1, 'exports', '$user->rights->export->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->export->enabled', __HANDLER__, 'left', 4101__+MAX_llx_menu__, 'tools', '', 4100__+MAX_llx_menu__, '/exports/export.php?leftmenu=export', 'NewExport', 1, 'exports', '$user->rights->export->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->import->enabled', __HANDLER__, 'left', 4130__+MAX_llx_menu__, 'tools', 'import', 8__+MAX_llx_menu__, '/imports/index.php?leftmenu=import', 'FormatedImport', 0, 'exports', '$user->rights->import->run', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->import->enabled', __HANDLER__, 'left', 4130__+MAX_llx_menu__, 'tools', 'import', 8__+MAX_llx_menu__, '/imports/index.php?leftmenu=import', 'FormatedImport', 0, 'exports', '$user->rights->import->run', '', 2, 2, __ENTITY__);

View File

@ -241,9 +241,10 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
// Tools // Tools
$tmpentry=array('enabled'=>(! empty($conf->global->MAIN_MENU_ENABLE_MODULETOOLS) || ! empty($conf->barcode->enabled) || ! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled) || ! empty($conf->opensurvey->enabled) || ! empty($conf->resource->enabled)), $tmpentry=array(
'perms'=>(! empty($conf->global->MAIN_MENU_ENABLE_MODULETOOLS) || ! empty($conf->barcode->enabled) || ! empty($user->rights->mailing->lire) || ! empty($user->rights->export->lire) || ! empty($user->rights->import->run) || ! empty($user->rights->opensurvey->read) || ! empty($user->rights->resource->read)), 'enabled'=>1,
'module'=>'mailing|export|import|opensurvey|resource'); 'perms'=>1,
'module'=>'');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal); $showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode) if ($showmode)
{ {
@ -943,6 +944,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Various payment // Various payment
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
$langs->load("banks");
$newmenu->add("/compta/bank/various_payment/index.php?leftmenu=tax_various&amp;mainmenu=billing",$langs->trans("MenuVariousPayment"),1,$user->rights->banque->lire, '', $mainmenu, 'tax_various'); $newmenu->add("/compta/bank/various_payment/index.php?leftmenu=tax_various&amp;mainmenu=billing",$langs->trans("MenuVariousPayment"),1,$user->rights->banque->lire, '', $mainmenu, 'tax_various');
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i',$leftmenu)) $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create",$langs->trans("MenuNewVariousPayment"), 2, $user->rights->banque->modifier); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i',$leftmenu)) $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create",$langs->trans("MenuNewVariousPayment"), 2, $user->rights->banque->modifier);
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i',$leftmenu)) $newmenu->add("/compta/bank/various_payment/index.php?leftmenu=tax_various",$langs->trans("List"),2,$user->rights->banque->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i',$leftmenu)) $newmenu->add("/compta/bank/various_payment/index.php?leftmenu=tax_various",$langs->trans("List"),2,$user->rights->banque->lire);
@ -1421,10 +1423,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
*/ */
if ($mainmenu == 'tools') if ($mainmenu == 'tools')
{ {
$langs->load("mails");
$newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates');
if (! empty($conf->mailing->enabled)) if (! empty($conf->mailing->enabled))
{ {
$langs->load("mails");
$newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing'); $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing');
$newmenu->add("/comm/mailing/card.php?leftmenu=mailing&amp;action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer); $newmenu->add("/comm/mailing/card.php?leftmenu=mailing&amp;action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer);
$newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire); $newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire);

View File

@ -277,7 +277,15 @@ class pdf_soleil extends ModelePDFFicheinter
$curX = $this->posxdesc-1; $curX = $this->posxdesc-1;
// Description of product line // Description of product line
$txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); if (empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR))
{
$txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true);
}
else
{
$txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'day',false,$outputlangs,true);
}
if ($objectligne->duration > 0) if ($objectligne->duration > 0)
{ {
$txt.=" - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration); $txt.=" - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration);

View File

@ -37,7 +37,9 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
$usemargins=1; $usemargins=1;
} }
global $dateSelector, $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax; if (! isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine)
global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax;
if (! isset($dateSelector)) $dateSelector=1; // For backward compatibility if (! isset($dateSelector)) $dateSelector=1; // For backward compatibility
elseif (empty($dateSelector)) $dateSelector=0; elseif (empty($dateSelector)) $dateSelector=0;
if (empty($forceall)) $forceall=0; if (empty($forceall)) $forceall=0;

View File

@ -211,8 +211,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -92,11 +92,11 @@ $sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p
$sql.= " ON p.rowid = d.fk_projet WHERE 1 = 1"; $sql.= " ON p.rowid = d.fk_projet WHERE 1 = 1";
if ($statut != '' && $statut != '-1') if ($statut != '' && $statut != '-1')
{ {
$sql .= " AND d.fk_statut IN (".$statut.")"; $sql .= " AND d.fk_statut IN (".$db->escape($statut).")";
} }
if (trim($search_ref) != '') if (trim($search_ref) != '')
{ {
$sql.= natural_search('d.ref',$search_ref); $sql.= natural_search('d.ref', $search_ref);
} }
if (trim($search_all) != '') if (trim($search_all) != '')
{ {

View File

@ -231,8 +231,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -253,8 +253,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -74,7 +74,7 @@ print load_fiche_titre($title, $mesg);
dol_mkdir($dir); dol_mkdir($dir);
$stats = new ExpenseReportStats($db, $socid, $userid); $stats = new ExpenseReportStats($db, $socid, $userid);
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND e.fk_statut IN ('.$object_status.')'; if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND e.fk_statut IN ('.$db->escape($object_status).')';
// Build graphic number of object // Build graphic number of object
// $data = array(array('Lib',val1,val2,val3),...) // $data = array(array('Lib',val1,val2,val3),...)

View File

@ -1379,7 +1379,7 @@ else if ($id > 0 || ! empty($ref))
print dol_htmlentitiesbr($objp->description); print dol_htmlentitiesbr($objp->description);
// Date // Date
print '<td align="center" width="150">'.dol_print_date($db->jdate($objp->date_intervention),'dayhour').'</td>'; print '<td align="center" width="150">'.(empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)?dol_print_date($db->jdate($objp->date_intervention),'dayhour'):dol_print_date($db->jdate($objp->date_intervention),'day')).'</td>';
// Duration // Duration
print '<td align="right" width="150">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?convertSecondToTime($objp->duree):'').'</td>'; print '<td align="right" width="150">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?convertSecondToTime($objp->duree):'').'</td>';
@ -1452,7 +1452,8 @@ else if ($id > 0 || ! empty($ref))
// Date d'intervention // Date d'intervention
print '<td align="center" class="nowrap">'; print '<td align="center" class="nowrap">';
$form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) $form->select_date($db->jdate($objp->date_intervention),'di',0,0,0,"date_intervention");
else $form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention");
print '</td>'; print '</td>';
// Duration // Duration
@ -1519,7 +1520,8 @@ else if ($id > 0 || ! empty($ref))
$timearray=dol_getdate($now); $timearray=dol_getdate($now);
if (! GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); if (! GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']);
else $timewithnohour=dol_mktime(GETPOST('dihour','int'),GETPOST('dimin','int'), 0,GETPOST('dimonth','int'),GETPOST('diday','int'),GETPOST('diyear','int')); else $timewithnohour=dol_mktime(GETPOST('dihour','int'),GETPOST('dimin','int'), 0,GETPOST('dimonth','int'),GETPOST('diday','int'),GETPOST('diyear','int'));
$form->select_date($timewithnohour,'di',1,1,0,"addinter"); if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) $form->select_date($timewithnohour,'di',0,0,0,"addinter");
else $form->select_date($timewithnohour,'di',1,1,0,"addinter");
print '</td>'; print '</td>';
// Duration // Duration

View File

@ -223,8 +223,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -75,7 +75,7 @@ print load_fiche_titre($title,'','title_commercial.png');
dol_mkdir($dir); dol_mkdir($dir);
$stats = new FichinterStats($db, $socid, $mode, ($userid>0?$userid:0)); $stats = new FichinterStats($db, $socid, $mode, ($userid>0?$userid:0));
if ($object_status != '' && $object_status > -1) $stats->where .= ' AND c.fk_statut IN ('.$object_status.')'; if ($object_status != '' && $object_status > -1) $stats->where .= ' AND c.fk_statut IN ('.$db->escape($object_status).')';
// Build graphic number of object // Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);

View File

@ -535,9 +535,9 @@ if ($search_request_author) $sql.=natural_search(array('u.lastname','u.firstname
if ($billed != '' && $billed >= 0) $sql .= " AND cf.billed = ".$billed; if ($billed != '' && $billed >= 0) $sql .= " AND cf.billed = ".$billed;
//Required triple check because statut=0 means draft filter //Required triple check because statut=0 means draft filter
if (GETPOST('statut', 'alpha') !== '') if (GETPOST('statut', 'intcomma') !== '')
{ {
$sql .= " AND cf.fk_statut IN (".$db->escape(GETPOST('statut', 'alpha')).")"; $sql .= " AND cf.fk_statut IN (".$db->escape($db->escape(GETPOST('statut', 'intcomma'))).")";
} }
if ($search_status != '' && $search_status >= 0) if ($search_status != '' && $search_status >= 0)
{ {
@ -589,8 +589,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -373,8 +373,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -580,7 +580,7 @@ class TCPDI extends FPDF_TPL {
* close all files opened by parsers * close all files opened by parsers
*/ */
function _closeParsers() { function _closeParsers() {
if ($this->state > 2 && count($this->parsers) > 0) { if ($this->state > 2 && is_array($this->parsers) && count($this->parsers) > 0) {
$this->cleanUp(); $this->cleanUp();
return true; return true;
} }

View File

@ -155,6 +155,12 @@ ALTER TABLE llx_projet ADD COLUMN fk_user_modif integer;
ALTER TABLE llx_projet_task_time ADD COLUMN datec date; ALTER TABLE llx_projet_task_time ADD COLUMN datec date;
ALTER TABLE llx_projet_task_time ADD COLUMN tms timestamp; ALTER TABLE llx_projet_task_time ADD COLUMN tms timestamp;
ALTER TABLE llx_product_price ADD COLUMN fk_multicurrency integer;
ALTER TABLE llx_product_price ADD COLUMN multicurrency_code varchar(255);
ALTER TABLE llx_product_price ADD COLUMN multicurrency_tx double(24,8) DEFAULT 1;
ALTER TABLE llx_product_price ADD COLUMN multicurrency_price double(24,8) DEFAULT NULL;
ALTER TABLE llx_product_price ADD COLUMN multicurrency_price_ttc double(24,8) DEFAULT NULL;
ALTER TABLE llx_product_price_by_qty ADD COLUMN fk_user_creat integer; ALTER TABLE llx_product_price_by_qty ADD COLUMN fk_user_creat integer;
ALTER TABLE llx_product_price_by_qty ADD COLUMN fk_user_modif integer; ALTER TABLE llx_product_price_by_qty ADD COLUMN fk_user_modif integer;
ALTER TABLE llx_product_price_by_qty DROP COLUMN date_price; ALTER TABLE llx_product_price_by_qty DROP COLUMN date_price;
@ -534,6 +540,9 @@ ALTER TABLE llx_website_page ADD UNIQUE INDEX uk_website_page_url (fk_website,pa
ALTER TABLE llx_website_page ADD CONSTRAINT fk_website_page_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid); ALTER TABLE llx_website_page ADD CONSTRAINT fk_website_page_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid);
ALTER TABLE llx_website_page ADD COLUMN fk_user_create integer;
ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer;
UPDATE llx_extrafields set elementtype='categorie' where elementtype='categories'; UPDATE llx_extrafields set elementtype='categorie' where elementtype='categories';

View File

@ -36,6 +36,14 @@ ALTER TABLE llx_website_page ADD COLUMN fk_user_create integer;
ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer; ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer;
-- For 7.0
ALTER TABLE llx_facture_rec ADD COLUMN suspended integer DEFAULT 0;
ALTER TABLE llx_facture_rec MODIFY COLUMN titre VARCHAR(100);
UPDATE llx_c_email_templates SET position = 0 WHERE position IS NULL;
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VENTES', 'Income of products/services', 'Exemple: 7xxxxx', 0, 0, '', '10', 1, 1); INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VENTES', 'Income of products/services', 'Exemple: 7xxxxx', 0, 0, '', '10', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'DEPENSES', 'Expenses of products/services', 'Exemple: 6xxxxx', 0, 0, '', '20', 1, 1); INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'DEPENSES', 'Expenses of products/services', 'Exemple: 6xxxxx', 0, 0, '', '20', 1, 1);
@ -55,6 +63,7 @@ ALTER TABLE llx_mailing MODIFY COLUMN langs varchar(64);
ALTER TABLE llx_facture_fourn ADD COLUMN date_pointoftax date DEFAULT NULL; ALTER TABLE llx_facture_fourn ADD COLUMN date_pointoftax date DEFAULT NULL;
ALTER TABLE llx_facture_fourn ADD COLUMN date_valid date; ALTER TABLE llx_facture_fourn ADD COLUMN date_valid date;
ALTER TABLE llx_bookmark DROP COLUM fk_soc;
ALTER TABLE llx_website MODIFY COLUMN ref varchar(128); ALTER TABLE llx_website MODIFY COLUMN ref varchar(128);

View File

@ -66,6 +66,7 @@
UPDATE llx_user set api_key = null where api_key = ''; UPDATE llx_user set api_key = null where api_key = '';
UPDATE llx_c_email_templates SET position = 0 WHERE position IS NULL;
-- delete foreign key that should never exists -- delete foreign key that should never exists
ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_currency; ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_currency;

View File

@ -19,7 +19,6 @@
create table llx_bookmark create table llx_bookmark
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_soc integer,
fk_user integer NOT NULL, fk_user integer NOT NULL,
dateb datetime, dateb datetime,
url varchar(255) NOT NULL, url varchar(255) NOT NULL,

View File

@ -25,7 +25,7 @@ create table llx_c_email_templates
type_template varchar(32), -- template for which type of email (send invoice by email, send order, ...) type_template varchar(32), -- template for which type of email (send invoice by email, send order, ...)
lang varchar(6), lang varchar(6),
private smallint DEFAULT 0 NOT NULL, -- Template public or private private smallint DEFAULT 0 NOT NULL, -- Template public or private
fk_user integer, -- Id utilisateur si modele prive, sinon null fk_user integer, -- Id user owner if template is private, or null
datec datetime, datec datetime,
tms timestamp, tms timestamp,
label varchar(255), -- Label of predefined email label varchar(255), -- Label of predefined email

View File

@ -22,12 +22,14 @@
create table llx_facture_rec create table llx_facture_rec
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
titre varchar(50) NOT NULL, titre varchar(100) NOT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
fk_soc integer NOT NULL, fk_soc integer NOT NULL,
datec datetime, -- date de creation datec datetime, -- date de creation
tms timestamp, -- date creation/modification tms timestamp, -- date creation/modification
suspended integer DEFAULT 0, -- 1=suspended
amount double(24,8) DEFAULT 0 NOT NULL, amount double(24,8) DEFAULT 0 NOT NULL,
remise real DEFAULT 0, remise real DEFAULT 0,
remise_percent real DEFAULT 0, remise_percent real DEFAULT 0,

View File

@ -409,7 +409,7 @@ ComputedFormulaDesc=You can enter here a formula using other properties of objec
ExtrafieldParamHelpselect=List of values must be lines with format key,value (where key can't be '0')<br><br> for example : <br>1,value1<br>2,value2<br>code3,value3<br>...<br><br>In order to have the list depending on another complementary attribute list :<br>1,value1|options_<i>parent_list_code</i>:parent_key<br>2,value2|options_<i>parent_list_code</i>:parent_key <br><br>In order to have the list depending on another list :<br>1,value1|<i>parent_list_code</i>:parent_key<br>2,value2|<i>parent_list_code</i>:parent_key ExtrafieldParamHelpselect=List of values must be lines with format key,value (where key can't be '0')<br><br> for example : <br>1,value1<br>2,value2<br>code3,value3<br>...<br><br>In order to have the list depending on another complementary attribute list :<br>1,value1|options_<i>parent_list_code</i>:parent_key<br>2,value2|options_<i>parent_list_code</i>:parent_key <br><br>In order to have the list depending on another list :<br>1,value1|<i>parent_list_code</i>:parent_key<br>2,value2|<i>parent_list_code</i>:parent_key
ExtrafieldParamHelpcheckbox=List of values must be lines with format key,value (where key can't be '0')<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>... ExtrafieldParamHelpcheckbox=List of values must be lines with format key,value (where key can't be '0')<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpradio=List of values must be lines with format key,value (where key can't be '0')<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>... ExtrafieldParamHelpradio=List of values must be lines with format key,value (where key can't be '0')<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpsellist=List of values comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list:<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter ExtrafieldParamHelpsellist=List of values comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>- idfilter is necessarly a primary int key<br>- filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list:<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter
ExtrafieldParamHelpchkbxlst=List of values comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list :<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter ExtrafieldParamHelpchkbxlst=List of values comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list :<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter
ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath<br>Syntax : ObjectName:Classpath<br>Example : Societe:societe/class/societe.class.php ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath<br>Syntax : ObjectName:Classpath<br>Example : Societe:societe/class/societe.class.php
LibraryToBuildPDF=Library used for PDF generation LibraryToBuildPDF=Library used for PDF generation
@ -1674,6 +1674,8 @@ OpportunityPercent=When you create an opportunity, you will defined an estimated
TemplateForElement=This template record is dedicated to which element TemplateForElement=This template record is dedicated to which element
TypeOfTemplate=Type of template TypeOfTemplate=Type of template
TemplateIsVisibleByOwnerOnly=Template is visible by owner only TemplateIsVisibleByOwnerOnly=Template is visible by owner only
VisibleEverywhere=Visible everywhere
VisibleNowhere=Visible nowhere
FixTZ=TimeZone fix FixTZ=TimeZone fix
FillFixTZOnlyIfRequired=Example: +2 (fill only if problem experienced) FillFixTZOnlyIfRequired=Example: +2 (fill only if problem experienced)
ExpectedChecksum=Expected Checksum ExpectedChecksum=Expected Checksum

View File

@ -155,9 +155,13 @@ FoundXQualifiedRecurringInvoiceTemplate=Found %s recurring template invoice(s) q
NotARecurringInvoiceTemplate=Not a recurring template invoice NotARecurringInvoiceTemplate=Not a recurring template invoice
NewBill=New invoice NewBill=New invoice
LastBills=Latest %s invoices LastBills=Latest %s invoices
LatestTemplateInvoices=Latest %s template invoices
LatestCustomerTemplateInvoices=Latest %s customer template invoices
LatestSupplierTemplateInvoices=Latest %s supplier template invoices
LastCustomersBills=Latest %s customer invoices LastCustomersBills=Latest %s customer invoices
LastSuppliersBills=Latest %s supplier invoices LastSuppliersBills=Latest %s supplier invoices
AllBills=All invoices AllBills=All invoices
AllCustomerTemplateInvoices=All template invoices
OtherBills=Other invoices OtherBills=Other invoices
DraftBills=Draft invoices DraftBills=Draft invoices
CustomersDraftInvoices=Customer draft invoices CustomersDraftInvoices=Customer draft invoices

View File

@ -75,6 +75,7 @@ ErrorCantSaveADoneUserWithZeroPercentage=Can't save an action with "statut not s
ErrorRefAlreadyExists=Ref used for creation already exists. ErrorRefAlreadyExists=Ref used for creation already exists.
ErrorPleaseTypeBankTransactionReportName=Please type bank statement name where entry is reported (Format YYYYMM or YYYYMMDD) ErrorPleaseTypeBankTransactionReportName=Please type bank statement name where entry is reported (Format YYYYMM or YYYYMMDD)
ErrorRecordHasChildren=Failed to delete record since it has some childs. ErrorRecordHasChildren=Failed to delete record since it has some childs.
ErrorRecordHasAtLeastOneChildOfType=Object has at least one child of type %s
ErrorRecordIsUsedCantDelete=Can't delete record. It is already used or included into other object. ErrorRecordIsUsedCantDelete=Can't delete record. It is already used or included into other object.
ErrorModuleRequireJavascript=Javascript must not be disabled to have this feature working. To enable/disable Javascript, go to menu Home->Setup->Display. ErrorModuleRequireJavascript=Javascript must not be disabled to have this feature working. To enable/disable Javascript, go to menu Home->Setup->Display.
ErrorPasswordsMustMatch=Both typed passwords must match each other ErrorPasswordsMustMatch=Both typed passwords must match each other

View File

@ -48,6 +48,8 @@ TypeContact_fichinter_external_CUSTOMER=Following-up customer contact
PrintProductsOnFichinter=Print also lines of type "product" (not only services) on intervention card PrintProductsOnFichinter=Print also lines of type "product" (not only services) on intervention card
PrintProductsOnFichinterDetails=interventions generated from orders PrintProductsOnFichinterDetails=interventions generated from orders
UseServicesDurationOnFichinter=Use services duration for interventions generated from orders UseServicesDurationOnFichinter=Use services duration for interventions generated from orders
UseDurationOnFichinter=Hides the duration field for intervention records
UseDateWithoutHourOnFichinter=Hides hours and minutes off the date field for intervention records
InterventionStatistics=Statistics of interventions InterventionStatistics=Statistics of interventions
NbOfinterventions=Nb of intervention cards NbOfinterventions=Nb of intervention cards
NumberOfInterventionsByMonth=Nb of intervention cards by month (date of validation) NumberOfInterventionsByMonth=Nb of intervention cards by month (date of validation)

View File

@ -24,7 +24,7 @@ FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p
FormatDateHourTextShort=%b %d, %Y, %I:%M %p FormatDateHourTextShort=%b %d, %Y, %I:%M %p
FormatDateHourText=%B %d, %Y, %I:%M %p FormatDateHourText=%B %d, %Y, %I:%M %p
DatabaseConnection=Database connection DatabaseConnection=Database connection
NoTemplateDefined=No template defined for this email type NoTemplateDefined=No template available for this email type
AvailableVariables=Available substitution variables AvailableVariables=Available substitution variables
NoTranslation=No translation NoTranslation=No translation
NoRecordFound=No record found NoRecordFound=No record found
@ -805,6 +805,7 @@ ConfirmSetToDraft=Are you sure you want to go back to Draft status ?
ImportId=Import id ImportId=Import id
Websites=Web sites Websites=Web sites
Events=Events Events=Events
EMailTemplates=Emails templates
# Week day # Week day
Monday=Monday Monday=Monday
Tuesday=Tuesday Tuesday=Tuesday
@ -834,7 +835,7 @@ ShortThursday=T
ShortFriday=F ShortFriday=F
ShortSaturday=S ShortSaturday=S
ShortSunday=S ShortSunday=S
SelectMailModel=Select email template SelectMailModel=Select an email template
SetRef=Set ref SetRef=Set ref
Select2ResultFoundUseArrows=Some results found. Use arrows to select. Select2ResultFoundUseArrows=Some results found. Use arrows to select.
Select2NotFound=No result found Select2NotFound=No result found

View File

@ -19,6 +19,9 @@ TextNextMonthOfInvoice=Following month (text) of invoice date
ZipFileGeneratedInto=Zip file generated into <b>%s</b>. ZipFileGeneratedInto=Zip file generated into <b>%s</b>.
DocFileGeneratedInto=Doc file generated into <b>%s</b>. DocFileGeneratedInto=Doc file generated into <b>%s</b>.
JumpToLogin=Disconnected. Go to login page... JumpToLogin=Disconnected. Go to login page...
MessageForm=Message on online payment form
MessageOK=Message on validated payment return page
MessageKO=Message on canceled payment return page
YearOfInvoice=Year of invoice date YearOfInvoice=Year of invoice date
PreviousYearOfInvoice=Previous year of invoice date PreviousYearOfInvoice=Previous year of invoice date

View File

@ -30,8 +30,6 @@ InformationToFindParameters=Help to find your %s account information
PAYBOX_CGI_URL_V2=Url of Paybox CGI module for payment PAYBOX_CGI_URL_V2=Url of Paybox CGI module for payment
VendorName=Name of vendor VendorName=Name of vendor
CSSUrlForPaymentForm=CSS style sheet url for payment form CSSUrlForPaymentForm=CSS style sheet url for payment form
MessageOK=Message on validated payment return page
MessageKO=Message on canceled payment return page
NewPayboxPaymentReceived=New Paybox payment received NewPayboxPaymentReceived=New Paybox payment received
NewPayboxPaymentFailed=New Paybox payment tried but failed NewPayboxPaymentFailed=New Paybox payment tried but failed
PAYBOX_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or failed) PAYBOX_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or failed)

View File

@ -31,8 +31,6 @@ InformationToFindParameters=Help to find your %s account information
STRIPE_CGI_URL_V2=Url of Stripe CGI module for payment STRIPE_CGI_URL_V2=Url of Stripe CGI module for payment
VendorName=Name of vendor VendorName=Name of vendor
CSSUrlForPaymentForm=CSS style sheet url for payment form CSSUrlForPaymentForm=CSS style sheet url for payment form
MessageOK=Message on validated payment return page
MessageKO=Message on canceled payment return page
NewStripePaymentReceived=New Stripe payment received NewStripePaymentReceived=New Stripe payment received
NewStripePaymentFailed=New Stripe payment tried but failed NewStripePaymentFailed=New Stripe payment tried but failed
STRIPE_TEST_SECRET_KEY=Secret test key STRIPE_TEST_SECRET_KEY=Secret test key

View File

@ -48,6 +48,8 @@ TypeContact_fichinter_external_CUSTOMER=Contact client suivi de l'intervention
PrintProductsOnFichinter=Imprimer aussi les lignes de type "produit" (pas seulement de type service) sur les fiches d'intervention PrintProductsOnFichinter=Imprimer aussi les lignes de type "produit" (pas seulement de type service) sur les fiches d'intervention
PrintProductsOnFichinterDetails=interventions générées à partir des commandes PrintProductsOnFichinterDetails=interventions générées à partir des commandes
UseServicesDurationOnFichinter=Utiliser la durée des services dans les interventions créées depuis des commandes UseServicesDurationOnFichinter=Utiliser la durée des services dans les interventions créées depuis des commandes
UseDurationOnFichinter=Masquer le champ durée dans les fiches d'intervention
UseDateWithoutHourOnFichinter=Masquer l'heure de la date d'intervention
InterventionStatistics=Statistiques des interventions InterventionStatistics=Statistiques des interventions
NbOfinterventions=Nb de fiches d'intervention NbOfinterventions=Nb de fiches d'intervention
NumberOfInterventionsByMonth=Nb de fiches d'intervention par mois (date de validation) NumberOfInterventionsByMonth=Nb de fiches d'intervention par mois (date de validation)

View File

@ -227,8 +227,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($crit != '' && (! in_array($typ, array('select')) || $crit != '0')) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }
@ -355,7 +356,7 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields.=$form->showCheckAddButtons('checkforselect', 1); $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";

View File

@ -57,9 +57,11 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++; if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++; if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_OK','alpha'),'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM",GETPOST('ONLINE_PAYMENT_MESSAGE_FORM','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_MESSAGE_OK','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++; if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_KO",GETPOST('ONLINE_PAYMENT_KO','alpha'),'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO",GETPOST('ONLINE_PAYMENT_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++; if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++; if (! $result > 0) $error++;
@ -182,6 +184,12 @@ print '<br>'.$langs->trans("Example").': http://mysite/mycss.css';
print '</td></tr>'; print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MessageForm").'</td><td>';
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_FORM',$conf->global->ONLINE_PAYMENT_MESSAGE_FORM,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
$doleditor->Create();
print '</td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("MessageOK").'</td><td>'; print $langs->trans("MessageOK").'</td><td>';
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%'); $doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');

View File

@ -64,6 +64,8 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++; if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL",GETPOST('PAYPAL_ADD_PAYMENT_URL','alpha'),'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL",GETPOST('PAYPAL_ADD_PAYMENT_URL','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++; if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM",GETPOST('ONLINE_PAYMENT_MESSAGE_FORM'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_MESSAGE_OK'),'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_MESSAGE_OK'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++; if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO",GETPOST('ONLINE_PAYMENT_MESSAGE_KO'),'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO",GETPOST('ONLINE_PAYMENT_MESSAGE_KO'),'chaine',0,'',$conf->entity);
@ -220,6 +222,13 @@ print $form->selectyesno("PAYPAL_ADD_PAYMENT_URL",$conf->global->PAYPAL_ADD_PAYM
print '</td></tr>'; print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MessageForm").'</td><td>';
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_FORM',$conf->global->ONLINE_PAYMENT_MESSAGE_FORM,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
$doleditor->Create();
print '</td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("MessageOK").'</td><td>'; print $langs->trans("MessageOK").'</td><td>';
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%'); $doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');

View File

@ -51,6 +51,7 @@ $price_by_qty_rowid = GETPOST('pbq', 'int');
$finished = GETPOST('finished', 'int'); $finished = GETPOST('finished', 'int');
$alsoproductwithnosupplierprice = GETPOST('alsoproductwithnosupplierprice', 'int'); $alsoproductwithnosupplierprice = GETPOST('alsoproductwithnosupplierprice', 'int');
$warehouseStatus = GETPOST('warehousestatus', 'alpha'); $warehouseStatus = GETPOST('warehousestatus', 'alpha');
$hidepriceinlabel = GETPOST('hidepriceinlabel', 'int');
/* /*
@ -192,7 +193,7 @@ else
$form = new Form($db); $form = new Form($db);
if (empty($mode) || $mode == 1) { // mode=1: customer if (empty($mode) || $mode == 1) { // mode=1: customer
$arrayresult = $form->select_produits_list("", $htmlname, $type, 0, $price_level, $searchkey, $status, $finished, $outjson, $socid, '1', 0, '', 0, $warehouseStatus); $arrayresult = $form->select_produits_list("", $htmlname, $type, 0, $price_level, $searchkey, $status, $finished, $outjson, $socid, '1', 0, '', $hidepriceinlabel, $warehouseStatus);
} elseif ($mode == 2) { // mode=2: supplier } elseif ($mode == 2) { // mode=2: supplier
$arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson, 0, $alsoproductwithnosupplierprice); $arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson, 0, $alsoproductwithnosupplierprice);
} }

View File

@ -298,7 +298,7 @@ class ActionsCardService
function LoadListDatas($limit, $offset, $sortfield, $sortorder) function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{ {
global $conf; global $conf;
global $search_categ,$sall,$sref,$sbarcode,$snom,$catid; global $search_categ,$sall,$sref,$search_barcode,$snom,$catid;
$this->getFieldList(); $this->getFieldList();
@ -320,7 +320,7 @@ class ActionsCardService
$sql.= " AND (p.ref LIKE '%".$this->db->escape($sall)."%' OR p.label LIKE '%".$this->db->escape($sall)."%' OR p.description LIKE '%".$this->db->escape($sall)."%' OR p.note LIKE '%".$this->db->escape($sall)."%')"; $sql.= " AND (p.ref LIKE '%".$this->db->escape($sall)."%' OR p.label LIKE '%".$this->db->escape($sall)."%' OR p.description LIKE '%".$this->db->escape($sall)."%' OR p.note LIKE '%".$this->db->escape($sall)."%')";
} }
if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'"; if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'";
if ($sbarcode) $sql.= " AND p.barcode LIKE '%".$sbarcode."%'"; if ($search_barcode) $sql.= " AND p.barcode LIKE '%".$search_barcode."%'";
if ($snom) $sql.= " AND p.label LIKE '%".$this->db->escape($snom)."%'"; if ($snom) $sql.= " AND p.label LIKE '%".$this->db->escape($snom)."%'";
if (isset($_GET["tosell"]) && dol_strlen($_GET["tosell"]) > 0) if (isset($_GET["tosell"]) && dol_strlen($_GET["tosell"]) > 0)
{ {

View File

@ -115,14 +115,14 @@ class FormProduct
$sql.= " WHERE e.entity IN (".getEntity('stock').")"; $sql.= " WHERE e.entity IN (".getEntity('stock').")";
if (count($warehouseStatus)) if (count($warehouseStatus))
{ {
$sql.= " AND e.statut IN (".implode(',',$warehouseStatus).")"; $sql.= " AND e.statut IN (".$db->escape(implode(',',$warehouseStatus)).")";
} }
else else
{ {
$sql.= " AND e.statut = 1"; $sql.= " AND e.statut = 1";
} }
if(!empty($exclude)) $sql.= ' AND e.rowid NOT IN('.implode(',', $exclude).')'; if(!empty($exclude)) $sql.= ' AND e.rowid NOT IN('.$db->escape(implode(',', $exclude)).')';
if ($sumStock && empty($fk_product)) $sql.= " GROUP BY e.rowid, e.label, e.description, e.fk_parent"; if ($sumStock && empty($fk_product)) $sql.= " GROUP BY e.rowid, e.label, e.description, e.fk_parent";
$sql.= " ORDER BY e.label"; $sql.= " ORDER BY e.label";

View File

@ -3750,7 +3750,7 @@ class Product extends CommonObject
$sql.= " WHERE w.entity IN (".getEntity('stock').")"; $sql.= " WHERE w.entity IN (".getEntity('stock').")";
$sql.= " AND w.rowid = ps.fk_entrepot"; $sql.= " AND w.rowid = ps.fk_entrepot";
$sql.= " AND ps.fk_product = ".$this->id; $sql.= " AND ps.fk_product = ".$this->id;
if ($conf->global->ENTREPOT_EXTRA_STATUS && count($warehouseStatus)) $sql.= " AND w.statut IN (".implode(',',$warehouseStatus).")"; if ($conf->global->ENTREPOT_EXTRA_STATUS && count($warehouseStatus)) $sql.= " AND w.statut IN (".$db->escape(implode(',',$warehouseStatus)).")";
dol_syslog(get_class($this)."::load_stock", LOG_DEBUG); dol_syslog(get_class($this)."::load_stock", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);

View File

@ -226,8 +226,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -1,703 +0,0 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Adolfo segura <adolfo.segura@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/product/list.php
* \ingroup produit
* \brief Page to list products and services
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/inventory/listview.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
if (! empty($conf->categorie->enabled))
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$langs->load("products");
$langs->load("stocks");
$langs->load("suppliers");
$langs->load("companies");
if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
$action=GETPOST('action','alpha');
$massaction=GETPOST('massaction','alpha');
$show_files=GETPOST('show_files','int');
$confirm=GETPOST('confirm','alpha');
$toselect = GETPOST('toselect', 'array');
$sref=GETPOST("sref");
$sbarcode=GETPOST("sbarcode");
$snom=GETPOST("snom");
$sall=GETPOST("sall");
$type= (int) GETPOST("type","int");
$search_sale = GETPOST("search_sale");
$search_categ = GETPOST("search_categ",'int');
$tosell = GETPOST("tosell", 'int');
$tobuy = GETPOST("tobuy", 'int');
$fourn_id = GETPOST("fourn_id",'int');
$catid = GETPOST('catid','int');
$search_tobatch = GETPOST("search_tobatch",'int');
$search_accountancy_code_sell = GETPOST("search_accountancy_code_sell",'alpha');
$search_accountancy_code_buy = GETPOST("search_accountancy_code_buy",'alpha');
$optioncss = GETPOST('optioncss','alpha');
//Show/hide child products. Hidden by default
if (!$_POST) {
$search_hidechildproducts = 'on';
} else {
$search_hidechildproducts = GETPOST('search_hidechildproducts');
}
$diroutputmassaction=$conf->product->dir_output . '/temp/massgeneration/'.$user->id;
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = (GETPOST("page",'int')?GETPOST("page", 'int'):0);
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="p.ref";
if (! $sortorder) $sortorder="ASC";
// Initialize context for list
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'productservicelist';
if ((string) $type == '1') { $contextpage='servicelist'; if ($search_type=='') $search_type='1'; }
if ((string) $type == '0') { $contextpage='productlist'; if ($search_type=='') $search_type='0'; }
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db);
$form=new Form($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('product');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
if (empty($action)) $action='list';
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$canvas=GETPOST("canvas");
$objcanvas=null;
if (! empty($canvas))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
$objcanvas = new Canvas($db,$action);
$objcanvas->getCanvas('product','list',$canvas);
}
// Security check
if ($type=='0') $result=restrictedArea($user,'produit','','','','','',$objcanvas);
else if ($type=='1') $result=restrictedArea($user,'service','','','','','',$objcanvas);
else $result=restrictedArea($user,'produit|service','','','','','',$objcanvas);
// Define virtualdiffersfromphysical
$virtualdiffersfromphysical=0;
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER))
{
$virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
}
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'p.ref'=>"Ref",
'pfp.ref_fourn'=>"RefSupplier",
'p.label'=>"ProductLabel",
'p.description'=>"Description",
"p.note"=>"Note",
);
// multilang
if (! empty($conf->global->MAIN_MULTILANGS))
{
$fieldstosearchall['pl.label']='ProductLabelTranslated';
$fieldstosearchall['pl.description']='ProductDescriptionTranslated';
$fieldstosearchall['pl.note']='ProductNoteTranslated';
}
if (! empty($conf->barcode->enabled)) {
$fieldstosearchall['p.barcode']='Gencod';
}
if (empty($conf->global->PRODUIT_MULTIPRICES))
{
$titlesellprice=$langs->trans("SellingPrice");
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
$titlesellprice=$form->textwithpicto($langs->trans("SellingPrice"), $langs->trans("DefaultPriceRealPriceMayDependOnCustomer"));
}
}
// Definition of fields for lists
$arrayfields=array(
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
//'pfp.ref_fourn'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))),
'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>($contextpage != 'servicelist'), 'enabled'=>(! empty($conf->barcode->enabled))),
'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))),
'p.price'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)),
'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(! empty($user->rights->fournisseur->lire))),
'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
'stock_virtual'=>array('label'=>$langs->trans("VirtualStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service' && $virtualdiffersfromphysical)),
'p.tobatch'=>array('label'=>$langs->trans("ManageLotSerial"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))),
'p.accountancy_code_sell'=>array('label'=>$langs->trans("ProductAccountancySellCode"), 'checked'=>0),
'p.accountancy_code_buy'=>array('label'=>$langs->trans("ProductAccountancyBuyCode"), 'checked'=>0),
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'p.tosell'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Sell").')', 'checked'=>1, 'position'=>1000),
'p.tobuy'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Buy").')', 'checked'=>1, 'position'=>1000)
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key]);
}
}
/*
* Actions
*/
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$sall="";
$sref="";
$snom="";
$sbarcode="";
$search_categ=0;
$tosell="";
$tobuy="";
$search_tobatch='';
$search_accountancy_code_sell='';
$search_accountancy_code_buy='';
$search_array_options=array();
}
// Mass actions
$objectclass='Product';
if ((string) $type == '1') { $objectlabel='Services'; }
if ((string) $type == '0') { $objectlabel='Products'; }
$permtoread = $user->rights->produit->lire;
$permtodelete = $user->rights->produit->supprimer;
$uploaddir = $conf->product->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
/*
* View
*/
$htmlother=new FormOther($db);
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
{
$objcanvas->assign_values($action); // This must contains code to load data (must call LoadListDatas($limit, $offset, $sortfield, $sortorder))
$objcanvas->display_canvas($action); // This is code to show template
}
else
{
$title=$langs->trans("ProductsAndServices");
if (isset($type))
{
if ($type==1)
{
$texte = $langs->trans("Services");
}
else
{
$texte = $langs->trans("Products");
}
}
else
{
$texte = $langs->trans("ProductsAndServices");
}
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql.= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
$sql.= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_buy,';
$sql.= ' p.datec, p.tms,';
//$sql.= ' pfp.ref_fourn as ref_supplier, ';
$sql.= ' MIN(pfp.unitprice) as minsellprice';
if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($type === 0)) {
$sql .= ', pac.rowid prod_comb_id';
}
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields as ef on (p.rowid = ef.fk_object)";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
// multilang
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$langs->getDefaultLang() ."'";
if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($type === 0)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
}
$sql.= ' WHERE p.entity IN ('.getEntity('product').')';
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
// if the type is not 1, we show all products (type = 0,2,3)
if (dol_strlen($type))
{
if ($type == 1) $sql.= " AND p.fk_product_type = '1'";
else $sql.= " AND p.fk_product_type <> '1'";
}
if ($sref) $sql .= natural_search('p.ref', $sref);
if ($snom) $sql .= natural_search('p.label', $snom);
if ($sbarcode) $sql .= natural_search('p.barcode', $sbarcode);
if (isset($tosell) && dol_strlen($tosell) > 0 && $tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($tosell);
if (isset($tobuy) && dol_strlen($tobuy) > 0 && $tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($tobuy);
if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'";
if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cp.fk_categorie = ".$db->escape($search_categ);
if ($search_categ == -2) $sql.= " AND cp.fk_categorie IS NULL";
if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id;
if ($search_tobatch != '' && $search_tobatch >= 0) $sql.= " AND p.tobatch = ".$db->escape($search_tobatch);
if ($search_accountancy_code_sell) $sql.= natural_search('p.accountancy_code_sell', $search_accountancy_code_sell);
if ($search_accountancy_code_sell) $sql.= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy);
// Add where from extra fields
if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($type === 0)) {
$sql .= " AND pac.rowid IS NULL";
}
// Add where from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey];
$mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
}
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,";
$sql.= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,";
$sql.= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_buy';
if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($type === 0)) {
$sql .= ', pac.rowid';
}
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
// TODO put these functions into product.lib.php if this go from demo to core
/**
* Function return formated sell price
*
* @param int $fk_object rowid of product
* @return string
*/
function list_get_product_sellprice($fk_object) {
global $langs,$conf, $user;
$object = Listview::getCachedOjbect('Product', $fk_object);
if($object === false) return '';
if ($object->status)
{
if ($object->price_base_type == 'TTC') return price($object->price_ttc).' '.$langs->trans("TTC");
else return price($object->price).' '.$langs->trans("HT");
}
return '';
}
/**
* Function return formated product status sell or buy
*
* @param int $fk_object rowid of product
* @param string $field concerned field status|status_buy
* @param int $type for libstatus
* @return string
*/
function list_get_product_status($fk_object, $field, $type) {
global $conf, $user;
$object = Listview::getCachedOjbect('Product', $fk_object);
if($object === false) return '';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
return ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
} else {
return $object->LibStatut($object->{$field},5,$type);
}
}
/**
* Function return formated ref
*
* @param int $fk_object rowid of product
* @return string
*/
function list_get_product_ref($fk_object) {
global $conf, $user;
$object = Listview::getCachedOjbect('Product', $fk_object);
if($object === false) return '';
return $object->getNomUrl(1,'',24);
}
/**
* Function return formated extrafield
*
* @param int $fk_object rowid of product
* @param string $key extrafield to output
* @return string
*/
function list_get_product_extrafield($fk_object, $key) {
global $extrafields;
$object = Listview::getCachedOjbect('Product', $fk_object);
if($object === false) return '';
return $extrafields->showOutputField($key, $object->array_options['options_'.$key], '', 1);
}
/**
* Function return formated virtual stock
*
* @param int $fk_object rowid of product
* @return string
*/
function list_get_product_virtual_stock($fk_object) {
global $langs;
$object = Listview::getCachedOjbect('Product', $fk_object);
if($object === false) return '';
$object->load_stock('nobatch');
$out = '';
if ($object->type != 1)
{
if ($object->seuil_stock_alerte != '' && $object->stock_theorique < (float) $object->seuil_stock_alerte) $out.= img_warning($langs->trans("StockTooLow")).' ';
$out.= (double) $object->stock_theorique;
}
return $out;
}
/**
* Function return formated stock
*
* @param int $fk_object rowid of product
* @return string
*/
function list_get_product_stock($fk_object) {
global $langs;
$object = Listview::getCachedOjbect('Product', $fk_object);
if($object === false) return '';
$out = '';
if ($object->type != 1)
{
if ($object->seuil_stock_alerte != '' && $object->stock_reel< (float) $object->seuil_stock_alerte) $out.= img_warning($langs->trans("StockTooLow")).' ';
$out.= (double) $object->stock_reel;
}
return $out;
}
/**
* Function return formated min buy price
*
* @param int $fk_object rowid of product
* @return string
*/
function list_get_product_minbuyprice($fk_object) {
global $conf, $user, $langs,$db,$form;
$out = '';
$object = Listview::getCachedOjbect('Product', $fk_object);
if($object === false || empty($object->status_buy) ) return '';
$product_fourn =new ProductFournisseur($db);
if ($product_fourn->find_min_price_product_fournisseur($fk_object) > 0)
{
if ($product_fourn->product_fourn_price_id > 0)
{
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
{
$htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1);
$out.= $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext);
}
else $out.= price($product_fourn->fourn_unitprice).' '.$langs->trans("HT");
}
}
return $out;
}
// array of customized field function
$arrayeval = array(
'tobuy'=>'list_get_product_status(@rowid@, "status_buy",1)'
,'tosell'=>'list_get_product_status(@rowid@, "status",0)'
,'ref'=>'list_get_product_ref(@rowid@)'
,'label'=>'dol_trunc("@val@",40)'
,'price'=>'list_get_product_sellprice(@rowid@)'
,'stock_virtual'=>'list_get_product_virtual_stock(@rowid@)'
,'stock'=>'list_get_product_stock(@rowid@)'
,'minbuyprice'=>'list_get_product_minbuyprice(@rowid@)'
);
// defined list align for field
$arrayalign = array(
'price'=>'right'
,'tobuy'=>'right'
,'tosell'=>'right'
,'desiredstock'=>'right'
,'stock'=>'right'
,'stock_virtual'=>'right'
,'minbuyprice'=>'right'
,'datec'=>'center'
,'tms'=>'center'
);
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListMoreFields',$parameters); // Note that $action and $object may have been modified by hook
if($reshook) {
$arrayfields = $hookmanager->resArray;
}
// init title, hidden field (allowed into selected fields), and position
$arrayhide = $arraytitle = $arrayposition = array();
foreach($arrayfields as $k=>$data) {
if(!isset($data['enabled']) || $data['enabled']) {
list($t,$f) = explode('.',$k);
if(empty($f))$f = $k;
$arraytitle[$f]=$data['label'];
if(empty($data['checked'])) $arrayhide[] = $f;
$arrayposition[$f] = empty($data['position']) ? 0 : $data['position'];
}
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayalign[$key]=$extrafields->getAlignFlag($key);
$arrayeval[$key] = 'list_get_product_extrafield(@rowid@, "'.$key.'")';
}
}
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->produit->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
// Filter on categories
$moreforfilter='';
if (! empty($conf->categorie->enabled))
{
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('Categories'). ': ';
$moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT,$search_categ,'search_categ',1);
$moreforfilter.='</div>';
}
//Show/hide child products. Hidden by default
if (!empty($conf->variants->enabled) && $type === 0) {
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= '<input type="checkbox" id="search_hidechildproducts" name="search_hidechildproducts" value="on"'.($search_hidechildproducts ? 'checked="checked"' : '').'>';
$moreforfilter.= ' <label for="search_hidechildproducts">'.$langs->trans('HideChildProducts').'</label>';
$moreforfilter.='</div>';
}
if ($moreforfilter)
{
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if(!empty($hookmanager->resPrint)) {
$moreforfilter.=$hookmanager->resPrint;
}
}
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($search_categ > 0) $param.="&amp;search_categ=".urlencode($search_categ);
if ($sref) $param="&amp;sref=".urlencode($sref);
if ($search_ref_supplier) $param="&amp;search_ref_supplier=".urlencode($search_ref_supplier);
if ($sbarcode) $param.=($sbarcode?"&amp;sbarcode=".urlencode($sbarcode):"");
if ($snom) $param.="&amp;snom=".urlencode($snom);
if ($sall) $param.="&amp;sall=".urlencode($sall);
if ($tosell != '') $param.="&amp;tosell=".urlencode($tosell);
if ($tobuy != '') $param.="&amp;tobuy=".urlencode($tobuy);
if ($fourn_id > 0) $param.=($fourn_id?"&amp;fourn_id=".$fourn_id:"");
if ($seach_categ) $param.=($search_categ?"&amp;search_categ=".urlencode($search_categ):"");
if ($type != '') $param.='&amp;type='.urlencode($type);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($search_tobatch) $param="&amp;search_ref_supplier=".urlencode($search_ref_supplier);
if ($search_accountancy_code_sell) $param="&amp;search_accountancy_code_sell=".urlencode($search_accountancy_code_sell);
if ($search_accountancy_code_buy) $param="&amp;search_accountancy_code_buy=".urlencode($search_accountancy_code_buy);
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
//var_dump($arraytitle,$arrayhide);
$list=new Listview($db, 'product');
$listHTML = $list->render($sql,array(
'list'=>array(
'title'=>$texte
,'image'=>'title_products.png'
,'massactions'=>$arrayofmassactions
,'param_url'=>$param
,'messageNothing'=>''
)
,'limit'=>array(
'nbLine'=>$limit
)
,'sortfield'=>$sortfield
,'sortorder'=>$sortorder
,'title'=>$arraytitle // column definition title (only defined where abble to show)
,'position'=>array(
'text-align'=>$arrayalign
,'rank'=>$arrayposition
)
,'allow-fields-select'=>1 // allow to select hidden fields
,'head_search'=>$moreforfilter //custom search on head
,'no-auto-sql-search'=>1 //disabled auto completion sql for search and pager url, use dolibarr style for migration of product list
,'translate'=>array()
,'search'=>array(
'ref'=>array('search_type'=>true, 'table'=>'p', 'fieldname'=>'sref')
,'label'=>array('search_type'=>true, 'table'=>'p', 'fieldname'=>'snom')
,'tosell'=>array('search_type'=> array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')), 'fieldname'=>'tosell')
,'tobuy'=>array('search_type'=> array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')), 'fieldname'=>'tobuy')
,'barcode'=>array('search_type'=>true, 'table'=>'p', 'fieldname'=>'sbarcode')
,'accountancy_code_sell'=>array('search_type'=>true, 'table'=>'p', 'fieldname'=>'search_accountancy_code_sell')
,'accountancy_code_buy'=>array('search_type'=>true, 'table'=>'p', 'fieldname'=>'search_accountancy_code_buy')
)
,'type'=>array(
'datec'=>'datetime'
,'tms'=>'datetime'
)
,'hide'=>$arrayhide
,'eval'=>$arrayeval
));
$num = $list->totalRow;
$arrayofselected=is_array($toselect)?$toselect:array();
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
{
$id = $list->TField[0]->rowid;
header("Location: ".DOL_URL_ROOT.'/product/card.php?id='.$id);
exit;
}
$helpurl='';
if (isset($type))
{
if ($type == 0)
{
$helpurl='EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
}
else if ($type == 1)
{
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
}
}
llxHeader('',$title,$helpurl,'');
// Displays product removal confirmation
if (GETPOST('delprod')) {
setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs');
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
echo $listHTML;
print '</form>';
}
llxFooter();
$db->close();

View File

@ -52,14 +52,14 @@ $confirm=GETPOST('confirm','alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$sall=GETPOST('sall', 'alphanohtml'); $sall=GETPOST('sall', 'alphanohtml');
$sref=GETPOST("sref"); $search_ref=GETPOST("search_ref");
$sbarcode=GETPOST("sbarcode"); $search_barcode=GETPOST("search_barcode");
$snom=GETPOST("snom"); $search_label=GETPOST("search_label");
$search_type = GETPOST("search_type",'int'); $search_type = GETPOST("search_type",'int');
$search_sale = GETPOST("search_sale"); $search_sale = GETPOST("search_sale");
$search_categ = GETPOST("search_categ",'int'); $search_categ = GETPOST("search_categ",'int');
$tosell = GETPOST("tosell", 'int'); $search_tosell = GETPOST("search_tosell", 'int');
$tobuy = GETPOST("tobuy", 'int'); $search_tobuy = GETPOST("search_tobuy", 'int');
$fourn_id = GETPOST("fourn_id",'int'); $fourn_id = GETPOST("fourn_id",'int');
$catid = GETPOST('catid','int'); $catid = GETPOST('catid','int');
$search_tobatch = GETPOST("search_tobatch",'int'); $search_tobatch = GETPOST("search_tobatch",'int');
@ -209,12 +209,12 @@ if (empty($reshook))
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{ {
$sall=""; $sall="";
$sref=""; $search_ref="";
$snom=""; $search_label="";
$sbarcode=""; $search_barcode="";
$search_categ=0; $search_categ=0;
$tosell=""; $search_tosell="";
$tobuy=""; $search_tobuy="";
$search_tobatch=''; $search_tobatch='';
$search_type=''; $search_type='';
$search_accountancy_code_sell=''; $search_accountancy_code_sell='';
@ -298,11 +298,11 @@ else
if ($search_type == 1) $sql.= " AND p.fk_product_type = 1"; if ($search_type == 1) $sql.= " AND p.fk_product_type = 1";
else $sql.= " AND p.fk_product_type <> 1"; else $sql.= " AND p.fk_product_type <> 1";
} }
if ($sref) $sql .= natural_search('p.ref', $sref); if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
if ($snom) $sql .= natural_search('p.label', $snom); if ($search_label) $sql .= natural_search('p.label', $search_label);
if ($sbarcode) $sql .= natural_search('p.barcode', $sbarcode); if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode);
if (isset($tosell) && dol_strlen($tosell) > 0 && $tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($tosell); if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($search_tosell);
if (isset($tobuy) && dol_strlen($tobuy) > 0 && $tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($tobuy); if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($search_tobuy);
if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'";
if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid; if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL"; if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL";
@ -325,8 +325,9 @@ else
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }
@ -395,22 +396,22 @@ else
$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_categ > 0) $param.="&amp;search_categ=".urlencode($search_categ); if ($sall) $param.="&sall=".urlencode($sall);
if ($sref) $param="&amp;sref=".urlencode($sref); if ($search_categ > 0) $param.="&search_categ=".urlencode($search_categ);
if ($search_ref_supplier) $param="&amp;search_ref_supplier=".urlencode($search_ref_supplier); if ($search_ref) $param="&search_ref=".urlencode($search_ref);
if ($sbarcode) $param.=($sbarcode?"&amp;sbarcode=".urlencode($sbarcode):""); if ($search_ref_supplier) $param="&search_ref_supplier=".urlencode($search_ref_supplier);
if ($snom) $param.="&amp;snom=".urlencode($snom); if ($search_barcode) $param.=($search_barcode?"&search_barcode=".urlencode($search_barcode):"");
if ($sall) $param.="&amp;sall=".urlencode($sall); if ($search_label) $param.="&search_label=".urlencode($search_label);
if ($tosell != '') $param.="&amp;tosell=".urlencode($tosell); if ($search_tosell != '') $param.="&search_tosell=".urlencode($search_tosell);
if ($tobuy != '') $param.="&amp;tobuy=".urlencode($tobuy); if ($search_tobuy != '') $param.="&search_tobuy=".urlencode($search_tobuy);
if ($fourn_id > 0) $param.=($fourn_id?"&amp;fourn_id=".$fourn_id:""); if ($fourn_id > 0) $param.=($fourn_id?"&fourn_id=".$fourn_id:"");
if ($seach_categ) $param.=($search_categ?"&amp;search_categ=".urlencode($search_categ):""); if ($seach_categ) $param.=($search_categ?"&search_categ=".urlencode($search_categ):"");
if ($type != '') $param.='&amp;type='.urlencode($type); if ($type != '') $param.='&type='.urlencode($type);
if ($search_type != '') $param.='&amp;search_type='.urlencode($search_type); if ($search_type != '') $param.='&search_type='.urlencode($search_type);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($search_tobatch) $param="&amp;search_ref_supplier=".urlencode($search_ref_supplier); if ($search_tobatch) $param="&search_ref_supplier=".urlencode($search_ref_supplier);
if ($search_accountancy_code_sell) $param="&amp;search_accountancy_code_sell=".urlencode($search_accountancy_code_sell); if ($search_accountancy_code_sell) $param="&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell);
if ($search_accountancy_code_buy) $param="&amp;search_accountancy_code_buy=".urlencode($search_accountancy_code_buy); if ($search_accountancy_code_buy) $param="&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy);
// Add $param from extra fields // Add $param from extra fields
foreach ($search_array_options as $key => $val) foreach ($search_array_options as $key => $val)
{ {
@ -516,7 +517,7 @@ else
if (! empty($arrayfields['p.ref']['checked'])) if (! empty($arrayfields['p.ref']['checked']))
{ {
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="sref" size="8" value="'.dol_escape_htmltag($sref).'">'; print '<input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['pfp.ref_fourn']['checked'])) if (! empty($arrayfields['pfp.ref_fourn']['checked']))
@ -528,7 +529,7 @@ else
if (! empty($arrayfields['p.label']['checked'])) if (! empty($arrayfields['p.label']['checked']))
{ {
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="snom" size="12" value="'.dol_escape_htmltag($snom).'">'; print '<input class="flat" type="text" name="search_label" size="12" value="'.dol_escape_htmltag($search_label).'">';
print '</td>'; print '</td>';
} }
// Type // Type
@ -543,7 +544,7 @@ else
if (! empty($arrayfields['p.barcode']['checked'])) if (! empty($arrayfields['p.barcode']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="sbarcode" size="6" value="'.dol_escape_htmltag($sbarcode).'">'; print '<input class="flat" type="text" name="search_barcode" size="6" value="'.dol_escape_htmltag($search_barcode).'">';
print '</td>'; print '</td>';
} }
// Duration // Duration
@ -650,13 +651,13 @@ else
if (! empty($arrayfields['p.tosell']['checked'])) if (! empty($arrayfields['p.tosell']['checked']))
{ {
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print $form->selectarray('tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$tosell,1); print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$search_tosell,1);
print '</td >'; print '</td >';
} }
if (! empty($arrayfields['p.tobuy']['checked'])) if (! empty($arrayfields['p.tobuy']['checked']))
{ {
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print $form->selectarray('tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$tobuy,1); print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$search_tobuy,1);
print '</td>'; print '</td>';
} }
print '<td class="liste_titre" align="middle">'; print '<td class="liste_titre" align="middle">';

View File

@ -44,7 +44,7 @@ $sref=GETPOST("sref");
$snom=GETPOST("snom"); $snom=GETPOST("snom");
$sall=GETPOST('sall', 'alphanohtml'); $sall=GETPOST('sall', 'alphanohtml');
$type=GETPOST("type","int"); $type=GETPOST("type","int");
$sbarcode=GETPOST("sbarcode"); $search_barcode=GETPOST("search_barcode");
$catid=GETPOST('catid','int'); $catid=GETPOST('catid','int');
$toolowstock=GETPOST('toolowstock'); $toolowstock=GETPOST('toolowstock');
$tosell = GETPOST("tosell"); $tosell = GETPOST("tosell");
@ -135,7 +135,7 @@ if (dol_strlen($type))
} }
} }
if ($sref) $sql.= natural_search('p.ref', $ref); if ($sref) $sql.= natural_search('p.ref', $ref);
if ($sbarcode) $sql.= natural_search('p.barcode', $sbarcode); if ($search_barcode) $sql.= natural_search('p.barcode', $search_barcode);
if ($snom) $sql.= natural_search('p.label', $snom); if ($snom) $sql.= natural_search('p.label', $snom);
if (! empty($tosell)) $sql.= " AND p.tosell = ".$tosell; if (! empty($tosell)) $sql.= " AND p.tosell = ".$tosell;
if (! empty($tobuy)) $sql.= " AND p.tobuy = ".$tobuy; if (! empty($tobuy)) $sql.= " AND p.tobuy = ".$tobuy;

View File

@ -46,7 +46,7 @@ $sref=GETPOST("sref");
$snom=GETPOST("snom"); $snom=GETPOST("snom");
$sall=GETPOST('sall', 'alphanohtml'); $sall=GETPOST('sall', 'alphanohtml');
$type=GETPOST("type","int"); $type=GETPOST("type","int");
$sbarcode=GETPOST("sbarcode",'alpha'); $search_barcode=GETPOST("search_barcode",'alpha');
$search_warehouse=GETPOST('search_warehouse','alpha'); $search_warehouse=GETPOST('search_warehouse','alpha');
$search_batch=GETPOST('search_batch','alpha'); $search_batch=GETPOST('search_batch','alpha');
$catid=GETPOST('catid','int'); $catid=GETPOST('catid','int');
@ -140,7 +140,7 @@ if (dol_strlen($type))
} }
} }
if ($sref) $sql.= natural_search("p.ref", $sref); if ($sref) $sql.= natural_search("p.ref", $sref);
if ($sbarcode) $sql.= natural_search("p.barcode", $sbarcode); if ($search_barcode) $sql.= natural_search("p.barcode", $search_barcode);
if ($snom) $sql.= natural_search("p.label", $snom); if ($snom) $sql.= natural_search("p.label", $snom);
if (! empty($tosell)) $sql.= " AND p.tosell = ".$tosell; if (! empty($tosell)) $sql.= " AND p.tosell = ".$tosell;
if (! empty($tobuy)) $sql.= " AND p.tobuy = ".$tobuy; if (! empty($tobuy)) $sql.= " AND p.tobuy = ".$tobuy;

View File

@ -465,8 +465,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -244,8 +244,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -323,8 +323,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -321,8 +321,9 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -802,7 +802,7 @@ print '</div>'."\n";
print '<br>'; print '<br>';
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs,1,$suffix);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -156,12 +156,13 @@ print '<div id="dolpaymentdiv" align="center">'."\n";
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>\n"; print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>\n";
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO; $key='ONLINE_PAYMENT_MESSAGE_KO';
if (! empty($conf->global->$key)) print $conf->global->$key;
print "\n</div>\n"; print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs,0,$suffix);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -115,7 +115,8 @@ dol_syslog("Call newpaymentok with token=".$onlinetoken." paymentType=".$payment
print $langs->trans("YourPaymentHasBeenRecorded")."<br><br>\n"; print $langs->trans("YourPaymentHasBeenRecorded")."<br><br>\n";
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK; $key='ONLINE_PAYMENT_MESSAGE_OK';
if (! empty($conf->global->$key)) print $conf->global->$key;
// Appel des triggers // Appel des triggers
@ -192,7 +193,7 @@ if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
print "\n</div>\n"; print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs,0,$suffix);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -66,6 +66,7 @@ $suffix=GETPOST("suffix",'aZ09');
$amount=price2num(GETPOST("amount",'alpha')); $amount=price2num(GETPOST("amount",'alpha'));
if (! GETPOST("currency",'alpha')) $currency=$conf->currency; if (! GETPOST("currency",'alpha')) $currency=$conf->currency;
else $currency=GETPOST("currency",'alpha'); else $currency=GETPOST("currency",'alpha');
$source = GETPOST("source",'alpha');
if (! $action) if (! $action)
{ {
@ -607,8 +608,11 @@ $found=false;
$error=0; $error=0;
$var=false; $var=false;
$object = null;
// Free payment // Free payment
if (! GETPOST("source")) if (! $source)
{ {
$found=true; $found=true;
$tag=GETPOST("tag"); $tag=GETPOST("tag");
@ -655,7 +659,7 @@ if (! GETPOST("source"))
// Payment on customer order // Payment on customer order
if (GETPOST("source") == 'order') if ($source == 'order')
{ {
$found=true; $found=true;
$langs->load("orders"); $langs->load("orders");
@ -672,6 +676,8 @@ if (GETPOST("source") == 'order')
else else
{ {
$result=$order->fetch_thirdparty($order->socid); $result=$order->fetch_thirdparty($order->socid);
$object = $order;
} }
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
@ -765,7 +771,7 @@ if (GETPOST("source") == 'order')
// Payment on customer invoice // Payment on customer invoice
if (GETPOST("source") == 'invoice') if ($source == 'invoice')
{ {
$found=true; $found=true;
$langs->load("bills"); $langs->load("bills");
@ -782,6 +788,8 @@ if (GETPOST("source") == 'invoice')
else else
{ {
$result=$invoice->fetch_thirdparty($invoice->socid); $result=$invoice->fetch_thirdparty($invoice->socid);
$object = $invoice;
} }
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
@ -874,7 +882,7 @@ if (GETPOST("source") == 'invoice')
} }
// Payment on contract line // Payment on contract line
if (GETPOST("source") == 'contractline') if ($source == 'contractline')
{ {
$found=true; $found=true;
$langs->load("contracts"); $langs->load("contracts");
@ -882,6 +890,7 @@ if (GETPOST("source") == 'contractline')
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$contractline=new ContratLigne($db); $contractline=new ContratLigne($db);
$result=$contractline->fetch('',$ref); $result=$contractline->fetch('',$ref);
if ($result < 0) if ($result < 0)
{ {
@ -892,6 +901,8 @@ if (GETPOST("source") == 'contractline')
{ {
if ($contractline->fk_contrat > 0) if ($contractline->fk_contrat > 0)
{ {
$object = $contractline;
$contract=new Contrat($db); $contract=new Contrat($db);
$result=$contract->fetch($contractline->fk_contrat); $result=$contract->fetch($contractline->fk_contrat);
if ($result > 0) if ($result > 0)
@ -914,7 +925,8 @@ if (GETPOST("source") == 'contractline')
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
{ {
$amount=$contractline->total_ttc; $amount=$contractline->total_ttc;
if ($contractline->fk_product)
if ($contractline->fk_product && ! empty($conf->global-PAYMENT_USE_NEW_PRICE_FOR_CONTRACTLINES))
{ {
$product=new Product($db); $product=new Product($db);
$result=$product->fetch($contractline->fk_product); $result=$product->fetch($contractline->fk_product);
@ -940,6 +952,7 @@ if (GETPOST("source") == 'contractline')
exit; exit;
} }
} }
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
$amount=price2num($amount); $amount=price2num($amount);
} }
@ -1072,7 +1085,7 @@ if (GETPOST("source") == 'contractline')
} }
// Payment on member subscription // Payment on member subscription
if (GETPOST("source") == 'membersubscription') if ($source == 'membersubscription')
{ {
$found=true; $found=true;
$langs->load("members"); $langs->load("members");
@ -1089,6 +1102,8 @@ if (GETPOST("source") == 'membersubscription')
} }
else else
{ {
$object = $member;
$subscription=new Subscription($db); $subscription=new Subscription($db);
} }
@ -1264,6 +1279,7 @@ else
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '</table>'."\n"; print '</table>'."\n";
print '</form>'."\n"; print '</form>'."\n";
print '</div>'."\n"; print '</div>'."\n";
print '<br>'; print '<br>';
@ -1445,8 +1461,7 @@ if (preg_match('/^dopayment/',$action))
} }
htmlPrintOnlinePaymentFooter($mysoc,$langs,1,$suffix,$object);
htmlPrintOnlinePaymentFooter($mysoc,$langs);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -238,11 +238,13 @@ if ($urllogo)
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>"; print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO; $key='ONLINE_PAYMENT_MESSAGE_KO';
if (! empty($conf->global->$key)) print $conf->global->$key;
print "\n</div>\n"; print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs,0,$suffix);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -285,7 +285,9 @@ if ($ispaymentok)
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n"; print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n"; print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
$key='ONLINE_PAYMENT_MESSAGE_OK';
if (! empty($conf->global->$key)) print $conf->global->$key;
$sendemail = ''; $sendemail = '';
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL; if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
@ -441,7 +443,7 @@ else
print "\n</div>\n"; print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs,0,$suffix);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -1015,7 +1015,7 @@ print '<br>';
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs,1,$suffix);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -166,11 +166,13 @@ print '<span id="dolpaymentspan"></span>'."\n";
print '<div id="dolpaymentdiv" align="center">'."\n"; print '<div id="dolpaymentdiv" align="center">'."\n";
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>"; print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO; $key='ONLINE_PAYMENT_MESSAGE_KO';
if (! empty($conf->global->$key)) print $conf->global->$key;
print "\n</div>\n"; print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs,0,$suffix);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -170,7 +170,9 @@ if ($PAYPALTOKEN)
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n"; print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n"; print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
$key='ONLINE_PAYMENT_MESSAGE_OK';
if (! empty($conf->global->$key)) print $conf->global->$key;
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
@ -326,7 +328,7 @@ else
print "\n</div>\n"; print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs,0,$suffix);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com> /* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2017 Saasprov <saasprov@gmail.com> * Copyright (C) 2017 Saasprov <saasprov@gmail.com>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* *
* 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
@ -1084,6 +1085,7 @@ if (preg_match('/^dopayment/',$action))
box-shadow: 0 1px 3px 0 #e6ebf1; box-shadow: 0 1px 3px 0 #e6ebf1;
-webkit-transition: box-shadow 150ms ease; -webkit-transition: box-shadow 150ms ease;
transition: box-shadow 150ms ease; transition: box-shadow 150ms ease;
width: 350px;
} }
.StripeElement--focus { .StripeElement--focus {
@ -1227,7 +1229,7 @@ if (preg_match('/^dopayment/',$action))
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs,1,$suffix);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -153,11 +153,13 @@ print '<span id="dolpaymentspan"></span>'."\n";
print '<div id="dolpaymentdiv" align="center">'."\n"; print '<div id="dolpaymentdiv" align="center">'."\n";
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>"; print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO; $key='ONLINE_PAYMENT_MESSAGE_KO';
if (! empty($conf->global->$key)) print $conf->global->$key;
print "\n</div>\n"; print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs,0,$suffix);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -120,7 +120,9 @@ if ($ispaymentok)
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n"; print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n"; print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
$key='ONLINE_PAYMENT_MESSAGE_OK';
if (! empty($conf->global->$key)) print $conf->global->$key;
$sendemail = ''; $sendemail = '';
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL; if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
@ -191,7 +193,7 @@ if ($ispaymentok)
print "\n</div>\n"; print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs,0,$suffix);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@ -76,8 +76,9 @@ foreach ($search_array_options as $key => $val)
$param.='&search_options_'.$tmpkey.'='.urlencode($val); $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
$mode=0; $mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
{ {
$filter['ef.'.$tmpkey]=natural_search('ef.'.$tmpkey, $crit, $mode); $filter['ef.'.$tmpkey]=natural_search('ef.'.$tmpkey, $crit, $mode);
} }

View File

@ -186,7 +186,6 @@ if (empty($reshook))
$objects = array( $objects = array(
'Adherent' => '/adherents/class/adherent.class.php', 'Adherent' => '/adherents/class/adherent.class.php',
'Societe' => '/societe/class/societe.class.php', 'Societe' => '/societe/class/societe.class.php',
'Bookmark' => '/bookmarks/class/bookmark.class.php',
'Categorie' => '/categories/class/categorie.class.php', 'Categorie' => '/categories/class/categorie.class.php',
'ActionComm' => '/comm/action/class/actioncomm.class.php', 'ActionComm' => '/comm/action/class/actioncomm.class.php',
'Propal' => '/comm/propal/class/propal.class.php', 'Propal' => '/comm/propal/class/propal.class.php',
@ -1977,7 +1976,7 @@ else
print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 200); print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 200);
} }
dol_htmloutput_errors($error,$errors); dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';

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