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

Conflicts:
	htdocs/core/lib/company.lib.php
	htdocs/core/lib/functions.lib.php
	htdocs/langs/en_US/cashdesk.lang
This commit is contained in:
ldestailleur
2019-01-04 19:36:20 +01:00
24 changed files with 283 additions and 175 deletions

View File

@@ -91,7 +91,7 @@ NEW: tag odt line_product_ref_fourn for supplier doc lines
NEW: The binding step in accountancy has a country filter with autocompletion
NEW: Top menu is always on screen with MD theme.
NEW: Withdraw request massaction can include already partially paid invoices
NEW: Option "Simplify interface for blind persons"
For developers:
NEW: Add lib for multiselect with checkboxes

View File

@@ -584,14 +584,14 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$accountingaccount->fetch($k, null, true);
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label;
} else if ($tabtype[$key] == 'payment_donation') {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$accountingaccount->fetch($k, null, true);
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label;
} else if ($tabtype[$key] == 'member') {
$bookkeeping->subledger_account = '';
@@ -605,21 +605,21 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$accountingaccount->fetch($k, null, true);
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label;
} else if ($tabtype[$key] == 'payment_various') {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$accountingaccount->fetch($k, null, true);
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label;
} else if ($tabtype[$key] == 'banktransfert') {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$accountingaccount->fetch($k, null, true);
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label;
} else {
if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty.
@@ -1173,28 +1173,28 @@ function getSourceDocRef($val, $typerecord)
// WE MUST HAVE SAME REF FOR ALL LINES WE WILL RECORD INTO THE BOOKKEEPING
$ref = $val['ref'];
if ($ref == '(SupplierInvoicePayment)' || $ref == '(SupplierInvoicePaymentBack)') {
$ref = $langs->trans('Supplier');
$ref = $langs->transnoentitiesnoconv('Supplier');
}
if ($ref == '(CustomerInvoicePayment)' || $ref == '(CustomerInvoicePaymentBack)') {
$ref = $langs->trans('Customer');
$ref = $langs->transnoentitiesnoconv('Customer');
}
if ($ref == '(SocialContributionPayment)') {
$ref = $langs->trans('SocialContribution');
$ref = $langs->transnoentitiesnoconv('SocialContribution');
}
if ($ref == '(DonationPayment)') {
$ref = $langs->trans('Donation');
$ref = $langs->transnoentitiesnoconv('Donation');
}
if ($ref == '(SubscriptionPayment)') {
$ref = $langs->trans('Subscription');
$ref = $langs->transnoentitiesnoconv('Subscription');
}
if ($ref == '(ExpenseReportPayment)') {
$ref = $langs->trans('Employee');
$ref = $langs->transnoentitiesnoconv('Employee');
}
if ($ref == '(LoanPayment)') {
$ref = $langs->trans('Loan');
$ref = $langs->transnoentitiesnoconv('Loan');
}
if ($ref == '(payment_salary)') {
$ref = $langs->trans('Employee');
$ref = $langs->transnoentitiesnoconv('Employee');
}
$sqlmid = '';
@@ -1203,63 +1203,63 @@ function getSourceDocRef($val, $typerecord)
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
$ref = $langs->trans("Invoice");
$ref = $langs->transnoentitiesnoconv("Invoice");
}
elseif ($typerecord == 'payment_supplier')
{
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . $val["paymentsupplierid"];
$ref = $langs->trans("SupplierInvoice");
$ref = $langs->transnoentitiesnoconv("SupplierInvoice");
}
elseif ($typerecord == 'payment_expensereport')
{
$sqlmid = 'SELECT e.rowid as id, e.ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as pe, " . MAIN_DB_PREFIX . "expensereport as e";
$sqlmid .= " WHERE pe.rowid=" . $val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
$ref = $langs->trans("ExpenseReport");
$ref = $langs->transnoentitiesnoconv("ExpenseReport");
}
elseif ($typerecord == 'payment_salary')
{
$sqlmid = 'SELECT s.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s";
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
$ref = $langs->trans("SalaryPayment");
$ref = $langs->transnoentitiesnoconv("SalaryPayment");
}
elseif ($typerecord == 'sc')
{
$sqlmid = 'SELECT sc.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementcharge as sc";
$sqlmid .= " WHERE sc.rowid=" . $val["paymentscid"];
$ref = $langs->trans("SocialContribution");
$ref = $langs->transnoentitiesnoconv("SocialContribution");
}
elseif ($typerecord == 'payment_vat')
{
$sqlmid = 'SELECT v.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v";
$sqlmid .= " WHERE v.rowid=" . $val["paymentvatid"];
$ref = $langs->trans("PaymentVat");
$ref = $langs->transnoentitiesnoconv("PaymentVat");
}
elseif ($typerecord == 'payment_donation')
{
$sqlmid = 'SELECT payd.fk_donation as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd";
$sqlmid .= " WHERE payd.fk_donation=" . $val["paymentdonationid"];
$ref = $langs->trans("Donation");
$ref = $langs->transnoentitiesnoconv("Donation");
}
elseif ($typerecord == 'payment_loan')
{
$sqlmid = 'SELECT l.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_loan as l";
$sqlmid .= " WHERE l.rowid=" . $val["paymentloanid"];
$ref = $langs->trans("LoanPayment");
$ref = $langs->transnoentitiesnoconv("LoanPayment");
}
elseif ($typerecord == 'payment_various')
{
$sqlmid = 'SELECT v.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v";
$sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"];
$ref = $langs->trans("VariousPayment");
$ref = $langs->transnoentitiesnoconv("VariousPayment");
}
// Add warning
if (empty($sqlmid))
@@ -1281,6 +1281,6 @@ function getSourceDocRef($val, $typerecord)
else dol_print_error($db);
}
$ref = dol_trunc($langs->trans("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300
$ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300
return $ref;
}

View File

@@ -384,7 +384,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$connectstringserver = '';
$connectstringsource = '';
$connectstringtarget = '';
if (function_exists('imap_open'))
{
$connectstringserver = $object->getConnectStringIMAP();
@@ -397,7 +397,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{
$morehtml .= 'IMAP functions not available on your PHP';
}
if (! $connection)
{
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource;
@@ -412,7 +412,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{
imap_close($connection);
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'<div class="refidno">'.$morehtml.'</div>', '', 0, '', '', 0, '');
print '<div class="fichecenter">';
@@ -487,6 +487,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1);
print '</td><td>';
print '<input type="text" name="operationparam">';
$htmltext=$langs->transnoentitiesnoconv("OperationParamDesc");
//var_dump($htmltext);
print $form->textwithpicto('', $htmltext);
print '</td>';
print '<td></td>';
print '<td align="right"><input type="submit" name="addoperation" id="addoperation" class="flat button" value="'.$langs->trans("Add").'"></td>';

View File

@@ -120,8 +120,6 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
/*
* Actions
*
* Put here all code to do according to value of "$action" parameter
*/
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
@@ -165,8 +163,6 @@ if (empty($reshook))
/*
* View
*
* Put here all code to render page
*/
$form=new Form($db);
@@ -212,20 +208,20 @@ $reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object)
$sql.=$hookmanager->resPrint;
/* If a group by is required
$sql.= " GROUP BY "
foreach($object->fields as $key => $val)
{
$sql.='t.'.$key.', ';
}
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/, $/','', $sql);
*/
$sql.= " GROUP BY "
foreach($object->fields as $key => $val)
{
$sql.='t.'.$key.', ';
}
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/, $/','', $sql);
*/
$sql.=$db->order($sortfield,$sortorder);
@@ -305,8 +301,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->emailcollector->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
if (GETPOST('nomassaction','int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
@@ -324,7 +320,7 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton='';
//if ($user->rights->emailcollector->creer)
//{
//{
$newcardbutton='<a class="butActionNew" href="emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle">'.$langs->trans('New').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
@@ -333,6 +329,10 @@ $newcardbutton.= '</a>';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
// Add code for pre mass action (confirmation or email presend form)
/*$topicmail="";
$modelmail="";
$objecttmp=new EmailCollector($db);
$trackid='xxxx'.$object->id;*/
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall)
@@ -343,8 +343,8 @@ if ($sall)
$moreforfilter = '';
/*$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
$moreforfilter.= '</div>';*/
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
$moreforfilter.= '</div>';*/
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -371,11 +371,11 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
print '<tr class="liste_titre">';
foreach($object->fields as $key => $val)
{
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
$cssforfield='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@@ -397,11 +397,14 @@ print '</tr>'."\n";
print '<tr class="liste_titre">';
foreach($object->fields as $key => $val)
{
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
$cssforfield='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n";
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@@ -444,15 +447,22 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">';
foreach($object->fields as $key => $val)
{
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
if ($key == 'status') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td';
if ($align) print ' class="'.$align.'"';
print '>';
$cssforfield='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td';
if ($cssforfield || $val['css']) print ' class="';
print $cssforfield;
if ($cssforfield && $val['css']) print ' ';
print $val['css'];
if ($cssforfield || $val['css']) print '"';
print '>';
print $object->showOutputField($val, $key, $obj->$key, '');
print '</td>';
if (! $i) $totalarray['nbfield']++;

View File

@@ -383,12 +383,24 @@ class BlockedLog
// Set object_data
$this->object_data=new stdClass();
// Add fields to exclude
$arrayoffieldstoexclude = array(
'table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','errors','modelpdf',
'table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','errors','modelpdf','civility_id','contact','contact_id',
'table_element_line','ismultientitymanaged','isextrafieldmanaged',
'linkedObjectsIds','linkedObjects','fk_delivery_address',
'context'
'context',
'projet' // There is already ->fk_project
);
// Add more fields to exclude depending on object type
if ($this->element == 'cashcontrol')
{
$arrayoffieldstoexclude = array_merge($arrayoffieldstoexclude, array(
'name','lastname','firstname','region','region_id','region_code','state','state_id','state_code','country','country_id','country_code',
'total_ht','total_tva','total_ttc','total_localtax1','total_localtax2',
'barcode_type','barcode_type_code','barcode_type_label','barcode_type_coder','mode_reglement_id','cond_reglement_id','mode_reglement','cond_reglement','shipping_method_id',
'fk_incoterms','libelle_incoterms','location_incoterms','lines')
);
}
// Add thirdparty info
if (empty($object->thirdparty) && method_exists($object, 'fetch_thirdparty')) $object->fetch_thirdparty();

View File

@@ -115,11 +115,10 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
print '<td>'.$langs->trans("ThirdParty").'</td>';
print '<td align="right">'.$langs->trans("Debit").'</td>';
print '<td align="right">'.$langs->trans("Credit").'</td>';
print '<td align="right" width="80">'.$langs->trans("BankBalance").'</td>';
print '<td align="right">'.$langs->trans("BankBalance").'</td>';
print '</tr>';
// Current balance
print '<tr class="liste_total">';
print '<td align="left" colspan="5">'.$langs->trans("CurrentBalance").'</td>';
print '<td align="right" class="nowrap">'.price($solde).'</td>';
@@ -133,7 +132,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
// Remainder to pay in future
$sqls = array();
$sqls = array();
// Customer invoices
$sql = "SELECT 'invoice' as family, f.rowid as objid, f.ref as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,";
@@ -142,9 +141,9 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.paye = 0 AND f.fk_statut = 1"; // Not paid
$sql.= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice
$sql.= " ORDER BY dlr ASC";
$sqls[] = $sql;
$sql.= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice
$sql.= " ORDER BY dlr ASC";
$sqls[] = $sql;
// Supplier invoices
$sql = " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,";
@@ -153,51 +152,51 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid";
$sql.= " WHERE ff.entity = ".$conf->entity;
$sql.= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid
$sql.= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice
$sql.= " ORDER BY dlr ASC";
$sqls[] = $sql;
$sql.= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice
$sql.= " ORDER BY dlr ASC";
$sqls[] = $sql;
// Social contributions
$sql = " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr";
$sql.= ", cs.fk_account";
$sql.= ", cs.fk_account";
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id";
$sql.= " WHERE cs.entity = ".$conf->entity;
$sql.= " AND cs.paye = 0"; // Not paid
$sql.= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution
$sql.= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution
$sql.= " ORDER BY dlr ASC";
$sqls[] = $sql;
$sqls[] = $sql;
// others sql
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreSQL', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook) and isset($hookmanager->resArray['sql'])){
$sqls[] = $hookmanager->resArray['sql'];
}
// others sql
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreSQL', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook) and isset($hookmanager->resArray['sql'])){
$sqls[] = $hookmanager->resArray['sql'];
}
$error=0;
$tab_sqlobjOrder=array();
$tab_sqlobj=array();
foreach($sqls as $sql){
$resql = $db->query($sql);
if($resql){
while($sqlobj = $db->fetch_object($resql)){
$tab_sqlobj[] = $sqlobj;
$tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr);
}
$db->free($resql);
}else{
$error++;
}
}
foreach($sqls as $sql){
$resql = $db->query($sql);
if($resql){
while($sqlobj = $db->fetch_object($resql)){
$tab_sqlobj[] = $sqlobj;
$tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr);
}
$db->free($resql);
}else{
$error++;
}
}
// Sort array
if (! $error)
{
array_multisort($tab_sqlobjOrder,$tab_sqlobj);
//Apply distinct filter
// Apply distinct filter
foreach ($tab_sqlobj as $key=>$value) {
$tab_sqlobj[$key] = "'" . serialize($value) . "'";
}
@@ -262,13 +261,13 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$paiement = -1*$socialcontribstatic->getSommePaiement(); // Payment already done
}
$parameters = array('obj' => $obj);
$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook)){
$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : '';
$refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : '';
$paiement = isset($hookmanager->resArray['paiement']) ? $hookmanager->resArray['paiement'] : 0;
}
$parameters = array('obj' => $obj);
$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook)){
$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : '';
$refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : '';
$paiement = isset($hookmanager->resArray['paiement']) ? $hookmanager->resArray['paiement'] : 0;
}
$total_ttc = $obj->total_ttc;
if ($paiement) $total_ttc = $obj->total_ttc - $paiement;
@@ -307,7 +306,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde;
}
// solde
// solde
print '<tr class="liste_total">';
print '<td align="left" colspan="5">'.$langs->trans("FutureBalance").' ('.$object->currency_code.')</td>';
print '<td align="right" class="nowrap">'.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).'</td>';

