Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export to PDF using LibreOffice 5 command line #8196

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 2 additions & 6 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ Following changes may create regressions for some external modules, but were nec

***** ChangeLog for 7.0.0 compared to 6.0.5 *****
For users:
NEW: Add a preview icon after files that can be previewed (pdf + images)
NEW: When payment is registered, PDF of invoices are also regenerated so payments
appears with no need to click on regenerate.
NEW: #5711 Add shipment line deleting and editing for draft shipments.
NEW: Accept substitution key __(ABC)__ replaced with value of translation of key ABC
NEW: Accept substitution key __[ABC]__ replaced with value of const ABC
NEW: Accountancy Add fields for sale accounting account for intracommunity sales & export sales
NEW: Accountancy Add variant on sell account for intracommunity sales & export sales
NEW: Add a button "Activate all services" on contracts
NEW: Add a confirmation for all mass action 'delete'
NEW: Add a group task line for tasks on same level on gantt diagram
Expand Down Expand Up @@ -585,9 +583,7 @@ Following changes may create regression for some external modules, but were nece
exists, but if an external module need action on it, it must provides itself its trigger file.
* Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode. So, if you set var
$multicompany_transverse_mode to 1 into your conf file, you must remove this line and a new key into
the Home - setup - other admin page.
* If you use Multicompany transverse mode, it will be necessary to check the activation of the modules in the children
entities and to review completely the rights of the groups and the users.
the Home - setup - other admin page.
* Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx')
* Some other change were done in the way we read permission of a user when module multicompany is enabled. You can
retreive the old behavior by adding constant MULTICOMPANY_BACKWARD_COMPATIBILITY to 1.
Expand Down
4 changes: 2 additions & 2 deletions htdocs/adherents/type.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
$object->subscription = (int) trim($subscription);
$object->note = trim($comment);
$object->mail_valid = trim($mail_valid);
$object->vote = (boolean) trim($vote);
$object->vote = trim($vote);

// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
Expand Down Expand Up @@ -160,7 +160,7 @@
$object->subscription = (int) trim($subscription);
$object->note = trim($comment);
$object->mail_valid = trim($mail_valid);
$object->vote = (boolean) trim($vote);
$object->vote = trim($vote);

// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
Expand Down
10 changes: 4 additions & 6 deletions htdocs/comm/propal/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,8 @@
$ret = $object->fetch($id, $ref);
if ($ret > 0)
$ret = $object->fetch_thirdparty();
if ($ret <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
if ($ret < 0)
dol_print_error('', $object->error);
}

// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
Expand Down Expand Up @@ -1714,7 +1711,7 @@
print '</table>';
}

} elseif ($object->id > 0) {
} else {
/*
* Show object in view mode
*/
Expand Down Expand Up @@ -1821,6 +1818,7 @@

$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';


$morehtmlref='<div class="refidno">';
// Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', 0, 1);
Expand Down
3 changes: 0 additions & 3 deletions htdocs/compta/facture/class/facture.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3004,9 +3004,6 @@ function update_percent($line, $percent)
$line->total_ttc = $tabprice[2];
$line->total_localtax1 = $tabprice[9];
$line->total_localtax2 = $tabprice[10];
$line->multicurrency_total_ht = $tabprice[16];
$line->multicurrency_total_tva = $tabprice[17];
$line->multicurrency_total_ttc = $tabprice[18];
$line->update($user);
$this->update_price(1);
$this->db->commit();
Expand Down
14 changes: 2 additions & 12 deletions htdocs/compta/sociales/class/chargesociales.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ function check()
function create($user)
{
global $conf;
$error=0;

$now=dol_now();

Expand Down Expand Up @@ -192,17 +191,8 @@ function create($user)
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");

//dol_syslog("ChargesSociales::create this->id=".$this->id);
$result=$this->call_trigger('PAYMENTSOCIALCONTRIBUTION_CREATE',$user);
if ($result < 0) $error++;

if(empty($error)) {
$this->db->commit();
return $this->id;
}
else {
$this->db->rollback();
return -1*$error;
}
$this->db->commit();
return $this->id;
}
else
{
Expand Down
3 changes: 0 additions & 3 deletions htdocs/compta/tva/class/tva.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,6 @@ function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='')
$linkclose='';
if (empty($notooltip))
{



if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowMyObject");
Expand Down
16 changes: 9 additions & 7 deletions htdocs/contrat/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@

if ($action != 'editline' || GETPOST('rowid') != $objp->rowid)
{
print '<tr '.$bcnd[$var].' class="tdtop">';
print '<tr '.$bcnd[$var].' valign="top">';
// Label
if ($objp->fk_product > 0)
{
Expand All @@ -1571,10 +1571,12 @@
$productstatic->ref=$objp->pref;
$productstatic->entity=$objp->pentity;
$productstatic->label=$objp->plabel;
$text = $productstatic->getNomUrl(1,'',32);
$text = $productstatic->getNomUrl(1,'',20);
if ($objp->plabel)
{
$text .= ' - ';
//$productstatic->ref=$objp->label;
//$text .= $productstatic->getNomUrl(0,'',16);
$text .= $objp->plabel;
}
$description = $objp->description;
Expand Down Expand Up @@ -1711,8 +1713,8 @@
$productstatic->type=$objp->ptype;
$productstatic->ref=$objp->pref;
$productstatic->entity=$objp->pentity;
print $productstatic->getNomUrl(1,'',32);
print $objp->label?' - '.dol_trunc($objp->label,32):'';
print $productstatic->getNomUrl(1,'',20);
print $objp->label?' - '.dol_trunc($objp->label,16):'';
print '<br>';
}
else
Expand Down Expand Up @@ -1820,7 +1822,7 @@
'text' => $langs->trans("ConfirmMoveToAnotherContractQuestion"),
array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid));

print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'),$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion);
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'),$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion);
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
}

Expand All @@ -1832,7 +1834,7 @@
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$comment = GETPOST('comment','alpha');
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment),$langs->trans("ActivateService"),$langs->trans("ConfirmActivateService",dol_print_date($dateactstart,"%A %d %B %Y")),"confirm_active", '', 0, 1);
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment),$langs->trans("ActivateService"),$langs->trans("ConfirmActivateService",dol_print_date($dateactstart,"%A %d %B %Y")),"confirm_active", '', 0, 1);
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
}

Expand All @@ -1851,7 +1853,7 @@
}
else
{
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne','int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y")), "confirm_closeline", '', 0, 1);
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne','int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y")), "confirm_closeline", '', 0, 1);
}
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
}
Expand Down
3 changes: 2 additions & 1 deletion htdocs/contrat/services_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
$filter_opcloture=GETPOST('filter_opcloture');

// Initialize context for list
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contractservicelist'.$mode;
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'servicelist'.$mode;

// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array($contextpage));
Expand Down Expand Up @@ -483,6 +483,7 @@
print '</td>';
}
// Extra fields
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';

// Fields from hook
Expand Down
17 changes: 2 additions & 15 deletions htdocs/contrat/tpl/linkedobjectblock.tpl.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -51,22 +50,10 @@
<td><?php echo $objectlink->getNomUrl(1); ?></td>
<td></td>
<td align="center"><?php echo dol_print_date($objectlink->date_contrat,'day'); ?></td>
<td align="right"><?php
// Price of contract is not shown by default because a contract is a list of service with
// start and end date that change with time andd that may be different that the period of reference for price.
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE))
{
$totalcontrat = 0;
foreach ($objectlink->lines as $linecontrat) {
$totalcontrat = $totalcontrat + $linecontrat->total_ht;
$total = $total + $linecontrat->total_ht;
}
echo price($totalcontrat);
} ?></td>
<td align="right"><?php // var_dump($objectlink->total_ttc); ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(7); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
</tr>
<?php } ?>

<!-- END PHP TEMPLATE -->
<!-- END PHP TEMPLATE -->
91 changes: 29 additions & 62 deletions htdocs/core/actions_linkedfiles.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,70 +182,37 @@
$filenamefrom=dol_sanitizeFileName(GETPOST('renamefilefrom','alpha'), '_', 0); // Do not remove accents
$filenameto=dol_sanitizeFileName(GETPOST('renamefileto','alpha'), '_', 0); // Do not remove accents

