Merge branch 'develop' into 7.0_fix_invoicelist

This commit is contained in:
Laurent Destailleur 2018-03-09 22:37:20 +01:00 committed by GitHub
commit d8d13a7348
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
609 changed files with 20986 additions and 10790 deletions

View File

@ -327,6 +327,9 @@ script:
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade600700-2.log
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log
php upgrade2.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-2.log
php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log
cd -
set +e
echo

View File

@ -2,6 +2,20 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 8.0.0 compared to 7.0.0 *****
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Hook 'maildao' was renamed into 'mail' into the method sendfile that send emails, and method was renamed from
'doaction' into 'sendMail'.
* Rename trigger CONTRACT_SERVICE_ACTIVATE into LINECONTRACT_ACTIVATE and
CONTRACT_SERVICE_CLOSE into LINECONTRACT_CLOSE
* Remove triggers *_CLONE. The trigger CREATE with context 'createfromclone' is already called so this is
a duplicated feature. Cloning is not a business event, the business event is CREATE, so no trigger required.
***** 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)

View File

@ -28,27 +28,331 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
/**
* Class to manage categories of an accounting account
*/
class AccountancyCategory
class AccountancyCategory // extends CommonObject
{
private $db;
public $error;
public $errors = array ();
public $element = 'accounting_category';
public $table_element = 'c_accounting_category';
public $db; //!< To store db handler
public $error; //!< To return error code (or message)
public $errors=array(); //!< To return several error codes (or messages)
public $element='c_accounting_category'; //!< Id that identify managed objects
public $table_element='c_accounting_category'; //!< Name of table without prefix where object is stored
public $id;
public $code;
public $label;
public $range_account;
public $sens;
public $category_type;
public $formula;
public $position;
public $fk_country;
public $active;
public $lines_cptbk;
public $lines_display;
public $sdc;
/**
* Constructor
* Constructor
*
* @param DoliDB $db Database handler
* @param DoliDb $db Database handler
*/
public function __construct($db) {
function __construct($db)
{
$this->db = $db;
}
/**
* Create object into database
*
* @param User $user User that create
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
function create($user, $notrigger=0)
{
global $conf, $langs;
$error=0;
// Clean parameters
if (isset($this->code)) $this->code=trim($this->code);
if (isset($this->label)) $this->label=trim($this->label);
if (isset($this->range_account)) $this->range_account=trim($this->range_account);
if (isset($this->sens)) $this->sens=trim($this->sens);
if (isset($this->category_type)) $this->category_type=trim($this->category_type);
if (isset($this->formula)) $this->formula=trim($this->formula);
if (isset($this->position)) $this->position=trim($this->position);
if (isset($this->fk_country)) $this->fk_country=trim($this->fk_country);
if (isset($this->active)) $this->active=trim($this->active);
// Check parameters
// Put here code to add control on parameters values
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category(";
if ($this->rowid > 0) $sql.= "rowid,";
$sql.= "code,";
$sql.= "label,";
$sql.= "range_account,";
$sql.= "sens,";
$sql.= "category_type,";
$sql.= "formula,";
$sql.= "position,";
$sql.= "fk_country,";
$sql.= "active";
$sql.= ") VALUES (";
if ($this->rowid > 0) $sql.= " ".$this->rowid.",";
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").",";
$sql.= " ".(! isset($this->range_account)?'NULL':"'".$this->db->escape($this->range_account)."'").",";
$sql.= " ".(! isset($this->sens)?'NULL':"'".$this->db->escape($this->sens)."'").",";
$sql.= " ".(! isset($this->category_type)?'NULL':"'".$this->db->escape($this->category_type)."'").",";
$sql.= " ".(! isset($this->formula)?'NULL':"'".$this->db->escape($this->formula)."'").",";
$sql.= " ".(! isset($this->position)?'NULL':$this->db->escape($this->position)).",";
$sql.= " ".(! isset($this->fk_country)?'NULL':$this->db->escape($this->fk_country)).",";
$sql.= " ".(! isset($this->active)?'NULL':$this->db->escape($this->active));
$sql.= ")";
$this->db->begin();
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_accounting_category");
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return $this->id;
}
}
/**
* Load object in memory from database
*
* @param int $id Id object
* @param string $code Code
* @param string $label Label
* @return int <0 if KO, >0 if OK
*/
function fetch($id,$code='',$label='')
{
global $langs;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.code,";
$sql.= " t.label,";
$sql.= " t.range_account,";
$sql.= " t.sens,";
$sql.= " t.category_type,";
$sql.= " t.formula,";
$sql.= " t.position,";
$sql.= " t.fk_country,";
$sql.= " t.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t";
if ($id) $sql.= " WHERE t.rowid = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
elseif ($label) $sql.= " WHERE t.label = '".$this->db->escape($label)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->code = $obj->code;
$this->label = $obj->label;
$this->range_account = $obj->range_account;
$this->sens = $obj->sens;
$this->category_type = $obj->category_type;
$this->formula = $obj->formula;
$this->position = $obj->position;
$this->fk_country = $obj->fk_country;
$this->active = $obj->active;
}
$this->db->free($resql);
return 1;
}
else
{
$this->error="Error ".$this->db->lasterror();
return -1;
}
}
/**
* Update object into database
*
* @param User $user User that modify
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;
// Clean parameters
if (isset($this->code)) $this->code=trim($this->code);
if (isset($this->label)) $this->label=trim($this->label);
if (isset($this->range_account)) $this->range_account=trim($this->range_account);
if (isset($this->sens)) $this->sens=trim($this->sens);
if (isset($this->category_type)) $this->category_type=trim($this->category_type);
if (isset($this->formula)) $this->formula=trim($this->formula);
if (isset($this->position)) $this->position=trim($this->position);
if (isset($this->fk_country)) $this->fk_country=trim($this->fk_country);
if (isset($this->active)) $this->active=trim($this->active);
// Check parameters
// Put here code to add control on parameters values
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."c_accounting_category SET";
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").",";
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
$sql.= " range_account=".(isset($this->range_account)?"'".$this->db->escape($this->range_account)."'":"null").",";
$sql.= " sens=".(isset($this->sens)?$this->sens:"null").",";
$sql.= " category_type=".(isset($this->category_type)?$this->category_type:"null").",";
$sql.= " formula=".(isset($this->formula)?"'".$this->db->escape($this->formula)."'":"null").",";
$sql.= " position=".(isset($this->position)?$this->position:"null").",";
$sql.= " fk_country=".(isset($this->fk_country)?$this->fk_country:"null").",";
$sql.= " active=".(isset($this->active)?$this->active:"null")."";
$sql.= " WHERE rowid=".$this->id;
$this->db->begin();
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return 1;
}
}
/**
* Delete object in database
*
* @param User $user User that delete
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger=0)
{
global $conf, $langs;
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_accounting_category";
$sql.= " WHERE rowid=".$this->id;
$this->db->begin();
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return 1;
}
}
/**
* Function to select all accounting accounts from an accounting category
*
@ -443,65 +747,6 @@ class AccountancyCategory
}
// calcule
/* I try to replace this with dol_eval()
const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/';
const PARENTHESIS_DEPTH = 10;
public function calculate($input)
{
global $langs;
if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){
// Remove white spaces and invalid math chars
$input = str_replace($langs->trans("ThousandSeparator"), '', $input);
$input = str_replace(',', '.', $input);
$input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input);
// Calculate each of the parenthesis from the top
$i = 0;
while(strpos($input, '(') || strpos($input, ')')){
$input = preg_replace_callback('/\(([^\(\)]+)\)/', 'self::callback', $input);
$i++;
if($i > self::PARENTHESIS_DEPTH){
break;
}
}
// Calculate the result
if(preg_match(self::PATTERN, $input, $match)){
return $this->compute($match[0]);
}
return 0;
}
return $input;
}
private function compute($input){
$compute = create_function('', 'return '.$input.';');
return 0 + $compute();
}
private function callback($input){
if(is_numeric($input[1])){
return $input[1];
}
elseif(preg_match(self::PATTERN, $input[1], $match)){
return $this->compute($match[0]);
}
return 0;
}
*/
/**
* Get all accounting account of a group.
* You must choose between first parameter (personalized group) or the second (free criteria filter)

View File

@ -882,7 +882,7 @@ if (empty($action) || $action == 'view') {
else print $accountoshow;
print '</td>';
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
print '<td align="right">'. ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
//}
@ -976,7 +976,7 @@ if (empty($action) || $action == 'view') {
print "<td>";
print '</td>';
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT") . " NPR (counterpart)</td>";
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
}

View File

@ -1003,7 +1003,7 @@ else
if ($res < 0) {
dol_print_error($db,$object->error); exit;
}
$res=$object->fetch_optionals($object->id,$extralabels);
$res=$object->fetch_optionals();
if ($res < 0) {
dol_print_error($db); exit;
}
@ -1272,7 +1272,7 @@ else
if ($res < 0) {
dol_print_error($db,$object->error); exit;
}
$res=$object->fetch_optionals($object->id,$extralabels);
$res=$object->fetch_optionals();
if ($res < 0) {
dol_print_error($db); exit;
}

View File

@ -1156,12 +1156,9 @@ class Adherent extends CommonObject
$this->model_pdf = $obj->model_pdf;
// Retreive all extrafield for thirdparty
// Retreive all extrafield
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
// Load other properties
$result=$this->fetch_subscriptions();
@ -1251,9 +1248,9 @@ class Adherent extends CommonObject
* Insert subscription into database and eventually add links to banks, mailman, etc...
*
* @param int $date Date of effect of subscription
* @param double $montant Amount of subscription (0 accepted for some members)
* @param double $amount Amount of subscription (0 accepted for some members)
* @param int $accountid Id bank account
* @param string $operation Type operation (if Id bank account provided)
* @param string $operation Type of payment (if Id bank account provided). Example: 'CB', ...
* @param string $label Label operation (if Id bank account provided)
* @param string $num_chq Numero cheque (if Id bank account provided)
* @param string $emetteur_nom Name of cheque writer
@ -1261,7 +1258,7 @@ class Adherent extends CommonObject
* @param int $datesubend Date end subscription
* @return int rowid of record added, <0 if KO
*/
function subscription($date, $montant, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0)
function subscription($date, $amount, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0)
{
global $conf,$langs,$user;
@ -1270,7 +1267,7 @@ class Adherent extends CommonObject
$error=0;
// Clean parameters
if (! $montant) $montant=0;
if (! $amount) $amount=0;
$this->db->begin();
@ -1290,8 +1287,9 @@ class Adherent extends CommonObject
$subscription->fk_adherent=$this->id;
$subscription->dateh=$date; // Date of new subscription
$subscription->datef=$datefin; // End data of new subscription
$subscription->amount=$montant;
$subscription->note=$label;
$subscription->amount=$amount;
$subscription->note=$label; // deprecated
$subscription->note_public=$label;
$rowid=$subscription->create($user);
if ($rowid > 0)
@ -1303,7 +1301,7 @@ class Adherent extends CommonObject
{
// Change properties of object (used by triggers)
$this->last_subscription_date=dol_now();
$this->last_subscription_amount=$montant;
$this->last_subscription_amount=$amount;
$this->last_subscription_date_start=$date;
$this->last_subscription_date_end=$datefin;
}
@ -1322,11 +1320,314 @@ class Adherent extends CommonObject
else
{
$this->error=$subscription->error;
$this->errors=$subscription->errors;
$this->db->rollback();
return -1;
}
}
/**
* Do complementary actions after subscription recording.
*
* @param int $subscriptionid Id of created subscription
* @param string $option Which action ('bankdirect', 'invoiceonly', ...)
* @param int $accountid Id bank account
* @param int $datesubscription Date of subscription
* @param int $paymentdate Date of payment
* @param string $operation Code of type of operation (if Id bank account provided). Example 'CB', ...
* @param string $label Label operation (if Id bank account provided)
* @param double $amount Amount of subscription (0 accepted for some members)
* @param string $num_chq Numero cheque (if Id bank account provided)
* @param string $emetteur_nom Name of cheque writer
* @param string $emetteur_banque Name of bank of cheque
* @param string $autocreatethirdparty Auto create new thirdparty if member not linked to a thirdparty.
* @return int <0 if KO, >0 if OK
*/
function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom='', $emetteur_banque='', $autocreatethirdparty=0)
{
global $conf, $langs, $user, $mysoc;
$error = 0;
$this->invoice = null; // This will contains invoice if an invoice is created
// Insert into bank account directlty (if option choosed for) + link to llx_subscription if option is 'bankdirect'
if ($option == 'bankdirect' && $accountid)
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$acct=new Account($this->db);
$result=$acct->fetch($accountid);
$dateop=$paymentdate;
$insertid=$acct->addline($dateop, $operation, $label, $amount, $num_chq, '', $user, $emetteur_nom, $emetteur_banque);
if ($insertid > 0)
{
$inserturlid=$acct->add_url_line($insertid, $this->id, DOL_URL_ROOT.'/adherents/card.php?rowid=', $this->getFullname($langs), 'member');
if ($inserturlid > 0)
{
// Update table subscription
$sql ="UPDATE ".MAIN_DB_PREFIX."subscription SET fk_bank=".$insertid;
$sql.=" WHERE rowid=".$subscriptionid;
dol_syslog("subscription::subscription", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql)
{
$error++;
$this->error=$this->db->lasterror();
$this->errors[]=$this->error;
}
}
else
{
$error++;
$this->error=$acct->error;
$this->errors=$acct->errors;
}
}
else
{
$error++;
$this->error=$acct->error;
$this->errors=$acct->errors;
}
}
// If option choosed, we create invoice
if (($option == 'bankviainvoice' && $accountid) || $option == 'invoiceonly')
{
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php';
$invoice=new Facture($this->db);
$customer=new Societe($this->db);
if (! $error)
{
if (! ($this->fk_soc > 0))
{
if ($autocreatethirdparty)
{
// Create a linked thirdparty to member
$companyalias='';
$fullname = $this->getFullName($langs);
if ($this->morphy == 'mor')
{
$companyname=$this->societe;
if (! empty($fullname)) $companyalias=$fullname;
}
else
{
$companyname=$fullname;
if (! empty($this->societe)) $companyalias=$this->societe;
}
$result=$customer->create_from_member($this, $companyname, $companyalias);
if ($result < 0)
{
$this->error = $company->error;
$this->errors = $company->errors;
$error++;
}
else
{
$this->fk_soc = $result;
}
}
else
{
$langs->load("errors");
$this->error=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
$this->errors[]=$this->error;
$error++;
}
}
}
if (! $error)
{
$result=$customer->fetch($this->fk_soc);
if ($result <= 0)
{
$this->error=$customer->error;
$this->errors=$customer->errors;
$error++;
}
}
if (! $error)
{
// Create draft invoice
$invoice->type=Facture::TYPE_STANDARD;
$invoice->cond_reglement_id=$customer->cond_reglement_id;
if (empty($invoice->cond_reglement_id))
{
$paymenttermstatic=new PaymentTerm($this->db);
$invoice->cond_reglement_id=$paymenttermstatic->getDefaultId();
if (empty($invoice->cond_reglement_id))
{
$error++;
$this->error='ErrorNoPaymentTermRECEPFound';
$this->errors[]=$this->error;
}
}
$invoice->socid=$this->fk_soc;
$invoice->date=$datesubscription;
// Possibility to add external linked objects with hooks
$invoice->linked_objects['subscription'] = $subscriptionid;
if (! empty($_POST['other_linked_objects']) && is_array($_POST['other_linked_objects']))
{
$invoice->linked_objects = array_merge($invoice->linked_objects, $_POST['other_linked_objects']);
}
$result=$invoice->create($user);
if ($result <= 0)
{
$this->error=$invoice->error;
$this->errors=$invoice->errors;
$error++;
}
else
{
$this->invoice = $invoice;
}
}
if (! $error)
{
// Add line to draft invoice
$idprodsubscription=0;
if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) $idprodsubscription = $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS;
$vattouse=0;
if (isset($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) && $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry')
{
$vattouse=get_default_tva($mysoc, $mysoc, $idprodsubscription);
}
//print xx".$vattouse." - ".$mysoc." - ".$customer;exit;
$result=$invoice->addline($label,0,1,$vattouse,0,0,$idprodsubscription,0,$datesubscription,$datesubend,0,0,'','TTC',$amount,1);
if ($result <= 0)
{
$this->error=$invoice->error;
$this->errors=$invoice->errors;
$error++;
}
}
if (! $error)
{
// Validate invoice
$result=$invoice->validate($user);
if ($result <= 0)
{
$this->error=$invoice->error;
$this->errors=$invoice->errors;
$error++;
}
}
if (! $error)
{
// TODO Link invoice with subscription ?
}
// Add payment onto invoice
if (! $error && $option == 'bankviainvoice' && $accountid)
{
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
$amounts = array();
$amounts[$invoice->id] = price2num($amount);
$paiement = new Paiement($this->db);
$paiement->datepaye = $paymentdate;
$paiement->amounts = $amounts;
$paiement->paiementid = dol_getIdFromCode($this->db,$operation,'c_paiement','code','id',1);
$paiement->num_paiement = $num_chq;
$paiement->note = $label;
$paiement->note_public = $label;
if (! $error)
{
// Create payment line for invoice
$paiement_id = $paiement->create($user);
if (! $paiement_id > 0)
{
$this->error=$paiement->error;
$this->errors=$paiement->errors;
$error++;
}
}
if (! $error)
{
// Add transaction into bank account
$bank_line_id=$paiement->addPaymentToBank($user,'payment','(SubscriptionPayment)',$accountid,$emetteur_nom,$emetteur_banque);
if (! ($bank_line_id > 0))
{
$this->error=$paiement->error;
$this->errors=$paiement->errors;
$error++;
}
}
if (! $error)
{
// Update fk_bank into subscription table
$sql = 'UPDATE '.MAIN_DB_PREFIX.'subscription SET fk_bank='.$bank_line_id;
$sql.= ' WHERE rowid='.$subscriptionid;
$result = $this->db->query($sql);
if (! $result)
{
$error++;
}
}
if (! $error)
{
// Set invoice as paid
$invoice->set_paid($user);
}
}
if (! $error)
{
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
$newlang = $_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $customer->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
// Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
$invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
if ($error)
{
return -1;
}
else
{
return 1;
}
}
/**
* Function that validate a member
*
@ -2158,9 +2459,9 @@ class Adherent extends CommonObject
/**
* Function used to replace a thirdparty id with another one.
*
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @return bool
*/
public static function replaceThirdparty($db, $origin_id, $dest_id)

View File

@ -118,7 +118,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
{
if ($result > 0)
{
// Creation user
// Creation of thirdparty
$company = new Societe($db);
$result=$company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha'));
@ -203,8 +203,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$langs->load("banks");
$result=$object->fetch($rowid);
$result=$adht->fetch($object->typeid);
$result = $object->fetch($rowid);
$result = $adht->fetch($object->typeid);
// Subscription informations
$datesubscription=0;
@ -222,7 +222,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{
$paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
}
$subscription=price2num(GETPOST("subscription",'alpha')); // Amount of subscription
$amount=price2num(GETPOST("subscription",'alpha')); // Amount of subscription
$label=$_POST["label"];
// Payment informations
@ -233,6 +233,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$emetteur_banque=$_POST["chqbank"];
$option=$_POST["paymentsave"];
if (empty($option)) $option='none';
$sendalsoemail=GETPOST("sendmail",'alpha');
// Check parameters
if (! $datesubscription)
@ -263,8 +264,6 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$action='addsubscription';
}
$amount = price2num(GETPOST("subscription",'alpha'));
// Check if a payment is mandatory or not
if (! $error && $adht->subscription) // Member type need subscriptions
{
@ -292,6 +291,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
}
if ($errmsg)
{
$error++;
setEventMessages($errmsg, null, 'errors');
$error++;
$action='addsubscription';
@ -300,12 +300,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
}
}
// Record the subscription then complementary actions
if (! $error && $action=='subscription')
{
$db->begin();
// Create subscription
$crowid=$object->subscription($datesubscription, $subscription, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
$crowid=$object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
if ($crowid <= 0)
{
$error++;
@ -315,238 +316,21 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if (! $error)
{
// Insert into bank account directlty (if option choosed for) + link to llx_subscription if option is 'bankdirect'
if ($option == 'bankdirect' && $accountid)
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$acct=new Account($db);
$result=$acct->fetch($accountid);
$dateop=$paymentdate;
$insertid=$acct->addline($dateop, $operation, $label, $subscription, $num_chq, '', $user, $emetteur_nom, $emetteur_banque);
if ($insertid > 0)
{
$inserturlid=$acct->add_url_line($insertid, $object->id, DOL_URL_ROOT.'/adherents/card.php?rowid=', $object->getFullname($langs), 'member');
if ($inserturlid > 0)
{
// Update table subscription
$sql ="UPDATE ".MAIN_DB_PREFIX."subscription SET fk_bank=".$insertid;
$sql.=" WHERE rowid=".$crowid;
dol_syslog("subscription::subscription", LOG_DEBUG);
$resql = $db->query($sql);
if (! $resql)
{
$error++;
$errmsg=$db->lasterror();
setEventMessages($errmsg, null, 'errors');
}
}
else
{
$error++;
$errmsg=$acct->error;
$errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
}
}
else
{
$error++;
$errmsg=$acct->error;
$errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
}
}
// If option choosed, we create invoice
if (($option == 'bankviainvoice' && $accountid) || $option == 'invoiceonly')
{
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php';
$invoice=new Facture($db);
$customer=new Societe($db);
if (! $error)
{
if (! ($object->fk_soc > 0))
{
$langs->load("errors");
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
setEventMessages($errmsg, null, 'errors');
$error++;
}
}
if (! $error)
{
$result=$customer->fetch($object->fk_soc);
if ($result <= 0)
{
$errmsg=$customer->error;
$errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++;
}
}
if (! $error)
{
// Create draft invoice
$invoice->type= Facture::TYPE_STANDARD;
$invoice->cond_reglement_id=$customer->cond_reglement_id;
if (empty($invoice->cond_reglement_id))
{
$paymenttermstatic=new PaymentTerm($db);
$invoice->cond_reglement_id=$paymenttermstatic->getDefaultId();
if (empty($invoice->cond_reglement_id))
{
$error++;
$errmsg='ErrorNoPaymentTermRECEPFound';
setEventMessages($errmsg, null, 'errors');
}
}
$invoice->socid=$object->fk_soc;
$invoice->date=$datesubscription;
// Possibility to add external linked objects with hooks
$invoice->linked_objects['subscription'] = $crowid;
if (! empty($_POST['other_linked_objects']) && is_array($_POST['other_linked_objects']))
{
$invoice->linked_objects = array_merge($invoice->linked_objects, $_POST['other_linked_objects']);
}
$result=$invoice->create($user);
if ($result <= 0)
{
$errmsg=$invoice->error;
$errmsgs=$invoice->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++;
}
}
if (! $error)
{
// Add line to draft invoice
$idprodsubscription=0;
if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) $idprodsubscription = $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS;
$vattouse=0;
if (isset($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) && $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry')
{
$vattouse=get_default_tva($mysoc, $mysoc, $idprodsubscription);
}
//print xx".$vattouse." - ".$mysoc." - ".$customer;exit;
$result=$invoice->addline($label,0,1,$vattouse,0,0,$idprodsubscription,0,$datesubscription,$datesubend,0,0,'','TTC',$subscription,1);
if ($result <= 0)
{
$errmsg=$invoice->error;
setEventMessages($errmsg, null, 'errors');
$error++;
}
}
if (! $error)
{
// Validate invoice
$result=$invoice->validate($user);
if ($result <= 0)
{
$errmsg=$invoice->error;
$errmsgs=$invoice->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++;
}
}
// Add payment onto invoice
if ($option == 'bankviainvoice' && $accountid)
{
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
$amounts[$invoice->id] = price2num($subscription);
$paiement = new Paiement($db);
$paiement->datepaye = $paymentdate;
$paiement->amounts = $amounts;
$paiement->paiementid = dol_getIdFromCode($db,$operation,'c_paiement','code','id',1);
$paiement->num_paiement = $num_chq;
$paiement->note = $label;
if (! $error)
{
// Create payment line for invoice
$paiement_id = $paiement->create($user);
if (! $paiement_id > 0)
{
$errmsg=$paiement->error;
$errmsgs=$paiement->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++;
}
}
if (! $error)
{
// Add transaction into bank account
$bank_line_id=$paiement->addPaymentToBank($user,'payment','(SubscriptionPayment)',$accountid,$emetteur_nom,$emetteur_banque);
if (! ($bank_line_id > 0))
{
$errmsg=$paiement->error;
$errmsgs=$paiement->errors;
setEventMessages($paiement->error, $paiement->errors, 'errors');
$error++;
}
}
if (! $error)
{
// Update fk_bank into subscription table
$sql = 'UPDATE '.MAIN_DB_PREFIX.'subscription SET fk_bank='.$bank_line_id;
$sql.= ' WHERE rowid='.$crowid;
$result = $db->query($sql);
if (! $result)
{
$error++;
}
}
if (! $error)
{
// Set invoice as paid
$invoice->set_paid($user);
}
if (! $error)
{
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
$newlang = $_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $customer->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
// Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
$invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
}
$result = $object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque);
if ($result < 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
else
{
// If an invoice was created, it is into $object->invoice
}
}
if (! $error)
{
$db->commit();
// $db->commit();
}
else
{
@ -554,23 +338,56 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$action = 'addsubscription';
}
if (! $error)
{
setEventMessages("SubscriptionRecorded", null, 'mesgs');
}
// Send email
if (! $error)
{
// Send confirmation Email
if ($object->email && $_POST["sendmail"])
if ($object->email && $sendalsoemail)
{
$subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
$texttosend=$object->makeSubstitution($adht->getMailOnSubscription());
$result=$object->send_an_email($texttosend,$subjecttosend,array(),array(),array(),"","",0,-1);
// Attach a file ?
$file='';
$listofpaths=array();
$listofnames=array();
$listofmimes=array();
if (is_object($object->invoice))
{
$invoicediroutput = $conf->facture->dir_output;
$fileparams = dol_most_recent_file($invoicediroutput . '/' . $object->invoice->ref, preg_quote($object->invoice->ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
$listofpaths=array($file);
$listofnames=array(basename($file));
$listofmimes=array(dol_mimetype($file));
}
$result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1);
if ($result < 0)
{
$errmsg=$object->error;
setEventMessages($errmsg, null, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
else
{
setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs');
}
}
else
{
setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs');
}
}
// Clean some POST vars
if (! $error)
{
$_POST["subscription"]='';
$_POST["accountid"]='';
$_POST["operation"]='';
@ -934,7 +751,7 @@ if ($rowid > 0)
print load_fiche_titre($langs->trans("NewCotisation"));
// Define default choice to select
// Define default choice for complementary actions
$bankdirect=0; // 1 means option by default is write to bank direct with no invoice
$invoiceonly=0; // 1 means option by default is invoice only
$bankviainvoice=0; // 1 means option by default is write to bank via invoice
@ -945,11 +762,11 @@ if ($rowid > 0)
if (GETPOST('paymentsave') == 'bankviainvoice') $bankviainvoice=1;
}
else
{
{
if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $bankviainvoice=1;
else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && ! empty($conf->banque->enabled)) $bankdirect=1;
else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && ! empty($conf->banque->enabled)) $bankdirect=1;
else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $invoiceonly=1;
}
}
print "\n\n<!-- Form add subscription -->\n";
@ -1048,15 +865,11 @@ if ($rowid > 0)
}
if (! $datefrom)
{
if ($object->datefin > 0)
$datefrom=$object->datevalid;
if ($object->datefin > 0)
{
$datefrom=dol_time_plus_duree($object->datefin,1,'d');
}
else
{
//$datefrom=dol_now();
$datefrom=$object->datevalid;
}
}
print $form->select_date($datefrom,'','','','',"subscription",1,1,1);
print "</td></tr>";
@ -1208,7 +1021,7 @@ if ($rowid > 0)
$subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
$texttosend=$object->makeSubstitution($adht->getMailOnSubscription());
$tmp='<input name="sendmail" type="checkbox"'.(GETPOST('sendmail')?GETPOST('sendmail'):(! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?' checked':'')).'>';
$tmp='<input name="sendmail" type="checkbox"'.(GETPOST('sendmail','alpha')?' checked':(! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?' checked':'')).'>';
$helpcontent='';
$helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
$helpcontent.='<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
@ -1218,7 +1031,7 @@ if ($rowid > 0)
$helpcontent.='<b>'.$langs->trans("MailText").'</b>:<br>';
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
print $form->textwithpicto($tmp,$helpcontent,1,'help');
print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend');
}
print '</td></tr>';
print '</tbody>';

View File

@ -361,7 +361,7 @@ if ($rowid > 0)
{
$object = new AdherentType($db);
$object->fetch($rowid);
$object->fetch_optionals($object->id,$extralabels);
$object->fetch_optionals();
/*
* Confirmation suppression
@ -692,7 +692,7 @@ if ($rowid > 0)
{
$object = new AdherentType($db);
$object->fetch($rowid);
$object->fetch_optionals($object->id,$extralabels);
$object->fetch_optionals();
$head = member_type_prepare_head($object);

View File

@ -48,9 +48,11 @@ $MAXAGENDA=$conf->global->AGENDA_EXT_NB;
// List of aviable colors
$colorlist=array('BECEDD','DDBECE','BFDDBE','F598B4','F68654','CBF654','A4A4A5');
/*
* Actions
*/
if ($actionsave)
{
$db->begin();

View File

@ -173,11 +173,12 @@ $message.='<br>';
$message.='<br>';
print $message;
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
$message =$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptionsNotAdmin",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptionsNotAutoEvent",'systemauto','systemauto').'<br>';
print info_admin($message);

View File

@ -93,7 +93,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,);
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,25,0);
// Name of SQL tables of dictionaries
$tabname=array();
@ -121,7 +121,7 @@ $tabname[21]= MAIN_DB_PREFIX."c_availability";
$tabname[22]= MAIN_DB_PREFIX."c_input_reason";
$tabname[23]= MAIN_DB_PREFIX."c_revenuestamp";
$tabname[24]= MAIN_DB_PREFIX."c_type_resource";
//$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
$tabname[25]= MAIN_DB_PREFIX."c_type_container";
$tabname[26]= MAIN_DB_PREFIX."c_units";
$tabname[27]= MAIN_DB_PREFIX."c_stcomm";
$tabname[28]= MAIN_DB_PREFIX."c_holiday_types";
@ -160,7 +160,7 @@ $tablib[21]= "DictionaryAvailability";
$tablib[22]= "DictionarySource";
$tablib[23]= "DictionaryRevenueStamp";
$tablib[24]= "DictionaryResourceType";
//$tablib[25]= "DictionaryEMailTemplates";
$tablib[25]= "DictionaryTypeOfContainer";
$tablib[26]= "DictionaryUnits";
$tablib[27]= "DictionaryProspectStatus";
$tablib[28]= "DictionaryHolidayTypes";
@ -199,7 +199,7 @@ $tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX
$tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
$tabsql[23]= "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
//$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template').")";
$tabsql[25]= "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
@ -237,8 +237,8 @@ $tabsqlsort[20]="code ASC, libelle ASC";
$tabsqlsort[21]="code ASC, label ASC";
$tabsqlsort[22]="code ASC, label ASC";
$tabsqlsort[23]="country ASC, taux ASC";
$tabsqlsort[24]="code ASC,label ASC";
//$tabsqlsort[25]="label ASC";
$tabsqlsort[24]="code ASC, label ASC";
$tabsqlsort[25]="t.module ASC, t.code ASC, t.label ASC";
$tabsqlsort[26]="code ASC";
$tabsqlsort[27]="code ASC";
$tabsqlsort[28]="country ASC, code ASC";
@ -277,7 +277,7 @@ $tabfield[21]= "code,label";
$tabfield[22]= "code,label";
$tabfield[23]= "country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[24]= "code,label";
//$tabfield[25]= "label,type_template,private,position,topic,content_lines,content";
$tabfield[25]= "code,label";
$tabfield[26]= "code,label,short_label";
$tabfield[27]= "code,libelle";
$tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
@ -316,7 +316,7 @@ $tabfieldvalue[21]= "code,label";
$tabfieldvalue[22]= "code,label";
$tabfieldvalue[23]= "country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldvalue[24]= "code,label";
//$tabfieldvalue[25]= "label,type_template,private,position,topic,content_lines,content";
$tabfieldvalue[25]= "code,label";
$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27]= "code,libelle";
$tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
@ -355,7 +355,7 @@ $tabfieldinsert[21]= "code,label";
$tabfieldinsert[22]= "code,label";
$tabfieldinsert[23]= "fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[24]= "code,label";
//$tabfieldinsert[25]= "label,type_template,private,position,topic,content_lines,content,entity";
$tabfieldinsert[25]= "code,label";
$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27]= "code,libelle";
$tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country";
@ -383,8 +383,8 @@ $tabrowid[8] = "id";
$tabrowid[9] = "code_iso";
$tabrowid[10]= "";
$tabrowid[11]= "rowid";
$tabrowid[12]= "rowid";
$tabrowid[13]= "id";
$tabrowid[12]= "";
$tabrowid[13]= "";
$tabrowid[14]= "";
$tabrowid[15]= "";
$tabrowid[16]= "code";
@ -396,7 +396,7 @@ $tabrowid[21]= "rowid";
$tabrowid[22]= "rowid";
$tabrowid[23]= "";
$tabrowid[24]= "";
//$tabrowid[25]= "";
$tabrowid[25]= "";
$tabrowid[26]= "";
$tabrowid[27]= "id";
$tabrowid[28]= "";
@ -435,7 +435,7 @@ $tabcond[21]= ! empty($conf->propal->enabled);
$tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled));
$tabcond[23]= true;
$tabcond[24]= ! empty($conf->resource->enabled);
//$tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_DIC);
$tabcond[25]= ! empty($conf->website->enabled);
$tabcond[26]= ! empty($conf->product->enabled);
$tabcond[27]= ! empty($conf->societe->enabled);
$tabcond[28]= ! empty($conf->holiday->enabled);
@ -474,7 +474,7 @@ $tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[23] = array('revenuestamp_type'=>'FixedOfPercent');
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
//$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'content_lines'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[25] = array('code'=>$langs->trans('EnterAnyCode'));
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
@ -513,7 +513,7 @@ $tabfieldcheck[21] = array();
$tabfieldcheck[22] = array();
$tabfieldcheck[23] = array();
$tabfieldcheck[24] = array();
//$tabfieldcheck[25] = array();
$tabfieldcheck[25] = array();
$tabfieldcheck[26] = array();
$tabfieldcheck[27] = array();
$tabfieldcheck[28] = array();
@ -1072,8 +1072,7 @@ if ($id)
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); $class='width100'; }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
{
if ($id != 25) $valuetoshow=$form->textwithtooltip($langs->trans("Label"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,''));
else $valuetoshow=$langs->trans("Label");
$valuetoshow=$form->textwithtooltip($langs->trans("Label"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,''));
}
if ($fieldlist[$field]=='libelle_facture') {
$valuetoshow=$form->textwithtooltip($langs->trans("LabelOnDocuments"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,''));
@ -1298,12 +1297,7 @@ if ($id)
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='position') { $align='right'; }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
{
//if ($id != 25) $valuetoshow=$form->textwithtooltip($langs->trans("Label"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,''));
//else $valuetoshow=$langs->trans("Label");
$valuetoshow=$langs->trans("Label");
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
if ($fieldlist[$field]=='libelle_facture') {
//$valuetoshow=$form->textwithtooltip($langs->trans("LabelOnDocuments"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,''));
$valuetoshow=$langs->trans("LabelOnDocuments");

103
htdocs/admin/export.php Normal file
View File

@ -0,0 +1,103 @@
<?php
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.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/>.
*/
/**
* \file htdocs/admin/expedition.php
* \ingroup expedition
* \brief Page d'administration/configuration du module Expedition
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("admin");
$langs->load("exports");
$langs->load('other');
if (! $user->admin)
accessforbidden();
$action=GETPOST('action','alpha');
$value=GETPOST('value','alpha');
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
/*
* View
*/
$page_name = "ExportSetup";
llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
. $langs->trans("BackToModuleList") . '</a>';
print_fiche_titre($langs->trans($page_name), $linkback);
// Configuration header
dol_fiche_head(
$head,
'settings',
$langs->trans("ExportsArea"),
0,
"exports"
);
// Setup page goes here
$form=new Form($db);
$var=false;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("ExportModel").'</td>'."\n";
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100"></td>'."\n";
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("set_EXPORTS_SHARE_MODELS").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_EXPORTS_SHARE_MODELS">';
echo ajax_constantonoff('EXPORTS_SHARE_MODELS');
print '</form>';
print '</td></tr>';
print '</table>';
llxFooter();
$db->close();

View File

@ -70,6 +70,7 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
if ($action == 'update' && empty($_POST["cancel"]))
{
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO"),'chaine',0,'',$conf->entity);
// Send mode parameters
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"),'chaine',0,'',$conf->entity);
@ -239,6 +240,11 @@ if ($action == 'edit')
print $form->selectyesno('MAIN_DISABLE_ALL_MAILS',$conf->global->MAIN_DISABLE_ALL_MAILS,1);
print '</td></tr>';
// Force e-mail recipient
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>';
print '<input class="flat" name="MAIN_MAIL_FORCE_SENDTO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO)?$conf->global->MAIN_MAIL_FORCE_SENDTO:'') . '" />';
print '</td></tr>';
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
@ -478,6 +484,11 @@ else
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS).'</td></tr>';
// Force e-mail recipient
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.$conf->global->MAIN_MAIL_FORCE_SENDTO;
if (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO) && ! isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail"));
print '</td></tr>';
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
@ -644,25 +655,7 @@ else
dol_fiche_end();
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
print '<br>';
/*
// Warning 1
if ($linuxlike)
{
$sendmailoption=ini_get('mail.force_extra_parameters');
if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
{
print info_admin($langs->trans("SendmailOptionNotComplete"));
}
}*/
// Warning 2
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
}
// Boutons actions
// Actions button
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
@ -689,6 +682,22 @@ else
print '</div>';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
/*
// Warning 1
if ($linuxlike)
{
$sendmailoption=ini_get('mail.force_extra_parameters');
if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
{
print info_admin($langs->trans("SendmailOptionNotComplete"));
}
}*/
// Warning 2
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
}
if (! in_array($action, array('testconnect', 'test', 'testhtml')))
{
$text = '';

View File

@ -507,25 +507,21 @@ print '</form>'."\n";
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
{
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$formfile = new FormFile($db);
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
$formfile = new FormFile($db);
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$hidegeneratedfilelistifempty=1;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
$filedir=$diroutputmassaction;
$genallowed=$user->rights->monmodule->read;
$delallowed=$user->rights->monmodule->create;
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
$filedir=$diroutputmassaction;
$genallowed=$user->rights->monmodule->read;
$delallowed=$user->rights->monmodule->create;
print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
dol_fiche_end();

View File

@ -163,8 +163,6 @@ foreach ($modulesdir as $dir)
$modules[$i] = $objMod;
$filename[$i]= $modName;
$special = $objMod->special;
// Gives the possibility to the module, to provide his own family info and position of this family
if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
if (!is_array($familyinfo)) $familyinfo=array();
@ -180,13 +178,11 @@ foreach ($modulesdir as $dir)
$moduleposition = 800;
}
if ($special == 1) $familykey='interface';
$orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
$dirmod[$i] = $dir;
//print $i.'-'.$dirmod[$i].'<br>';
// Set categ[$i]
$specialstring = isset($specialtostring[$special])?$specialtostring[$special]:'unknown';
$specialstring = 'unknown';
if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring='expdev';
if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories
else $categ[$specialstring]=1;
@ -240,7 +236,6 @@ foreach($orders as $tmpkey => $tmpvalue)
$i++;
}
$value = $orders[$key];
$special = $objMod->special;
$tab=explode('_',$value);
$familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];