View File

@@ -1,6 +1,4 @@
<?php
use Stripe\BankAccount;
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
@@ -33,7 +31,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
$langs->loadLangs(array("cashcontrol","install","cashdesk","admin","banks"));
$langs->loadLangs(array("install","cashdesk","admin","banks"));
$id=GETPOST('id','int');
$ref = GETPOST('ref', 'alpha');
@@ -84,16 +82,23 @@ $hookmanager->initHooks(array('cashcontrolcard','globalcard'));
* Actions
*/
$permissiontoadd = ($user->rights->cashdesk->use || $user->rights->takepos->use);
$permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use) || ($permissiontoadd && $object->status == 0);
if (empty($backtopage)) $backtopage = dol_buildpath('/compta/cashcontrol/cashcontrol_card.php',1).'?id='.($id > 0 ? $id : '__ID__');
$backurlforlist = dol_buildpath('/compta/cashcontrol/cashcontrol_list.php',1);
$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record
if (empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH))
{
setEventMessages($langs->trans("CashDesk")." - ".$langs->trans("NotConfigured"), null, 'errors');
}
if (GETPOST('cancel'))
if (GETPOST('cancel','alpha'))
{
$action = 'create';
}
if ($action=="start")
{
$error=0;
@@ -127,7 +132,7 @@ elseif ($action=="add")
$error=0;
foreach($arrayofpaymentmode as $key=>$val)
{
if (GETPOST($key,'alpha') == '')
if (GETPOST($key.'_amount','alpha') == '')
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors');
$action='start';
@@ -135,7 +140,7 @@ elseif ($action=="add")
}
else
{
$object->$key = price2num(GETPOST($key,'alpha'));
$object->$key = price2num(GETPOST($key.'_amount','alpha'));
}
}
@@ -183,6 +188,32 @@ if ($action=="close")
$action="view";
}
// Action to delete
if ($action == 'confirm_delete' && ! empty($permissiontodelete))
{
$object->fetch($id);
if (! ($object->id > 0))
{
dol_print_error('', 'Error, object must be fetched before being deleted');
exit;
}
$result=$object->delete($user);
var_dump($result);
if ($result > 0)
{
// Delete OK
setEventMessages("RecordDeleted", null, 'mesgs');
header("Location: ".$backurlforlist);
exit;
}
else
{
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
}
}
/*
@@ -414,7 +445,7 @@ if ($action=="create" || $action=="start")
foreach($arrayofpaymentmode as $key => $val)
{
print '<td align="center"'.($i == 0 ? ' class="hide0"':'').'>';
print '<input name="'.$key.'" type="text"'.($key == 'cash'?' autofocus':'').' class="maxwidth100 center" value="'.GETPOST($key,'alpha').'">';
print '<input name="'.$key.'_amount" type="text"'.($key == 'cash'?' autofocus':'').' class="maxwidth100 center" value="'.GETPOST($key.'_amount','alpha').'">';
print '</td>';
$i++;
}
@@ -493,16 +524,12 @@ if (empty($action) || $action=="view")
print price($object->opening, 0, $langs, 1, -1, -1, $conf->currency);
print "</td></tr>";
print '<tr><td valign="middle">'.$langs->trans("Cash").'</td><td>';
print price($object->cash, 0, $langs, 1, -1, -1, $conf->currency);
print "</td></tr>";
print '<tr><td valign="middle">'.$langs->trans("Cheque").'</td><td>';
print price($object->cheque, 0, $langs, 1, -1, -1, $conf->currency);
print "</td></tr>";
print '<tr><td valign="middle">'.$langs->trans("Card").'</td><td>';
print price($object->card, 0, $langs, 1, -1, -1, $conf->currency);
print "</td></tr>";
foreach($arrayofpaymentmode as $key => $val)
{
print '<tr><td valign="middle">'.$langs->trans($val).'</td><td>';
print price($object->$key, 0, $langs, 1, -1, -1, $conf->currency);
print "</td></tr>";
}
print "</table>\n";
print '</div>';
@@ -516,6 +543,8 @@ if (empty($action) || $action=="view")
if ($object->status == CashControl::STATUS_DRAFT)
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '&amp;action=close">' . $langs->trans('Close') . '</a></div>';
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '&amp;action=confirm_delete">' . $langs->trans('Delete') . '</a></div>';
}
print '</div>';

View File

@@ -276,6 +276,18 @@ class CashControl extends CommonObject
return $result;
}
/**
* Delete object in database
*
* @param User $user User that deletes
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, >0 if OK
*/
public function delete(User $user, $notrigger = false)
{
return $this->deleteCommon($user, $notrigger);
//return $this->deleteCommon($user, $notrigger, 1);
}
/**
* Return label of the status

View File

@@ -286,7 +286,7 @@ if ($resql)
print "<div style='text-align: right'><h2>";
print $langs->trans("Cash").": ".price($cash)."<br><br>";
print $langs->trans("PaymentTypeCB").": ".price($bank)."<br><br>";
print $langs->trans("PaymentTypeCheque").": ".price($cheque)."<br><br>";
print $langs->trans("PaymentTypeCHQ").": ".price($cheque)."<br><br>";
print "</h2></div>";
//save totals to DB

View File

@@ -19,7 +19,7 @@
*/
/**
* \file htdocs/compta/list/index.php
* \file htdocs/compta/sociales/list.php
* \ingroup tax
* \brief Page to list all social contributions
*/

