Introduce main_doc into table of objects to know what is main doc.
Work on option PROPOSAL_USE_ONLINE_SIGN
This commit is contained in:
parent
1b563dbf76
commit
9c45e86a1c
@ -44,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/propale/modules_propale.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/signature.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
@ -2362,6 +2363,15 @@ if ($action == 'create')
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('propal'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
// Show online signature link
|
||||
$useonlinepayment = $conf->global->MAIN_FEATURES_LEVEL;
|
||||
|
||||
if ($object->statut != Propal::STATUS_DRAFT && $useonlinepayment)
|
||||
{
|
||||
print '<br>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
print showOnlineSignatureUrl('proposal', $object->ref);
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
@ -1252,7 +1252,7 @@ class Propal extends CommonObject
|
||||
$sql.= ", p.datep as dp";
|
||||
$sql.= ", p.fin_validite as dfv";
|
||||
$sql.= ", p.date_livraison as date_livraison";
|
||||
$sql.= ", p.model_pdf, p.ref_client, p.extraparams";
|
||||
$sql.= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams";
|
||||
$sql.= ", p.note_private, p.note_public";
|
||||
$sql.= ", p.fk_projet, p.fk_statut";
|
||||
$sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture";
|
||||
@ -1306,6 +1306,7 @@ class Propal extends CommonObject
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->fk_project = $obj->fk_projet;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->last_main_doc = $obj->last_main_doc;
|
||||
$this->note = $obj->note_private; // TODO deprecated
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
|
||||
@ -1553,7 +1553,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ', c.fk_shipping_method';
|
||||
$sql.= ', c.fk_warehouse';
|
||||
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed';
|
||||
$sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams';
|
||||
$sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.last_main_doc, c.fk_delivery_address, c.extraparams';
|
||||
$sql.= ', c.fk_incoterms, c.location_incoterms';
|
||||
$sql.= ", c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc";
|
||||
$sql.= ", i.libelle as libelle_incoterms";
|
||||
@ -1608,6 +1608,7 @@ class Commande extends CommonOrder
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->fk_project = $obj->fk_projet;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->last_main_doc = $obj->last_main_doc;
|
||||
$this->mode_reglement_id = $obj->fk_mode_reglement;
|
||||
$this->mode_reglement_code = $obj->mode_reglement_code;
|
||||
$this->mode_reglement = $obj->mode_reglement_libelle;
|
||||
|
||||
@ -4378,7 +4378,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
// Show online payment link
|
||||
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||
|
||||
if ($object->statut != 0 && $useonlinepayment)
|
||||
if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment)
|
||||
{
|
||||
print '<br>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
|
||||
@ -1193,7 +1193,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ', f.datec as datec';
|
||||
$sql.= ', f.date_valid as datev';
|
||||
$sql.= ', f.tms as datem';
|
||||
$sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf';
|
||||
$sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf, f.last_main_doc,';
|
||||
$sql.= ', f.fk_facture_source';
|
||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet, f.extraparams';
|
||||
$sql.= ', f.situation_cycle_ref, f.situation_counter, f.situation_final';
|
||||
@ -1262,6 +1262,7 @@ class Facture extends CommonInvoice
|
||||
$this->user_author = $obj->fk_user_author;
|
||||
$this->user_valid = $obj->fk_user_valid;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->last_main_doc = $obj->last_main_doc;
|
||||
$this->situation_cycle_ref = $obj->situation_cycle_ref;
|
||||
$this->situation_counter = $obj->situation_counter;
|
||||
$this->situation_final = $obj->situation_final;
|
||||
|
||||
@ -91,7 +91,7 @@ if ($action == 'builddoc' && $permissioncreate)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($donotredirect)) // This is se when include is done by bulk action "Bill Orders"
|
||||
if (empty($donotredirect)) // This is use when include is done by bulk action "Bill Orders"
|
||||
{
|
||||
setEventMessages($langs->trans("FileGenerated"), null);
|
||||
|
||||
|
||||
@ -4047,13 +4047,14 @@ abstract class CommonObject
|
||||
|
||||
if (in_array(get_class($this), array('Adherent')))
|
||||
{
|
||||
$arrayofrecords = array(); // The write_file of templates of adherent class need this
|
||||
$arrayofrecords = array(); // The write_file of templates of adherent class need this var
|
||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams);
|
||||
}
|
||||
else
|
||||
{
|
||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
}
|
||||
// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
|
||||
|
||||
if ($resultwritefile > 0)
|
||||
{
|
||||
@ -4080,9 +4081,19 @@ abstract class CommonObject
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($this->db);
|
||||
$result = $ecmfile->fetch(0, '', ($rel_dir?$rel_dir.'/':'').$filename);
|
||||
|
||||
if (! empty($conf->global->PROPOSAL_USE_ONLINE_SIGN))
|
||||
{
|
||||
if (empty($ecmfile->share)) // Because object not found or share not set yet
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$ecmfile->share = getRandomPassword(true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull));
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content
|
||||
$ecmfile->fullpath_orig = '';
|
||||
$ecmfile->gen_or_uploaded = 'generated';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
@ -4097,7 +4108,7 @@ abstract class CommonObject
|
||||
{
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull));
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content
|
||||
$ecmfile->fullpath_orig = '';
|
||||
$ecmfile->gen_or_uploaded = 'generated';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
@ -4108,6 +4119,21 @@ abstract class CommonObject
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
/*$this->result['fullname']=$destfull;
|
||||
$this->result['filepath']=$ecmfile->filepath;
|
||||
$this->result['filename']=$ecmfile->filename;*/
|
||||
|
||||
// Update the last_main_doc field into main object
|
||||
$update_main_doc_field=0;
|
||||
if (! empty($obj->update_main_doc_field)) $update_main_doc_field=1;
|
||||
if ($update_main_doc_field && ! empty($this->table_element))
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET last_main_doc = '".($ecmfile->filepath.'/'.$ecmfile->filename)."'";
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -99,7 +99,7 @@ function showOnlinePaymentUrl($type,$ref)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("PAYMENT");
|
||||
$langs->load("payment");
|
||||
$langs->load("paybox");
|
||||
$servicename='Online';
|
||||
|
||||
@ -110,7 +110,6 @@ function showOnlinePaymentUrl($type,$ref)
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return string with full Url
|
||||
*
|
||||
|
||||
94
htdocs/core/lib/signature.lib.php
Normal file
94
htdocs/core/lib/signature.lib.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* 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/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return string with full Url
|
||||
*
|
||||
* @param string $type Type of URL ('proposal', ...)
|
||||
* @param string $ref Ref of object
|
||||
* @return string Url string
|
||||
*/
|
||||
function showOnlineSignatureUrl($type,$ref)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("payment");
|
||||
$langs->load("paybox");
|
||||
$servicename='Online';
|
||||
|
||||
$out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlineSignature",$servicename).'<br>';
|
||||
$url = getOnlineSignatureUrl(0, $type, $ref);
|
||||
$out.= '<input type="text" id="onlinesignatureurl" class="quatrevingtpercent" value="'.$url.'">';
|
||||
$out.= ajax_autoselect("onlinesignatureurl", 0);
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return string with full Url
|
||||
*
|
||||
* @param int $mode 0=True url, 1=Url formated with colors
|
||||
* @param string $type Type of URL ('proposal', ...)
|
||||
* @param string $ref Ref of object
|
||||
* @return string Url string
|
||||
*/
|
||||
function getOnlineSignatureUrl($mode, $type, $ref='')
|
||||
{
|
||||
global $conf, $db, $langs;
|
||||
|
||||
$ref=str_replace(' ','',$ref);
|
||||
$out='';
|
||||
|
||||
if ($type == 'proposal')
|
||||
{
|
||||
$out=DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode?'<font color="#666666">':'');
|
||||
if ($mode == 1) $out.='proposal_ref';
|
||||
if ($mode == 0) $out.=urlencode($ref);
|
||||
$out.=($mode?'</font>':'');
|
||||
if ($mode == 1) $out.='&hashp=<font color="#666666">hash_of_file</font>';
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$propaltmp=new Propal($db);
|
||||
$res = $propaltmp->fetch(0, $ref);
|
||||
if ($res <= 0) return 'FailedToGetProposal';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($db);
|
||||
|
||||
$ecmfile->fetch(0, '', $propaltmp->last_main_doc);
|
||||
|
||||
$hashp=$ecmfile->share;
|
||||
if (empty($hashp))
|
||||
{
|
||||
$out = $langs->trans("FeatureOnlineSignDisabled");
|
||||
return $out;
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.='&hashp='.$hashp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For multicompany
|
||||
if (! empty($out)) $out.="&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
|
||||
|
||||
return $out;
|
||||
}
|
||||
@ -56,6 +56,11 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* @var int Save the name of generated file as the main doc when generating a doc with this template
|
||||
*/
|
||||
public $update_main_doc_field;
|
||||
|
||||
/**
|
||||
* @var string document type
|
||||
*/
|
||||
@ -100,8 +105,9 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$this->db = $db;
|
||||
$this->name = "einstein";
|
||||
$this->description = $langs->trans('PDFEinsteinDescription');
|
||||
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
|
||||
|
||||
// Dimension page pour format A4
|
||||
// Dimension page
|
||||
$this->type = 'pdf';
|
||||
$formatarray=pdf_getFormat();
|
||||
$this->page_largeur = $formatarray['width'];
|
||||
@ -599,7 +605,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // Pas d'erreur
|
||||
}
|
||||
else
|
||||
|
||||
@ -45,6 +45,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
var $db;
|
||||
var $name;
|
||||
var $description;
|
||||
var $update_main_doc_field; // Save the name of generated file as the main doc when generating a doc with this template
|
||||
var $type;
|
||||
|
||||
var $phpmin = array(4,3,0); // Minimum version of PHP required by module
|
||||
@ -86,7 +87,9 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$this->db = $db;
|
||||
$this->name = "crabe";
|
||||
$this->description = $langs->trans('PDFCrabeDescription');
|
||||
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
|
||||
|
||||
// Dimensiont page
|
||||
$this->type = 'pdf';
|
||||
$formatarray=pdf_getFormat();
|
||||
$this->page_largeur = $formatarray['width'];
|
||||
@ -702,7 +705,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // No error
|
||||
}
|
||||
else
|
||||
|
||||
@ -43,6 +43,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
var $db;
|
||||
var $name;
|
||||
var $description;
|
||||
var $update_main_doc_field; // Save the name of generated file as the main doc when generating a doc with this template
|
||||
var $type;
|
||||
|
||||
var $phpmin = array(4,3,0); // Minimum version of PHP required by module
|
||||
@ -74,8 +75,9 @@ class pdf_azur extends ModelePDFPropales
|
||||
$this->db = $db;
|
||||
$this->name = "azur";
|
||||
$this->description = $langs->trans('DocModelAzurDescription');
|
||||
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
|
||||
|
||||
// Dimension page pour format A4
|
||||
// Dimension page
|
||||
$this->type = 'pdf';
|
||||
$formatarray=pdf_getFormat();
|
||||
$this->page_largeur = $formatarray['width'];
|
||||
@ -760,7 +762,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // Pas d'erreur
|
||||
}
|
||||
else
|
||||
|
||||
@ -48,7 +48,7 @@ class EcmFiles //extends CommonObject
|
||||
*/
|
||||
public $ref; // hash of file path
|
||||
public $label; // hash of file content (md5_file(dol_osencode($destfull))
|
||||
public $share; // hash for file sharing. empty by default
|
||||
public $share; // hash for file sharing, empty by default (example: getRandomPassword(true))
|
||||
public $entity;
|
||||
public $filename;
|
||||
public $filepath;
|
||||
|
||||
@ -79,6 +79,20 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
|
||||
ALTER TABLE llx_ecm_files MODIFY label varchar(128) NOT NULL;
|
||||
ALTER TABLE llx_ecm_files ADD COLUMN share varchar(128) NULL after label;
|
||||
ALTER TABLE llx_ecm_files ADD COLUMN src_object_type varchar(32);
|
||||
ALTER TABLE llx_ecm_files ADD COLUMN src_object_id integer;
|
||||
|
||||
|
||||
ALTER TABLE llx_propal ADD COLUMN last_main_doc varchar(255);
|
||||
ALTER TABLE llx_commande ADD COLUMN last_main_doc varchar(255);
|
||||
ALTER TABLE llx_facture ADD COLUMN last_main_doc varchar(255);
|
||||
ALTER TABLE llx_contrat ADD COLUMN last_main_doc varchar(255);
|
||||
ALTER TABLE llx_expedition ADD COLUMN last_main_doc varchar(255);
|
||||
ALTER TABLE llx_fichinter ADD COLUMN last_main_doc varchar(255);
|
||||
ALTER TABLE llx_livraison ADD COLUMN last_main_doc varchar(255);
|
||||
ALTER TABLE llx_supplier_proposal ADD COLUMN last_main_doc varchar(255);
|
||||
ALTER TABLE llx_facture_fourn ADD COLUMN last_main_doc varchar(255);
|
||||
ALTER TABLE llx_commande_fournisseur ADD COLUMN last_main_doc varchar(255);
|
||||
|
||||
|
||||
ALTER TABLE llx_c_paiement ADD COLUMN position integer NOT NULL DEFAULT 0;
|
||||
|
||||
@ -54,6 +54,7 @@ create table llx_commande
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
|
||||
facture tinyint default 0,
|
||||
fk_account integer, -- bank account
|
||||
|
||||
@ -57,6 +57,7 @@ create table llx_commande_fournisseur
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
|
||||
date_livraison datetime default NULL,
|
||||
fk_account integer, -- bank account
|
||||
|
||||
@ -44,6 +44,7 @@ create table llx_contrat
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255)
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -19,12 +19,14 @@
|
||||
CREATE TABLE llx_ecm_files
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
ref varchar(128), -- contains a hash id from filename+filepath
|
||||
ref varchar(128), -- contains hash from filename+filepath
|
||||
label varchar(128) NOT NULL, -- contains hash of file content
|
||||
share varchar(128) NULL, -- contains a hash for file sharing
|
||||
share varchar(128) NULL, -- contains hash for file sharing
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
filepath varchar(255) NOT NULL, -- relative to dolibarr document dir. Example module/def
|
||||
filename varchar(255) NOT NULL, -- file name only without any directory
|
||||
src_object_type varchar(32), -- Source object type ('proposal', 'invoice', ...)
|
||||
src_object_id integer, -- Source object id
|
||||
fullpath_orig varchar(750), -- full path of original filename, when file is uploaded from a local computer
|
||||
description text,
|
||||
keywords varchar(750), -- list of keywords, separated with comma. Must be limited to most important keywords.
|
||||
|
||||
@ -54,6 +54,8 @@ create table llx_expedition
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
|
||||
fk_incoterms integer, -- for incoterms
|
||||
location_incoterms varchar(255), -- for incoterms
|
||||
|
||||
|
||||
@ -77,6 +77,7 @@ create table llx_facture
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
|
||||
fk_incoterms integer, -- for incoterms
|
||||
location_incoterms varchar(255), -- for incoterms
|
||||
|
||||
@ -71,6 +71,8 @@ create table llx_facture_fourn
|
||||
fk_incoterms integer, -- for incoterms
|
||||
location_incoterms varchar(255), -- for incoterms
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255), -- for stock other parameters with json format
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ create table llx_fichinter
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255) -- for other parameters with json format
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -40,6 +40,7 @@ create table llx_livraison
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
fk_incoterms integer, -- for incoterms
|
||||
location_incoterms varchar(255), -- for incoterms
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ create table llx_propal
|
||||
date_valid datetime, -- date de validation
|
||||
date_cloture datetime, -- date de cloture
|
||||
fk_user_author integer, -- user making creation
|
||||
fk_user_modif integer, -- user making last change
|
||||
fk_user_modif integer, -- user making last change
|
||||
fk_user_valid integer, -- user validating
|
||||
fk_user_cloture integer, -- user closing (signed or not)
|
||||
fk_statut smallint DEFAULT 0 NOT NULL, -- 0=draft, 1=validated, 2=accepted, 3=refused, 4=billed/closed
|
||||
@ -60,7 +60,10 @@ create table llx_propal
|
||||
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
|
||||
model_pdf varchar(255), -- last template used to generate main document
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
|
||||
date_livraison date DEFAULT NULL, -- delivery date
|
||||
fk_shipping_method integer, -- shipping method id
|
||||
fk_availability integer NULL,
|
||||
|
||||
@ -47,7 +47,9 @@ CREATE TABLE llx_supplier_proposal (
|
||||
fk_mode_reglement integer DEFAULT NULL,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255) DEFAULT NULL,
|
||||
model_pdf varchar(255) DEFAULT NULL,
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
|
||||
date_livraison date DEFAULT NULL,
|
||||
fk_shipping_method integer DEFAULT NULL,
|
||||
import_key varchar(14) DEFAULT NULL,
|
||||
|
||||
@ -70,3 +70,9 @@ Stats=Sales statistics
|
||||
StatusProsp=Prospect status
|
||||
DraftPropals=Draft commercial proposals
|
||||
NoLimit=No limit
|
||||
ToOfferALinkForOnlineSignature=Link for online signature
|
||||
WelcomeOnOnlineSignaturePage=Welcome on the page to accept commerical proposals from %s
|
||||
ThisScreenAllowsYouToSignDocFrom=This screen allow you to accept and sign, or refuse, a quote/commercial proposal
|
||||
ThisIsInformationOnDocumentToSign=This is information on document to accept or refuse
|
||||
SignatureProposalRef=Signature of quote/commerical proposal %s
|
||||
FeatureOnlineSignDisabled=Feature for online signing disabled or document generated before the feature was enabled
|
||||
@ -62,14 +62,16 @@ $action=GETPOST('action','alpha');
|
||||
// currency (iso code)
|
||||
|
||||
$suffix=GETPOST("suffix",'alpha');
|
||||
$SOURCE=GETPOST("source",'alpha');
|
||||
$source=GETPOST("source",'alpha');
|
||||
$ref=$REF=GETPOST("ref",'alpha');
|
||||
|
||||
if (empty($source)) $source='proposal';
|
||||
|
||||
if (! $action)
|
||||
{
|
||||
if ($source && ! $ref)
|
||||
{
|
||||
dol_print_error('',$langs->trans('ErrorBadParameters')." - ref");
|
||||
print $langs->trans('ErrorBadParameters')." - ref missing";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -90,10 +92,10 @@ $urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than cur
|
||||
// Complete urls for post treatment
|
||||
$SECUREKEY=GETPOST("securekey"); // Secure key
|
||||
|
||||
if (! empty($SOURCE))
|
||||
if (! empty($source))
|
||||
{
|
||||
$urlok.='source='.urlencode($SOURCE).'&';
|
||||
$urlko.='source='.urlencode($SOURCE).'&';
|
||||
$urlok.='source='.urlencode($source).'&';
|
||||
$urlko.='source='.urlencode($source).'&';
|
||||
}
|
||||
if (! empty($REF))
|
||||
{
|
||||
@ -113,7 +115,7 @@ if (! empty($entity))
|
||||
$urlok=preg_replace('/&$/','',$urlok); // Remove last &
|
||||
$urlko=preg_replace('/&$/','',$urlko); // Remove last &
|
||||
|
||||
|
||||
$creditor = $mysoc->name;
|
||||
|
||||
|
||||
/*
|
||||
@ -141,10 +143,10 @@ $conf->dol_hide_leftmenu=1;
|
||||
llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
||||
|
||||
// Check link validity
|
||||
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
||||
if (! empty($source) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
||||
{
|
||||
$langs->load("errors");
|
||||
dol_print_error_email('BADREFINONLINESIGNFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $SOURCE, $ref));
|
||||
dol_print_error_email('BADREFINONLINESIGNFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $source, $ref));
|
||||
llxFooter();
|
||||
$db->close();
|
||||
exit;
|
||||
@ -205,7 +207,7 @@ if (! empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT))
|
||||
}
|
||||
if (empty($text))
|
||||
{
|
||||
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePage").'</strong></td></tr>'."\n";
|
||||
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePage", $mysoc->name).'</strong></td></tr>'."\n";
|
||||
$text.='<tr><td class="textpublicpayment">'.$langs->trans("ThisScreenAllowsYouToSignDocFrom",$creditor).'<br><br></td></tr>'."\n";
|
||||
}
|
||||
print $text;
|
||||
@ -219,45 +221,24 @@ $found=false;
|
||||
$error=0;
|
||||
$var=false;
|
||||
|
||||
// Free payment
|
||||
if (! GETPOST("source"))
|
||||
{
|
||||
$found=true;
|
||||
$tag=GETPOST("tag");
|
||||
$fulltag=$tag;
|
||||
|
||||
// Creditor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
|
||||
// We do not add fields shipToName, shipToStreet, shipToCity, shipToState, shipToCountryCode, shipToZip, shipToStreet2, phoneNum
|
||||
// as they don't exists (buyer is unknown, tag is free).
|
||||
}
|
||||
|
||||
|
||||
// Payment on customer order
|
||||
if (GETPOST("source") == 'order')
|
||||
if ($source == 'proposal')
|
||||
{
|
||||
$found=true;
|
||||
$langs->load("orders");
|
||||
$langs->load("proposal");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
|
||||
$order=new Commande($db);
|
||||
$result=$order->fetch('',$ref);
|
||||
if ($result < 0)
|
||||
$proposal=new Propal($db);
|
||||
$result=$proposal->fetch('',$ref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$mesg=$order->error;
|
||||
$mesg=$proposal->error;
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$order->fetch_thirdparty($order->socid);
|
||||
$result=$proposal->fetch_thirdparty($proposal->socid);
|
||||
}
|
||||
|
||||
// Creditor
|
||||
@ -270,336 +251,21 @@ if (GETPOST("source") == 'order')
|
||||
// Debitor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$order->thirdparty->name.'</b>';
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$proposal->thirdparty->name.'</b>';
|
||||
|
||||
// Object
|
||||
|
||||
$text='<b>'.$langs->trans("PaymentOrderRef",$order->ref).'</b>';
|
||||
$text='<b>'.$langs->trans("SignatureProposalRef",$proposal->ref).'</b>';
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||
print '<input type="hidden" name="source" value="'.GETPOST("source",'alpha').'">';
|
||||
print '<input type="hidden" name="ref" value="'.$order->ref.'">';
|
||||
print '<input type="hidden" name="ref" value="'.$proposal->ref.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Payment on customer invoice
|
||||
if (GETPOST("source") == 'invoice')
|
||||
{
|
||||
$found=true;
|
||||
$langs->load("bills");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
$invoice=new Facture($db);
|
||||
$result=$invoice->fetch('',$ref);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=$invoice->error;
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$invoice->fetch_thirdparty($invoice->socid);
|
||||
}
|
||||
|
||||
if ($action != 'dosign') // Do not change amount if we just click on first dosign
|
||||
{
|
||||
$amount=price2num($invoice->total_ttc - $invoice->getSommePaiement());
|
||||
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||
$amount=price2num($amount);
|
||||
}
|
||||
|
||||
// Creditor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Debitor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$invoice->thirdparty->name.'</b>';
|
||||
|
||||
// Object
|
||||
|
||||
$text='<b>'.$langs->trans("PaymentInvoiceRef",$invoice->ref).'</b>';
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||
print '<input type="hidden" name="source" value="'.GETPOST("source",'alpha').'">';
|
||||
print '<input type="hidden" name="ref" value="'.$invoice->ref.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
}
|
||||
|
||||
// Payment on contract line
|
||||
if (GETPOST("source") == 'contractline')
|
||||
{
|
||||
$found=true;
|
||||
$langs->load("contracts");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
|
||||
$contractline=new ContratLigne($db);
|
||||
$result=$contractline->fetch('',$ref);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=$contractline->error;
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($contractline->fk_contrat > 0)
|
||||
{
|
||||
$contract=new Contrat($db);
|
||||
$result=$contract->fetch($contractline->fk_contrat);
|
||||
if ($result > 0)
|
||||
{
|
||||
$result=$contract->fetch_thirdparty($contract->socid);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$contract->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='ErrorRecordNotFound';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action != 'dosign') // Do not change amount if we just click on first dosign
|
||||
{
|
||||
$amount=$contractline->total_ttc;
|
||||
if ($contractline->fk_product)
|
||||
{
|
||||
$product=new Product($db);
|
||||
$result=$product->fetch($contractline->fk_product);
|
||||
|
||||
// We define price for product (TODO Put this in a method in product class)
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
$pu_ht = $product->multiprices[$contract->thirdparty->price_level];
|
||||
$pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level];
|
||||
$price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level];
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ht = $product->price;
|
||||
$pu_ttc = $product->price_ttc;
|
||||
$price_base_type = $product->price_base_type;
|
||||
}
|
||||
|
||||
$amount=$pu_ttc;
|
||||
if (empty($amount))
|
||||
{
|
||||
dol_print_error('','ErrorNoPriceDefinedForThisProduct');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||
$amount=price2num($amount);
|
||||
}
|
||||
|
||||
$qty=1;
|
||||
if (GETPOST('qty')) $qty=GETPOST('qty');
|
||||
|
||||
// Creditor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Debitor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$contract->thirdparty->name.'</b>';
|
||||
|
||||
// Object
|
||||
|
||||
$text='<b>'.$langs->trans("PaymentRenewContractId",$contract->ref,$contractline->ref).'</b>';
|
||||
if ($contractline->fk_product)
|
||||
{
|
||||
$text.='<br>'.$product->ref.($product->label?' - '.$product->label:'');
|
||||
}
|
||||
if ($contractline->description) $text.='<br>'.dol_htmlentitiesbr($contractline->description);
|
||||
//if ($contractline->date_fin_validite) {
|
||||
// $text.='<br>'.$langs->trans("DateEndPlanned").': ';
|
||||
// $text.=dol_print_date($contractline->date_fin_validite);
|
||||
//}
|
||||
if ($contractline->date_fin_validite)
|
||||
{
|
||||
$text.='<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_fin_validite);
|
||||
}
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||
print '<input type="hidden" name="source" value="'.GETPOST("source",'alpha').'">';
|
||||
print '<input type="hidden" name="ref" value="'.$contractline->ref.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Quantity
|
||||
|
||||
$label=$langs->trans("Quantity");
|
||||
$qty=1;
|
||||
$duration='';
|
||||
if ($contractline->fk_product)
|
||||
{
|
||||
if ($product->isService() && $product->duration_value > 0)
|
||||
{
|
||||
$label=$langs->trans("Duration");
|
||||
|
||||
// TODO Put this in a global method
|
||||
if ($product->duration_value > 1)
|
||||
{
|
||||
$dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("DurationDays"),"w"=>$langs->trans("DurationWeeks"),"m"=>$langs->trans("DurationMonths"),"y"=>$langs->trans("DurationYears"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("DurationDay"),"w"=>$langs->trans("DurationWeek"),"m"=>$langs->trans("DurationMonth"),"y"=>$langs->trans("DurationYear"));
|
||||
}
|
||||
$duration=$product->duration_value.' '.$dur[$product->duration_unit];
|
||||
}
|
||||
}
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$label.'</td>';
|
||||
print '<td class="CTableRow'.($var?'1':'2').'"><b>'.($duration?$duration:$qty).'</b>';
|
||||
print '<input type="hidden" name="newqty" value="'.dol_escape_htmltag($qty).'">';
|
||||
print '</b></td></tr>'."\n";
|
||||
|
||||
// Amount
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
|
||||
if (empty($amount)) print ' ('.$langs->trans("ToComplete").')';
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">';
|
||||
if (empty($amount) || ! is_numeric($amount))
|
||||
{
|
||||
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
|
||||
print '<input class="flat" size=8 type="text" name="newamount" value="'.GETPOST("newamount","int").'">';
|
||||
}
|
||||
else {
|
||||
print '<b>'.price($amount).'</b>';
|
||||
print '<input type="hidden" name="amount" value="'.$amount.'">';
|
||||
print '<input type="hidden" name="newamount" value="'.$amount.'">';
|
||||
}
|
||||
// Currency
|
||||
print ' <b>'.$langs->trans("Currency".$currency).'</b>';
|
||||
print '<input type="hidden" name="currency" value="'.$currency.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
}
|
||||
|
||||
// Payment on member subscription
|
||||
if (GETPOST("source") == 'membersubscription')
|
||||
{
|
||||
$found=true;
|
||||
$langs->load("members");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
|
||||
$member=new Adherent($db);
|
||||
$result=$member->fetch('',$ref);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=$member->error;
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$subscription=new Subscription($db);
|
||||
}
|
||||
|
||||
if ($action != 'dosign') // Do not change amount if we just click on first dosign
|
||||
{
|
||||
$amount=$subscription->total_ttc;
|
||||
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||
$amount=price2num($amount);
|
||||
}
|
||||
|
||||
$fulltag='MEM='.$member->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
|
||||
if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; }
|
||||
$fulltag=dol_string_unaccent($fulltag);
|
||||
|
||||
// Creditor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Debitor
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Member");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>';
|
||||
if ($member->morphy == 'mor' && ! empty($member->societe)) print $member->societe;
|
||||
else print $member->getFullName($langs);
|
||||
print '</b>';
|
||||
|
||||
// Object
|
||||
|
||||
$text='<b>'.$langs->trans("PaymentSubscription").'</b>';
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||
print '<input type="hidden" name="source" value="'.GETPOST("source",'alpha').'">';
|
||||
print '<input type="hidden" name="ref" value="'.$member->ref.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
if ($member->last_subscription_date || $member->last_subscription_amount)
|
||||
{
|
||||
// Last subscription date
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("LastSubscriptionDate");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.dol_print_date($member->last_subscription_date,'day');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Last subscription amount
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("LastSubscriptionAmount");
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.price($member->last_subscription_amount);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
if (empty($amount) && ! GETPOST('newamount')) $_GET['newamount']=$member->last_subscription_amount;
|
||||
}
|
||||
|
||||
// Amount
|
||||
|
||||
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
|
||||
if (empty($amount))
|
||||
{
|
||||
print ' ('.$langs->trans("ToComplete");
|
||||
if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>';
|
||||
print ')';
|
||||
}
|
||||
print '</td><td class="CTableRow'.($var?'1':'2').'">';
|
||||
if (empty($amount) || ! is_numeric($amount))
|
||||
{
|
||||
$valtoshow=GETPOST("newamount",'int');
|
||||
if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow);
|
||||
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
|
||||
print '<input class="flat" size="8" type="text" name="newamount" value="'.$valtoshow.'">';
|
||||
}
|
||||
else {
|
||||
$valtoshow=$amount;
|
||||
if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow);
|
||||
print '<b>'.price($valtoshow).'</b>';
|
||||
print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
|
||||
print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
|
||||
}
|
||||
// Currency
|
||||
print ' <b>'.$langs->trans("Currency".$currency).'</b>';
|
||||
print '<input type="hidden" name="currency" value="'.$currency.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters");
|
||||
|
||||
@ -617,7 +283,7 @@ if ($action != 'dosign')
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error_email('ERRORNEWONLINESIGNPAYPAL');
|
||||
dol_print_error_email('ERRORNEWONLINESIGN');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -673,7 +673,7 @@ if ($source == 'order')
|
||||
|
||||
$order=new Commande($db);
|
||||
$result=$order->fetch('',$ref);
|
||||
if ($result < 0)
|
||||
if ($result <= 0)
|
||||
{
|
||||
$mesg=$order->error;
|
||||
$error++;
|
||||
@ -788,7 +788,7 @@ if ($source == 'invoice')
|
||||
|
||||
$invoice=new Facture($db);
|
||||
$result=$invoice->fetch('',$ref);
|
||||
if ($result < 0)
|
||||
if ($result <= 0)
|
||||
{
|
||||
$mesg=$invoice->error;
|
||||
$error++;
|
||||
@ -911,7 +911,7 @@ if ($source == 'contractline')
|
||||
$contractline=new ContratLigne($db);
|
||||
|
||||
$result=$contractline->fetch('',$ref);
|
||||
if ($result < 0)
|
||||
if ($result <= 0)
|
||||
{
|
||||
$mesg=$contractline->error;
|
||||
$error++;
|
||||
@ -1116,7 +1116,7 @@ if ($source == 'membersubscription')
|
||||
|
||||
$member=new Adherent($db);
|
||||
$result=$member->fetch('',$ref);
|
||||
if ($result < 0)
|
||||
if ($result <= 0)
|
||||
{
|
||||
$mesg=$member->error;
|
||||
$error++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user