View File

@ -358,8 +358,6 @@ foreach ($modulesdir as $dir)
$filename[$i]= $modName;
$modules[$modName] = $objMod;
$special = $objMod->special;
// Gives the possibility to the module, to provide his own family info and position of this family
if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
$familyinfo = array_merge($familyinfo, $objMod->familyinfo);
@ -374,8 +372,6 @@ foreach ($modulesdir as $dir)
$moduleposition = 800;
}
if ($special == 1) $familykey='interface';
// Add list of warnings to show into arrayofwarnings and arrayofwarningsext
if (! empty($objMod->warnings_activation))
{
@ -390,7 +386,7 @@ foreach ($modulesdir as $dir)
$dirmod[$i] = $dir;
//print $i.'-'.$dirmod[$i].'<br>';
// Set categ[$i]
$specialstring = isset($specialtostring[$special])?$specialtostring[$special]:'unknown';
$specialstring = 'unknown';
if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring='expdev';
if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories
else $categ[$specialstring]=1;
@ -531,12 +527,9 @@ if ($mode == 'common')
$objMod = $modules[$modName];
$dirofmodule = $dirmod[$key];
$special = $objMod->special;
//print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."<br>";
//print $objMod->name." - ".$key." - ".$objMod->version."<br>";
//if (($mode != (isset($specialtostring[$special])?$specialtostring[$special]:'unknown') && $mode != 'expdev')
if (($special >= 4 && $mode != 'expdev')
|| ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental')) continue; // Discard if not for current tab
if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') continue; // Discard if not for current tab
if (! $objMod->getName())
{

View File

@ -95,6 +95,7 @@ print '<table class="noborder" width="100%">';
$i=0;
// $list is defined into oauth.lib.php
foreach ($list as $key)
{
$supported=0;

View File

@ -141,13 +141,27 @@ if ($mode == 'setup' && $user->admin)
$urltodelete=$urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms='https://github.com/settings/applications/';
}
if ($key[0] == 'OAUTH_GOOGLE_NAME')
elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
{
$OAUTH_SERVICENAME='Google';
$urltorenew=$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete=$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms='https://security.google.com/settings/security/permissions';
}
elseif ($key[0] == 'OAUTH_STRIPE_TEST_NAME')
{
$OAUTH_SERVICENAME='StripeTest';
$urltorenew=$urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete='';
$urltocheckperms='';
}
else
{
$urltorenew='';
$urltodelete='';
$urltocheckperms='';
}
// Show value of token
$tokenobj=null;
@ -204,7 +218,6 @@ if ($mode == 'setup' && $user->admin)
print '<table class="noborder" width="100%">'."\n";
$var=false;
print '<tr class="liste_titre">';
print '<th class="titlefieldcreate">'.$langs->trans($key[0]).'</th>';
print '<th></th>';
@ -222,7 +235,6 @@ if ($mode == 'setup' && $user->admin)
print '</td>';
print '</tr>'."\n";
$var = ! $var;
print '<tr class="oddeven">';
print '<td'.($key['required']?' class="required"':'').'>';
//var_dump($key);
@ -237,19 +249,21 @@ if ($mode == 'setup' && $user->admin)
if (is_object($tokenobj))
{
//test on $storage->hasAccessToken($OAUTH_SERVICENAME) ?
print '<a class="button" href="'.$urltodelete.'">'.$langs->trans('DeleteAccess').'</a><br><br>';
print '<a class="button" href="'.$urltodelete.'">'.$langs->trans('DeleteAccess').'</a><br>';
}
// Request remote token
print '<a class="button" href="'.$urltorenew.'">'.$langs->trans('RequestAccess').'</a><br><br>';
if ($urltorenew)
{
print '<a class="button" href="'.$urltorenew.'">'.$langs->trans('RequestAccess').'</a><br>';
}
// Check remote access
if ($urltocheckperms)
{
print $langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': <a href="'.$urltocheckperms.'" target="_'.strtolower($OAUTH_SERVICENAME).'">'.$urltocheckperms.'</a>';
print '<br>'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': <a href="'.$urltocheckperms.'" target="_'.strtolower($OAUTH_SERVICENAME).'">'.$urltocheckperms.'</a>';
}
print '</td>';
print '</tr>';
$var = ! $var;
print '<tr class="oddeven">';
print '<td'.($key['required']?' class="required"':'').'>';
//var_dump($key);
@ -272,7 +286,6 @@ if ($mode == 'setup' && $user->admin)
if (is_object($tokenobj))
{
// Token refresh
$var = ! $var;
print '<tr class="oddeven">';
print '<td'.($key['required']?' class="required"':'').'>';
//var_dump($key);
@ -283,7 +296,6 @@ if ($mode == 'setup' && $user->admin)
print '</tr>';
// Token expired
$var = ! $var;
print '<tr class="oddeven">';
print '<td'.($key['required']?' class="required"':'').'>';
//var_dump($key);
@ -294,7 +306,6 @@ if ($mode == 'setup' && $user->admin)
print '</tr>';
// Token expired at
$var = ! $var;
print '<tr class="oddeven">';
print '<td'.($key['required']?' class="required"':'').'>';
//var_dump($key);
@ -354,7 +365,6 @@ if ($mode == 'userconf' && $user->admin)
print $langs->trans('PrintUserConfDesc'.$driver)."<br><br>\n";
print '<table class="noborder" width="100%">';
$var=true;
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("User").'</th>';
print '<th>'.$langs->trans("PrintModule").'</th>';

View File

@ -611,18 +611,6 @@ else // Show
print '<td>'.$langs->trans("Value").'</td>'."\n";
print "</tr>\n";
if (! empty($dolibarr_pdf_force_fpdf))
{
print '<tr class="oddeven">'."\n";
print '<td>dolibarr_pdf_force_fpdf</td>'."\n";
print '<td>';
print $dolibarr_pdf_force_fpdf;
print '</td>';
print '</tr>';
}
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("LibraryToBuildPDF").'</td>'."\n";
print '<td>';
@ -663,11 +651,6 @@ else // Show
print "</table>\n";
print '</div>';
if (! empty($dolibarr_pdf_force_fpdf))
{
print info_admin($langs->trans("WarningUsingFPDF")).'<br>';
}
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
print '</div>';

View File

@ -631,7 +631,7 @@ print "<tr class=\"liste_titre\">\n";
print " <td>".$langs->trans("Name")."</td>\n";
print " <td>".$langs->trans("Value")."</td>\n";
print "</tr>\n";
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->dir_output."</td>\n</tr>\n";
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->multidir_output[$conf->entity]."</td>\n</tr>\n";
print "</table>\n<br>";

View File

@ -146,6 +146,16 @@ if ($action == 'setlevel')
dol_syslog("admin/syslog: level ".$level);
if (! $res > 0) $error++;
if (! $error)
{
$file_saves = GETPOST("file_saves");
$res = dolibarr_set_const($db,"SYSLOG_FILE_SAVES",$file_saves,'chaine',0,'',0);
dol_syslog("admin/syslog: file saves ".$file_saves);
if (! $res > 0) $error++;
}
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@ -284,6 +294,13 @@ print '<option value="'.LOG_INFO.'" '.($conf->global->SYSLOG_LEVEL==LOG_INFO?'SE
print '<option value="'.LOG_DEBUG.'" '.($conf->global->SYSLOG_LEVEL>=LOG_DEBUG?'SELECTED':'').'>LOG_DEBUG ('.LOG_DEBUG.')</option>';
print '</select>';
print '</td></tr>';
if(! empty($conf->loghandlers['mod_syslog_file']) && ! empty($conf->cron->enabled)) {
print '<tr class="oddeven"><td width="140">'.$langs->trans("SyslogFileNumberOfSaves").'</td>';
print '<td colspan="2"><input type="number" name="file_saves" placeholder="14" min="0" step="1" value="'.$conf->global->SYSLOG_FILE_SAVES.'" />';
print ' (<a href="'.dol_buildpath('/cron/list.php', 1).'?search_label=CompressSyslogs&status=-1">'.$langs->trans('ConfigureCleaningCronjobToSetFrequencyOfSaves').'</a>)</td></tr>';
}
print '</table>';
print "</form>\n";

View File

@ -116,7 +116,7 @@ if (function_exists('curl_init'))
}
else
{
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="button">' .$langs->trans("Check").'</a>';
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="butAction">' .$langs->trans("Check").'</a>';
}
}
@ -325,13 +325,14 @@ $configfileparameters=array(
'?dolibarr_font_DOL_DEFAULT_TTF_BOLD' => 'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator4' => '',
'dolibarr_main_prod' => 'Production mode (Hide all error messages)',
'dolibarr_main_restrict_os_commands' => 'Restrict CLI commands for backups',
'dolibarr_main_restrict_ip' => 'Restrict access to some IPs only',
'?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page',
'?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli',
'?dolibarr_strict_mode' => 'Strict mode is on/off',
'?dolibarr_pdf_force_fpdf' => 'Force fpdf usage to generate PDF'
'?dolibarr_strict_mode' => 'Strict mode is on/off',
'?dolibarr_nocsrfcheck' => 'Disable CSRF security checks'
);
$var=true;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -441,8 +442,8 @@ if ($resql)
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="tdoverflow">'.$obj->name.'</td>'."\n";
print '<td class="tdoverflow">'.$obj->value.'</td>'."\n";
print '<td class="tdoverflowmax300">'.$obj->name.'</td>'."\n";
print '<td class="tdoverflowmax300">'.dol_escape_htmltag($obj->value).'</td>'."\n";
if (empty($conf->multicompany->enabled) || !$user->entity) print '<td align="center" width="80px">'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
print "</tr>\n";

View File

@ -140,7 +140,7 @@ if (GETPOST('target') == 'remote')
if (! $xmlarray['curl_error_no'] && $xmlarray['http_code'] != '404')
{
$xmlfile = $xmlarray['content'];
//print "eee".$xmlfile."eee";
//print "xmlfilestart".$xmlfile."xmlfileend";
$xml = simplexml_load_string($xmlfile);
}
else

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@zendsi.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
@ -30,17 +30,20 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$langs->load('admin');
$langs->load('objects');
$langs->load("companies");
$langs->load("products");
if (!$user->admin) accessforbidden();
$action = GETPOST('action','alpha');
// Other parameters ACCOUNTING_*
// Other parameters
$list = array (
'ACCOUNTING_VAT_PAY_ACCOUNT'
);
/*
* Actions
*/
@ -60,137 +63,174 @@ $list = array (
$tax_mode = empty($conf->global->TAX_MODE)?0:$conf->global->TAX_MODE;
if ($action == 'update') {
$error = 0;
$error = 0;
// Tax mode
$tax_mode = GETPOST('tax_mode','alpha');
$db->begin();
$db->begin();
$res = dolibarr_set_const($db, 'TAX_MODE', $tax_mode,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE', $tax_mode,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
switch ($tax_mode)
{
case 0:
$value = 'payment';
break;
case 1:
$value = 'invoice';
break;
}
switch ($tax_mode)
{
case 0:
$value = 'payment';
break;
case 1:
$value = 'invoice';
break;
}
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_VAT_RETURN", GETPOST("MAIN_INFO_VAT_RETURN",'alpha'),'chaine',0,'',$conf->entity);
// Others options
foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha');
foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
if (! $error) {
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors');
}
if (! $error) {
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*
* View
*/
llxHeader();
llxHeader('', $langs->trans("TaxSetup"));
$form=new Form($db);
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans('TaxSetup'),$linkback,'title_setup');
dol_fiche_head();
//dol_fiche_head(null, '', '', -1);
if (empty($mysoc->tva_assuj))
{
print $langs->trans("YourCompanyDoesNotUseVAT").'<br>';
print $langs->trans("YourCompanyDoesNotUseVAT").'<br>';
}
else
{
print '<table class="noborder" width="100%">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
// Cas des parametres TAX_MODE_SELL/BUY_SERVICE/PRODUCT
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('OptionVatMode').'</td><td>'.$langs->trans('Description').'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td width="200"><input type="radio" name="tax_mode" value="0"'.($tax_mode != 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionVatDefaultDesc'));
print "</td></tr>\n";
print '<tr class="oddeven"><td width="200"><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionVatDebitOptionDesc'))."</td></tr>\n";
print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
print '<input name="tva" id="intra_vat" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">';
print '</td></tr>';
print "</table>\n";
print '<tr class="oddeven"><td><label for="activate_MAIN_INFO_VAT_RETURN">'.$langs->trans("VATReturn").'</label></td>';
if (! $conf->use_javascript_ajax)
{
print '<td class="nowrap" align="right">';
print $langs->trans("NotAvailableWhenAjaxDisabled");
print "</td>";
}
else
{
print '<td width="120">';
$listval=array('0'=>$langs->trans(""),
'1'=>$langs->trans("Monthly"),
'2'=>$langs->trans("Quarterly"),
'3'=>$langs->trans("Annual"),
);
print $form->selectarray("MAIN_INFO_VAT_RETURN", $listval, $conf->global->MAIN_INFO_VAT_RETURN);
print "</td>";
}
print '</tr>';
print '<br>';
print load_fiche_titre($langs->trans("SummaryOfVatExigibilityUsedByDefault"),'','');
//print ' ('.$langs->trans("CanBeChangedWhenMakingInvoice").')';
print '</table>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>&nbsp;</td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>';
print "<br>\n";
// Products
print '<tr class="oddeven"><td>'.$langs->trans("Product").'</td>';
print '<td>';
print $langs->trans("OnDelivery");
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
print '</td>';
print '<td>';
print $langs->trans("OnDelivery");
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
print '</td></tr>';
print '<table class="noborder" width="100%">';
// Services
print '<tr class="oddeven"><td>'.$langs->trans("Services").'</td>';
print '<td>';
if ($tax_mode == 0)
{
print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
}
if ($tax_mode == 1)
{
print $langs->trans("OnInvoice");
print ' ('.$langs->trans("InvoiceDateUsed").')';
}
print '</td>';
print '<td>';
if ($tax_mode == 0)
{
print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
}
if ($tax_mode == 1)
{
print $langs->trans("OnInvoice");
print ' ('.$langs->trans("InvoiceDateUsed").')';
}
print '</td></tr>';
// Cas des parametres TAX_MODE_SELL/BUY_SERVICE/PRODUCT
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('OptionVatMode').'</td><td>'.$langs->trans('Description').'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td width="200"><input type="radio" name="tax_mode" value="0"'.($tax_mode != 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionVatDefaultDesc'));
print "</td></tr>\n";
print '<tr class="oddeven"><td width="200"><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionVatDebitOptionDesc'))."</td></tr>\n";
print '</table>';
print "</table>\n";
print '<br>';
print load_fiche_titre($langs->trans("SummaryOfVatExigibilityUsedByDefault"),'','');
//print ' ('.$langs->trans("CanBeChangedWhenMakingInvoice").')';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>&nbsp;</td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>';
// Products
print '<tr class="oddeven"><td>'.$langs->trans("Product").'</td>';
print '<td>';
print $langs->trans("OnDelivery");
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
print '</td>';
print '<td>';
print $langs->trans("OnDelivery");
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
print '</td></tr>';
// Services
print '<tr class="oddeven"><td>'.$langs->trans("Services").'</td>';
print '<td>';
if ($tax_mode == 0)
{
print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
}
if ($tax_mode == 1)
{
print $langs->trans("OnInvoice");
print ' ('.$langs->trans("InvoiceDateUsed").')';
}
print '</td>';
print '<td>';
if ($tax_mode == 0)
{
print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
}
if ($tax_mode == 1)
{
print $langs->trans("OnInvoice");
print ' ('.$langs->trans("InvoiceDateUsed").')';
}
print '</td></tr>';
print '</table>';
}
print "<br>\n";
@ -205,12 +245,10 @@ print "</tr>\n";
foreach ($list as $key)
{
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
$label = $langs->trans($key);
print '<td><label for="'.$key.'">'.$label.'</label></td>';
// Value
@ -228,7 +266,9 @@ foreach ($list as $key)
print '</table>';
dol_fiche_end();
//dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '" name="button">';

View File

@ -401,6 +401,23 @@ $titre=$langs->trans("WebsiteSetup");
$linkback='<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($titre,$linkback,'title_setup');
// Onglets
$head=array();
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/website.php";
$head[$h][1] = $langs->trans("WebSites");
$head[$h][2] = 'website';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/website_options.php";
$head[$h][1] = $langs->trans("Options");
$head[$h][2] = 'options';
$h++;
dol_fiche_head($head, 'website', '', -1);
print $langs->trans("WebsiteSetupDesc").'<br>';
print "<br>\n";
@ -648,7 +665,9 @@ if ($id)
}
}
print '<br>';
dol_fiche_end();
//print '<br>';
llxFooter();

View File

@ -0,0 +1,153 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/website.php
* \ingroup setup
* \brief Page to administer web sites
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
$langs->load("errors");
$langs->load("admin");
$langs->load("companies");
$langs->load("website");
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$rowid=GETPOST('rowid','alpha');
if (!$user->admin) accessforbidden();
$status = 1;
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admin'));
$arrayofparameters=array('WEBSITE_USE_WEBSITE_ACCOUNTS'=>array('css'=>'minwidth200'));
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
/*
* View
*/
$form = new Form($db);
$formadmin=new FormAdmin($db);
llxHeader('', $langs->trans("WebsiteSetup"));
$titre=$langs->trans("WebsiteSetup");
$linkback='<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($titre,$linkback,'title_setup');
// Onglets
$head=array();
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/website.php";
$head[$h][1] = $langs->trans("WebSites");
$head[$h][2] = 'website';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/website_options.php";
$head[$h][1] = $langs->trans("Options");
$head[$h][2] = 'options';
$h++;
dol_fiche_head($head, 'options', '', -1);
if ($action == 'edit')
{
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach($arrayofparameters as $key => $val)
{
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip'));
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css'])?'minwidth200':$val['css']).'" value="' . $conf->global->$key . '"></td></tr>';
}
print '</table>';
print '<br><div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
print '<br>';
}
else
{
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach($arrayofparameters as $key => $val)
{
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip'));
print '</td><td>' . $conf->global->$key . '</td></tr>';
}
print '</table>';
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
print '</div>';
}
dol_fiche_end();
//print '<br>';
llxFooter();
$db->close();

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2012-2018 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* 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
@ -41,7 +41,7 @@ if ($action == 'setproductionmode')
{
$status = GETPOST('status','alpha');
if (dolibarr_set_const($db, 'API_PRODUCTION_MODE', $status, 'chaine', 0, '', $conf->entity) > 0)
if (dolibarr_set_const($db, 'API_PRODUCTION_MODE', $status, 'chaine', 0, '', 0) > 0)
{
$error=0;

View File

@ -306,7 +306,7 @@ class Documents extends DolibarrApi
throw new RestException(404, 'Proposal not found');
}
$upload_dir = $conf->propal->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'propal');
$upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal');
}
else if ($modulepart == 'commande' || $modulepart == 'order')
{

View File

@ -66,7 +66,8 @@ class Setup extends DolibarrApi
$sql = "SELECT id, code, type, libelle as label, module";
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as t";
$sql.= " WHERE t.active = ".$active;
$sql.= " WHERE t.entity IN (".getEntity('c_paiement').")";
$sql.= " AND t.active = ".$active;
// Add sql filters
if ($sqlfilters)
{
@ -538,7 +539,8 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid as id, code, sortorder, libelle as label, libelle_facture as descr, type_cdr, nbjour, decalage, module";
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
$sql.= " WHERE t.active = ".$active;
$sql.= " WHERE t.entity IN (".getEntity('c_payment_term').")";
$sql.= " AND t.active = ".$active;
// Add sql filters
if ($sqlfilters)
{
@ -638,7 +640,7 @@ class Setup extends DolibarrApi
if (! $xmlarray['curl_error_no'] && $xmlarray['http_code'] != '404')
{
$xmlfile = $xmlarray['content'];
//print "eee".$xmlfile."eee";
//print "xmlfilestart".$xmlfile."endxmlfile";
$xml = simplexml_load_string($xmlfile);
}
else

View File

@ -745,11 +745,12 @@ class BlockedLog
return -2;
}
if (empty($this->action) || empty($this->fk_user) || empty($this->user_fullname)) {
if (empty($this->action)) {
$this->error=$langs->trans("BadParameterWhenCallingCreateOfBlockedLog");
dol_syslog($this->error, LOG_WARNING);
return -3;
}
if (empty($this->fk_user)) $this->user_fullname='(Anonymous)';
$this->date_creation = dol_now();

View File

@ -233,7 +233,7 @@ class Facturation
$this->prix_total_localtax2 = $total_localtax2;
$this->montant_tva = $total_ttc - $total_ht;
//print $this->prix_total_ttc.'eeee'; exit;
//print 'total: '.$this->prix_total_ttc; exit;
}
/**

View File

@ -324,7 +324,7 @@ switch ($action)
{
// We set status to payed
$result=$invoice->set_paid($user);
//print 'eeeee';exit;
//print 'set paid';exit;
}
}

View File

@ -236,7 +236,9 @@ class Categorie extends CommonObject
$this->type = $res['type'];
$this->entity = $res['entity'];
$this->fetch_optionals($this->id,null);
// Retreive all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
$this->db->free($resql);
@ -713,11 +715,12 @@ class Categorie extends CommonObject
}
}
// Save object we want to link category to into category instance to provide information to trigger
$this->linkto=$obj;
// Call trigger
$result=$this->call_trigger('CATEGORY_LINK',$user);
$this->linkto=$obj; // Deprecated. Save object we want to link category to into category instance to provide information to trigger
$this->context=array('linkto'=>$obj); // Save object we want to link category to into category instance to provide information to trigger
$result=$this->call_trigger('CATEGORY_LINK',$user);
if ($result < 0) { $error++; }
// End call triggers

View File

@ -53,11 +53,12 @@ $result = restrictedArea($user, 'categorie', $id, '&category');
$object = new Categorie($db);
$result=$object->fetch($id, $label);
$object->fetch_optionals($id,$extralabels);
if ($result <= 0)
{
dol_print_error($db,$object->error);
exit;
if ($result <= 0) {
dol_print_error($db,$object->error); exit;
}
$object->fetch_optionals();
if ($result <= 0) {
dol_print_error($db,$object->error); exit;
}
$type=$object->type;
@ -67,13 +68,14 @@ $extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categorycard'));
$hookmanager->initHooks(array('categorycard','globalcard'));
/*
* Actions
*/
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
// Remove element from category
if ($id > 0 && $removeelem > 0)
{
@ -353,7 +355,7 @@ if ($type == Categorie::TYPE_PRODUCT)
print "<br>";
print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("ProductsAndServices")."</td></tr>\n";
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("ProductsAndServices")." (".count($prods).")</td></tr>\n";
if (count($prods) > 0)
{
@ -402,7 +404,7 @@ if ($type == Categorie::TYPE_SUPPLIER)
{
print "<br>";
print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Suppliers")."</td></tr>\n";
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Suppliers")." (".count($socs).")</td></tr>\n";
if (count($socs) > 0)
{
@ -451,7 +453,7 @@ if($type == Categorie::TYPE_CUSTOMER)
{
print "<br>";
print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Customers")."</td></tr>\n";
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Customers")." (".count($socs).")</td></tr>\n";
if (count($socs) > 0)
{
@ -507,7 +509,7 @@ if ($type == Categorie::TYPE_MEMBER)
{
print "<br>";
print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Member")."</td></tr>\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Member")." (".count($prods).")</td></tr>\n";
if (count($prods) > 0)
{
@ -558,7 +560,7 @@ if ($type == Categorie::TYPE_CONTACT)
{
print "<br>";
print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Contact")."</td></tr>\n";
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Contact")." (".count($contacts).")</td></tr>\n";
if (count($contacts) > 0)
{
@ -613,7 +615,7 @@ if ($type == Categorie::TYPE_ACCOUNT)
{
print "<br>";
print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Account")."</td></tr>\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Account")." (".count($accounts).")</td></tr>\n";
if (count($accounts) > 0)
{
@ -666,7 +668,7 @@ if ($type == Categorie::TYPE_PROJECT)
{
print "<br>";
print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Project")."</td></tr>\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Project")." (".count($projects).")</td></tr>\n";
if (count($projects) > 0)
{

View File

@ -934,7 +934,7 @@ if ($id > 0)
$result2=$object->fetch_projet();
$result3=$object->fetch_contact();
$result4=$object->fetch_userassigned();
$result5=$object->fetch_optionals($id,$extralabels);
$result5=$object->fetch_optionals();
if ($listUserAssignedUpdated || $donotclearsession)
{
@ -1044,7 +1044,7 @@ if ($id > 0)
}
// Title
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
// Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';

View File

@ -212,7 +212,7 @@ class ActionComm extends CommonObject
$now=dol_now();
// Check parameters
if (empty($this->userownerid))
if (! isset($this->userownerid) || $this->userownerid === '') // $this->userownerid may be 0 (anonymous event) of > 0
{
dol_syslog("You tried to create an event but mandatory property ownerid was not defined", LOG_WARNING);
$this->errors[]='ErrorPropertyUserowneridNotDefined';
@ -465,7 +465,10 @@ class ActionComm extends CommonObject
// Load source object
$objFrom = clone $this;
// Retreive all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
// $this->fetch_userassigned();
$this->fetchResources();
@ -1233,8 +1236,12 @@ class ActionComm extends CommonObject
$result='';
// Set label of typ
$labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label;
// Set label of type
$labeltype = '';
if ($this->type_code)
{
$labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label;
}
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL');
@ -1286,7 +1293,7 @@ class ActionComm extends CommonObject
$linkstart.=$linkclose.'>';
$linkend='</a>';
//print 'rrr'.$this->libelle.'-'.$withpicto;
//print 'rrr'.$this->libelle.'rrr'.$this->label.'rrr'.$withpicto;
if ($withpicto == 2)
{
@ -1306,7 +1313,10 @@ class ActionComm extends CommonObject
{
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) // Add code into ()
{
$libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':'');
if ($labeltype)
{
$libelle.=(preg_match('/'.preg_quote($labeltype,'/').'/', $libelle)?'':' ('.$langs->transnoentities("Action".$this->type_code).')');
}
}
}
@ -1326,7 +1336,7 @@ class ActionComm extends CommonObject
* @param string $type 'event' or 'journal'
* @param int $cachedelay Do not rebuild file if date older than cachedelay seconds
* @param string $filename Force filename
* @param array $filters Array of filters
* @param array $filters Array of filters. Exemple array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...)
* @return int <0 if error, nb of events in new file if ok
*/
function build_exportfile($format,$type,$cachedelay,$filename,$filters)
@ -1407,7 +1417,9 @@ class ActionComm extends CommonObject
if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0);
if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0);
if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0);
// We must filter on assignement table
if ($key == 'actiontype') $sql.=" AND c.type = '".$this->db->escape($value)."'";
if ($key == 'notactiontype') $sql.=" AND c.type <> '".$this->db->escape($value)."'";
// We must filter on assignement table
if ($key == 'logint') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
if ($key == 'logina')
{

View File

@ -100,7 +100,7 @@ if ($object->id > 0)
$result2=$object->fetch_thirdparty();
$result3=$object->fetch_contact();
$result4=$object->fetch_userassigned();
$result5=$object->fetch_optionals($id,$extralabels);
$result5=$object->fetch_optionals();
if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
{

View File

@ -589,6 +589,7 @@ if ($resql)
$event->type_color=$obj->type_color;
$event->libelle=$obj->label;
$event->label=$obj->label;
$event->percentage=$obj->percent;
$event->authorid=$obj->fk_user_author; // user id of creator
$event->userownerid=$obj->fk_user_action; // user id of owner
@ -601,7 +602,9 @@ if ($resql)
$event->elementtype=$obj->elementtype;
$event->societe->id=$obj->fk_soc;
$event->thirdparty_id=$obj->fk_soc;
$event->contact->id=$obj->fk_contact;
$event->contact_id=$obj->fk_contact;
// Defined date_start_in_calendar and date_end_in_calendar property
// They are date start and end of action but modified to not be outside calendar view.
@ -1176,19 +1179,72 @@ else // View by day
$timestamp=dol_mktime(12,0,0,$month,$day,$year);
$arraytimestamp=dol_getdate($timestamp);
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
echo '<table width="100%" class="noborder nocellnopadd cal_pannel cal_month">';
echo ' <tr class="liste_titre">';
echo ' <td align="center">'.$langs->trans("Day".$arraytimestamp['wday'])."</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo ' <td class="'.$style.'" width="14%" valign="top">';
$maxnbofchar=80;
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
echo "</td>\n";
echo " </tr>\n";
//echo '<table class="tagtable centpercent noborder nocellnopadd cal_pannel cal_month">';
echo '<table class="tagtable centpercent noborder nocellnopadd cal_pannel cal_month noborderbottom" style="margin-bottom: 5px !important;">';
echo ' <tr class="tagtr liste_titre">';
echo ' <td class="tagtd width100"></td>';
echo ' <td class="tagtd center">'.$langs->trans("Day".$arraytimestamp['wday'])."</td>\n";
echo " </td>\n";
/*
echo ' <div class="tagtr">';
echo ' <div class="tagtd width100"></div>';
echo ' <div class="tagtd center">';
echo show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, -1);
echo ' </div>'."\n";
echo " </div>\n";
*/
echo '</table>';
print '</div>';
/* WIP View per hour */
$useviewhour = 0;
if ($useviewhour)
{
print '<div class="div-table-responsive-no-min borderbottom">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
$maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 500)?($_SESSION["dol_screenheight"]-200):660; // Also into index.php file
echo '<div style="max-height: '.$maxheightwin.'px;">';
echo '<div class="tagtable centpercent calendarviewcontainer">';
$maxnbofchar=80;
$tmp = explode('-', $conf->global->MAIN_DEFAULT_WORKING_HOURS);
$minhour = round($tmp[0],0);
$maxhour = round($tmp[1],0);
if ($minhour > 23) $minhour = 23;
if ($maxhour < 1) $maxhour = 1;
if ($maxhour <= $minhour) { $maxhour = $minhour + 1; }
$i = 0;
$j = 0;
while ($i < 24)
{
echo ' <div class="tagtr calendarviewcontainertr">'."\n";
echo ' <div class="tagtd width100 tdtop">'.dol_print_date($i*3600, 'hour', 'gmt').'</div>';
echo ' <div class="tagtd '.$style.' tdtop">';
echo " </div>\n";
echo " </div>\n";
$i++;
$j++;
}
echo '</div></div>';
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1);
print '</div>';
}
else
{
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0);
print '</div>';
}
}
print "\n".'</form>';
@ -1213,9 +1269,10 @@ $db->close();
* @param string $newparam Parameters on current URL
* @param int $showinfo Add extended information (used by day and week view)
* @param int $minheight Minimum height for each event. 60px by default.
* @param string $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button"
* @return void
*/
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60)
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $nonew=0)
{
global $user, $conf, $langs;
global $action, $filter, $filtert, $status, $actioncode; // Filters used into search form
@ -1230,26 +1287,35 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
print '<div id="dayevent_'.$dateint.'" class="dayevent tagtable centpercent nobordernopadding">'."\n";
print '<div class="tagtr"><div class="nowrap float">';
print '<a style="color: #666" href="'.DOL_URL_ROOT.'/comm/action/index.php?';
print 'action=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
print $newparam;
print '">';
if ($showinfo) print dol_print_date($curtime,'daytextshort');
else print dol_print_date($curtime,'%d');
print '</a>';
print '</div><div class="floatright nowrap">';
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
if ($nonew <= 0)
{
$newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
print '<div class="tagtr"><div class="nowrap float">';
print '<a style="color: #666" href="'.DOL_URL_ROOT.'/comm/action/index.php?';
print 'action=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
print $newparam;
print '">';
if ($showinfo) print dol_print_date($curtime,'daytextshort');
else print dol_print_date($curtime,'%d');
print '</a>';
print '</div><div class="floatright nowrap">';
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
{
$newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
//$param='month='.$monthshown.'&year='.$year;
$hourminsec='100000';
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$year,$month,$day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
print img_picto($langs->trans("NewAction"),'edit_add.png');
print '</a>';
//$param='month='.$monthshown.'&year='.$year;
$hourminsec='100000';
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$year,$month,$day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
print img_picto($langs->trans("NewAction"),'edit_add.png');
print '</a>';
}
print '</div></div>'."\n";
}
if ($nonew < 0)
{
print '</div>';
return;
}
print '</div></div>'."\n";
// Line with td contains all div of each events
print '<div class="tagtr">';
@ -1390,6 +1456,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
//print ' position: absolute; top: 40px; width: 50%;';
//print '"';
print '>';
//var_dump($event->userassigned);
//var_dump($event->transparency);
print '<table class="centpercent cal_event'.(empty($event->transparency)?' cal_event_notbusy':' cal_event_busy').'" style="'.$h;

View File

@ -331,13 +331,9 @@ if ($resql)
$num = $db->num_rows($resql);
/*$title=$langs->trans("DoneAndToDoActions");
if ($status == 'done') $title=$langs->trans("DoneActions");
if ($status == 'todo') $title=$langs->trans("ToDoActions");
*/
$title=$langs->trans("ListOfEvents");
$newtitle=$langs->trans($title);
// Local calendar
$newtitle ='<div class="nowrap clear inline-block minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda").' &nbsp; </div>';
//$newtitle=$langs->trans($title);
$tabactive='cardlist';

View File

@ -177,16 +177,27 @@ if (empty($reshook))
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// update order min amount
if ($action == 'setorder_min_amount')
{
$object->fetch($id);
$object->order_min_amount=GETPOST('order_min_amount');
$result=$object->update($object->id, $user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'update_extras') {
$object->fetch($id);
$object->oldcopy = dol_clone($object);
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none'));
if ($ret < 0) $error++;
if (! $error)
{
$result = $object->insertExtraFields();
$result = $object->insertExtraFields('COMPANY_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@ -211,7 +222,7 @@ if ($id > 0 && empty($object->id))
{
// Load data of third party
$res=$object->fetch($id);
if ($object->id <= 0) dol_print_error($db,$object->error,$object->errors);
if ($object->id < 0) dol_print_error($db, $object->error, $object->errors);
}
$title=$langs->trans("CustomerCard");
@ -220,7 +231,7 @@ $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$title,$help_url);
if ($id > 0)
if ($object->id > 0)
{
$head = societe_prepare_head($object);
@ -401,10 +412,20 @@ if ($id > 0)
print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
//if (empty($object->outstanding_limit)) print $langs->trans("NoLimit");
print '</td>';
print '</tr>';
print '<tr class="nowrap">';
print '<td>';
print $form->editfieldkey("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer);
print '</td><td>';
print $form->editfieldval("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
print '</td>';
print '</tr>';
}
// Multiprice level
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
@ -529,7 +550,7 @@ if ($id > 0)
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
$boxstat = '';
@ -538,7 +559,7 @@ if ($id > 0)
// Lien recap
$boxstat.='<div class="box">';
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom" width="100%">';
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
$boxstat.='<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
if (! empty($conf->propal->enabled))
@ -1272,7 +1293,8 @@ if ($id > 0)
}
else
{
dol_print_error($db,'Bad value for socid parameter');
$langs->load("errors");
print $langs->trans('ErrorRecordNotFound');
}
// End of page

View File

@ -676,8 +676,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{
$langs->load("propal");
$sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql.= ", s.code_client";
$sql = "SELECT s.nom as name, s.rowid, s.code_client";
$sql.= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -726,7 +726,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
print '</td>';
print '<td width="16" align="center" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir);
print '</td></tr></table>';

View File

@ -967,7 +967,7 @@ else
* Boutons d'action
*/
if (GETPOST('cancel','alpha') || $confirm=='no' || $action == '' || in_array($action,array('settodraft', 'valid','delete','sendall','clone')))
if (GETPOST('cancel','alpha') || $confirm=='no' || $action == '' || in_array($action,array('settodraft','valid','delete','sendall','clone','test')))
{
print "\n\n<div class=\"tabsAction\">\n";
@ -1071,7 +1071,9 @@ else
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
print load_fiche_titre($langs->trans("TestMailing"));
// Create l'objet formulaire mail
dol_fiche_head(null, '', '', -1);
// Create l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->fromname = $object->email_from;
@ -1099,6 +1101,10 @@ else
print $formmail->get_form();
print '<br>';
dol_fiche_end();
print dol_set_focus('#sendto');
}
@ -1114,7 +1120,7 @@ else
dol_fiche_head('', '', '', -1);
print '<table class="border" width="100%">';
print '<table class="bordernooddeven" width="100%">';
// Subject
print '<tr><td class="titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3">'.$object->sujet.'</td></tr>';
@ -1260,7 +1266,7 @@ else
dol_fiche_head(null, '', '', -1);
print '<table class="border" width="100%">';
print '<table class="bordernooddeven" width="100%">';
// Subject
print '<tr><td class="fieldrequired titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat quatrevingtpercent" type="text" name="sujet" value="'.$object->sujet.'"></td></tr>';

View File

@ -260,7 +260,7 @@ if ($object->fetch($id) >= 0)
print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"),1):''), 'title_generic');
//print '<table class="noborder" width="100%">';
print '<div class="tagtable centpercent liste_titre_bydiv" id="tablelines">';
print '<div class="tagtable centpercent liste_titre_bydiv borderbottom" id="tablelines">';
//print '<tr class="liste_titre">';
print '<div class="tagtr liste_titre">';

View File

@ -104,8 +104,11 @@ if ($id > 0 || ! empty($ref)) {
$ret = $object->fetch($id, $ref);
if ($ret > 0)
$ret = $object->fetch_thirdparty();
if ($ret < 0)
dol_print_error('', $object->error);
if ($ret <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -502,7 +505,7 @@ if (empty($reshook))
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
@ -1225,13 +1228,15 @@ if (empty($reshook))
}
else if ($action == 'update_extras') {
$object->oldcopy = dol_clone($object);
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none'));
if ($ret < 0) $error++;
if (! $error)
{
$result = $object->insertExtraFields();
$result = $object->insertExtraFields('PROPAL_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@ -1287,7 +1292,7 @@ if (empty($reshook))
}
// Actions to build doc
$upload_dir = $conf->propal->dir_output;
$upload_dir = $conf->propal->multidir_output[$object->entity];
$permissioncreate=$user->rights->propal->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
@ -1366,7 +1371,7 @@ if ($action == 'create')
$soc = $objectsrc->thirdparty;
$cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
$cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:0)); // TODO maybe add default value option
$mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
@ -1453,17 +1458,13 @@ if ($action == 'create')
// Ligne info remises tiers
print '<tr><td>' . $langs->trans('Discounts') . '</td><td>';
if ($soc->remise_percent)
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
else
print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount = $soc->getAvailableDiscounts();
print '. ';
if ($absolute_discount)
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount, 0, $langs, 1, -1, -1, $conf->currency));
else
print $langs->trans("CompanyHasNoAbsoluteDiscount");
print '.';
$thirdparty = $soc;
$discount_type = 0;
$backtopage = urlencode($_SERVER["PHP_SELF"] . '?socid=' . $thirdparty->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid'));
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
print '</td></tr>';
}
@ -1711,7 +1712,7 @@ if ($action == 'create')
print '</table>';
}
} else {
} elseif ($object->id > 0) {
/*
* Show object in view mode
*/
@ -1818,7 +1819,6 @@ if ($action == 'create')
$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);
@ -1871,31 +1871,26 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// Link for thirdparty discounts
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
}
print '<tr><td class="titlefield">' . $langs->trans('Discounts') . '</td><td>';
if ($soc->remise_percent)
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
else
print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
$absolute_discount = $soc->getAvailableDiscounts('', 'fk_facture_source IS NULL');
$absolute_creditnote = $soc->getAvailableDiscounts('', 'fk_facture_source IS NOT NULL');
$absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
$absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote);
$absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
if ($absolute_discount) {
if ($object->statut > Propal::STATUS_DRAFT) {
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount, 0, $langs, 0, 0, -1, $conf->currency));
} else {
// Remise dispo de type non avoir
$filter = 'fk_facture_source IS NULL';
print '<br>';
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filter, 0, '', 1);
}
}
if ($absolute_creditnote) {
print $langs->trans("CompanyHasCreditNote", price($absolute_creditnote, 0, $langs, 0, 0, -1, $conf->currency)) . '. ';
}
if (! $absolute_discount && ! $absolute_creditnote)
print $langs->trans("CompanyHasNoAbsoluteDiscount") . '.';
$thirdparty = $soc;
$discount_type = 0;
$backtopage = urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id);
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
print '</td></tr>';
// Date of proposal
@ -1917,7 +1912,7 @@ if ($action == 'create')
print '</form>';
} else {
if ($object->date) {
print dol_print_date($object->date, 'daytext');
print dol_print_date($object->date, 'day');
} else {
print '&nbsp;';
}
@ -1943,7 +1938,7 @@ if ($action == 'create')
print '</form>';
} else {
if (! empty($object->fin_validite)) {
print dol_print_date($object->fin_validite, 'daytext');
print dol_print_date($object->fin_validite, 'day');
if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay))
print img_warning($langs->trans("Late"));
} else {
@ -2130,6 +2125,22 @@ if ($action == 'create')
print '</tr>';
}
$tmparray=$object->getTotalWeightVolume();
$totalWeight=$tmparray['weight'];
$totalVolume=$tmparray['volume'];
if ($totalWeight) {
print '<tr><td>' . $langs->trans("CalculatedWeight") . '</td>';
print '<td>';
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
print '</td></tr>';
}
if ($totalVolume) {
print '<tr><td>' . $langs->trans("CalculatedVolume") . '</td>';
print '<td>';
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
print '</td></tr>';
}
// Incoterms
if (!empty($conf->incoterm->enabled))
{
@ -2405,7 +2416,7 @@ if ($action == 'create')
* Documents generes
*/
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
$filedir = $conf->propal->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->propal->lire;
$delallowed = $user->rights->propal->creer;
@ -2446,7 +2457,7 @@ if ($action == 'create')
// Presend form
$modelmail='propal_send';
$defaulttopic='SendPropalRef';
$diroutput = $conf->propal->dir_output;
$diroutput = $conf->propal->multidir_output[$object->entity];
$trackid = 'pro'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View File

@ -1210,7 +1210,7 @@ class Propal extends CommonObject
// get extrafields so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
$line->fetch_optionals();
// Load dest object
$clonedObj = clone $this;
@ -1289,11 +1289,6 @@ class Propal extends CommonObject
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$clonedObj,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
// Call trigger
$result=$clonedObj->call_trigger('PROPAL_CLONE',$user);
if ($result < 0) { $error++; }
// End call triggers
}
unset($this->context['createfromclone']);
@ -1348,8 +1343,8 @@ class Propal extends CommonObject
$sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
$sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
$sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."propal as p";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id AND cp.entity IN ('.getEntity('c_paiement').')';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid AND cr.entity IN ('.getEntity('c_payment_term').')';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
@ -1440,12 +1435,9 @@ class Propal extends CommonObject
$this->brouillon = 1;
}
// Retreive all extrafield for invoice
// Retreive all extrafield
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
$this->db->free($resql);
@ -1757,8 +1749,8 @@ class Propal extends CommonObject
// to not lose the linked files
$oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($num);
$dirsource = $conf->propal->dir_output.'/'.$oldref;
$dirdest = $conf->propal->dir_output.'/'.$newref;
$dirsource = $conf->propal->multidir_output[$this->entity].'/'.$oldref;
$dirdest = $conf->propal->multidir_output[$this->entity].'/'.$newref;
if (file_exists($dirsource))
{
@ -1767,7 +1759,7 @@ class Propal extends CommonObject
{
dol_syslog("Rename ok");
// Rename docs starting with $oldref with $newref
$listoffiles=dol_dir_list($conf->propal->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
$listoffiles=dol_dir_list($dirdest, 'files', 1, '^'.preg_quote($oldref,'/'));
foreach($listoffiles as $fileentry)
{
$dirsource=$fileentry['name'];
@ -2823,9 +2815,9 @@ class Propal extends CommonObject
{
// We remove directory
$ref = dol_sanitizeFileName($this->ref);
if ($conf->propal->dir_output && !empty($this->ref))
if ($conf->propal->multidir_output[$this->entity] && !empty($this->ref))
{
$dir = $conf->propal->dir_output . "/" . $ref ;
$dir = $conf->propal->multidir_output[$this->entity] . "/" . $ref ;
$file = $dir . "/" . $ref . ".pdf";
if (file_exists($file))
{

View File

@ -75,7 +75,7 @@ $object->fetch($id,$ref);
if ($object->id > 0)
{
$object->fetch_thirdparty();
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref);
$upload_dir = $conf->propal->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
}
@ -90,7 +90,7 @@ $form = new Form($db);
if ($object->id > 0)
{
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref);
$upload_dir = $conf->propal->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$head = propal_prepare_head($object);
dol_fiche_head($head, 'document', $langs->trans('Proposal'), -1, 'propal');

View File

@ -216,7 +216,7 @@ $max=5;
* Last modified proposals
*/
$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as socname, s.rowid as socid, s.canvas, s.client,";
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, s.nom as socname, s.rowid as socid, s.canvas, s.client,";
$sql.= " date_cloture as datec";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
@ -262,7 +262,7 @@ if ($resql)
print '<td width="16" align="right" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir);
print '</td></tr></table>';
@ -296,7 +296,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
$now=dol_now();
$sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client";
$sql.= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -341,7 +342,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
print '</td>';
print '<td width="16" align="center" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir);
print '</td></tr></table>';

View File

@ -110,7 +110,7 @@ if (! empty($socid))
}
$result = restrictedArea($user, $module, $objectid, $dbtable);
$diroutputmassaction=$conf->propal->dir_output . '/temp/massgeneration/'.$user->id;
$diroutputmassaction=$conf->propal->multidir_output[$conf->entity] . '/temp/massgeneration/'.$user->id;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('propallist'));
@ -214,7 +214,7 @@ if (empty($reshook))
$objectlabel='Proposals';
$permtoread = $user->rights->propal->lire;
$permtodelete = $user->rights->propal->supprimer;
$uploaddir = $conf->propal->dir_output;
$uploaddir = $conf->propal->multidir_output[$conf->entity];
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@ -242,7 +242,7 @@ if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name,";
$sql.= ' p.rowid, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
$sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
$sql.= ' p.datec as date_creation, p.tms as date_update,';
$sql.= " pr.rowid as project_id, pr.ref as project_ref,";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
@ -462,7 +462,7 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@ -663,7 +663,7 @@ if ($resql)
// Other picto tool
print '<td width="16" align="right" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print '</td></tr></table>';
@ -892,25 +892,18 @@ if ($resql)
print '</form>'."\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
/*
* Show list of available documents
*/
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$hidegeneratedfilelistifempty=1;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
$filedir=$diroutputmassaction;
$genallowed=$user->rights->propal->lire;
$delallowed=$user->rights->propal->creer;
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'','');
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
$filedir=$diroutputmassaction;
$genallowed=$user->rights->propal->lire;
$delallowed=$user->rights->propal->creer;
print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{

View File

@ -56,7 +56,14 @@ if (GETPOST('action','aZ09') == 'setremise')
{
$object = new Societe($db);
$object->fetch($id);
$result=$object->set_remise_client(price2num(GETPOST("remise")),GETPOST("note"),$user);
$discount_type = GETPOST('discount_type', 'int');
if(! empty($discount_type)) {
$result=$object->set_remise_supplier(price2num(GETPOST("remise")),GETPOST("note"),$user);
} else {
$result=$object->set_remise_client(price2num(GETPOST("remise")),GETPOST("note"),$user);
}
if ($result > 0)
{
@ -100,34 +107,73 @@ if ($socid > 0)
$head = societe_prepare_head($object);
$isCustomer = $object->client == 1 || $object->client == 3;
$isSupplier = $object->fournisseur == 1;
print '<form method="POST" action="remise.php?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"), 0, 'company');
dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"), -1, 'company');
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
if(! $isCustomer && ! $isSupplier) {
print '<p class="opacitymedium">'.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').'</p>';
dol_fiche_end();
print '</form>';
llxFooter();
$db->close();
exit;
}
print '<table class="border centpercent">';
// Discount
print '<tr><td class="titlefield">';
print $langs->trans("CustomerRelativeDiscount").'</td><td>'.price2num($object->remise_percent)."%</td></tr>";
if($isCustomer) {
// Customer discount
print '<tr><td class="titlefield">';
print $langs->trans("CustomerRelativeDiscount").'</td><td>'.price2num($object->remise_percent)."%</td></tr>";
}
if($isSupplier) {
// Supplier discount
print '<tr><td class="titlefield">';
print $langs->trans("SupplierRelativeDiscount").'</td><td>'.price2num($object->remise_supplier_percent)."%</td></tr>";
}
print '</table>';
print '<br>';
print load_fiche_titre($langs->trans("NewRelativeDiscount"),'','');
print '<div class="underbanner clearboth"></div>';
if($isCustomer && ! $isSupplier) {
print '<input type="hidden" name="discount_type" value="0" />';
}
if(! $isCustomer && $isSupplier) {
print '<input type="hidden" name="discount_type" value="1" />';
}
print '<table class="border centpercent">';
if($isCustomer && $isSupplier) {
// Discount type
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td>';
print '<td><input type="radio" name="discount_type" id="discount_type_0" selected value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
print ' <input type="radio" name="discount_type" id="discount_type_1" selected value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
print '</td></tr>';
}
// New value
print '<tr><td class="titlefield fieldrequired">';
print $langs->trans("NewValue").'</td><td><input type="text" size="5" name="remise" value="'.dol_escape_htmltag(GETPOST("remise")).'">%</td></tr>';
@ -155,57 +201,128 @@ if ($socid > 0)
print '<br>';
if($isCustomer) {
if($isSupplier) {
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
}
/*
* List log of all percent discounts
*/
$sql = "SELECT rc.rowid, rc.remise_client as remise_percent, rc.note, rc.datec as dc,";
$sql.= " u.login, u.rowid as user_id";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise as rc, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE rc.fk_soc = " . $object->id;
$sql.= " AND rc.entity = " . $conf->entity;
$sql.= " AND u.rowid = rc.fk_user_author";
$sql.= " ORDER BY rc.datec DESC";
$resql=$db->query($sql);
if ($resql)
{
print '<table class="noborder" width="100%">';
$tag = !$tag;
print '<tr class="liste_titre">';
print '<td width="160">'.$langs->trans("Date").'</td>';
print '<td width="160" align="center">'.$langs->trans("CustomerRelativeDiscountShort").'</td>';
print '<td align="left">'.$langs->trans("NoteReason").'</td>';
print '<td align="center">'.$langs->trans("User").'</td>';
print '</tr>';
$num = $db->num_rows($resql);
if ($num > 0)
{
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>'.dol_print_date($db->jdate($obj->dc),"dayhour").'</td>';
print '<td align="center">'.price2num($obj->remise_percent).'%</td>';
print '<td align="left">'.$obj->note.'</td>';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '</tr>';
$i++;
}
/*
* List log of all customer percent discounts
*/
$sql = "SELECT rc.rowid, rc.remise_client as remise_percent, rc.note, rc.datec as dc,";
$sql.= " u.login, u.rowid as user_id";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise as rc, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE rc.fk_soc = " . $object->id;
$sql.= " AND rc.entity = " . $conf->entity;
$sql.= " AND u.rowid = rc.fk_user_author";
$sql.= " ORDER BY rc.datec DESC";
$resql=$db->query($sql);
if ($resql)
{
print '<table class="noborder" width="100%">';
$tag = !$tag;
print '<tr class="liste_titre">';
print '<td width="160">'.$langs->trans("Date").'</td>';
print '<td width="160" align="center">'.$langs->trans("CustomerRelativeDiscountShort").'</td>';
print '<td align="left">'.$langs->trans("NoteReason").'</td>';
print '<td align="center">'.$langs->trans("User").'</td>';
print '</tr>';
$num = $db->num_rows($resql);
if ($num > 0)
{
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>'.dol_print_date($db->jdate($obj->dc),"dayhour").'</td>';
print '<td align="center">'.price2num($obj->remise_percent).'%</td>';
print '<td align="left">'.$obj->note.'</td>';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '</tr>';
$i++;
}
}
else
{
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$db->free($resql);
print "</table>";
}
else
{
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$db->free($resql);
print "</table>";
}
else
{
dol_print_error($db);
dol_print_error($db);
}
}
if($isSupplier) {
if($isCustomer) {
print '</div>'; // class="fichehalfleft"
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
}
/*
* List log of all supplier percent discounts
*/
$sql = "SELECT rc.rowid, rc.remise_supplier as remise_percent, rc.note, rc.datec as dc,";
$sql.= " u.login, u.rowid as user_id";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_supplier as rc, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE rc.fk_soc = " . $object->id;
$sql.= " AND rc.entity = " . $conf->entity;
$sql.= " AND u.rowid = rc.fk_user_author";
$sql.= " ORDER BY rc.datec DESC";
$resql=$db->query($sql);
if ($resql)
{
print '<table class="noborder" width="100%">';
$tag = !$tag;
print '<tr class="liste_titre">';
print '<td width="160">'.$langs->trans("Date").'</td>';
print '<td width="160" align="center">'.$langs->trans("CustomerRelativeDiscountShort").'</td>';
print '<td align="left">'.$langs->trans("NoteReason").'</td>';
print '<td align="center">'.$langs->trans("User").'</td>';
print '</tr>';
$num = $db->num_rows($resql);
if ($num > 0)
{
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>'.dol_print_date($db->jdate($obj->dc),"dayhour").'</td>';
print '<td align="center">'.price2num($obj->remise_percent).'%</td>';
print '<td align="left">'.$obj->note.'</td>';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '</tr>';
$i++;
}
}
else
{
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$db->free($resql);
print "</table>";
}
else
{
dol_print_error($db);
}
if($isCustomer) {
print '</div>'; // class="ficheaddleft"
print '</div>'; // class="fichehalfright"
print '</div>'; // class="fichecenter"
}
}
}
llxFooter();

File diff suppressed because it is too large Load Diff

View File

@ -1268,9 +1268,11 @@ if (empty($reshook))
if ($action == 'update_extras')
{
$object->oldcopy = dol_clone($object);
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none'));
if ($ret < 0) $error++;
if (! $error)
@ -1281,7 +1283,7 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields();
$result = $object->insertExtraFields('ORDER_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@ -1448,7 +1450,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
$soc = $objectsrc->thirdparty;
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:0)); // TODO maybe add default value option
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
$availability_id = (!empty($objectsrc->availability_id)?$objectsrc->availability_id:(!empty($soc->availability_id)?$soc->availability_id:0));
@ -1556,17 +1558,14 @@ if ($action == 'create' && $user->rights->commande->creer)
// Ligne info remises tiers
print '<tr><td>' . $langs->trans('Discounts') . '</td><td>';
if ($soc->remise_percent)
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
else
print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
$absolute_discount = $soc->getAvailableDiscounts();
if ($absolute_discount)
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency" . $conf->currency));
else
print $langs->trans("CompanyHasNoAbsoluteDiscount");
print '.';
$thirdparty = $soc;
$discount_type = 0;
$backtopage = urlencode($_SERVER["PHP_SELF"] . '?socid=' . $thirdparty->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid'));
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
print '</td></tr>';
}
// Date
@ -1804,7 +1803,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$author = new User($db);
$author->fetch($object->user_author_id);
$res = $object->fetch_optionals($object->id, $extralabels);
$res = $object->fetch_optionals();
$head = commande_prepare_head($object);
dol_fiche_head($head, 'order', $langs->trans("CustomerOrder"), -1, 'order');
@ -2038,12 +2037,11 @@ if ($action == 'create' && $user->rights->commande->creer)
// Relative and absolute discounts
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final
// invoice
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')";
$filtercreditnote = "fk_facture_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%'";
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
}
$addrelativediscount = '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditRelativeDiscounts") . '</a>';
@ -2051,29 +2049,17 @@ if ($action == 'create' && $user->rights->commande->creer)
$addcreditnote = '<a href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&socid=' . $soc->id . '&type=2&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("AddCreditNote") . '</a>';
print '<tr><td class="titlefield">' . $langs->trans('Discounts') . '</td><td>';
if ($soc->remise_percent)
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
else
print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
$absolute_discount = $soc->getAvailableDiscounts('', 'fk_facture_source IS NULL');
$absolute_creditnote = $soc->getAvailableDiscounts('', 'fk_facture_source IS NOT NULL');
$absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
$absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote);
$absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
if ($absolute_discount) {
if ($object->statut > Commande::STATUS_DRAFT) {
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
} else {
// Remise dispo de type remise fixe (not credit note)
print '<br>';
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount, 0, '', 1);
}
}
if ($absolute_creditnote) {
print $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '. ';
}
if (! $absolute_discount && ! $absolute_creditnote)
print $langs->trans("CompanyHasNoAbsoluteDiscount") . '.';
$thirdparty = $soc;
$discount_type = 0;
$backtopage = urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id);
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
print '</td></tr>';
// Date
@ -2300,12 +2286,15 @@ if ($action == 'create' && $user->rights->commande->creer)
$tmparray=$object->getTotalWeightVolume();
$totalWeight=$tmparray['weight'];
$totalVolume=$tmparray['volume'];
if ($totalWeight || $totalVolume)
if ($totalWeight)
{
print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
print '<td>';
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
print '</td></tr>';
}
if ($totalVolume)
{
print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
print '<td>';
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
@ -2388,8 +2377,12 @@ if ($action == 'create' && $user->rights->commande->creer)
}
// Total HT
$alert = '';
if($object->total_ht < $object->thirdparty->order_min_amount) {
$alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
}
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
print '<td>' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td>';
print '<td>' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . $alert . '</td>';
// Total VAT
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td>' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';

View File

@ -1024,7 +1024,7 @@ class Commande extends CommonOrder
// get lines so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
$line->fetch_optionals();
// Load source object
$objFrom = clone $this;
@ -1073,11 +1073,6 @@ class Commande extends CommonOrder
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
// Call trigger
$result=$this->call_trigger('ORDER_CLONE',$user);
if ($result < 0) $error++;
// End call triggers
}
unset($this->context['createfromclone']);
@ -1150,7 +1145,7 @@ class Commande extends CommonOrder
$line->marque_tx = $marginInfos[2];
// get extrafields from original line
$object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
$object->lines[$i]->fetch_optionals();
foreach($object->lines[$i]->array_options as $options_key => $value)
$line->array_options[$options_key] = $value;
@ -1589,8 +1584,8 @@ class Commande extends CommonOrder
$sql.= ', ca.code as availability_code, ca.label as availability_label';
$sql.= ', dr.code as demand_reason_code';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid AND cr.entity IN ('.getEntity('c_payment_term').')';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id AND p.entity IN ('.getEntity('c_paiement').')';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = ca.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
@ -1675,12 +1670,9 @@ class Commande extends CommonOrder
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
// Retrieve all extrafields for invoice
// Retreive all extrafield
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
$this->db->free($result);

View File

@ -1101,25 +1101,18 @@ if ($resql)
print '</form>'."\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
/*
* Show list of available documents
*/
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$hidegeneratedfilelistifempty=1;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
$filedir=$diroutputmassaction;
$genallowed=$user->rights->commande->lire;
$delallowed=$user->rights->commande->creer;
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
$filedir=$diroutputmassaction;
$genallowed=$user->rights->commande->lire;
$delallowed=$user->rights->commande->creer;
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{

View File

@ -673,7 +673,7 @@ if ($resql)
print '</td>';
print '<td>&nbsp;</td>';
print '<td class="nowrap">';
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1);
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')), 'operation', '1,2', 2, 1);
print '</td>';
print '<td>';
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq","alpha").'">';
@ -852,7 +852,7 @@ if ($resql)
if (! empty($arrayfields['type']['checked']))
{
print '<td class="liste_titre" align="center">';
$form->select_types_paiements(empty($search_type)?'':$search_type, 'search_type', '', 2, 0, 1, 0, 1, 'maxwidth100');
$form->select_types_paiements(empty($search_type)?'':$search_type, 'search_type', '', 2, 1, 1, 0, 1, 'maxwidth100');
print '</td>';
}
if (! empty($arrayfields['b.num_chq']['checked']))

View File

@ -913,12 +913,9 @@ class Account extends CommonObject
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_update = $this->db->jdate($obj->date_update);
// Retreive all extrafield for thirdparty
// Retreive all extrafield
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
return 1;
}

View File

@ -62,6 +62,7 @@ if (! $user->rights->banque->lire && ! $user->rights->banque->consolidate) acces
/*
* Actions
*/
if ($cancel)
{
if ($backtopage)
@ -108,10 +109,23 @@ if ($user->rights->banque->modifier && $action == "update")
{
$error=0;
$ac = new Account($db);
$ac->fetch($id);
$acline = new AccountLine($db);
$acline->fetch($rowid);
if ($ac->courant == Account::TYPE_CASH && $_POST['value'] != 'LIQ')
$acsource = new Account($db);
$acsource->fetch($id);
$actarget = new Account($db);
if (GETPOST('accountid','int') > 0 && ! $acline->rappro && ! $acline->getVentilExportCompta()) // We ask to change bank account
{
$actarget->fetch(GETPOST('accountid','int'));
}
else
{
$actarget->fetch($id);
}
if ($actarget->courant == Account::TYPE_CASH && GETPOST('value','alpha') != 'LIQ')
{
setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
$error++;
@ -119,16 +133,6 @@ if ($user->rights->banque->modifier && $action == "update")
if (! $error)
{
// Avant de modifier la date ou le montant, on controle si ce n'est pas encore rapproche
$conciliated=0;
$sql = "SELECT b.rappro FROM ".MAIN_DB_PREFIX."bank as b WHERE rowid=".$rowid;
$result = $db->query($sql);
if ($result)
{
$objp = $db->fetch_object($result);
$conciliated=$objp->rappro;
}
$db->begin();
$amount = price2num($_POST['amount']);
@ -142,15 +146,15 @@ if ($user->rights->banque->modifier && $action == "update")
if (isset($_POST['banque'])) $sql.=" banque='".$db->escape($_POST["banque"])."',";
if (isset($_POST['emetteur'])) $sql.=" emetteur='".$db->escape($_POST["emetteur"])."',";
// Blocked when conciliated
if (! $conciliated)
if (! $acline->rappro)
{
if (isset($_POST['label'])) $sql.=" label='".$db->escape($_POST["label"])."',";
if (isset($_POST['amount'])) $sql.=" amount='".$amount."',";
if (isset($_POST['dateomonth'])) $sql.=" dateo = '".$db->idate($dateop)."',";
if (isset($_POST['datevmonth'])) $sql.=" datev = '".$db->idate($dateval)."',";
}
$sql.= " fk_account = ".$id;
$sql.= " WHERE rowid = ".$rowid;
$sql.= " fk_account = ".$actarget->id;
$sql.= " WHERE rowid = ".$acline->id;
$result = $db->query($sql);
if (! $result)
@ -282,7 +286,7 @@ if ($result)
$account = $acct->id;
$bankline = new AccountLine($db);
$bankline->fetch($rowid,$ref);
$bankline->fetch($rowid, $ref);
$links=$acct->get_url($rowid);
$bankline->load_previous_next_ref('','rowid');
@ -311,21 +315,19 @@ if ($result)
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Ref
/*
print '<tr><td class="titlefield">'.$langs->trans("Ref")."</td>";
print '<td>';
print $form->showrefnav($bankline, 'rowid', $linkback, 1, 'rowid', 'rowid');
print '</td>';
print '</tr>';
*/
$i++;
// Bank account
print '<tr><td class="titlefield">'.$langs->trans("Account").'</td>';
print '<td>';
print $acct->getNomUrl(1,'transactions','reflabel');
if (! $objp->rappro && ! $bankline->getVentilExportCompta())
{
print $form->select_comptes($acct->id, 'accountid', 0, '', 0);
}
else
{
print $acct->getNomUrl(1,'transactions','reflabel');
}
print '</td>';
print '</tr>';

View File

@ -102,7 +102,7 @@ $sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
$sql.= " pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id AND pst.entity IN (" . getEntity('c_paiement').")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
@ -187,7 +187,7 @@ if ($result)
// Type
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
$form->select_types_paiements($typeid,'typeid','',0,1,1,16);
print '</td>';
// Account

View File

@ -139,7 +139,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id AND pct.entity IN (".getEntity('c_paiement').")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pc.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " WHERE cs.fk_type = c.id";
@ -260,7 +260,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id AND pct.entity IN (".getEntity('c_paiement').")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id";
$sql.= " WHERE pv.entity IN (".getEntity("tax").")";
if ($year > 0)
{
@ -474,7 +474,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id AND pct.entity IN (".getEntity('c_paiement').")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id";
$sql.= " , ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE s.entity IN (".getEntity('user').")";
$sql.= " AND u.rowid = s.fk_user";

View File

@ -716,7 +716,7 @@ if (empty($reshook))
$sql = 'SELECT SUM(pf.amount) as total_paiements';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (' . getEntity('c_paiement') . ')';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
$sql.= ' WHERE pf.fk_facture = '.$object->id;
$sql.= ' AND pf.fk_paiement = p.rowid';
$sql.= ' AND p.entity IN (' . getEntity('facture').')';
@ -2112,9 +2112,11 @@ if (empty($reshook))
if ($action == 'update_extras') {
$object->oldcopy = dol_clone($object);
// Fill array 'array_options' with data from add form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none'));
if ($ret < 0) $error++;
if (! $error) {
@ -2125,7 +2127,7 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields();
$result = $object->insertExtraFields('BILL_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@ -2697,19 +2699,12 @@ if ($action == 'create')
{
// Discounts for third party
print '<tr><td>' . $langs->trans('Discounts') . '</td><td colspan="2">';
if ($soc->remise_percent)
print $langs->trans("CompanyHasRelativeDiscount", '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">' . $soc->remise_percent . '</a>');
else
print $langs->trans("CompanyHasNoRelativeDiscount");
print ' <a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">(' . $langs->trans("EditRelativeDiscount") . ')</a>';
print '. ';
print '<br>';
if ($absolute_discount)
print $langs->trans("CompanyHasAbsoluteDiscount", '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">' . price($absolute_discount) . '</a>', $langs->trans("Currency" . $conf->currency));
else
print $langs->trans("CompanyHasNoAbsoluteDiscount");
print ' <a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">(' . $langs->trans("EditGlobalDiscounts") . ')</a>';
print '.';
$thirdparty = $soc;
$discount_type = 0;
$backtopage = urlencode($_SERVER["PHP_SELF"] . '?socid=' . $thirdparty->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid'));
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
print '</td></tr>';
}
@ -2998,7 +2993,7 @@ else if ($id > 0 || ! empty($ref))
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%'))";
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
}
@ -3361,84 +3356,14 @@ else if ($id > 0 || ! empty($ref))
print '</td></tr>';
// Relative and absolute discounts
$addrelativediscount = '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditRelativeDiscounts") . '</a>';
$addabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditGlobalDiscounts") . '</a>';
$addcreditnote = '<a href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&socid=' . $soc->id . '&type=2&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("AddCreditNote") . '</a>';
$viewabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("ViewAvailableGlobalDiscounts") . '</a>';
print '<!-- Discounts --><tr><td>' . $langs->trans('Discounts');
print '</td><td>';
if ($soc->remise_percent)
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
else
print $langs->trans("CompanyHasNoRelativeDiscount");
// print ' ('.$addrelativediscount.')';
// Is there is commercial discount or down payment available ?
if ($absolute_discount > 0) {
print '. ';
if ($object->statut > 0 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
if ($object->statut == 0) {
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
print '. ';
} else {
if ($object->statut < 1 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
$text = $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
print '<br>' . $text . '.<br>';
} else {
$text = $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency));
$text2 = $langs->trans("AbsoluteDiscountUse");
print $form->textwithpicto($text, $text2);
}
}
} else {
// Discount available of type fixed amount (not credit note)
print '<br>';
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, GETPOST('discountid'), 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount, $resteapayer, ' (' . $addabsolutediscount . ')');
}
} else {
if ($absolute_creditnote > 0) // If not, link will be added later
{
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
print ' (' . $addabsolutediscount . ')<br>';
else
print '. ';
} else
print '. ';
}
// Is there credit notes availables ?
if ($absolute_creditnote > 0)
{
// If validated, we show link "add credit note to payment"
if ($object->statut != Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_CREDIT_NOTE) {
if ($object->statut == 0 && $object->type != Facture::TYPE_DEPOSIT) {
$text = $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency));
print $form->textwithpicto($text, $langs->trans("CreditNoteDepositUse"));
} else {
print $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '.';
}
} else { // We can add a credit note on a down payment or standard invoice or situation invoice
// There is credit notes discounts available
if (! $absolute_discount) print '<br>';
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer);
$more=' ('.$addcreditnote. (($addcreditnote && $viewabsolutediscount) ? ' - ' : '') . $viewabsolutediscount . ')';
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher
}
}
if (! $absolute_discount && ! $absolute_creditnote) {
print $langs->trans("CompanyHasNoAbsoluteDiscount");
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
print ' (' . $addabsolutediscount . ')<br>';
else
print '. ';
}
// if ($object->statut == 0 && $object->type != 2 && $object->type != 3)
// {
// if (! $absolute_discount && ! $absolute_creditnote) print '<br>';
// print ' &nbsp; - &nbsp; ';
// print $addabsolutediscount;
// print ' &nbsp; - &nbsp; '.$addcreditnote; // We disbale link to credit note
// }
print '</td><td>';
$thirdparty = $soc;
$discount_type = 0;
$backtopage = urlencode($_SERVER["PHP_SELF"] . '?facid=' . $object->id);
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
print '</td></tr>';
// Date invoice

View File

@ -304,8 +304,8 @@ class FactureRec extends CommonInvoice
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
//$sql.= ', el.fk_source';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid AND c.entity IN ('.getEntity('c_payment_term').')';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id AND p.entity IN ('.getEntity('c_paiement').')';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'";
$sql.= ' WHERE f.entity IN ('.getEntity('facture').')';
if ($rowid) $sql.= ' AND f.rowid='.$rowid;
@ -381,12 +381,9 @@ class FactureRec extends CommonInvoice
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
// Retreive all extrafield for thirdparty
// Retreive all extrafield
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
/*
* Lines
@ -504,7 +501,7 @@ class FactureRec extends CommonInvoice
$line->price = $objp->price;
$line->remise = $objp->remise;
$extralabelsline = $line->fetch_optionals($line->id,$extrafieldsline);
$extralabelsline = $line->fetch_optionals($line->id);
// Multicurrency
$line->fk_multicurrency = $objp->fk_multicurrency;

View File

@ -239,7 +239,7 @@ class Facture extends CommonInvoice
* @param int $forceduedate 1=Do not recalculate due date from payment condition but force it with value
* @return int <0 if KO, >0 if OK
*/
function create($user,$notrigger=0,$forceduedate=0)
function create(User $user, $notrigger=0, $forceduedate=0)
{
global $langs,$conf,$mysoc,$hookmanager;
$error=0;
@ -265,13 +265,13 @@ class Facture extends CommonInvoice
$this->multicurrency_tx = 1;
}
dol_syslog(get_class($this)."::create user=".$user->id);
dol_syslog(get_class($this)."::create user=".$user->id." date=".$this->date);
// Check parameters
if (empty($this->date) || empty($user->id))
if (empty($this->date))
{
$this->error="ErrorBadParameter";
dol_syslog(get_class($this)."::create Try to create an invoice with an empty parameter (user, date, ...)", LOG_ERR);
$this->error="Try to create an invoice with an empty parameter (date)";
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
return -3;
}
$soc = new Societe($this->db);
@ -799,14 +799,17 @@ class Facture extends CommonInvoice
// Charge facture source
$facture=new Facture($this->db);
$this->fetch_optionals();
if(!empty($this->array_options)){
$facture->array_options = $this->array_options;
}
// Retreive all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
foreach($this->lines as &$line){
if(!empty($this->array_options)){
$facture->array_options = $this->array_options;
}
foreach($this->lines as &$line){
$line->fetch_optionals();//fetch extrafields
}
}
$facture->fk_facture_source = $this->fk_facture_source;
$facture->type = $this->type;
@ -967,11 +970,6 @@ class Facture extends CommonInvoice
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
// Call trigger
$result=$this->call_trigger('BILL_CLONE',$user);
if ($result < 0) $error++;
// End call triggers
}
unset($this->context['createfromclone']);
@ -1042,7 +1040,7 @@ class Facture extends CommonInvoice
$line->pa_ht = $marginInfos[0];
// get extrafields from original line
$object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
$object->lines[$i]->fetch_optionals();
foreach($object->lines[$i]->array_options as $options_key => $value)
$line->array_options[$options_key] = $value;
@ -1258,8 +1256,8 @@ class Facture extends CommonInvoice
$sql.= ', f.fk_incoterms, f.location_incoterms';
$sql.= ", i.libelle as libelle_incoterms";
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid AND c.entity IN (' . getEntity('c_payment_term').')';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id AND p.entity IN ('.getEntity('c_paiement').')';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid';
$sql.= ' WHERE f.entity IN ('.getEntity('facture').')';
if ($rowid) $sql.= " AND f.rowid=".$rowid;
@ -1344,16 +1342,13 @@ class Facture extends CommonInvoice
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
// Retrieve all extrafield for invoice
// Retreive all extrafield
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
/*
* Lines
*/
*/
$this->lines = array();
@ -2247,7 +2242,7 @@ class Facture extends CommonInvoice
// Validate
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql.= " SET facnumber='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".$user->id.", date_valid = '".$this->db->idate($now)."'";
$sql.= " SET facnumber='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'";
if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) // If option enabled, we force invoice date
{
$sql.= ", datef='".$this->db->idate($this->date)."'";
@ -3222,7 +3217,6 @@ class Facture extends CommonInvoice
}
}
/**
* Return next reference of customer invoice not already used (or last reference)
* according to numbering module defined into constant FACTURE_ADDON

View File

@ -90,7 +90,6 @@ class PaymentTerm // extends CommonObject
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_payment_term(";
$sql.= "rowid,";
$sql.= "entity,";
$sql.= "code,";
$sql.= "sortorder,";
@ -101,7 +100,6 @@ class PaymentTerm // extends CommonObject
$sql.= "nbjour,";
$sql.= "decalage";
$sql.= ") VALUES (";
$sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->db->escape($this->rowid)."'").",";
$sql.= " ".(! isset($this->entity)?getEntity('c_payment_term'):"'".$this->db->escape($this->entity)."'").",";
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
$sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->db->escape($this->sortorder)."'").",";
@ -181,7 +179,6 @@ class PaymentTerm // extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
$sql.= " WHERE t.rowid = ".$id;
$sql.= " AND t.entity = " . getEntity('c_payment_term');
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
@ -221,36 +218,36 @@ class PaymentTerm // extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
function getDefaultId()
{
global $langs;
function getDefaultId()
{
global $langs;
$ret=0;
$ret=0;
$sql = "SELECT";
$sql = "SELECT";
$sql.= " t.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
$sql.= " WHERE t.code = 'RECEP'";
$sql.= " AND t.entity = " . getEntity('c_payment_term');
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
$sql.= " WHERE t.code = 'RECEP'";
$sql.= " AND t.entity IN (".getEntity('c_payment_term').")";
dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
if ($obj) $ret=$obj->rowid;
}
$this->db->free($resql);
return $ret;
}
else
{
$this->error="Error ".$this->db->lasterror();
return -1;
}
}
dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
if ($obj) $ret=$obj->rowid;
}
$this->db->free($resql);
return $ret;
}
else
{
$this->error="Error ".$this->db->lasterror();
return -1;
}
}
/**
@ -293,7 +290,6 @@ class PaymentTerm // extends CommonObject
$sql.= " nbjour=".(isset($this->nbjour)?$this->nbjour:"null").",";
$sql.= " decalage=".(isset($this->decalage)?$this->decalage:"null")."";
$sql.= " WHERE rowid = " . $this->id;
$sql.= " AND entity = " . getEntity('c_payment_term');
$this->db->begin();
@ -350,7 +346,6 @@ class PaymentTerm // extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_payment_term";
$sql.= " WHERE rowid = " . $this->id;
$sql.= " AND t.entity = " . getEntity('c_payment_term');
$this->db->begin();

View File

@ -446,13 +446,15 @@ if (empty($reshook))
}
else if ($action == 'update_extras')
{
$object->oldcopy = dol_clone($object);
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none'));
if ($ret < 0) $error++;
if (! $error) {
$result = $object->insertExtraFields();
$result = $object->insertExtraFields('BILLREC_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@ -1187,7 +1189,7 @@ if ($action == 'create')
$disableedit=1;
$disablemove=1;
$disableremove=1;
$ret = $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
$object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
}
print "</table>\n";

View File

@ -419,19 +419,19 @@ if ($resql)
// Date invoice
if (! empty($arrayfields['f.date_last_gen']['checked']))
{
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
$formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5);
print '<td class="liste_titre nowraponall" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
$formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle');
print '</td>';
}
// Date next generation
if (! empty($arrayfields['f.date_when']['checked']))
{
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day_date_when" value="'.$search_day_date_when.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month_date_when" value="'.$search_month_date_when.'">';
$formother->select_year($search_year_date_when?$search_year_date_when:-1,'search_year_date_when',1, 20, 5);
print '<td class="liste_titre nowraponall" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_date_when" value="'.$search_day_date_when.'">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month_date_when" value="'.$search_month_date_when.'">';
$formother->select_year($search_year_date_when?$search_year_date_when:-1,'search_year_date_when',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle');
print '</td>';
}
// Extra fields
@ -599,8 +599,10 @@ if ($resql)
if (! empty($arrayfields['f.date_when']['checked']))
{
print '<td align="center">';
print '<div class="nowraponall">';
print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'<strike>':'').dol_print_date($db->jdate($objp->date_when),'day').($invoicerectmp->isMaxNbGenReached()?'</strike>':'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
if ($objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late"));
print '</div>';
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
@ -636,7 +638,7 @@ if ($resql)
}
else
{
print $langs->trans("DateIsNotEnough");
print $form->textwithpicto('', $langs->trans("DateIsNotEnough"));
}
}
else

View File

@ -276,7 +276,7 @@ if ($massaction == 'withdrawrequest')
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("AmountMustBePositive"), $objecttmp->errors, 'errors');
}
if(!($objecttmp->statut > Facture::STATUS_DRAFT)){
if (!($objecttmp->statut > Facture::STATUS_DRAFT)){
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("Draft"), $objecttmp->errors, 'errors');
}
@ -298,11 +298,11 @@ if ($massaction == 'withdrawrequest')
$numprlv = $db->num_rows($result_sql);
}
if($numprlv>0){
if ($numprlv>0){
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'errors');
}
if(!empty($objecttmp->mode_reglement_id ) && $objecttmp->mode_reglement_id != 3){
if (!empty($objecttmp->mode_reglement_code ) && $objecttmp->mode_reglement_code != 'PRE'){
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("BadPaymentMethod"), $objecttmp->errors, 'errors');
}
@ -702,18 +702,18 @@ if ($resql)
if (! empty($arrayfields['f.date']['checked']))
{
print '<td class="liste_titre nowraponall" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">';
$formother->select_year($year?$year:-1,'year',1, 20, 5, 0, 0, '', 'width75');
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">';
$formother->select_year($year?$year:-1,'year',1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
print '</td>';
}
// Date due
if (! empty($arrayfields['f.date_lim_reglement']['checked']))
{
print '<td class="liste_titre nowraponall" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.dol_escape_htmltag($day_lim).'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_lim" value="'.dol_escape_htmltag($month_lim).'">';
$formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5, 0, 0, '', 'width75');
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="day_lim" value="'.dol_escape_htmltag($day_lim).'">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="month_lim" value="'.dol_escape_htmltag($month_lim).'">';
$formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Late");
print '</td>';
}
@ -756,7 +756,7 @@ if ($resql)
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
{
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10);
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10);
print '</td>';
}
if (! empty($arrayfields['f.total_ht']['checked']))
@ -775,14 +775,14 @@ if ($resql)
}
if (! empty($arrayfields['f.total_localtax1']['checked']))
{
// Amount
// Localtax1
print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="5" name="search_montant_localtax1" value="'.$search_montant_localtax1.'">';
print '</td>';
}
if (! empty($arrayfields['f.total_localtax2']['checked']))
{
// Amount
// Localtax2
print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="5" name="search_montant_localtax2" value="'.$search_montant_localtax2.'">';
print '</td>';
@ -1192,22 +1192,18 @@ if ($resql)
print "</form>\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$hidegeneratedfilelistifempty=1;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
$filedir=$diroutputmassaction;
$genallowed=$user->rights->facture->lire;
$delallowed=$user->rights->facture->creer;
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
$filedir=$diroutputmassaction;
$genallowed=$user->rights->facture->lire;
$delallowed=$user->rights->facture->creer;
print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{

View File

@ -140,8 +140,16 @@ if ($object->id > 0)
if ($object->paye) $resteapayer=0;
$resteapayeraffiche=$resteapayer;
$absolute_discount=$object->thirdparty->getAvailableDiscounts('','fk_facture_source IS NULL');
$absolute_creditnote=$object->thirdparty->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
}
$absolute_discount=$object->thirdparty->getAvailableDiscounts('',$filterabsolutediscount);
$absolute_creditnote=$object->thirdparty->getAvailableDiscounts('',$filtercreditnote);
$absolute_discount=price2num($absolute_discount,'MT');
$absolute_creditnote=price2num($absolute_creditnote,'MT');
@ -253,61 +261,13 @@ if ($object->id > 0)
// Discounts
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
if ($absolute_discount > 0)
{
if ($object->statut > Facture::STATUS_DRAFT || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
{
if ($object->statut == Facture::STATUS_DRAFT)
{
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)).'. ';
}
else
{
if ($object->statut < Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
{
$text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
print '<br>'.$text.'.<br>';
}
else
{
$text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
$text2=$langs->trans("AbsoluteDiscountUse");
print $form->textwithpicto($text,$text2);
}
}
}
else
{
// Remise dispo de type non avoir
$filter='fk_facture_source IS NULL';
print '<br>';
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$object->thirdparty->id,$absolute_discount,$filter,$resteapayer,'',1);
}
}
if ($absolute_creditnote > 0)
{
// If validated, we show link "add credit note to payment"
if ($object->statut != Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_CREDIT_NOTE)
{
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_DEPOSIT)
{
$text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency));
print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse"));
}
else print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'.';
}
else
{
// Remise dispo de type avoir
$filter='fk_facture_source IS NOT NULL';
if (! $absolute_discount) print '<br>';
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id_for_payment',$object->thirdparty->id,$absolute_creditnote,$filter,$resteapayer,'',1);
}
}
if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
$thirdparty = $object->thirdparty;
$discount_type = 0;
$backtopage = urlencode($_SERVER["PHP_SELF"] . '?facid=' . $object->id);
$cannotApplyDiscount = 1;
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
print '</td></tr>';
// Date invoice

View File

@ -132,7 +132,7 @@ class Localtax extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
function update($user=null, $notrigger=0)
function update(User $user, $notrigger=0)
{
global $conf, $langs;
@ -149,8 +149,8 @@ class Localtax extends CommonObject
$this->db->begin();
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET";
$sql.= " localtaxtype=".$this->ltt.",";
$sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET";
$sql.= " localtaxtype=".$this->ltt.",";
$sql.= " tms='".$this->db->idate($this->tms)."',";
$sql.= " datep='".$this->db->idate($this->datep)."',";
$sql.= " datev='".$this->db->idate($this->datev)."',";
@ -160,7 +160,7 @@ class Localtax extends CommonObject
$sql.= " fk_bank=".$this->fk_bank.",";
$sql.= " fk_user_creat=".$this->fk_user_creat.",";
$sql.= " fk_user_modif=".$this->fk_user_modif;
$sql.= " WHERE rowid=".$this->id;
$sql.= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
@ -255,12 +255,12 @@ class Localtax extends CommonObject
}
/**
* Delete object in database
*
* @param User $user User that delete
* @return int <0 if KO, >0 if OK
*/
/**
* Delete object in database
*
* @param User $user User that delete
* @return int <0 if KO, >0 if OK
*/
function delete($user)
{
// Call trigger
@ -285,11 +285,11 @@ class Localtax extends CommonObject
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
function initAsSpecimen()
{

View File

@ -88,11 +88,11 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm == 'yes'))
{
$error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
$paiement_id = 0;
$totalpayment = 0;
$multicurrency_totalpayment = 0;
@ -827,7 +827,7 @@ if (! GETPOST('action','aZ09'))
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.facnumber';
$sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (' . getEntity('c_paiement').')';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
$sql.= ', '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' WHERE p.fk_facture = f.rowid';
$sql.= ' AND f.entity IN (' . getEntity('facture').')';

View File

@ -332,8 +332,6 @@ if ($resql)
if ($num > 0)
{
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object($resql);

View File

@ -107,7 +107,7 @@ class Cpaiement
// Insert request
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
$sql.= 'id,';
$sql.= 'entity,';
$sql.= 'code,';
$sql.= 'libelle,';
$sql.= 'type,';
@ -118,7 +118,7 @@ class Cpaiement
$sql .= ') VALUES (';
$sql .= ' '.(! isset($this->id)?'NULL':$this->id).',';
$sql .= ' '.(! isset($this->entity)?getEntity('c_paiement'):$this->entity).',';
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
$sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").',';
$sql .= ' '.(! isset($this->type)?'NULL':$this->type).',';
@ -186,7 +186,8 @@ class Cpaiement
$sql .= " t.module";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
if (null !== $ref) {
$sql .= ' WHERE t.code = ' . '\'' . $ref . '\'';
$sql .= ' WHERE t.entity IN ('.getEntity('c_paiement').')';
$sql .= ' AND t.code = ' . '\'' . $ref . '\'';
} else {
$sql .= ' WHERE t.id = ' . $id;
}

View File

@ -209,9 +209,10 @@ class Paiement extends CommonObject
$total = $totalamount_converted; // Maybe use price2num with MT for the converted value
$mtotal = $totalamount;
}
$note = ($this->note_public?$this->note_public:$this->note);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, fk_user_creat)";
$sql.= " VALUES (".$conf->entity.", '".$this->ref."', '". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$total."', '".$mtotal."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.")";
$sql.= " VALUES (".$conf->entity.", '".$this->ref."', '". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$total."', '".$mtotal."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($note)."', ".$user->id.")";
dol_syslog(get_class($this)."::Create insert paiement", LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -138,7 +138,7 @@ else
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (" . getEntity('c_paiement') . ")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";

View File

@ -17,9 +17,9 @@
*/
/**
* \file htdocs/compta/paiement/avalider.php
* \file htdocs/compta/paiement/tovalidate.php
* \ingroup compta
* \brief Page liste des paiements a valider des factures clients
* \brief Page list payment to validate. Visible in menu when option BILL_ADD_PAYMENT_VALIDATION is on.
*/
require '../../main.inc.php';

View File

@ -726,16 +726,12 @@ class BonPrelevement extends CommonObject
$sql = "SELECT count(f.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
//if ($banque || $agence) $sql.=", ".MAIN_DB_PREFIX."societe_rib as sr";
$sql.= " WHERE f.fk_statut = 1";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND f.rowid = pfd.fk_facture";
$sql.= " AND f.paye = 0";
$sql.= " AND pfd.traite = 0";
$sql.= " AND f.total_ttc > 0";
//if ($banque || $agence) $sql.= " AND f.fk_soc = sr.rowid";
//if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
//if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
dol_syslog(get_class($this)."::SommeAPrelever");
$resql = $this->db->query($sql);
@ -805,9 +801,8 @@ class BonPrelevement extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
//if ($banque || $agence) $sql.= ", ".MAIN_DB_PREFIX."societe_rib as sr";
$sql.= " WHERE f.rowid = pfd.fk_facture";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND f.entity IN (".getEntity('facture').')';
$sql.= " AND s.rowid = f.fk_soc";
//if ($banque || $agence) $sql.= " AND s.rowid = sr.fk_soc";
$sql.= " AND f.fk_statut = 1";
@ -1340,6 +1335,7 @@ class BonPrelevement extends CommonObject
$sql.= " AND soc.rowid = f.fk_soc";
$sql.= " AND rib.fk_soc = f.fk_soc";
$sql.= " AND rib.default_rib = 1";
$sql.= " AND rib.type = 'ban'";
//print $sql;
// Define $fileDebiteurSection. One section DrctDbtTxInf per invoice.

View File

@ -822,7 +822,7 @@ else
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
$sql.= " WHERE p.entity IN (".getEntity('expensereport').")";
$sql.= " AND p.fk_statut>=5";
@ -906,7 +906,7 @@ else
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
$sql.= " WHERE p.entity IN (".getEntity('donation').")";
$sql.= " AND fk_statut >= 2";
}

View File

@ -698,7 +698,7 @@ if (! empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES'
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
$sql.= " WHERE p.entity IN (".getEntity('expensereport').")";
$sql.= " AND p.fk_statut>=5";
@ -761,7 +761,7 @@ if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
$sql.= " WHERE p.entity IN (".getEntity('donation').")";
$sql.= " AND fk_statut >= 2";
if (! empty($date_start) && ! empty($date_end))

View File

@ -73,7 +73,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
if (empty($datev)) $datev=$datep;
$type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement');
$type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement', 'code', 'id', 1);
$object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
$object->fk_user=GETPOST("fk_user") > 0 ? GETPOST("fk_user","int") : 0;

View File

@ -105,7 +105,7 @@ $sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.da
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
$sql.= " pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id AND pst.entity IN (".getEntity('c_paiement').")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid,";
$sql.= " ".MAIN_DB_PREFIX."user as u";
@ -179,7 +179,7 @@ if ($result)
print '<td class="liste_titre">&nbsp;</td>';
// Type
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
$form->select_types_paiements($typeid,'typeid','',0,1,1,16);
print '</td>';
// Account
if (! empty($conf->banque->enabled))

View File

@ -586,7 +586,7 @@ if ($id > 0)
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid';
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id AND c.entity IN (" . getEntity('c_paiement').")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " WHERE p.fk_charge = ".$id;
$sql.= " AND p.fk_charge = cs.rowid";

View File

@ -83,7 +83,7 @@ class ChargeSociales extends CommonObject
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id AND p.entity IN ('.getEntity('c_paiement').')';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id';
$sql.= ' WHERE cs.entity IN ('.getEntity('tax').')';
if ($ref) $sql.= " AND cs.rowid = ".$ref;
else $sql.= " AND cs.rowid = ".$id;
@ -156,6 +156,7 @@ class ChargeSociales extends CommonObject
function create($user)
{
global $conf;
$error=0;
$now=dol_now();
@ -191,8 +192,17 @@ class ChargeSociales extends CommonObject
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
//dol_syslog("ChargesSociales::create this->id=".$this->id);
$this->db->commit();
return $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;
}
}
else
{

View File

@ -203,7 +203,7 @@ class PaymentSocialContribution extends CommonObject
$sql.= " t.fk_user_modif,";
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
$sql.= ' b.fk_account';
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id AND pt.entity IN (" . getEntity('c_paiement') . ")";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
$sql.= " WHERE t.rowid = ".$id;
// TODO link on entity of tax;

View File

@ -133,7 +133,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs,";
$sql.= " ".MAIN_DB_PREFIX."paiementcharge as pc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id AND pct.entity IN (".getEntity('c_paiement').")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id";
$sql.= " WHERE cs.fk_type = c.id AND pc.fk_charge = cs.rowid";
$sql.= " AND cs.entity = ".$conf->entity;
if ($year > 0)

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.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
@ -695,6 +696,38 @@ class Tva extends CommonObject
return $result;
}
/**
* Return amount of payments already done
*
* @return int Amount of payment already done, <0 if KO
*/
function getSommePaiement()
{
$table='paiementcharge';
$field='fk_charge';
$sql = 'SELECT sum(amount) as amount';
$sql.= ' FROM '.MAIN_DB_PREFIX.$table;
$sql.= ' WHERE '.$field.' = '.$this->id;
dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$amount=0;
$obj = $this->db->fetch_object($resql);
if ($obj) $amount=$obj->amount?$obj->amount:0;
$this->db->free($resql);
return $amount;
}
else
{
return -1;
}
}
/**
* Informations of vat payment object
*

View File

@ -0,0 +1,177 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.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/>.
*/
/**
* \file htdocs/compta/tva/document.php
* \ingroup tax
* \brief Page with attached files on social contributions
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
if (! empty($conf->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
$langs->load("other");
$langs->load("companies");
$langs->load("compta");
$langs->load("bills");
$id = GETPOST('id','int');
$action = GETPOST('action','aZ09');
$confirm = GETPOST('confirm', 'alpha');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', $id, 'vat','charges');
// Get parameters
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) {
$page = 0;
}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
$object = new Tva($db);
if ($id > 0) $object->fetch($id);
$upload_dir = $conf->tax->dir_output.'/'.dol_sanitizeFileName($object->ref);
$modulepart='tax';
/*
* Actions
*/
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
if ($action == 'setlib' && $user->rights->tax->charges->creer)
{
$object->fetch($id);
$result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
/*
* View
*/
$form = new Form($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
$title = $langs->trans("VATPayment") . ' - ' . $langs->trans("Documents");
$help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
llxHeader("",$title,$help_url);
if ($object->id)
{
$alreadypayed=$object->getSommePaiement();
$head=vat_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans("VATPayment"), -1, 'bill');
$morehtmlref='<div class="refidno">';
// Label of social contribution
$morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' : ';
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
$morehtmlref.='</div>';
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/tva/index.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0;
foreach($filearray as $key => $file)
{
$totalsize+=$file['size'];
}
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
$modulepart = 'tax';
$permission = $user->rights->tax->charges->creer;
$permtoedit = $user->rights->fournisseur->facture->creer;
$param = '&id=' . $object->id;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
}
else
{
print $langs->trans("ErrorUnknown");
}
llxFooter();
$db->close();

View File

@ -100,7 +100,7 @@ $bankstatic = new Account($db);
$sql = "SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id AND pst.entity IN (".getEntity('c_paiement').")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " WHERE t.entity IN (".getEntity('tax').")";
@ -173,7 +173,7 @@ if ($result)
print '</td>';
// Type
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
$form->select_types_paiements($typeid,'typeid','',0,1,1,16);
print '</td>';
// Account
if (! empty($conf->banque->enabled))

View File

@ -238,6 +238,15 @@ $dolibarr_main_prod='0';
//
$dolibarr_main_restrict_os_commands='mysqldump, mysql, pg_dump, pgrestore';
// $dolibarr_main_restrict_ip
// To restrict access to backoffice to some ip addresses only.
// Note: Pages that does not need login (like public pages, web site) are not protected with this.
// Default value: ''
// Examples:
// $dolibarr_main_restrict_ip='127.0.0.1, 192.168.0.1';
//
$dolibarr_main_restrict_ip='';
// dolibarr_nocsrfcheck
// This parameter can be used to disable CSRF protection.
// This might be required if you access Dolibarr behind a proxy that make
@ -284,16 +293,6 @@ $dolibarr_nocsrfcheck='0';
// Examples:
// $dolibarr_strict_mode=0;
// dolibarr_pdf_force_fpdf
// Set this to 1 to use the libray FPDF instead of TCPDF. FPDF is not embedded with Dolibarr,
// so you also have to uncomment line $dolibarr_lib_FPDF_PATH to provide path to FPDF library.
// Warning: FPDF does not support all features supported by TCPDF used by default. So using
// this library instead of TCPF will break some features like transparent logo, cyrillic, arab,
// and asiatic languages, total number of pages, ...
// Default value: 0
// Examples:
// $dolibarr_pdf_force_fpdf=1;
//#################################

View File

@ -190,7 +190,8 @@ else
$object = new Contact($db);
$res=$object->fetch($id, $user);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
$res=$object->fetch_optionals($object->id,$extralabels);
$res=$object->fetch_optionals();
if ($res < 0) { dol_print_error($db,$object->error); exit; }
// Show tabs
$head = contact_prepare_head($object);

View File

@ -468,7 +468,8 @@ else
$object = new Contact($db);
$res=$object->fetch($id, $user);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
$res=$object->fetch_optionals($object->id,$extralabels);
$res=$object->fetch_optionals();
if ($res < 0) { dol_print_error($db,$object->error); exit; }
// Show tabs
$head = contact_prepare_head($object);
@ -607,7 +608,15 @@ else
// State
if (empty($conf->global->SOCIETE_DISABLE_STATE))
{
print '<tr><td><label for="state_id">'.$langs->trans('State').'</label></td><td colspan="'.$colspan.'" class="maxwidthonsmartphone">';
if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2))
{
print '<tr><td><label for="state_id">'.$langs->trans('Region-State').'</label></td><td colspan="'.$colspan.'" class="maxwidthonsmartphone">';
}
else
{
print '<tr><td><label for="state_id">'.$langs->trans('State').'</label></td><td colspan="'.$colspan.'" class="maxwidthonsmartphone">';
}
if ($object->country_id)
{
print $formcompany->select_state(GETPOST("state_id",'alpha')?GETPOST("state_id",'alpha'):$object->state_id,$object->country_code,'state_id');
@ -852,7 +861,15 @@ else
// State
if (empty($conf->global->SOCIETE_DISABLE_STATE))
{
print '<tr><td><label for="state_id">'.$langs->trans('State').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2))
{
print '<tr><td><label for="state_id">'.$langs->trans('Region-State').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
}
else
{
print '<tr><td><label for="state_id">'.$langs->trans('State').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
}
print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?GETPOST("country_id"):$object->country_id,'state_id');
print '</td></tr>';
}

View File

@ -801,12 +801,9 @@ class Contact extends CommonObject
}
}
// Retreive all extrafield for contact
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
// Retreive all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
return 1;
}