View File

@@ -166,7 +166,7 @@ if ($result)
print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines, 'title_accountancy', 0, $newcardbutton, '', $limit);
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" class="flat" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';

View File

@@ -149,6 +149,7 @@ if ($action == 'update' && ! empty($permissiontoadd))
if ($action == "update_extras" && ! empty($permissiontoadd))
{
$object->fetch(GETPOST('id','int'));
$attributekey = GETPOST('attribute','alpha');
$attributekeylong = 'options_'.$attributekey;
$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong,' alpha');
@@ -169,6 +170,12 @@ if ($action == "update_extras" && ! empty($permissiontoadd))
// Action to delete
if ($action == 'confirm_delete' && ! empty($permissiontodelete))
{
if (! ($object->id > 0))
{
dol_print_error('', 'Error, object must be fetched before being deleted');
exit;
}
$result=$object->delete($user);
if ($result > 0)
{

View File

@@ -452,7 +452,7 @@ class Form
if ($notabs == 2) $tag='div';
if ($notabs == 3) $tag='span';
// Sanitize tooltip
$htmltext=str_replace("\\","\\\\",$htmltext);
//$htmltext=str_replace("\\","\\\\",$htmltext);
$htmltext=str_replace("\r","",$htmltext);
$htmltext=str_replace("\n","",$htmltext);

View File

@@ -1341,6 +1341,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if (is_object($objcon) && $objcon->id) {
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm";
$sql.= " AND r.element_type = '" . $db->escape($objcon->table_element) . "' AND r.fk_element = " . $objcon->id;
}
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
@@ -1379,13 +1380,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
}
// Work with new table actioncomm_resources and multiple contact affectation.
if (is_object($objcon) && $objcon->id)
{
$sql.= " AND r.element_type = '" . $objcon->table_element . "'" .
" AND r.fk_element = " . $objcon->id;
}
// Condition on actioncode
if (! empty($actioncode))
{
@@ -1410,7 +1404,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']);
//TODO Add limit for thirdparty in contexte very all result
//TODO Add limit in nb of results
$sql.= $db->order($sortfield, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql=$db->query($sql);

View File

@@ -158,6 +158,8 @@ if ($permission) {
</form>
<?php
$var = false;
$arrayofsource=array('internal','external'); // Show both link to user and thirdparties contacts
foreach($arrayofsource as $source) {
@@ -169,9 +171,10 @@ if ($permission) {
$i = 0;
while ($i < $num) {
$var = ! $var;
?>
<form class="tagtr oddeven">
<form class="tagtr oddeven <?php echo ($var?'impair':'pair') ?>">
<div class="tagtd" align="left">
<?php if ($tab[$i]['source']=='internal') echo $langs->trans("User"); ?>
<?php if ($tab[$i]['source']=='external') echo $langs->trans("ThirdPartyContact"); ?>

View File

@@ -96,8 +96,8 @@ class EmailCollector extends CommonObject
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector'),
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1),
'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>100, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com'),
'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myacount@gmail.com'),
'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>1, 'comment'=>"IMAP password"),
'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'),
'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'comment'=>"IMAP password"),
'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'),
//'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105),
//'actiontodo' => array('type'=>'varchar(255)', 'label'=>'ActionToDo', 'visible'=>1, 'enabled'=>1, 'position'=>106),

View File

@@ -181,6 +181,7 @@ CREATE TABLE llx_emailcollector_emailcollector(
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;
ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN login varchar(128);
ALTER TABLE llx_emailcollector_emailcollector ADD INDEX idx_emailcollector_entity (entity);
ALTER TABLE llx_emailcollector_emailcollector ADD INDEX idx_emailcollector_status (status);

View File

@@ -1848,6 +1848,7 @@ WithoutDolTrackingID=Dolibarr Tracking ID not found
FormatZip=Zip
MainMenuCode=Menu entry code (mainmenu)
ECMAutoTree=Show automatic ECM tree
OperationParamDesc=Define values to use for action, or how to extract values. For example:<br>VALUE:abc<br>REGEX:SUBJECT:([^\s]*)<br>REGEX:BODY:My company name is\s([^\s]*)
##### Resource ####
ResourceSetup=Configuration of Resource module
UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).
@@ -1856,3 +1857,5 @@ DisabledResourceLinkContact=Disable feature to link a resource to contacts
ConfirmUnactivation=Confirm module reset
OnMobileOnly=On small screen (smartphone) only
DisableProspectCustomerType=Disable the "Prospect + Customer" third party type (so third party must be Prospect or Customer but can't be both)
MAIN_OPTIMIZEFORTEXTBROWSER=Simplify interface for blind person
MAIN_OPTIMIZEFORTEXTBROWSERDesc=Enable this option if you are a blind person, or use application from a text browser like lynx or links.

View File

@@ -1,6 +1,6 @@
BlockedLog=Unalterable Logs
Field=Field
BlockedLogDesc=This module tracks some events into an unalterable log (that you can't modify once recorded) into a block chain, in real time. This module provides compatibility with requirements of laws of some countries (like France with the law Finance 2016 - Norme NF535).
BlockedLogDesc=This module tracks some events into an unalterable log (that you can't modify once recorded) into a block chain, in real time. This module provides compatibility with requirements of laws of some countries (like France with the law Finance 2016 - Norme NF525).
Fingerprints=Archived events and fingerprints
FingerprintsDesc=This is the tool to browse or extract the unalterable logs. Unalterable logs are generated and archived locally into a dedicated table, in real time when you record a business event. You can use this tool to export this archive and save it into an external support (some countries, like France, ask that you do it every year). Note that, there is no feature to purge this log and every change tried to be done directly into this log (by a hacker for example) will be reported with a non-valid fingerprint. If you really need to purge this table because you used your application for a demo/test purpose and want to clean your data to start your production, you can ask your reseller or integrator to reset your database (all your data will be removed).
CompanyInitialKey=Company initial key (hash of genesis block)

View File

@@ -43,6 +43,9 @@ TakeposConnectorNecesary='TakePOS Connector' required
OrderPrinters=Order printers
SearchProduct=Search product
Receipt=Receipt
AmountAtEndOfPeriod=Amount at end of period (day, month or year)
Header=Header
Footer=Footer
AmountAtEndOfPeriod=Amount at end of period (day, month or year)
TheoricalAmount=Theorical amount
RealAmount=Real amount
CashFenceDone=Cash fence done for the period

View File

@@ -118,7 +118,7 @@ if (empty($reshook))
$error=0;
$permissiontoadd = $user->rights->mymodule->write;
$permissiontodelete = $user->rights->mymodule->delete;
$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
if (empty($backtopage)) $backtopage = dol_buildpath('/mymodule/myobject_card.php',1).'?id='.($id > 0 ? $id : '__ID__');
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php',1);
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record

View File

@@ -88,13 +88,13 @@ $pagenext = $page + 1;
//if (! $sortorder) $sortorder="DESC";
// Initialize technical objects
$object=new MyObject($db);
$object = new MyObject($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->mymodule->dir_output . '/temp/massgeneration/'.$user->id;
$diroutputmassaction = $conf->mymodule->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('myobjectlist')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('myobject'); // Load $extrafields->attributes['myobject']
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_');
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,'','search_');
// Default sort order (if not yet defined by previous GETPOST)
if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition.
@@ -474,11 +474,14 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">';
foreach($object->fields as $key => $val)
{
$cssforfield='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked']))
$cssforfield='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td';
if ($cssforfield || $val['css']) print ' class="';

View File

@@ -24,6 +24,8 @@
define('NOSCANPOSTFORINJECTION',1);
define('NOSTYLECHECK',1);
header('X-XSS-Protection:0');
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -910,6 +912,7 @@ if ($action == 'updatecss')
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$csscontent.= "ob_start();\n";
$csscontent.= "header('Cache-Control: max-age=3600, public, must-revalidate');\n";
$csscontent.= "header('Content-type: text/css');\n";
$csscontent.= "// END PHP ?>\n";
@@ -942,6 +945,7 @@ if ($action == 'updatecss')
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$jscontent.= "ob_start();\n";
$jscontent.= "header('Cache-Control: max-age=3600, public, must-revalidate');\n";
$jscontent.= "header('Content-type: application/javascript');\n";
$jscontent.= "// END PHP ?>\n";
@@ -974,6 +978,7 @@ if ($action == 'updatecss')
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$robotcontent.= "ob_start();\n";
$robotcontent.= "header('Cache-Control: max-age=3600, public, must-revalidate');\n";
$robotcontent.= "header('Content-type: text/css');\n";
$robotcontent.= "// END PHP ?>\n";*/
@@ -1000,20 +1005,21 @@ if ($action == 'updatecss')
// Css file
$htaccesscontent ='';
/*$robotcontent.= "<?php // BEGIN PHP\n";
$robotcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$robotcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$robotcontent.= "ob_start();\n";
$robotcontent.= "header('Content-type: text/css');\n";
$robotcontent.= "// END PHP ?>\n";*/
/*$htaccesscontent.= "<?php // BEGIN PHP\n";
$htaccesscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$htaccesscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$htaccesscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$htaccesscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$htaccesscontent.= "ob_start();\n";
$htaccesscontent.= "header('Cache-Control: max-age=3600, public, must-revalidate');\n";
$htaccesscontent.= "header('Content-type: text/css');\n";
$htaccesscontent.= "// END PHP ?>\n";*/
$htaccesscontent.= GETPOST('WEBSITE_HTACCESS', 'none');
/*$robotcontent.= "\n".'<?php // BEGIN PHP'."\n";
$robotcontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
$robotcontent.= "// END PHP ?>"."\n";*/
/*$htaccesscontent.= "\n".'<?php // BEGIN PHP'."\n";
$htaccesscontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
$htaccesscontent.= "// END PHP ?>"."\n";*/
dol_syslog("Save file htaccess into ".$filehtaccess);
@@ -1857,7 +1863,14 @@ if (! GETPOST('hide_websitemenu'))
if ($action != 'addcontainer')
{
$out='';
$out.='<select name="pageid" id="pageid" class="minwidth200 maxwidth300">';
if ($atleastonepage && $action != 'editsource')
{
$out.='<select name="pageid" id="pageid" class="minwidth200 maxwidth300">';
}
else
{
$out.='<select name="pageidbis" id="pageid" class="minwidth200 maxwidth300" disabled="disabled">';
}
if ($atleastonepage)
{
if (empty($pageid) && $action != 'createcontainer') // Page id is not defined, we try to take one
@@ -1884,7 +1897,15 @@ if (! GETPOST('hide_websitemenu'))
}
else $out.='<option value="-1">&nbsp;</option>';
$out.='</select>';
$out.=ajax_combobox('pageid');
if ($atleastonepage && $action != 'editsource')
{
$out.=ajax_combobox('pageid');
}
else
{
$out.='<input type="hidden" name="pageid" value="'.$pageid.'">';
$out.=ajax_combobox('pageid');
}
print $out;
}
else
@@ -1893,7 +1914,7 @@ if (! GETPOST('hide_websitemenu'))
}
//print '<input type="submit" class="button" name="refreshpage" value="'.$langs->trans("Load").'"'.($atleastonepage?'':' disabled="disabled"').'>';
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshpage" value="'.$langs->trans("Load").'"'.($atleastonepage?'':' disabled="disabled"').'>';
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshpage" value="'.$langs->trans("Load").'"'.(($atleastonepage && $action != 'editsource')?'':' disabled="disabled"').'>';
// Print nav arrows

View File

@@ -1,11 +1,12 @@
<?php
// BEGIN PHP File wrapper.php - DO NOT MODIFY - It is just a copy of wrapper example.
// BEGIN PHP File wrapper.php - DO NOT MODIFY - It is just a copy of wrapper.html sample.
$websitekey=basename(dirname(__FILE__));
if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$encoding = '';
$hashp=GETPOST('hashp','aZ09');
$modulepart=GETPOST('modulepart','alpha');
$modulepart=GETPOST('modulepart','aZ09');
$entity=GETPOST('entity','int')?GETPOST('entity','int'):$conf->entity;
$original_file=GETPOST("file","alpha");
@@ -54,17 +55,26 @@ if (! empty($hashp))
// Define attachment (attachment=true to force choice popup 'open'/'save as')
$attachment = true;
if (preg_match('/\.(html|htm)$/i',$original_file)) $attachment = false;
if (isset($_GET["attachment"])) $attachment = GETPOST("attachment",'alpha')?true:false;
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
if (isset($_GET["attachment"])) $attachment = GETPOST("attachment",'none')?true:false;
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS_WEBSITE)) $attachment=false;
// Define mime type
$type = 'application/octet-stream';
if (GETPOST('type','alpha')) $type=GETPOST('type','alpha');
if (GETPOST('type','none')) $type=GETPOST('type','alpha');
else $type=dol_mimetype($original_file);
// Security: Delete string ../ into $original_file
$original_file=str_replace("../","/", $original_file);
// Cache or not
if (GETPOST("cache",'none') || image_format_supported($original_file) >= 0)
{
// Important: Following code is to avoid page request by browser and PHP CPU at
// each Dolibarr page access.
header('Cache-Control: max-age=3600, public, must-revalidate');
header('Pragma: cache'); // This is to avoid having Pragma: no-cache
}
// Find the subdirectory name as the reference
$refname=basename(dirname($original_file)."/");
@@ -110,15 +120,13 @@ else
// Permissions are ok and file found, so we return it
//top_httphead($type);
header('Content-Type: '.$type);
header('Content-Description: File Transfer');
if ($encoding) header('Content-Encoding: '.$encoding);
// Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, attachment=need user action to open)
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
header('Content-Length: ' . dol_filesize($fullpath_original_file));
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
readfile($fullpath_original_file_osencoded);
}