2
0
forked from Wavyzz/dolibarr

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

This commit is contained in:
Laurent Destailleur
2020-10-22 17:55:47 +02:00
41 changed files with 263 additions and 107 deletions

View File

@@ -75,6 +75,9 @@ if ($action == 'add' && !empty($permissiontoadd))
$value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup
} elseif ($object->fields[$key]['type'] == 'boolean') {
$value = ((GETPOST($key) == '1' || GETPOST($key) == 'on') ? 1 : 0);
} elseif ($object->fields[$key]['type'] == 'reference') {
$tmparraykey = array_keys($object->param_list);
$value = $tmparraykey[GETPOST($key)].','.GETPOST($key.'2');
} else {
$value = GETPOST($key, 'alphanohtml');
}
@@ -162,6 +165,8 @@ if ($action == 'update' && !empty($permissiontoadd))
$value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup
} elseif ($object->fields[$key]['type'] == 'boolean') {
$value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0);
} elseif ($object->fields[$key]['type'] == 'reference') {
$value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2');
} else {
$value = GETPOST($key, 'alpha');
}

View File

@@ -33,18 +33,24 @@ if ($action == 'print_file' && $user->rights->printing->read) {
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/modules_printing.php';
$objectprint = new PrintingDriver($db);
$list = $objectprint->listDrivers($db, 10);
$dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']);
if (!empty($list)) {
$errorprint = 0;
$printerfound = 0;
foreach ($list as $driver) {
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
$langs->load($driver);
foreach ($dirmodels as $dir) {
if (file_exists(dol_buildpath($dir, 0).$driver.'.modules.php')) {
$classfile = dol_buildpath($dir, 0).$driver.'.modules.php';
break;
}
}
require_once $classfile;
$classname = 'printing_'.$driver;
$printer = new $classname($db);
$langs->load($printer::LANGFILE);
//print '<pre>'.print_r($printer, true).'</pre>';
if (!empty($conf->global->{$printer->active}))
{
if (!empty($conf->global->{$printer->active})) {
$printerfound++;
$subdir = '';

View File

@@ -125,7 +125,7 @@ class box_services_contracts extends ModeleBoxes
$contractlinestatic->type = $objp->type;
$contractlinestatic->product_id = $objp->product_id;
$contractlinestatic->product_ref = $objp->product_ref;
$contratlignestatic->product_type = $objp->product_type;
$contractlinestatic->product_type = $objp->product_type;
$contractlinestatic->statut = $objp->contractline_status;

View File

@@ -815,7 +815,7 @@ class dolReceiptPrinter extends Printer
}
}
// If is DummyPrintConnector send to log to debugging
if ($this->printer->connector instanceof DummyPrintConnector)
if ($this->printer->connector instanceof DummyPrintConnector || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector")
{
$data = $this->printer->connector->getData();
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") echo base64_encode($data);
@@ -868,6 +868,11 @@ class dolReceiptPrinter extends Printer
public function initPrinter($printerid)
{
global $conf;
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector"){
$this->connector = new DummyPrintConnector();
$this->printer = new Printer($this->connector, $this->profile);
return;
}
$error = 0;
$sql = 'SELECT rowid, name, fk_type, fk_profile, parameter';
$sql .= ' FROM '.MAIN_DB_PREFIX.'printer_receipt';

View File

@@ -4390,7 +4390,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
// Right
print '<td class="nobordernopadding valignmiddle right">';
print '<input type="hidden" name="pageplusoneold" value="'.($page+1).'">';
print '<input type="hidden" name="pageplusoneold" value="'.((int) $page + 1).'">';
if ($sortfield) $options .= "&sortfield=".urlencode($sortfield);
if ($sortorder) $options .= "&sortorder=".urlencode($sortorder);
// Show navigation bar

View File

@@ -1278,6 +1278,9 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
// Description short of product line
$libelleproduitservice = $label;
if (!empty($libelleproduitservice) && !empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) {
$libelleproduitservice = '<b>' . $libelleproduitservice . '</b>';
}
// Description long of product line
if (!empty($desc) && ($desc != $label))

View File

@@ -1656,7 +1656,7 @@ class pdf_crabe extends ModelePDFFactures
if ($object->type == 2) $title = $outputlangs->transnoentities("InvoiceAvoir");
if ($object->type == 3) $title = $outputlangs->transnoentities("InvoiceDeposit");
if ($object->type == 4) $title = $outputlangs->transnoentities("InvoiceProForma");
if ($this->situationinvoice) $title = $outputlangs->transnoentities("InvoiceSituation");
if ($this->situationinvoice) $title = $outputlangs->transnoentities("PDFInvoiceSituation");
$pdf->MultiCell($w, 3, $title, '', 'R');
$pdf->SetFont('', 'B', $default_font_size);

View File

@@ -1899,11 +1899,11 @@ class pdf_sponge extends ModelePDFFactures
if ($object->type == 2) $title = $outputlangs->transnoentities("InvoiceAvoir");
if ($object->type == 3) $title = $outputlangs->transnoentities("InvoiceDeposit");
if ($object->type == 4) $title = $outputlangs->transnoentities("InvoiceProForma");
if ($this->situationinvoice) $title = $outputlangs->transnoentities("InvoiceSituation");
if ($this->situationinvoice) $title = $outputlangs->transnoentities("PDFInvoiceSituation");
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
$title .= ' - ';
if ($object->type == 0) {
if ($this->situationinvoice) $title .= $outputlangsbis->transnoentities("InvoiceSituation");
if ($this->situationinvoice) $title .= $outputlangsbis->transnoentities("PDFInvoiceSituation");
$title .= $outputlangsbis->transnoentities("PdfInvoiceTitle");
} elseif ($object->type == 1) $title .= $outputlangsbis->transnoentities("InvoiceReplacement");
elseif ($object->type == 2) $title .= $outputlangsbis->transnoentities("InvoiceAvoir");

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
*
* 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
@@ -68,7 +69,7 @@ class mod_mo_advanced extends ModeleNumRefMos
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
$texte .= '<input type="hidden" name="action" value="updateMask">';
$texte .= '<input type="hidden" name="maskconstBom" value="MRP_MO_ADVANCED_MASK">';
$texte .= '<input type="hidden" name="maskconstMo" value="MRP_MO_ADVANCED_MASK">';
$texte .= '<table class="nobordernopadding" width="100%">';
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Mo"), $langs->transnoentities("Mo"));

View File

@@ -66,12 +66,17 @@ class PrintingDriver
$type = 'printing';
$list = array();
$moduledir = DOL_DOCUMENT_ROOT."/core/modules/printing/";
$tmpfiles = dol_dir_list($moduledir, 'all', 0, '\modules.php', '', 'name', SORT_ASC, 0);
foreach ($tmpfiles as $record) {
$listoffiles = array();
$dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']);
foreach ($dirmodels as $dir) {
$tmpfiles = dol_dir_list(dol_buildpath($dir, 0), 'all', 0, '\modules.php', '', 'name', SORT_ASC, 0);
if (!empty($tmpfiles)) {
$listoffiles = array_merge($listoffiles, $tmpfiles);
}
}
foreach ($listoffiles as $record) {
$list[$record['fullname']] = str_replace('.modules.php', '', $record['name']);
}
}
return $list;
}

View File

@@ -35,16 +35,39 @@ use OAuth\OAuth2\Service\Google;
*/
class printing_printgcp extends PrintingDriver
{
/**
* @var string module name
*/
public $name = 'printgcp';
/**
* @var string module description
*/
public $desc = 'PrintGCPDesc';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'printer';
/**
* @var string module description
*/
public $active = 'PRINTING_PRINTGCP';
/**
* @var array module parameters
*/
public $conf = array();
/**
* @var string google id
*/
public $google_id = '';
/**
* @var string google secret
*/
public $google_secret = '';
/**
@@ -68,6 +91,7 @@ class printing_printgcp extends PrintingDriver
const PRINTERS_SEARCH_URL = 'https://www.google.com/cloudprint/search';
const PRINTERS_GET_JOBS = 'https://www.google.com/cloudprint/jobs';
const PRINT_URL = 'https://www.google.com/cloudprint/submit';
const LANGFILE = 'printgcp';
/**
* Constructor
@@ -280,7 +304,7 @@ class printing_printgcp extends PrintingDriver
$responsedata = json_decode($response, true);
$printers = $responsedata['printers'];
// Check if we have printers?
if (count($printers) == 0) {
if (is_array($printers) && count($printers) == 0) {
// We dont have printers so return blank array
$ret['available'] = array();
} else {

View File

@@ -30,19 +30,54 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/printing/modules_printing.php';
*/
class printing_printipp extends PrintingDriver
{
/**
* @var string module name
*/
public $name = 'printipp';
/**
* @var string module description
*/
public $desc = 'PrintIPPDesc';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'printer';
/**
* @var string Constant name
*/
public $active = 'PRINTING_PRINTIPP';
/**
* @var array array of setup value
*/
public $conf = array();
/**
* @var string host
*/
public $host;
/**
* @var string port
*/
public $port;
public $userid; /* user login */
/**
* @var string username
*/
public $userid;
/**
* @var string login for printer host
*/
public $user;
/**
* @var string password for printer host
*/
public $password;
/**
@@ -60,6 +95,8 @@ class printing_printipp extends PrintingDriver
*/
public $db;
const LANGFILE = 'printipp';
/**
* Constructor
@@ -113,7 +150,7 @@ class printing_printipp extends PrintingDriver
$obj = $this->db->fetch_object($result);
if ($obj)
{
dol_syslog("Found a default printer for user ".$user->id." = ".$obj->printer_id);
dol_syslog("Found a default printer for user ".$user->id." = ".$obj->printer_id);
$ipp->setPrinterURI($obj->printer_id);
} else {
if (!empty($conf->global->PRINTIPP_URI_DEFAULT))