View File

@ -94,6 +94,7 @@ $permissionnote=$user->rights->contrat->creer; // Used by the include of actions
$permissiondellink=$user->rights->contrat->creer; // Used by the include of actions_dellink.inc.php
/*
* Actions
*/
@ -657,43 +658,53 @@ if (empty($reshook))
else if ($action == 'updateline' && $user->rights->contrat->creer && ! GETPOST('cancel','alpha'))
{
if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update)
{
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
$action = 'editline';
$_GET['rowid'] = GETPOST('elrowid');
$error++;
}
$error = 0;
if (!$error) {
$objectline = new ContratLigne($db);
if ($objectline->fetch(GETPOST('elrowid')))
{
$db->begin();
if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update)
{
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
$action = 'editline';
$_GET['rowid'] = GETPOST('elrowid');
$error++;
}
if ($date_start_real_update == '') $date_start_real_update=$objectline->date_ouverture;
if ($date_end_real_update == '') $date_end_real_update=$objectline->date_cloture;
if (! $error)
{
$objectline = new ContratLigne($db);
if ($objectline->fetch(GETPOST('elrowid')) < 0)
{
setEventMessages($objectline->error, $objectline->errors, 'errors');
$error++;
}
}
$vat_rate = GETPOST('eltva_tx');
// Define info_bits
$info_bits = 0;
if (preg_match('/\*/', $vat_rate))
$db->begin();
if (! $error)
{
if ($date_start_real_update == '') $date_start_real_update=$objectline->date_ouverture;
if ($date_end_real_update == '') $date_end_real_update=$objectline->date_cloture;
$vat_rate = GETPOST('eltva_tx');
// Define info_bits
$info_bits = 0;
if (preg_match('/\*/', $vat_rate))
$info_bits |= 0x01;
// Define vat_rate
$vat_rate = str_replace('*', '', $vat_rate);
$localtax1_tx=get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
$localtax2_tx=get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
$localtax1_tx=get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
$localtax2_tx=get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
$txtva = $vat_rate;
$txtva = $vat_rate;
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
}
// ajout prix d'achat
$fk_fournprice = $_POST['fournprice'];
@ -704,22 +715,22 @@ if (empty($reshook))
$fk_unit = GETPOST('unit', 'alpha');
$objectline->description=GETPOST('product_desc','none');
$objectline->price_ht=GETPOST('elprice');
$objectline->subprice=GETPOST('elprice');
$objectline->qty=GETPOST('elqty');
$objectline->remise_percent=GETPOST('elremise_percent');
$objectline->tva_tx=($txtva?$txtva:0); // Field may be disabled, so we use vat rate 0
$objectline->vat_src_code=$vat_src_code;
$objectline->localtax1_tx=is_numeric($localtax1_tx)?$localtax1_tx:0;
$objectline->localtax2_tx=is_numeric($localtax2_tx)?$localtax2_tx:0;
$objectline->date_ouverture_prevue=$date_start_update;
$objectline->date_ouverture=$date_start_real_update;
$objectline->date_fin_validite=$date_end_update;
$objectline->date_cloture=$date_end_real_update;
$objectline->fk_user_cloture=$user->id;
$objectline->fk_fournprice=$fk_fournprice;
$objectline->pa_ht=$pa_ht;
$objectline->description=GETPOST('product_desc','none');
$objectline->price_ht=GETPOST('elprice');
$objectline->subprice=GETPOST('elprice');
$objectline->qty=GETPOST('elqty');
$objectline->remise_percent=GETPOST('elremise_percent');
$objectline->tva_tx=($txtva?$txtva:0); // Field may be disabled, so we use vat rate 0
$objectline->vat_src_code=$vat_src_code;
$objectline->localtax1_tx=is_numeric($localtax1_tx)?$localtax1_tx:0;
$objectline->localtax2_tx=is_numeric($localtax2_tx)?$localtax2_tx:0;
$objectline->date_ouverture_prevue=$date_start_update;
$objectline->date_ouverture=$date_start_real_update;
$objectline->date_fin_validite=$date_end_update;
$objectline->date_cloture=$date_end_real_update;
$objectline->fk_user_cloture=$user->id;
$objectline->fk_fournprice=$fk_fournprice;
$objectline->pa_ht=$pa_ht;
if ($fk_unit > 0) {
$objectline->fk_unit = GETPOST('unit');
@ -727,30 +738,30 @@ if (empty($reshook))
$objectline->fk_unit = null;
}
// Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element);
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
$objectline->array_options=$array_options;
// Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element);
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
$objectline->array_options=$array_options;
// TODO verifier price_min si fk_product et multiprix
// TODO verifier price_min si fk_product et multiprix
$result=$objectline->update($user);
if ($result > 0)
{
$db->commit();
}
else
{
$result=$objectline->update($user);
if ($result < 0)
{
$error++;
setEventMessages($objectline->error, $objectline->errors, 'errors');
$db->rollback();
}
}
else
{
setEventMessages($objectline->error, $objectline->errors, 'errors');
}
}
}
}
if (! $error)
{
$db->commit();
}
else
{
$db->rollback();
}
}
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer)
@ -800,18 +811,30 @@ if (empty($reshook))
else if ($action == 'reopen' && $user->rights->contrat->creer)
{
$result = $object->reopen($user);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Close all lines
else if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer)
{
$object->closeAll($user);
$result = $object->closeAll($user);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Close all lines
else if ($action == 'confirm_activate' && $confirm == 'yes' && $user->rights->contrat->creer)
{
$object->activateAll($user);
$result = $object->activateAll($user);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer)
@ -853,13 +876,15 @@ if (empty($reshook))
}
else if ($action == 'update_extras')
{
$object->oldcopy = dol_clone($object);
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none'));
if ($ret < 0) $error++;
if (! $error) {
$result = $object->insertExtraFields();
$result = $object->insertExtraFields('CONTRACT_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@ -1501,8 +1526,10 @@ else
// Title line for service
$cursorline=1;
print '<div id="contrat-lines-container" data-contractid="'.$object->id.'" data-element="'.$object->element.'" >';
while ($cursorline <= $nbofservices)
{
print '<div id="contrat-line-container'.$object->lines[$cursorline-1]->id.'" data-contratlineid = "'.$object->lines[$cursorline-1]->id.'" data-element="'.$object->lines[$cursorline-1]->element.'" >';
print '<form name="update" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updateline">';
@ -1682,7 +1709,7 @@ else
if (is_array($extralabelslines) && count($extralabelslines)>0) {
print '<tr '.$bcnd[$var].'>';
$line = new ContratLigne($db);
$line->fetch_optionals($objp->rowid,$extralabelslines);
$line->fetch_optionals($objp->rowid);
print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bcnd[$var], 'colspan'=>$colspan));
print '</tr>';
}
@ -1756,7 +1783,7 @@ else
if (is_array($extralabelslines) && count($extralabelslines)>0) {
print '<tr '.$bcnd[$var].'>';
$line = new ContratLigne($db);
$line->fetch_optionals($objp->rowid,$extralabelslines);
$line->fetch_optionals($objp->rowid);
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$colspan));
print '</tr>';
}
@ -1848,7 +1875,7 @@ else
// Area with status and activation info of line
if ($object->statut > 0)
{
print '<table class="notopnoleftnoright tableforservicepart2" width="100%">';
print '<table class="notopnoleftnoright tableforservicepart2'.($cursorline < $nbofservices ?' boxtablenobottom':'').'" width="100%">';
print '<tr '.$bcnd[$var].'>';
print '<td>'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).'</td>';
@ -1899,7 +1926,7 @@ else
print $langs->trans("DateEndReal").': ';
print dol_print_date($objp->date_fin_reelle, 'day');
}
if (! empty($objp->comment)) print "<br>".$objp->comment;
if (! empty($objp->comment)) print " &nbsp;-&nbsp; ".$objp->comment;
print '</td>';
print '<td align="center">&nbsp;</td>';
@ -2015,9 +2042,10 @@ else
print '</form>';
}
print '</div>';
$cursorline++;
}
print '</div>';
// Form to add new line
if ($user->rights->contrat->creer && ($object->statut == 0))