if ($filenamefrom != $filenameto)
// Security:
// Disallow file with some extensions. We rename them.
// Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary code.
if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$filenameto) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED))
{
// Security:
// Disallow file with some extensions. We rename them.
// Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary code.
if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$filenameto) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED))
{
$filenameto.= '.noexe';
}

if ($filenamefrom && $filenameto)
{
$srcpath = $upload_dir.'/'.$filenamefrom;
$destpath = $upload_dir.'/'.$filenameto;

$result = dol_move($srcpath, $destpath);
if ($result)
{
if ($object->id)
{
$object->addThumbs($destpath);
}

// TODO Add revert function of addThumbs to remove for old name
//$object->delThumbs($srcpath);

setEventMessages($langs->trans("FileRenamed"), null);
}
else
{
$langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now.
setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors');
}
}
$filenameto.= '.noexe';
}
}

// Update properties in ECM table
if (GETPOST('ecmfileid', 'int') > 0)
{
$shareenabled = GETPOST('shareenabled', 'alpha');

include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$ecmfile=new EcmFiles($db);
$result = $ecmfile->fetch(GETPOST('ecmfileid', 'int'));
if ($result > 0)
{
if ($shareenabled)
{
if (empty($ecmfile->share))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$ecmfile->share = getRandomPassword(true);
}
}
else
{
$ecmfile->share = '';
}
$result = $ecmfile->update($user);
if ($result < 0)
{
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
}
}
if ($filenamefrom && $filenameto)
{
$srcpath = $upload_dir.'/'.$filenamefrom;
$destpath = $upload_dir.'/'.$filenameto;

$result = dol_move($srcpath, $destpath);
if ($result)
{
if ($object->id)
{
$object->addThumbs($destpath);
}

// TODO Add revert function of addThumbs to remove for old name
//$object->delThumbs($srcpath);

setEventMessages($langs->trans("FileRenamed"), null);
}
else
{
$langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now.
setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors');
}
}
}
}
18 changes: 9 additions & 9 deletions htdocs/core/class/commondocgenerator.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ function get_substitutionarray_object($object,$outputlangs,$array_key='object')
{
$object->fetch_projet();
}

$resarray[$array_key.'_project_ref'] = $object->project->ref;
$resarray[$array_key.'_project_title'] = $object->project->title;
$resarray[$array_key.'_project_description'] = $object->project->description;
Expand Down Expand Up @@ -510,7 +510,7 @@ function get_substitutionarray_lines($line,$outputlangs)
'line_multicurrency_total_tva_locale' => price($line->multicurrency_total_tva, 0, $outputlangs),
'line_multicurrency_total_ttc_locale' => price($line->multicurrency_total_ttc, 0, $outputlangs),
);

// Units
if ($conf->global->PRODUCT_USE_UNITS)
{
Expand All @@ -527,16 +527,16 @@ function get_substitutionarray_lines($line,$outputlangs)
$line->fetch_optionals($line->rowid,$extralabels);

$resarray = $this->fill_substitutionarray_with_extrafields($line,$resarray,$extrafields,$array_key=$array_key,$outputlangs);

// Load product data optional fields to the line -> enables to use "line_options_{extrafield}"
if (isset($line->fk_product) && $line->fk_product > 0)
if (isset($line->product_ref))
{
$tmpproduct = new Product($this->db);
$result = $tmpproduct->fetch($line->fk_product);
foreach($tmpproduct->array_options as $key=>$label)
$product = new Product($this->db);
$result = $product->fetch(null, $line->product_ref);
foreach($product->array_options as $key=>$label)
$resarray["line_".$key] = $label;
}

}
return $resarray;
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3496,7 +3496,7 @@ function setIncoterms($id_incoterm, $location)

/**
* Return if a country is inside the EEC (European Economic Community)
* @deprecated Use function isInEEC function instead
* @deprecated
*
* @return boolean true = country inside EEC, false = country outside EEC
*/
Expand Down