View File

@ -274,7 +274,8 @@ class Contrat extends CommonObject
// Load lines
$this->fetch_lines();
$ok=true;
$error=0;
foreach($this->lines as $contratline)
{
// Open lines not already open
@ -285,26 +286,27 @@ class Contrat extends CommonObject
$result = $contratline->active_line($user, $date_start, -1, $comment);
if ($result < 0)
{
$ok=false;
$error++;
$this->error = $contratline->error;
$this->errors = $contratline->errors;
break;
}
}
}
if ($this->statut == 0)
if (! $error && $this->statut == 0)
{
$result=$this->validate($user);
if ($result < 0) $ok=false;
$result=$this->validate($user, '', $notrigger);
if ($result < 0) $error++;
}
if ($ok)
if (! $error)
{
$this->db->commit();
return 1;
}
else
{
dol_print_error($this->db,'Error in activateAll function');
$this->db->rollback();
return -1;
}
@ -314,10 +316,11 @@ class Contrat extends CommonObject
* Close all lines of a contract
*
* @param User $user Object User making action
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @param string $comment Comment
* @return int <0 if KO, >0 if OK
*/
function closeAll(User $user, $notrigger=0)
function closeAll(User $user, $notrigger=0, $comment='')
{
$this->db->begin();
@ -326,7 +329,8 @@ class Contrat extends CommonObject
$now = dol_now();
$ok=true;
$error = 0;
foreach($this->lines as $contratline)
{
// Close lines not already closed
@ -335,29 +339,30 @@ class Contrat extends CommonObject
$contratline->date_cloture=$now;
$contratline->fk_user_cloture=$user->id;
$contratline->statut='5';
$result=$contratline->update($user);
$result=$contratline->close_line($user, $now, $comment, $notrigger);
if ($result < 0)
{
$ok=false;
$error++;
$this->error = $contratline->error;
$this->errors = $contratline->errors;
break;
}
}
}
if ($this->statut == 0)
if (! $error && $this->statut == 0)
{
$result=$this->validate($user, '', $notrigger);
if ($result < 0) $ok=false;
if ($result < 0) $error++;
}
if ($ok)
if (! $error)
{
$this->db->commit();
return 1;
}
else
{
dol_print_error($this->db,'Error in closeAll function');
$this->db->rollback();
return -1;
}
@ -607,7 +612,7 @@ class Contrat extends CommonObject
$this->mise_en_service = $this->db->jdate($result["datemise"]);
$this->date_contrat = $this->db->jdate($result["datecontrat"]);
$this->date_creation = $this->db->jdate($result["datecontrat"]);
$this->date_creation = $this->db->jdate($result["datecontrat"]);
$this->fin_validite = $this->db->jdate($result["fin_validite"]);
$this->date_cloture = $this->db->jdate($result["date_cloture"]);
@ -632,16 +637,15 @@ class Contrat extends CommonObject
$this->db->free($resql);
// Retreive all extrafield for thirdparty
// Retreive all extrafield
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
/*
* Lines
*/
*/
$this->lines = array();
@ -793,7 +797,7 @@ class Contrat extends CommonObject
// Retreive all extrafield for contract
// fetch optionals attributes and labels
$line->fetch_optionals($line->id,$extralabelsline);
$line->fetch_optionals();
$this->lines[$pos] = $line;
$this->lines_id_index_mapper[$line->id] = $pos;
@ -1338,7 +1342,7 @@ class Contrat extends CommonObject
// Check parameters
if ($fk_product <= 0 && empty($desc))
{
$this->error="DescRequiredForFreeProductLines";
$this->error="ErrorDescRequiredForFreeProductLines";
return -1;
}
@ -1831,7 +1835,6 @@ class Contrat extends CommonObject
}
if ($mode == 4 || $mode == 6 || $mode == 7)
{
$line=new ContratLigne($this->db);
$text='';
if ($mode == 4)
{
@ -1842,13 +1845,13 @@ class Contrat extends CommonObject
$text.='</span>';
}
$text.=($mode == 7?'<div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.$line->LibStatut(0,3,-1,'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.ContratLigne::LibStatut(0,3,-1,'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode == 7?'</div><div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.$line->LibStatut(4,3,0,'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.ContratLigne::LibStatut(4,3,0,'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode == 7?'</div><div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.$line->LibStatut(4,3,1,'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.ContratLigne::LibStatut(4,3,1,'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode == 7?'</div><div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.$line->LibStatut(5,3,-1,'class="paddingleft2 inline-block valigntextbottom"')) : '';
$text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5,3,-1,'class="paddingleft2 inline-block valigntextbottom"')) : '';
$text.=($mode == 7?'</div>':'');
return $text;
}
@ -2418,17 +2421,6 @@ class Contrat extends CommonObject
}
if (! $notrigger && empty($error))
{
// Call trigger
$clonedObj->old_copy=$this;
$result = $clonedObj->call_trigger('CONTRACT_CLONE', $user);
if ($result < 0) {
$error ++;
}
// End call triggers
}
unset($this->context['createfromclone']);
// End
@ -2551,7 +2543,7 @@ class ContratLigne extends CommonObjectLine
* @param string $moreatt More attribute
* @return string Libelle
*/
function LibStatut($statut,$mode,$expired=-1,$moreatt='')
static function LibStatut($statut,$mode,$expired=-1,$moreatt='')
{
global $langs;
$langs->load("contracts");
@ -2853,6 +2845,9 @@ class ContratLigne extends CommonObjectLine
$this->db->begin();
$this->oldcopy = new ContratLigne($this->db);
$this->oldcopy->fetch($this->id);
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
$sql.= " fk_contrat=".$this->fk_contrat.",";
@ -2892,22 +2887,14 @@ class ContratLigne extends CommonObjectLine
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$contrat=new Contrat($this->db);
$contrat->fetch($this->fk_contrat);
$result=$contrat->update_statut($user);
}
else
if (! $resql)
{
$this->error="Error ".$this->db->lasterror();
$error++;
//return -1;
}
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
@ -2915,19 +2902,52 @@ class ContratLigne extends CommonObjectLine
}
}
if (empty($error)) {
if (! $notrigger)
// If we change a planned date (start or end), sync dates for all services
if (! $error && ! empty($conf->global->CONTRACT_SYNC_PLANNED_DATE_OF_SERVICES))
{
// Call trigger
$result=$this->call_trigger('LINECONTRACT_UPDATE',$user);
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers
}
if ($this->date_ouverture_prevue != $this->oldcopy->date_ouverture_prevue)
{
$sql ='UPDATE '.MAIN_DB_PREFIX.'contratdet SET';
$sql.= " date_ouverture_prevue = ".($this->date_ouverture_prevue!=''?"'".$this->db->idate($this->date_ouverture_prevue)."'":"null");
$sql.= " WHERE fk_contrat = ".$this->fk_contrat;
$resql = $this->db->query($sql);
if (! $resql)
{
$error++;
$this->error="Error ".$this->db->lasterror();
}
}
if ($this->date_fin_validite != $this->oldcopy->date_fin_validite)
{
$sql ='UPDATE '.MAIN_DB_PREFIX.'contratdet SET';
$sql.= " date_fin_validite = ".($this->date_fin_validite!=''?"'".$this->db->idate($this->date_fin_validite)."'":"null");
$sql.= " WHERE fk_contrat = ".$this->fk_contrat;
$resql = $this->db->query($sql);
if (! $resql)
{
$error++;
$this->error="Error ".$this->db->lasterror();
}
}
}
if (empty($error)) {
$this->db->commit();
return 1;
if (! $error)
{
if (! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LINECONTRACT_UPDATE', $user);
if ($result < 0) { $error++; $this->db->rollback(); }
// End call triggers
}
}
if (! $error)
{
$this->db->commit();
return 1;
} else {
$this->db->rollback();
$this->errors[]=$this->error;
@ -3081,7 +3101,7 @@ class ContratLigne extends CommonObjectLine
$resql = $this->db->query($sql);
if ($resql) {
// Call trigger
$result = $this->call_trigger('CONTRACT_SERVICE_ACTIVATE', $user);
$result = $this->call_trigger('LINECONTRACT_ACTIVATE', $user);
if ($result < 0) $error++;
// End call triggers
@ -3112,12 +3132,13 @@ class ContratLigne extends CommonObjectLine
/**
* Close a contract line
*
* @param User $user Objet User who close contract
* @param int $date_end Date end
* @param string $comment A comment typed by user
* @return int <0 if KO, >0 if OK
* @param User $user Objet User who close contract
* @param int $date_end Date end
* @param string $comment A comment typed by user
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK
*/
function close_line($user, $date_end, $comment = '')
function close_line($user, $date_end, $comment = '', $notrigger=0)
{
global $langs, $conf;
@ -3139,15 +3160,19 @@ class ContratLigne extends CommonObjectLine
$sql .= " WHERE rowid = " . $this->id . " AND statut = 4";
$resql = $this->db->query($sql);
if ($resql) {
// Call trigger
$result = $this->call_trigger('CONTRACT_SERVICE_CLOSE', $user);
if ($result < 0) {
$error++;
$this->db->rollback();
return -1;
if ($resql)
{
if (! $notrigger)
{
// Call trigger
$result = $this->call_trigger('LINECONTRACT_CLOSE', $user);
if ($result < 0) {
$error++;
$this->db->rollback();
return -1;
}
// End call triggers
}
// End call triggers
$this->db->commit();
return 1;

View File

@ -49,8 +49,13 @@ $result=restrictedArea($user,'contrat',$id);
$object = new Contrat($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('contractcard','globalcard'));
// Add new contact
/*
* Actions
*/
if ($action == 'addcontact' && $user->rights->contrat->creer)
{

View File

@ -77,10 +77,14 @@ if ($object->id > 0)
$upload_dir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($object->ref);
$modulepart='contract';
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('contractcard','globalcard'));
/*
* Actions
*/
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';

View File

@ -41,6 +41,17 @@ $ref = GETPOST('ref','alpha');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contrat', $id, '');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('contractcard','globalcard'));
/*
* Actions
*/
// None
/*
* View

View File

@ -487,13 +487,13 @@ if ($resql)
if (! empty($arrayfields['c.date_contrat']['checked']))
{
// Date contract
print '<td class="liste_titre center">';
print '<td class="liste_titre center nowraponall">';
//print $langs->trans('Month').': ';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
//print '&nbsp;'.$langs->trans('Year').': ';
$syear = $year;
$formother->select_year($syear,'year',1, 20, 5);
print $formother->selectyear($syear,'year',1, 20, 5, 0, 0, '', 'widthauto');
print '</td>';
}
// Extra fields
@ -775,24 +775,18 @@ if ($resql)
print '</form>';
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
/*
* Show list of available documents
*/
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$hidegeneratedfilelistifempty=1;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
$filedir=$diroutputmassaction;
$genallowed=$user->rights->contrat->lire;
$delallowed=$user->rights->contrat->lire;
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
print $formfile->showdocuments('massfilesarea_contract','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
$filedir=$diroutputmassaction;
$genallowed=$user->rights->contrat->lire;
$delallowed=$user->rights->contrat->lire;
print $formfile->showdocuments('massfilesarea_contract','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{

View File

@ -49,6 +49,10 @@ $object->fetch($id,$ref);
$permissionnote=$user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('contractcard','globalcard'));
/*
* Actions

View File

@ -176,59 +176,91 @@ elseif ($action == 'confirm_updateline' && GETPOST('save','alpha') && GETPOST('l
}
elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha'))
{
// For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile.
// For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile.
if (! empty($upload_dir))
{
$reshook=$hookmanager->initHooks(array('actionlinkedfiles'));
$filenamefrom=dol_sanitizeFileName(GETPOST('renamefilefrom','alpha'), '_', 0); // Do not remove accents
$filenameto=dol_sanitizeFileName(GETPOST('renamefileto','alpha'), '_', 0); // Do not remove accents
$parameters=array('filenamefrom' => $filenamefrom, 'filenameto' => $filenameto, 'upload_dir' => $upload_dir);
$reshook=$hookmanager->executeHooks('renameUploadedFile', $parameters, $object);
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))
{
$filenameto.= '.noexe';
}
if (empty($reshook))
{
// 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;
if ($filenamefrom && $filenameto)
{
$srcpath = $upload_dir.'/'.$filenamefrom;
$destpath = $upload_dir.'/'.$filenameto;
$reshook=$hookmanager->initHooks(array('actionlinkedfiles'));
$parameters=array('filenamefrom' => $filenamefrom, 'filenameto' => $filenameto, 'upload_dir' => $upload_dir);
$reshook=$hookmanager->executeHooks('renameUploadedFile', $parameters, $object);
if (!file_exists($destpath))
{
$result = dol_move($srcpath, $destpath);
if ($result)
{
if ($object->id)
{
$object->addThumbs($destpath);
}
if (empty($reshook))
{
if (! file_exists($destpath))
{
$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);
// 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');
}
}
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');
}
}
}
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');
}
}
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("ErrorDestinationAlreadyExists", $filenameto), null, 'errors');
}
}
}
}
}
// 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');
}
}
}
}

View File

@ -106,7 +106,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$subject='';$actionmsg='';$actionmsg2='';
if (! empty($conf->dolimail->enabled)) $langs->load("dolimail@dolimail");
$langs->load('mails');
if (is_object($object))
@ -320,6 +319,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$mimetype = $attachedfiles['mimes'];
// Feature to push mail sent into Sent folder
/* This code must be now included into the hook mail, method sendMailAfter
if (! empty($conf->dolimail->enabled))
{
$mailfromid = explode("#", $_POST['frommail'],3); // $_POST['frommail'] = 'aaa#Sent# <aaa@aaa.com>' // TODO Use a better way to define Sent dir.
@ -328,7 +328,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
{
$mbid = $mailfromid[1];
/*IMAP Postbox*/
// IMAP Postbox
$mailboxconfig = new IMAP($db);
$mailboxconfig->fetch($mbid);
if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref();
@ -360,6 +360,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
}
}
}
*/
// Make substitution in email content
$substitutionarray=getCommonSubstitutionArray($langs, 0, null, $object);
@ -392,7 +393,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$result=$mailfile->sendfile();
if ($result)
{
// FIXME This must be moved into the trigger for action $trigger_name
// Two hooks are available into method $mailfile->sendfile, so dedicated code is no more required
/*
if (! empty($conf->dolimail->enabled))
{
$mid = (GETPOST('mid','int') ? GETPOST('mid','int') : 0); // Original mail id is set ?
@ -410,7 +412,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs');
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
}
}
}*/
// Initialisation of datas
if (is_object($object))
@ -445,12 +447,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// This avoid sending mail twice if going out and then back to page
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
setEventMessages($mesg, null, 'mesgs');
if ($conf->dolimail->enabled)
{
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:'').'&'.($paramname2?$paramname2:'mid').'='.$parm2val);
exit;
}
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:''));
$moreparam='';
if (isset($paramname2) || isset($paramval2)) $moreparam.= '&'.($paramname2?$paramname2:'mid').'='.$paramval2;
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:'').$moreparam);
exit;
}
else

View File

@ -91,6 +91,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
if ($user->rights->facture->lire)
{
$mesg = '';
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
@ -246,13 +248,11 @@ class box_graph_invoices_permonth extends ModeleBoxes
$stringtoshow.='</div>';
$stringtoshow.='</div>';
}
$this->info_box_contents[0][0] = array('td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
}
else
{
$this->info_box_contents[0][0] = array( 'td' => 'align="left" class="nohover"',
'maxlength'=>500,
'text' => $mesg);
$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="left" class="nohover"', 'maxlength'=>500, 'text' => $mesg);
}
}

View File

@ -245,11 +245,11 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$stringtoshow.='</div>';
$stringtoshow.='</div>';
}
$this->info_box_contents[0][0] = array('td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"','td' => 'align="center" class="nohover"','textnoformat'=>$stringtoshow);
}
else
{
$this->info_box_contents[0][0] = array( 'td' => 'align="left" class="nohover"',
$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'align="left" class="nohover"',
'maxlength'=>500,
'text' => $mesg);
}

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