Merge remote-tracking branch 'refs/remotes/Dolibarr/3.9' into 3.9
This commit is contained in:
commit
bd002656cd
104
ChangeLog
104
ChangeLog
@ -12,6 +12,71 @@ Upgrading to any other version or any other database system is abolutely require
|
||||
make a Dolibarr upgrade.
|
||||
|
||||
|
||||
***** ChangeLog for 3.9.1 compared to 3.9.* *****
|
||||
FIX: #3815 Call to undefined function local_by_date()
|
||||
FIX: #4424 Missing email of user popup in supplier orders area
|
||||
FIX: #4442 Missing translation in Banks menu
|
||||
FIX: #4737 Bank transacion type selector translation is cropped
|
||||
FIX: #4742 Able to delete a supplier invoice with a registered payment
|
||||
FIX: #4743 UI glitch in project summary page
|
||||
FIX: #4747 Missing UI background when registering a supplier invoice payment
|
||||
FIX: #4748 Supplier invoice payment confirmation amount is not translated
|
||||
FIX: #4766 VAT not shown in supplier invoice popup
|
||||
FIX: #4784
|
||||
FIX: #4809 Duplicate functions with different content
|
||||
FIX: #4812
|
||||
FIX: #4839
|
||||
FIX: #4851 Project selector in supplier invoices shows the project label twice
|
||||
FIX: #4870
|
||||
FIX: #4874 SQL error when listing users
|
||||
FIX: #4880
|
||||
FIX: #4961
|
||||
FIX: #4989
|
||||
FIX: If oauth has never been activated two tables are missing and printing is not working
|
||||
FIX: A not enabled field for list must not into fields to add
|
||||
FIX: Bad color of message password changed
|
||||
FIX: Bad error and style message when changing its own login
|
||||
FIX: Bad function name call on delete
|
||||
FIX: Bad include and param for project numbering module call
|
||||
FIX: bad translation language loaded FIX: When changing thirdparty on event card, the showempty option of contact was lost. FIX: Bad placeholder shown on combo to select a thirdparty.
|
||||
FIX: Bad vat definition when using POS module
|
||||
FIX: Box disabled because bugged
|
||||
FIX: Can not select a commercial on the creation of a third
|
||||
FIX: Check of EAN13 barcode when mask was set to use 13 digits instead of 12
|
||||
FIX: correct display of minimum buying price
|
||||
FIX: Creation of thumb image for size "small" was not done.
|
||||
FIX: Damn, where was the project ref ?
|
||||
FIX: Default vat is not set correctly when an error occured and we use VAT identified by a code.
|
||||
FIX: dont retrieve new buying price on margin display
|
||||
FIX: Duplicate records into export
|
||||
FIX: Each time we edit a line, we loose the unit price.
|
||||
FIX: Email templates not compatible with Multicompany
|
||||
FIX: Export must use a left join to not loose lines
|
||||
FIX: fetchAllEMailTemplate
|
||||
FIX: Filter/search on extrafields on lists
|
||||
FIX: finished parameters not used
|
||||
FIX: Generated thumbs must always use the png format so using thumbs can work.
|
||||
FIX: Hook resprint be printed
|
||||
FIX: image extension must be in lower case
|
||||
FIX: Missing clean of criteria
|
||||
FIX: Missing database escaping on supplier price insert/update
|
||||
FIX: Missing function
|
||||
FIX: Multiprice generator didn't recalculate prices if only the price_base_type property changes
|
||||
FIX: Not removing code into vatrate.
|
||||
FIX: Not showing sellprice properly on product list
|
||||
FIX: Parsing of amount to pay vat
|
||||
FIX: PHPCS
|
||||
FIX: PMP is deprecated at warehouse level
|
||||
FIX: real min buying price
|
||||
FIX: Same term to create than other objects
|
||||
FIX: Some records were lost into margin per product report
|
||||
FIX: systematic rounding causes prices to be updated without reason
|
||||
FIX: Template email must take care of positino column
|
||||
FIX: VAT rate can be negative. Example spain selling to morroco.
|
||||
FIX: When cloning an order the order result from clone must be now
|
||||
FIX: When using option Price per level, when adding a predefined product, the vat for customer was not correctly set.
|
||||
|
||||
|
||||
***** ChangeLog for 3.9.0 compared to 3.8.* *****
|
||||
For users:
|
||||
NEW: A new and more modern look for "eldy" theme.
|
||||
@ -696,6 +761,23 @@ Dolibarr better:
|
||||
- Function get_exdir require now 6 parameters. This is to prepare a future feature.
|
||||
|
||||
|
||||
***** ChangeLog for 3.7.4 compared to 3.7.3 *****
|
||||
FIX: #3694
|
||||
FIX: #4239
|
||||
FIX: #4291 Correctly filter external calendar GETPOSTs
|
||||
FIX: #4341
|
||||
FIX: #4414 Supplier invoices use FAC_FORCE_DATE_VALIDATION client invoices property
|
||||
FIX: #4440 Wrong price is filled by Product::fetch into multiprices arrays
|
||||
FIX: add missing global def for ttc column
|
||||
FIX: Contrat card don't consider user permissions to show active/unactive service button
|
||||
FIX: CVE CVE-2015-8685
|
||||
FIX: Email templates not compatible with Multicompany
|
||||
Fix: for avoid division by 0
|
||||
FIX: ISSUE #4506 : make working the PROPAL_CLONE_ON_CREATE_PAGE hidden constant
|
||||
FIX: $outputlangs is not defined (dolibarr 3.7, 3.8, 3.9)
|
||||
FIX: sql injection even when code is on several lines
|
||||
FIX: The third dashboard don't consider user permissions
|
||||
|
||||
***** ChangeLog for 3.7.3 compared to 3.7.2 *****
|
||||
FIX: #3734 Do not show empty links of deleted source objects in stock movement list
|
||||
FIX: #3890 Expected transactions bank account page, shows negative numbers
|
||||
@ -1028,6 +1110,11 @@ Dolibarr better:
|
||||
- Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.6.7 compared to 3.6.6 *****
|
||||
FIX: #4291 Correctly filter external calendar GETPOSTs
|
||||
FIX: CVE CVE-2015-8685
|
||||
|
||||
***** ChangeLog for 3.6.6 compared to 3.6.5 *****
|
||||
FIX: #3734 Do not show empty links of deleted source objects in stock movement list
|
||||
FIX: #4081 Added missing translation
|
||||
@ -1280,6 +1367,17 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
|
||||
- Remove add_photo_web() that is not used anymore by core code.
|
||||
|
||||
|
||||
***** ChangeLog for 3.5.8 compared to 3.5.7 *****
|
||||
FIX: #4291 Correctly filter external calendar GETPOSTs
|
||||
FIX: bad calculation for stock value
|
||||
FIX: bad stock valo
|
||||
FIX: change order date on clone (as everywhere else)
|
||||
FIX: CVE CVE-2015-8685
|
||||
FIX: The hours of date filter aren't correct
|
||||
FIX: #3442 Remove useless syslog
|
||||
FIX: #3448 Pass expected date format
|
||||
FIX: #3471 3.5 Rounding issue when dispatching non-integer
|
||||
|
||||
***** ChangeLog for 3.5.7 compared to 3.5.6 *****
|
||||
Fix: Paypal link were broken due to SSL v3 closed.
|
||||
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
|
||||
@ -1845,7 +1943,7 @@ backport commit 384e3812eb73a15adafb472cacfb93397a54459b to fix W3C/edit contrac
|
||||
- Fix: [ bug #810 ] Cannot update ODT template path
|
||||
- Fix: [ bug #816 ] Sales journal does not reflect localtaxes
|
||||
- Fix: [ bug #817 ] Purchases journal does not reflect localtaxes
|
||||
- Fix: [ bug #824 ] MAIN_DB_PREFIX not use into dictionnary
|
||||
- Fix: [ bug #824 ] MAIN_DB_PREFIX not use into dictionary
|
||||
- Fix: [ bug #828 ] Error when code_region is not a number in llx_c_regions (with postgres)
|
||||
- Fix: [ bug #855 ] Holiday approval email in French
|
||||
- Fix: [ bug #856 ] (Holidays module) Mail error if destination user doesn't have an email
|
||||
@ -1864,7 +1962,7 @@ backport commit 384e3812eb73a15adafb472cacfb93397a54459b to fix W3C/edit contrac
|
||||
- Fix: [ bug #736 ] Missing column in llx_c_chargesociales
|
||||
- Fix: Localtax2 for Spain must be based into buyer
|
||||
- Fix: [ bug #762 ] Bad profit calculation in Reporting
|
||||
- Fix: bug dictionnary with wrong prefix table
|
||||
- Fix: bug dictionary with wrong prefix table
|
||||
|
||||
***** ChangeLog for 3.3 compared to 3.2.* *****
|
||||
For users:
|
||||
@ -1952,7 +2050,7 @@ New experimental module:
|
||||
For developers:
|
||||
- New: Add webservice for thirdparty creation and list.
|
||||
- New: A module can overwrite templates parts.
|
||||
- New: Can add a link on title field of added dictionnary.
|
||||
- New: Can add a link on title field of added dictionary.
|
||||
- New: Uniformize code.
|
||||
- New: Add option WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER and
|
||||
WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER.
|
||||
|
||||
@ -216,7 +216,7 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
@ -322,10 +322,25 @@ if ($resql)
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked'])) print '<td class="liste_titre"></td>';
|
||||
}
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
|
||||
@ -168,7 +168,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, 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, active FROM ".MAIN_DB_PREFIX."c_email_templates";
|
||||
$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")";
|
||||
$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";
|
||||
@ -232,7 +232,7 @@ $tabfield[21]= "code,label";
|
||||
$tabfield[22]= "code,label";
|
||||
$tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfield[24]= "code,label";
|
||||
$tabfield[25]= "label,type_template,position,topic,content";
|
||||
$tabfield[25]= "label,type_template,private,position,topic,content";
|
||||
$tabfield[26]= "code,label,short_label";
|
||||
$tabfield[27]= "code,libelle";
|
||||
$tabfield[28]= "code,label,affect,delay,newByMonth,country_id,country";
|
||||
@ -264,7 +264,7 @@ $tabfieldvalue[21]= "code,label";
|
||||
$tabfieldvalue[22]= "code,label";
|
||||
$tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldvalue[24]= "code,label";
|
||||
$tabfieldvalue[25]= "label,type_template,position,topic,content";
|
||||
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
|
||||
$tabfieldvalue[26]= "code,label,short_label";
|
||||
$tabfieldvalue[27]= "code,libelle";
|
||||
$tabfieldvalue[28]= "code,label,affect,delay,newByMonth,country";
|
||||
@ -296,7 +296,7 @@ $tabfieldinsert[21]= "code,label";
|
||||
$tabfieldinsert[22]= "code,label";
|
||||
$tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldinsert[24]= "code,label";
|
||||
$tabfieldinsert[25]= "label,type_template,position,topic,content";
|
||||
$tabfieldinsert[25]= "label,type_template,private,position,topic,content,entity";
|
||||
$tabfieldinsert[26]= "code,label,short_label";
|
||||
$tabfieldinsert[27]= "code,libelle";
|
||||
$tabfieldinsert[28]= "code,label,affect,delay,newByMonth,fk_country";
|
||||
@ -585,7 +585,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric",$langs->transnoentities("Code")), null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
// Clean some parameters
|
||||
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
|
||||
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
|
||||
@ -1330,7 +1330,7 @@ if ($id)
|
||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
|
||||
$canbemodified=$iserasable;
|
||||
if ($obj->code == 'RECEP') $canbemodified=1;
|
||||
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&id='.$id.'&';
|
||||
|
||||
// Favorite
|
||||
|
||||
@ -62,7 +62,7 @@ if (GETPOST('submitproduct') && GETPOST('submitproduct'))
|
||||
{
|
||||
$producttmp->fetch(GETPOST('productid'));
|
||||
$forbarcode=$producttmp->barcode;
|
||||
$fk_barcode_type=$thirdpartytmp->barcode_type_code;
|
||||
$fk_barcode_type=$producttmp->barcode_type;
|
||||
|
||||
if (empty($fk_barcode_type) && ! empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ exit;*/
|
||||
print '<div class="inline-block" style="vertical-align: top">';
|
||||
print '<div class="principal">';
|
||||
|
||||
$page=GETPOST('menu','alpha');
|
||||
$page=GETPOST('menutpl','alpha');
|
||||
if (empty($page)) $page='facturation';
|
||||
|
||||
if (in_array(
|
||||
|
||||
@ -42,7 +42,7 @@ $langs->load("cashdesk");
|
||||
*/
|
||||
|
||||
//header("Content-type: text/html; charset=UTF-8");
|
||||
header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
||||
//header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
||||
|
||||
$arrayofjs=array();
|
||||
$arrayofcss=array('/cashdesk/css/style.css');
|
||||
|
||||
@ -99,31 +99,24 @@ class Facturation
|
||||
$product = new Product($db);
|
||||
$product->fetch($this->id);
|
||||
|
||||
$sql = "SELECT taux";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva";
|
||||
$sql.= " WHERE rowid = ".$this->tva();
|
||||
|
||||
dol_syslog("ajoutArticle", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$vat_rate=$obj->taux;
|
||||
//var_dump($vat_rate);exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
$vatrowid = $this->tva();
|
||||
|
||||
$tmp = getTaxesFromId($vatrowid);
|
||||
$vat_rate = $tmp['rate'];
|
||||
$vat_npr = $tmp['npr'];
|
||||
|
||||
$localtaxarray = getLocalTaxesFromRate($vatrowid, 0, $societe, $mysoc, 1);
|
||||
|
||||
// Define part of HT, VAT, TTC
|
||||
$resultarray=calcul_price_total($this->qte,$this->prix(),$this->remisePercent(),$vat_rate,0,0,0,'HT',0,$product->type,$mysoc);
|
||||
$resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $vat_rate, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray);
|
||||
|
||||
// Calcul du total ht sans remise
|
||||
$total_ht = $resultarray[0];
|
||||
$total_vat = $resultarray[1];
|
||||
$total_ttc = $resultarray[2];
|
||||
$total_localtax1 = $resultarray[9];
|
||||
$total_localtax2 = $resultarray[10];
|
||||
|
||||
// Calcul du montant de la remise
|
||||
if ($this->remisePercent())
|
||||
@ -143,7 +136,7 @@ class Facturation
|
||||
$newcartarray[$i]['label']=$product->label;
|
||||
$newcartarray[$i]['price']=$product->price;
|
||||
$newcartarray[$i]['price_ttc']=$product->price_ttc;
|
||||
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
if (isset($product->multiprices[$societe->price_level]))
|
||||
@ -160,6 +153,9 @@ class Facturation
|
||||
$newcartarray[$i]['remise']=price2num($montant_remise_ht);
|
||||
$newcartarray[$i]['total_ht']=price2num($total_ht,'MT');
|
||||
$newcartarray[$i]['total_ttc']=price2num($total_ttc,'MT');
|
||||
$newcartarray[$i]['total_vat']=price2num($total_vat, 'MT');
|
||||
$newcartarray[$i]['total_localtax1']=price2num($total_localtax1, 'MT');
|
||||
$newcartarray[$i]['total_localtax2']=price2num($total_localtax2, 'MT');
|
||||
$_SESSION['poscart']=$newcartarray;
|
||||
|
||||
$this->raz();
|
||||
@ -213,12 +209,18 @@ class Facturation
|
||||
// Total HT
|
||||
$remise = $tab[$i]['remise'];
|
||||
$total_ht += ($tab[$i]['total_ht']);
|
||||
$total_vat += ($tab[$i]['total_vat']);
|
||||
$total_ttc += ($tab[$i]['total_ttc']);
|
||||
$total_localtax1 += ($tab[$i]['total_localtax1']);
|
||||
$total_localtax2 += ($tab[$i]['total_localtax2']);
|
||||
}
|
||||
|
||||
$this->prix_total_ttc = $total_ttc;
|
||||
$this->prix_total_ht = $total_ht;
|
||||
|
||||
$this->prix_total_vat = $total_vat;
|
||||
$this->prix_total_localtax1 = $total_localtax1;
|
||||
$this->prix_total_localtax2 = $total_localtax2;
|
||||
|
||||
$this->montant_tva = $total_ttc - $total_ht;
|
||||
//print $this->prix_total_ttc.'eeee'; exit;
|
||||
}
|
||||
@ -442,9 +444,8 @@ class Facturation
|
||||
* @param int $aTva Vat
|
||||
* @return int Vat
|
||||
*/
|
||||
public function tva ( $aTva=null )
|
||||
public function tva($aTva=null)
|
||||
{
|
||||
|
||||
if ( !$aTva ) {
|
||||
|
||||
return $this->tva;
|
||||
@ -467,9 +468,8 @@ class Facturation
|
||||
* @param string $aNumFacture Invoice ref
|
||||
* @return string Invoice ref
|
||||
*/
|
||||
public function numInvoice( $aNumFacture=null )
|
||||
public function numInvoice($aNumFacture=null)
|
||||
{
|
||||
|
||||
if ( !$aNumFacture ) {
|
||||
|
||||
return $this->num_facture;
|
||||
|
||||
@ -37,7 +37,7 @@ switch ( $_GET['action'] )
|
||||
default:
|
||||
if ( $_POST['hdnSource'] != 'NULL' )
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx";
|
||||
$sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.recuperableonly";
|
||||
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot;
|
||||
@ -66,19 +66,23 @@ switch ( $_GET['action'] )
|
||||
{
|
||||
$ret[$key] = $value;
|
||||
}
|
||||
// Here $ret['tva_tx'] is vat rate of product but we want to not use the one into table but found by function
|
||||
|
||||
$productid = $ret['rowid'];
|
||||
$product = new Product($db);
|
||||
$product->fetch($productid);
|
||||
|
||||
/** add Ditto for MultiPrix*/
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($thirdpartyid);
|
||||
|
||||
$tva_tx = get_default_tva($mysoc,$societe,$productid);
|
||||
$tva_npr = get_default_npr($mysoc,$societe,$productid);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
dol_syslog('tva_tx='.$tva_tx.'-tva_npr='.$tva_npr);
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($societe->price_level))
|
||||
{
|
||||
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
|
||||
$productid = $ret['rowid'];
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($thirdpartyid);
|
||||
|
||||
$product = new Product($db);
|
||||
$product->fetch($productid);
|
||||
|
||||
if(isset($product->multiprices[$societe->price_level]))
|
||||
{
|
||||
$ret['price'] = $product->multiprices[$societe->price_level];
|
||||
@ -86,16 +90,39 @@ switch ( $_GET['action'] )
|
||||
// $product->multiprices_min[$societe->price_level];
|
||||
// $product->multiprices_min_ttc[$societe->price_level];
|
||||
// $product->multiprices_base_type[$societe->price_level];
|
||||
$ret['tva_tx'] = $product->multiprices_tva_tx[$societe->price_level];
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
if (isset($prod->multiprices_tva_tx[$societe->price_level])) $tva_tx=$prod->multiprices_tva_tx[$societe->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$societe->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$societe->price_level];
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/** end add Ditto */
|
||||
|
||||
$ret['tva_tx'] = $tva_tx;
|
||||
$ret['tva_npr'] = $tva_npr;
|
||||
//var_dump('tva_tx='.$ret['tva_tx'].'-tva_npr='.$ret['tva_npr'].'-'.$conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL);exit;
|
||||
|
||||
$obj_facturation->id($ret['rowid']);
|
||||
$obj_facturation->ref($ret['ref']);
|
||||
$obj_facturation->stock($ret['reel']);
|
||||
$obj_facturation->prix($ret['price']);
|
||||
$obj_facturation->tva($ret['tva_tx']);
|
||||
|
||||
// Use $ret['tva_tx'] / ret['tva_npr'] to find vat id
|
||||
$vatrowid = null;
|
||||
$sqlfindvatid = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'c_tva';
|
||||
$sqlfindvatid.= ' WHERE taux = '.$ret['tva_tx'].' AND recuperableonly = '.(int) $ret['tva_npr'];
|
||||
$sqlfindvatid.= ' AND fk_pays = '.$mysoc->country_id;
|
||||
$resqlfindvatid=$db->query($sqlfindvatid);
|
||||
if ($resqlfindvatid)
|
||||
{
|
||||
$obj = $db->fetch_object($resqlfindvatid);
|
||||
if ($obj) $vatrowid = $obj->rowid;
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
dol_syslog("save vatrowid=".$vatrowid);
|
||||
$obj_facturation->tva($vatrowid); // Save vat it for next use
|
||||
|
||||
// Definition du filtre pour n'afficher que le produit concerne
|
||||
if ( $_POST['hdnSource'] == 'LISTE' )
|
||||
@ -107,7 +134,7 @@ switch ( $_GET['action'] )
|
||||
$filtre = $_POST['txtRef'];
|
||||
}
|
||||
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&filtre='.$filtre;
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.$filtre;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -115,11 +142,11 @@ switch ( $_GET['action'] )
|
||||
|
||||
if ( $_POST['hdnSource'] == 'REF' )
|
||||
{
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&filtre='.$_POST['txtRef'];
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.$_POST['txtRef'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -130,40 +157,38 @@ switch ( $_GET['action'] )
|
||||
}
|
||||
else
|
||||
{
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'ajout_article': // We have clicked on button "Add product"
|
||||
|
||||
//var_dump('ajout_article');
|
||||
//exit;
|
||||
|
||||
if (! empty($obj_facturation->id)) // A product was previously selected and stored in session, so we can add it
|
||||
{
|
||||
dol_syslog("facturation_verif save vat ".$_POST['selTva']);
|
||||
$obj_facturation->qte($_POST['txtQte']);
|
||||
$obj_facturation->tva($_POST['selTva']);
|
||||
$obj_facturation->tva($_POST['selTva']); // Save VAT selected so we can use it for next product
|
||||
$obj_facturation->remisePercent($_POST['txtRemise']);
|
||||
$obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart']
|
||||
// We update prixTotalTtc
|
||||
|
||||
}
|
||||
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
|
||||
break;
|
||||
|
||||
case 'suppr_article':
|
||||
$obj_facturation->supprArticle($_GET['suppr_id']);
|
||||
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// We saved object obj_facturation
|
||||
$_SESSION['serObjFacturation'] = serialize($obj_facturation);
|
||||
|
||||
//var_dump($_SESSION['serObjFacturation']);
|
||||
header('Location: '.$redirection);
|
||||
exit;
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ if ( $retour >= 0 )
|
||||
$_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] = ($bankid_cb > 0 ? $bankid_cb : '');
|
||||
//var_dump($_SESSION);exit;
|
||||
|
||||
header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&id=NOUV');
|
||||
header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&id=NOUV');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
|
||||
@ -119,7 +119,7 @@ $langs->load("cashdesk");
|
||||
<td></td>
|
||||
<!-- Choix de la remise -->
|
||||
<td><input class="texte1" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/>
|
||||
<?php print genkeypad("txtRemise", "frmQte");?>
|
||||
<?php print genkeypad("txtRemise", "frmQte");?>
|
||||
</td>
|
||||
<!-- Affichage du total HT -->
|
||||
<td><input class="texte1_off" type="text" name="txtTotal" value="" disabled /></td><td></td>
|
||||
@ -128,16 +128,17 @@ $langs->load("cashdesk");
|
||||
<?php //var_dump($tab_tva); ?>
|
||||
<select name="selTva" onchange="javascript: modif();" >
|
||||
<?php
|
||||
$tva_tx = $obj_facturation->tva();
|
||||
$tab_tva_size=count($tab_tva);
|
||||
for($i=0;$i < $tab_tva_size;$i++) {
|
||||
$tva_tx = $obj_facturation->tva(); // Try to get a previously entered VAT rowid. First time, this will return empty.
|
||||
|
||||
if ( $tva_tx == $tab_tva[$i]['taux'] )
|
||||
$tab_tva_size=count($tab_tva); // $tab_tva contains list of possible vat array('rowid'=> , 'taux'=> )
|
||||
for ($i=0;$i < $tab_tva_size;$i++)
|
||||
{
|
||||
if ($tva_tx == $tab_tva[$i]['rowid'])
|
||||
$selected = 'selected';
|
||||
else
|
||||
$selected = '';
|
||||
$selected = '';
|
||||
|
||||
echo ('<option '.$selected.' value="'.$tab_tva[$i]['rowid'].'">'.$tab_tva[$i]['taux'].'</option>'."\n ");
|
||||
echo '<option '.$selected.' value="'.$tab_tva[$i]['rowid'].'">'.$tab_tva[$i]['taux'].'</option>'."\n ";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
@ -62,7 +62,7 @@ $langs->load("main");
|
||||
print '<div class="menu_bloc">';
|
||||
print '<ul class="menu">';
|
||||
// Link to new sell
|
||||
print '<li class="menu_choix1"><a href="affIndex.php?menu=facturation&id=NOUV"><span>'.$langs->trans("NewSell").'</span></a></li>';
|
||||
print '<li class="menu_choix1"><a href="affIndex.php?menutpl=facturation&id=NOUV"><span>'.$langs->trans("NewSell").'</span></a></li>';
|
||||
// Open new tab on backoffice (this is not a disconnect from POS)
|
||||
print '<li class="menu_choix2"><a href=".." target="backoffice"><span>'.$langs->trans("BackOffice").'</span></a></li>';
|
||||
// Disconnect
|
||||
|
||||
@ -113,7 +113,7 @@ $langs->load("bills");
|
||||
<p class="note_label"><?php echo $langs->trans("Notes"); ?><br><textarea class="textarea_note" name="txtaNotes"></textarea></p>
|
||||
|
||||
<div class="center"><input class="button" type="submit" name="btnValider" value="<?php echo $langs->trans("ValidateInvoice"); ?>" /><br>
|
||||
<br><a class="lien1" href="affIndex.php?menu=facturation"><?php echo $langs->trans("RestartSelling"); ?></a>
|
||||
<br><a class="lien1" href="affIndex.php?menutpl=facturation"><?php echo $langs->trans("RestartSelling"); ?></a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ switch ($action)
|
||||
|
||||
default:
|
||||
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=validation';
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=validation';
|
||||
break;
|
||||
|
||||
|
||||
@ -85,13 +85,13 @@ switch ($action)
|
||||
$obj_facturation->paiementLe($txtDatePaiement);
|
||||
}
|
||||
|
||||
$redirection = 'affIndex.php?menu=validation';
|
||||
$redirection = 'affIndex.php?menutpl=validation';
|
||||
break;
|
||||
|
||||
|
||||
case 'retour':
|
||||
|
||||
$redirection = 'affIndex.php?menu=facturation';
|
||||
$redirection = 'affIndex.php?menutpl=facturation';
|
||||
break;
|
||||
|
||||
|
||||
@ -158,45 +158,30 @@ switch ($action)
|
||||
// Get content of cart
|
||||
$tab_liste = $_SESSION['poscart'];
|
||||
|
||||
// Loop on each product
|
||||
// Loop on each line into cart
|
||||
$tab_liste_size=count($tab_liste);
|
||||
for ($i=0;$i < $tab_liste_size;$i++)
|
||||
for ($i=0; $i < $tab_liste_size; $i++)
|
||||
{
|
||||
// Recuperation de l'article
|
||||
$product = new Product($db);
|
||||
$product->fetch($tab_liste[$i]['fk_article']);
|
||||
$ret=array('label'=>$product->label,'tva_tx'=>$product->tva_tx,'price'=>$product->price);
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
if (isset($product->multiprices[$societe->price_level]))
|
||||
{
|
||||
$ret['price'] = $product->multiprices[$societe->price_level];
|
||||
}
|
||||
}
|
||||
$tab_article = $ret;
|
||||
|
||||
$res = $db->query('SELECT taux FROM '.MAIN_DB_PREFIX.'c_tva WHERE rowid = '.$tab_liste[$i]['fk_tva']);
|
||||
$ret=array();
|
||||
$tab = $db->fetch_array($res);
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
$ret[$cle] = $valeur;
|
||||
}
|
||||
$tab_tva = $ret;
|
||||
$tmp = getTaxesFromId($tab_liste[$i]['fk_tva']);
|
||||
$vat_rate = $tmp['rate'];
|
||||
$vat_npr = $tmp['npr'];
|
||||
|
||||
$invoiceline=new FactureLigne($db);
|
||||
$invoiceline->fk_product=$tab_liste[$i]['fk_article'];
|
||||
$invoiceline->desc=$tab_article['label'];
|
||||
$invoiceline->tva_tx=empty($tab_tva['taux'])?0:$tab_tva['taux']; // works even if vat_rate is ''
|
||||
//$invoiceline->tva_tx=$tab_tva['taux'];
|
||||
$invoiceline->desc=$tab_liste[$i]['label'];
|
||||
$invoiceline->qty=$tab_liste[$i]['qte'];
|
||||
$invoiceline->remise_percent=$tab_liste[$i]['remise_percent'];
|
||||
$invoiceline->price=$tab_article['price'];
|
||||
$invoiceline->subprice=$tab_article['price'];
|
||||
$invoiceline->price=$tab_liste[$i]['price'];
|
||||
$invoiceline->subprice=$tab_liste[$i]['price'];
|
||||
|
||||
$invoiceline->tva_tx=empty($vat_rate)?0:$vat_rate; // works even if vat_rate is ''
|
||||
$invoiceline->info_bits=empty($vat_npr)?0:$vat_npr;
|
||||
|
||||
$invoiceline->total_ht=$tab_liste[$i]['total_ht'];
|
||||
$invoiceline->total_ttc=$tab_liste[$i]['total_ttc'];
|
||||
$invoiceline->total_tva=($tab_liste[$i]['total_ttc']-$tab_liste[$i]['total_ht']);
|
||||
$invoiceline->total_tva=$tab_liste[$i]['total_vat'];
|
||||
$invoiceline->total_localtax1=$tab_liste[$i]['total_localtax1'];
|
||||
$invoiceline->total_localtax2=$tab_liste[$i]['total_localtax2'];
|
||||
$invoice->lines[]=$invoiceline;
|
||||
}
|
||||
|
||||
@ -336,7 +321,7 @@ switch ($action)
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
$redirection = 'affIndex.php?menu=validation_ok&facid='.$id; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
|
||||
$redirection = 'affIndex.php?menutpl=validation_ok&facid='.$id; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1090,17 +1090,22 @@ if ($id > 0)
|
||||
// Thirdparty - Contact
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ActionOnCompany").'</td>';
|
||||
print '<td>';
|
||||
print '<div class="maxwidth200onsmartphone">';
|
||||
$events=array();
|
||||
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
||||
print $form->select_company($object->socid,'socid','',1,1,0,$events);
|
||||
print '</td>';
|
||||
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
||||
print $form->select_company($object->socid, 'socid', '', 'SelectThirdParty', 1, 0, $events, 0);
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Contact
|
||||
print '<td>'.$langs->trans("Contact").'</td><td>';
|
||||
print '<tr><td>'.$langs->trans("Contact").'</td><td>';
|
||||
print '<div class="maxwidth200onsmartphone">';
|
||||
$form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200');
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Project
|
||||
@ -1108,10 +1113,10 @@ if ($id > 0)
|
||||
{
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
$langs->load("project");
|
||||
$langs->load("projects");
|
||||
|
||||
print '<tr><td width="30%">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
$numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid');
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
$numprojet=$formproject->select_projects($object->socid, $object->fk_project, 'projectid');
|
||||
if ($numprojet==0)
|
||||
{
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'">'.$langs->trans("AddProject").'</a>';
|
||||
@ -1120,7 +1125,7 @@ if ($id > 0)
|
||||
}
|
||||
|
||||
// Priority
|
||||
print '<tr><td class="nowrap" width="30%">'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefield nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||
print '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1136,7 +1141,7 @@ if ($id > 0)
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
|
||||
// Editeur wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90);
|
||||
$doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1281,7 +1286,7 @@ if ($id > 0)
|
||||
// Third party - Contact
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
|
||||
print '<tr><td>'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
|
||||
if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL')
|
||||
{
|
||||
if ($object->thirdparty->fetch($object->thirdparty->id))
|
||||
|
||||
@ -759,8 +759,11 @@ if (empty($reshook))
|
||||
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
||||
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
}
|
||||
}
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
|
||||
@ -2780,6 +2780,8 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function getLinesArray()
|
||||
{
|
||||
// For other object, here we call fetch_lines. But fetch_lines does not exists on proposal
|
||||
|
||||
$sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,';
|
||||
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
|
||||
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,';
|
||||
@ -2808,9 +2810,11 @@ class Propal extends CommonObject
|
||||
$this->lines[$i]->id = $obj->rowid; // for backward compatibility
|
||||
$this->lines[$i]->rowid = $obj->rowid;
|
||||
$this->lines[$i]->label = $obj->custom_label;
|
||||
$this->lines[$i]->desc = $obj->description;
|
||||
$this->lines[$i]->description = $obj->description;
|
||||
$this->lines[$i]->fk_product = $obj->fk_product;
|
||||
$this->lines[$i]->ref = $obj->ref;
|
||||
$this->lines[$i]->product_ref = $obj->ref;
|
||||
$this->lines[$i]->entity = $obj->entity; // Product entity
|
||||
$this->lines[$i]->product_label = $obj->product_label;
|
||||
$this->lines[$i]->product_desc = $obj->product_desc;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
@ -644,7 +644,7 @@ if (empty($reshook))
|
||||
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
||||
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
|
||||
|
||||
$pu_ht = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
$price_min = $prod->price_min;
|
||||
@ -657,10 +657,11 @@ if (empty($reshook))
|
||||
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
||||
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_tva_tx[$object->client->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->client->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
|
||||
$tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
$tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
}
|
||||
}
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
@ -1396,7 +1397,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
|
||||
{
|
||||
print '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
$("#socid").change(function() {
|
||||
var socid = $(this).val();
|
||||
// reload page
|
||||
@ -2310,7 +2311,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
{
|
||||
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
|
||||
}
|
||||
|
||||
|
||||
// Create intervention
|
||||
if ($conf->ficheinter->enabled) {
|
||||
$langs->load("interventions");
|
||||
@ -2327,12 +2328,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Create contract
|
||||
if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED)) {
|
||||
$langs->load("contracts");
|
||||
|
||||
|
||||
if ($user->rights->contrat->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Ship
|
||||
$numshipping = 0;
|
||||
if (! empty($conf->expedition->enabled)) {
|
||||
@ -2399,6 +2400,11 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
@ -2497,7 +2503,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
||||
}
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
||||
|
||||
@ -985,6 +985,7 @@ class Commande extends CommonOrder
|
||||
$this->user_author_id = $user->id;
|
||||
$this->user_valid = '';
|
||||
$this->date = dol_now();
|
||||
$this->date_commande = dol_now();
|
||||
$this->date_creation = '';
|
||||
$this->date_validation = '';
|
||||
$this->ref_client = '';
|
||||
@ -1253,7 +1254,7 @@ class Commande extends CommonOrder
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc);
|
||||
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
|
||||
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
@ -1386,7 +1387,7 @@ class Commande extends CommonOrder
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
$localtax1_tx=get_localtax($tva_tx,1,$this->client,$mysoc,$tva_npr);
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$this->client,$mysoc,$tva_npr);
|
||||
|
||||
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->client->price_level)
|
||||
$price = $prod->multiprices[$this->client->price_level];
|
||||
@ -1674,7 +1675,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
|
||||
$sql.= ' WHERE l.fk_commande = '.$this->id;
|
||||
if ($only_product) $sql .= ' AND p.fk_product_type = 0';
|
||||
$sql .= ' ORDER BY l.rang';
|
||||
$sql .= ' ORDER BY l.rang, l.rowid';
|
||||
|
||||
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1695,6 +1696,7 @@ class Commande extends CommonOrder
|
||||
$line->commande_id = $objp->fk_commande;
|
||||
$line->label = $objp->custom_label;
|
||||
$line->desc = $objp->description;
|
||||
$line->description = $objp->description; // Description line
|
||||
$line->product_type = $objp->product_type;
|
||||
$line->qty = $objp->qty;
|
||||
$line->tva_tx = $objp->tva_tx;
|
||||
@ -2480,7 +2482,7 @@ class Commande extends CommonOrder
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc);
|
||||
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
|
||||
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
@ -2917,7 +2919,7 @@ class Commande extends CommonOrder
|
||||
function LibStatut($statut,$billed,$mode,$donotshowbilled=0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
|
||||
$billedtext = '';
|
||||
if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):'');
|
||||
|
||||
@ -3212,12 +3214,14 @@ class Commande extends CommonOrder
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of order lines
|
||||
*
|
||||
* @return array Lines of order
|
||||
* Create an array of order lines
|
||||
*
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function getLinesArray()
|
||||
{
|
||||
return $this->fetch_lines();
|
||||
/*
|
||||
$lines = array();
|
||||
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.price, l.qty, l.tva_tx, ';
|
||||
@ -3287,7 +3291,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -62,6 +62,8 @@ if (dol_strlen($search_dt_start) > 0)
|
||||
$param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
|
||||
if (dol_strlen($search_dt_end) > 0)
|
||||
$param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
|
||||
if (GETPOST("req_nb")) $param.='&req_nb='.urlencode(GETPOST("req_nb"));
|
||||
if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@ -91,7 +93,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$companystatic=new Societe($db);
|
||||
$bankaccountstatic=new Account($db);
|
||||
|
||||
llxHeader();
|
||||
llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param);
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
@ -114,12 +116,10 @@ $sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
|
||||
if (GETPOST("req_nb"))
|
||||
{
|
||||
$sql.= " AND b.num_chq LIKE '%".$db->escape(GETPOST("req_nb"))."%'";
|
||||
$param.='&req_nb='.urlencode(GETPOST("req_nb"));
|
||||
}
|
||||
if (GETPOST("thirdparty"))
|
||||
{
|
||||
$sql.=" AND s.nom LIKE '%".$db->escape(GETPOST("thirdparty"))."%'";
|
||||
$param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
|
||||
}
|
||||
if ($bid)
|
||||
{
|
||||
@ -214,7 +214,7 @@ if ($resql)
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1, 8);
|
||||
$form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="req_nb" value="'.GETPOST("req_nb").'" size="2"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
|
||||
@ -1925,7 +1925,7 @@ if ($action == 'create')
|
||||
$objectsrc->fetch_thirdparty();
|
||||
|
||||
$projectid = (! empty($projectid) ? $projectid : $objectsrc->fk_project);
|
||||
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
|
||||
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : (! empty($objectsrc->ref_customer) ? $objectsrc->ref_customer:''));
|
||||
$ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
|
||||
|
||||
// only if socid not filled else it's allready done upper
|
||||
|
||||
@ -1065,7 +1065,7 @@ class Facture extends CommonInvoice
|
||||
$this->lines=array();
|
||||
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, ';
|
||||
$sql .= ' l.situation_percent, l.fk_prev_id,';
|
||||
$sql.= ' l.situation_percent, l.fk_prev_id,';
|
||||
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
|
||||
$sql.= ' l.rang, l.special_code,';
|
||||
$sql.= ' l.date_start as date_start, l.date_end as date_end,';
|
||||
@ -1075,7 +1075,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||
$sql.= ' WHERE l.fk_facture = '.$this->id;
|
||||
$sql.= ' ORDER BY l.rang';
|
||||
$sql.= ' ORDER BY l.rang, l.rowid';
|
||||
|
||||
dol_syslog(get_class($this).'::fetch_lines', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1092,7 +1092,9 @@ class Facture extends CommonInvoice
|
||||
$line->rowid = $objp->rowid; // deprecated
|
||||
$line->label = $objp->custom_label; // deprecated
|
||||
$line->desc = $objp->description; // Description line
|
||||
$line->description = $objp->description; // Description line
|
||||
$line->product_type = $objp->product_type; // Type of line
|
||||
$line->ref = $objp->product_ref; // Ref product
|
||||
$line->product_ref = $objp->product_ref; // Ref product
|
||||
$line->libelle = $objp->product_label; // TODO deprecated
|
||||
$line->product_label = $objp->product_label; // Label product
|
||||
@ -2360,7 +2362,7 @@ class Facture extends CommonInvoice
|
||||
$this->line->date_start = $date_start;
|
||||
$this->line->date_end = $date_end;
|
||||
$this->line->total_ht = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_tva = $total_tva;
|
||||
$this->line->total_tva = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva);
|
||||
$this->line->total_localtax1 = $total_localtax1;
|
||||
$this->line->total_localtax2 = $total_localtax2;
|
||||
$this->line->total_ttc = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||
@ -3441,6 +3443,8 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function getLinesArray()
|
||||
{
|
||||
return $this->fetch_lines();
|
||||
/*
|
||||
$sql = 'SELECT l.rowid, l.label as custom_label, l.description, l.fk_product, l.product_type, l.qty, l.tva_tx,';
|
||||
$sql.= ' l.fk_remise_except, l.localtax1_tx, l.localtax2_tx,';
|
||||
$sql .= ' l.situation_percent, l.fk_prev_id,';
|
||||
@ -3473,11 +3477,12 @@ class Facture extends CommonInvoice
|
||||
$this->lines[$i]->description = $obj->description;
|
||||
$this->lines[$i]->fk_product = $obj->fk_product;
|
||||
$this->lines[$i]->ref = $obj->product_ref;
|
||||
$this->lines[$i]->entity = $obj->entity; // Product entity
|
||||
$this->lines[$i]->product_label = $obj->product_label;
|
||||
$this->lines[$i]->product_ref = $obj->product_ref;
|
||||
$this->lines[$i]->product_label = $obj->product_label;
|
||||
$this->lines[$i]->product_desc = $obj->product_desc;
|
||||
$this->lines[$i]->fk_product_type = $obj->fk_product_type;
|
||||
$this->lines[$i]->product_type = $obj->product_type;
|
||||
$this->lines[$i]->entity = $obj->entity; // Product entity
|
||||
$this->lines[$i]->qty = $obj->qty;
|
||||
$this->lines[$i]->subprice = $obj->subprice;
|
||||
$this->lines[$i]->fk_remise_except = $obj->fk_remise_except;
|
||||
@ -3487,6 +3492,10 @@ class Facture extends CommonInvoice
|
||||
$this->lines[$i]->total_ht = $obj->total_ht;
|
||||
$this->lines[$i]->total_tva = $obj->total_tva;
|
||||
$this->lines[$i]->total_ttc = $obj->total_ttc;
|
||||
$this->lines[$i]->localtax1_tx = $obj->localtax1_tx;
|
||||
$this->lines[$i]->localtax2_tx = $obj->localtax2_tx;
|
||||
$this->lines[$i]->localtax1_type = $obj->localtax1_type;
|
||||
$this->lines[$i]->localtax2_type = $obj->localtax2_type;
|
||||
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
|
||||
$this->lines[$i]->situation_percent = $obj->situation_percent;
|
||||
$this->lines[$i]->fk_prev_id = $obj->fk_prev_id;
|
||||
@ -3511,7 +3520,7 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -214,7 +215,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
*/
|
||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.tva as total_tva, f.total_ttc, f.type";
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_fournisseur";
|
||||
|
||||
@ -168,9 +168,11 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 2)
|
||||
$parameters["start"] = $date_start;
|
||||
$parameters["end"] = $date_end;
|
||||
$parameters["direction"] = 'sell';
|
||||
$parameters["type"] = 'localtax'.$local;
|
||||
|
||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (is_array($coll_list))
|
||||
{
|
||||
@ -244,7 +246,9 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 1){
|
||||
|
||||
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
|
||||
$parameters["direction"] = 'buy';
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters["type"] = 'localtax'.$local;
|
||||
|
||||
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (is_array($coll_list))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
@ -170,9 +170,11 @@ for ($m = 1 ; $m < 13 ; $m++ ) {
|
||||
$parameters["mode"] = $modetax;
|
||||
$parameters["year"] = $y;
|
||||
$parameters["month"] = $m;
|
||||
$parameters["type"] = 'localtax'.$localTaxType;
|
||||
|
||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (! is_array($coll_listbuy) && $coll_listbuy == -1) {
|
||||
$langs->load("errors");
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
||||
* Copyright (C) 2014 Rosana Romero <rromero@2byte.es>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -116,16 +116,11 @@ $product_static=new Product($db);
|
||||
$payment_static=new Paiement($db);
|
||||
$paymentfourn_static=new PaiementFourn($db);
|
||||
|
||||
//print load_fiche_titre($langs->trans("VAT"),"");
|
||||
|
||||
//$fsearch.='<br>';
|
||||
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
|
||||
$fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
||||
//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
|
||||
//$fsearch.=' <input type="text" name="min" value="'.$min.'">';
|
||||
|
||||
$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
|
||||
// Affiche en-tete du rapport
|
||||
|
||||
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
|
||||
{
|
||||
$nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode");
|
||||
@ -138,14 +133,11 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) $nextquarter++;
|
||||
else { $nextquarter=1; $nextyear++; }
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.='<br>'.$langs->trans("DepositsAreIncluded");
|
||||
$description.=$fsearch;
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
@ -170,14 +162,10 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) $nextquarter++;
|
||||
else { $nextquarter=1; $nextyear++; }
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
$description.=$fsearch;
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
@ -203,16 +191,13 @@ if($local==1){
|
||||
|
||||
// VAT Received and paid
|
||||
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
$total = 0;
|
||||
$i=0;
|
||||
|
||||
// Load arrays of datas
|
||||
$x_coll= local_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell', $local);
|
||||
//$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell');
|
||||
$x_paye = local_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy', $local);
|
||||
$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell');
|
||||
$x_paye = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy');
|
||||
|
||||
|
||||
echo '<table class="noborder" width="100%">';
|
||||
@ -230,14 +215,14 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
else
|
||||
{
|
||||
$x_both = array();
|
||||
|
||||
//now, from these two arrays, get another array with one rate per line
|
||||
foreach(array_keys($x_coll) as $my_coll_rate)
|
||||
{
|
||||
//foreach($x_coll[$my_coll_rate][localtax1_list]){
|
||||
$x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht'];
|
||||
$x_both[$my_coll_rate]['coll']['vat'] = $x_coll[$my_coll_rate]['vat'];
|
||||
$x_both[$my_coll_rate]['coll']['localtax'.$local] = $x_coll[$my_coll_rate]['localtax'.$local];
|
||||
$x_both[$my_coll_rate]['paye']['totalht'] = 0;
|
||||
$x_both[$my_coll_rate]['paye']['vat'] = 0;
|
||||
$x_both[$my_coll_rate]['paye']['localtax'.$local] = 0;
|
||||
$x_both[$my_coll_rate]['coll']['links'] = '';
|
||||
$x_both[$my_coll_rate]['coll']['detail'] = array();
|
||||
foreach($x_coll[$my_coll_rate]['facid'] as $id=>$dummy)
|
||||
@ -303,9 +288,6 @@ else
|
||||
}
|
||||
//now we have an array (x_both) indexed by rates for coll and paye
|
||||
|
||||
|
||||
//print table headers for this quadri - incomes first
|
||||
|
||||
$x_coll_sum = 0;
|
||||
$x_coll_ht = 0;
|
||||
$x_paye_sum = 0;
|
||||
@ -314,8 +296,6 @@ else
|
||||
$span=3;
|
||||
if ($modetax == 0) $span+=2;
|
||||
|
||||
//print '<tr><td colspan="'.($span+1).'">'..')</td></tr>';
|
||||
|
||||
if($conf->global->$calc ==0 || $conf->global->$calc == 2){
|
||||
// Customers invoices
|
||||
print '<tr class="liste_titre">';
|
||||
@ -345,8 +325,6 @@ else
|
||||
|
||||
if($rate!=0){
|
||||
print "<tr>";
|
||||
//print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
/**/
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
@ -400,9 +378,7 @@ else
|
||||
print price($fields['totalht']);
|
||||
if (price2num($fields['ftotal_ttc']))
|
||||
{
|
||||
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
|
||||
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
|
||||
//print ' ('.round($ratiolineinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
@ -413,7 +389,6 @@ else
|
||||
{
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
print '<td class="nowrap" align="right">';
|
||||
//print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc'];
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
|
||||
{
|
||||
$payment_static->id=$fields['payment_id'];
|
||||
@ -424,7 +399,7 @@ else
|
||||
print $langs->trans("NotUsedForGoods");
|
||||
}
|
||||
else {
|
||||
print $fields['payment_amount'];
|
||||
print price($fields['payment_amount']);
|
||||
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
@ -491,7 +466,6 @@ else
|
||||
if($conf->global->$calc ==0 || $conf->global->$calc == 1){
|
||||
echo '<table class="noborder" width="100%">';
|
||||
//print table headers for this quadri - expenses now
|
||||
//imprime les en-tete de tables pour ce quadri - maintenant les d<>penses
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$elementsup.'</td>';
|
||||
print '<td align="left">'.$productsup.'</td>';
|
||||
@ -585,7 +559,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print $fields['payment_amount'];
|
||||
print price($fields['payment_amount']);
|
||||
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -298,7 +298,7 @@ if ($id > 0)
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$urladd = "&id=".$prev_id;
|
||||
$urladd = "&id=".$id;
|
||||
|
||||
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
|
||||
print"\n<!-- debut table -->\n";
|
||||
|
||||
@ -897,7 +897,7 @@ $parameters["date_end"] = $date_end;
|
||||
$parameters["bc"] = $bc;
|
||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('addBalanceLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
if ($mysoc->tva_assuj != 'franchise') // Assujeti
|
||||
|
||||
@ -472,7 +472,7 @@ $object = array(&$encaiss, &$encaiss_ttc, &$decaiss, &$decaiss_ttc);
|
||||
$parameters["mode"] = $modecompta;
|
||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('addReportInfo',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
/*
|
||||
* Salaries
|
||||
|
||||
@ -71,7 +71,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
$tva->datev=$datev;
|
||||
$tva->datep=$datep;
|
||||
|
||||
$amount = GETPOST("amount");
|
||||
$amount = price2num(GETPOST("amount"));
|
||||
if ($refund == 1) {
|
||||
$amount= -$amount;
|
||||
}
|
||||
|
||||
@ -250,9 +250,11 @@ $parameters["mode"] = $modetax;
|
||||
$parameters["start"] = $date_start;
|
||||
$parameters["end"] = $date_end;
|
||||
$parameters["direction"] = 'sell';
|
||||
$parameters["type"] = 'vat';
|
||||
|
||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (is_array($coll_list)) {
|
||||
$var=true;
|
||||
@ -333,7 +335,7 @@ $company_static=new Societe($db);
|
||||
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
|
||||
|
||||
$parameters["direction"] = 'buy';
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (is_array($coll_list)) {
|
||||
$var=true;
|
||||
$total = 0; $totalamount = 0;
|
||||
|
||||
@ -160,9 +160,10 @@ for ($m = 1 ; $m < 13 ; $m++ )
|
||||
$parameters["mode"] = $modetax;
|
||||
$parameters["year"] = $y;
|
||||
$parameters["month"] = $m;
|
||||
|
||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (! is_array($coll_listbuy) && $coll_listbuy == -1)
|
||||
{
|
||||
|
||||
@ -325,10 +325,12 @@ else
|
||||
$parameters["mode"] = $modetax;
|
||||
$parameters["start"] = $date_start;
|
||||
$parameters["end"] = $date_end;
|
||||
$parameters["type"] = 'vat';
|
||||
|
||||
$object = array(&$x_coll, &$x_paye, &$x_both);
|
||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
foreach(array_keys($x_coll) as $rate)
|
||||
{
|
||||
|
||||
@ -378,10 +378,12 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
||||
$parameters["mode"] = $modetax;
|
||||
$parameters["start"] = $date_start;
|
||||
$parameters["end"] = $date_end;
|
||||
$parameters["type"] = 'vat';
|
||||
|
||||
$object = array(&$x_coll, &$x_paye, &$x_both);
|
||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
foreach (array_keys($x_coll) as $rate) {
|
||||
$subtot_coll_total_ht = 0;
|
||||
|
||||
@ -127,7 +127,7 @@ $fieldstosearchall = array(
|
||||
// Definition of fields for list
|
||||
$arrayfields=array(
|
||||
'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||
'p.firstname'=>array('label'=>$langs->trans("Firsname"), 'checked'=>1),
|
||||
'p.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
||||
'p.poste'=>array('label'=>$langs->trans("Post"), 'checked'=>1),
|
||||
'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
|
||||
'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
|
||||
@ -212,7 +212,7 @@ $sql.= " p.rowid as cidp, p.lastname as lastname, p.statut, p.firstname, p.zip,
|
||||
$sql.= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
|
||||
$sql.= " co.code as country_code";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -322,7 +322,7 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015-2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1514,7 +1514,7 @@ class Contrat extends CommonObject
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc);
|
||||
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
|
||||
$tvatx = preg_replace('/\s*\(.*\)/','',$tvatx); // Remove code into vatrate.
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 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
|
||||
|
||||
@ -34,6 +34,8 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
$res=@include '../../main.inc.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
|
||||
//global $hookmanager;
|
||||
$hookmanager->initHooks(array('searchform'));
|
||||
|
||||
$search_boxvalue=GETPOST('q');
|
||||
|
||||
@ -113,16 +115,15 @@ if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFO
|
||||
}
|
||||
|
||||
|
||||
/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag
|
||||
/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag
|
||||
if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLOYEE) && $user->rights->hrm->employee->read)
|
||||
{
|
||||
$langs->load("hrm");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/hrm/employee/list.php', DOL_URL_ROOT.'/hrm/employee/list.php', $langs->trans("Employees"), 'employee', 'search_all', 'M', 'searchleftemployee', img_object('','user'));
|
||||
}
|
||||
*/
|
||||
|
||||
// Execute hook addSearchEntry
|
||||
$parameters=array();
|
||||
$parameters=array('search_boxvalue'=>$search_boxvalue);
|
||||
$reshook=$hookmanager->executeHooks('addSearchEntry',$parameters);
|
||||
if (empty($reshook))
|
||||
{
|
||||
@ -131,13 +132,6 @@ if (empty($reshook))
|
||||
else $arrayresult=$hookmanager->resArray;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print json_encode($arrayresult);
|
||||
|
||||
if (is_object($db)) $db->close();
|
||||
|
||||
@ -2890,7 +2890,7 @@ abstract class CommonObject
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " SET fk_incoterms = ".($id_incoterm > 0 ? $id_incoterm : "null");
|
||||
$sql.= ", location_incoterms = '".($id_incoterm > 0 ? $this->db->escape($location) : "null")."'";
|
||||
$sql.= ", location_incoterms = ".($id_incoterm > 0 ? "'".$this->db->escape($location)."'" : "null");
|
||||
$sql.= " WHERE rowid = " . $this->id;
|
||||
dol_syslog(get_class($this).'::setIncoterms', LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@ -51,7 +51,7 @@ abstract class CommonObjectLine extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Returns the text label from units dictionnary
|
||||
* Returns the text label from units dictionary
|
||||
*
|
||||
* @param string $type Label type (long or short)
|
||||
* @return string|int <0 if ko, label if ok
|
||||
|
||||
@ -3937,7 +3937,7 @@ class Form
|
||||
/**
|
||||
* Load into the cache vat rates of a country
|
||||
*
|
||||
* @param string $country_code Country code
|
||||
* @param string $country_code Country code with quotes ("'CA'", or "'CA,IN,...'")
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
*/
|
||||
function load_cache_vatrates($country_code)
|
||||
@ -4013,11 +4013,18 @@ class Form
|
||||
|
||||
$return='';
|
||||
|
||||
// Define defaultnpr and defaultttx
|
||||
// Define defaultnpr, defaultttx and defaultcode
|
||||
$defaultnpr=($info_bits & 0x01);
|
||||
$defaultnpr=(preg_match('/\*/',$selectedrate) ? 1 : $defaultnpr);
|
||||
$defaulttx=str_replace('*','',$selectedrate);
|
||||
|
||||
$defaultcode='';
|
||||
if (preg_match('/\s*\((.*)\)/', $defaulttx, $reg))
|
||||
{
|
||||
$defaultcode=$reg[1];
|
||||
$defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx);
|
||||
}
|
||||
//var_dump($defaulttx.'-'.$defaultnpr.'-'.$defaultcode);
|
||||
|
||||
// Check parameters
|
||||
if (is_object($societe_vendeuse) && ! $societe_vendeuse->country_code)
|
||||
{
|
||||
@ -4113,9 +4120,13 @@ class Form
|
||||
$return.= $rate['nprtva'] ? '*': '';
|
||||
if ($addcode && $rate['code']) $return.=' ('.$rate['code'].')';
|
||||
$return.= '"';
|
||||
if ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr)
|
||||
if ($defaultcode)
|
||||
{
|
||||
$return.= ' selected';
|
||||
if ($defaultcode == $rate['code']) $return.= ' selected';
|
||||
}
|
||||
elseif ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr)
|
||||
{
|
||||
$return.= ' selected';
|
||||
}
|
||||
$return.= '>'.vatrate($rate['libtva']);
|
||||
//$return.=($rate['code']?' '.$rate['code']:'');
|
||||
@ -4838,7 +4849,10 @@ class Form
|
||||
|
||||
foreach($array as $key => $val)
|
||||
{
|
||||
if (isset($val['enabled']) && ! $val['enabled'])
|
||||
/* var_dump($val);
|
||||
var_dump(array_key_exists('enabled', $val));
|
||||
var_dump(!$val['enabled']);*/
|
||||
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled'])
|
||||
{
|
||||
unset($array[$key]); // We don't want this field
|
||||
continue;
|
||||
|
||||
@ -136,7 +136,7 @@ class FormActions
|
||||
if (empty($onlyselect))
|
||||
{
|
||||
print ' <input type="text" id="val'.$htmlname.'" name="percentage" class="flat hideifna" value="'.($selected>=0?$selected:'').'" size="2"'.($canedit&&($selected>=0)?'':' disabled').'>';
|
||||
print '<span class="hideifna">%</span>';
|
||||
print '<span class="hideonsmartphone hideifna">%</span>';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -859,11 +859,15 @@ class FormFile
|
||||
{
|
||||
$fileinfo = pathinfo($file['name']);
|
||||
print '<td align="center">';
|
||||
$minifile=$fileinfo['filename'].'_mini.'.strtolower($fileinfo['extension']); // Thumbs are created with filename in lower case
|
||||
if (image_format_supported($file['name']) > 0)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" class="aphoto" target="_blank">';
|
||||
print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.'thumbs/'.$minifile).'" title="">';
|
||||
$minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // Thumbs are created with filename in lower case and with .png extension
|
||||
//print $relativepath.'<br>';
|
||||
//print $file['path'].'/'.$minifile.'<br>';
|
||||
if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.'.$fileinfo['extension']); // For old thumbs
|
||||
//print $file['path'].'/'.$minifile.'<br>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" class="aphoto" target="_blank">';
|
||||
print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$minifile).'" title="">';
|
||||
print '</a>';
|
||||
}
|
||||
else print ' ';
|
||||
|
||||
@ -334,7 +334,7 @@ class FormMail extends Form
|
||||
$out.= ' ';
|
||||
$out.= '</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$out.= '<table class="border" width="100%">'."\n";
|
||||
@ -874,13 +874,13 @@ class FormMail extends Form
|
||||
{
|
||||
$ret=array();
|
||||
|
||||
$sql = "SELECT rowid, label, topic, content, lang";
|
||||
$sql = "SELECT rowid, label, topic, content, lang, position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE type_template='".$this->db->escape($type_template)."'";
|
||||
$sql.= " AND entity IN (".getEntity("c_email_templates").")";
|
||||
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")";
|
||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||
$sql.= $this->db->order("lang,label","ASC");
|
||||
$sql.= $this->db->order("position,lang,label","ASC");
|
||||
//print $sql;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -894,7 +894,7 @@ class FormMail extends Form
|
||||
$line->id=$obj->rowid;
|
||||
$line->label=$obj->label;
|
||||
$line->topic=$obj->topic;
|
||||
$line->content=$obj->lacontentbel;
|
||||
$line->content=$obj->content;
|
||||
$line->lang=$obj->lang;
|
||||
$this->lines_model[]=$line;
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ class FormProjets
|
||||
continue;
|
||||
}
|
||||
|
||||
$labeltoshow=dol_trunc($obj->ref,18).' - '.$obj->title;
|
||||
$labeltoshow=dol_trunc($obj->ref,18);
|
||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
|
||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||
$labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
|
||||
|
||||
@ -1451,6 +1451,12 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
||||
$destfile=preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);
|
||||
}
|
||||
|
||||
// lowercase extension
|
||||
$info = pathinfo($destpath);
|
||||
$destpath = $info['dirname'].'/'.$info['filename'].'.'.strtolower($info['extension']);
|
||||
$info = pathinfo($destfile);
|
||||
$destfile = $info['filename'].'.'.strtolower($info['extension']);
|
||||
|
||||
$resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles);
|
||||
if (is_numeric($resupload) && $resupload > 0)
|
||||
{
|
||||
@ -1467,10 +1473,10 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
||||
{
|
||||
// Create small thumbs for image (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheigthsmall, '_small', 50, "thumbs");
|
||||
$imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs", IMAGETYPE_PNG);
|
||||
// Create mini thumbs for image (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
|
||||
$imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs", IMAGETYPE_PNG);
|
||||
}
|
||||
|
||||
setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs');
|
||||
|
||||
@ -3503,20 +3503,51 @@ function get_localtax_by_third($local)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get vat rate and npr from id.
|
||||
* You can call getLocalTaxesFromRate after to get other fields
|
||||
*
|
||||
* @param int $vatrowid Line ID into vat rate table.
|
||||
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
|
||||
*/
|
||||
function getTaxesFromId($vatrowid)
|
||||
{
|
||||
global $db, $mysoc;
|
||||
|
||||
dol_syslog("getTaxesFromId vatrowid=".$vatrowid);
|
||||
|
||||
// Search local taxes
|
||||
$sql = "SELECT t.rowid, t.code, t.taux as rate, t.recuperableonly as npr";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t";
|
||||
$sql.= " WHERE t.rowid ='".$vatrowid."'";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
return array('rowid'=>$obj->rowid, 'code'=>$obj->code, 'rate'=>$obj->rate, 'npr'=>$obj->npr);
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type and rate of localtaxes for a particular vat rate/country fo thirdparty
|
||||
* TODO
|
||||
* This function is also called to retrieve type for building PDF. Such call of function must be removed.
|
||||
* This function is ALSO called to retrieve type for building PDF. Such call of function must be removed.
|
||||
* Instead this function must be called when adding a line to get the array of localtax and type, and then
|
||||
* provide it to the function calcul_price_total.
|
||||
*
|
||||
* @param float $vatrate VAT Rate. Value can be '8.5' or '8.5 (8.5NPR)'.
|
||||
* @param string $vatrate VAT Rate. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123.
|
||||
* @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
|
||||
* @param Societe $buyer Company object
|
||||
* @param Societe $seller Company object
|
||||
* @param int $firstparamisid 1 if first param is id into table (use this if you can)
|
||||
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
|
||||
*/
|
||||
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller)
|
||||
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
|
||||
{
|
||||
global $db, $mysoc;
|
||||
|
||||
@ -3531,12 +3562,17 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller)
|
||||
|
||||
// Search local taxes
|
||||
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
if ($mysoc->country_code == 'ES') $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'";
|
||||
else $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'";
|
||||
$sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
|
||||
if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'";
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
|
||||
if ($firstparamisid) $sql.= " WHERE t.rowid ='".$vatrate."'";
|
||||
else
|
||||
{
|
||||
$sql.=", ".MAIN_DB_PREFIX."c_country as c";
|
||||
if ($mysoc->country_code == 'ES') $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; // local tax in spain use the buyer country ??
|
||||
else $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'";
|
||||
$sql.= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
|
||||
if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'";
|
||||
}
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -4559,7 +4595,7 @@ function setEventMessage($mesgs, $style='mesgs')
|
||||
*/
|
||||
function setEventMessages($mesg, $mesgs, $style='mesgs')
|
||||
{
|
||||
if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage');
|
||||
if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter style='.$style.' for setEventMessages');
|
||||
if (empty($mesgs)) setEventMessage($mesg, $style);
|
||||
else
|
||||
{
|
||||
|
||||
@ -301,7 +301,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $s
|
||||
* @param string $extName Extension to differenciate thumb file name ('_small', '_mini')
|
||||
* @param int $quality Quality of compression (0=worst, 100=best)
|
||||
* @param string $outdir Directory where to store thumb
|
||||
* @param int $targetformat New format of target (1,2,3,... or 0 to keep old format)
|
||||
* @param int $targetformat New format of target (IMAGETYPE_GIF, IMAGETYPE_JPG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_WBMP ... or 0 to keep old format)
|
||||
* @return string Full path of thumb or '' if it fails
|
||||
*/
|
||||
function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $quality=50, $outdir='thumbs', $targetformat=0)
|
||||
@ -473,6 +473,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
|
||||
}
|
||||
|
||||
// Initialisation des variables selon l'extension de l'image
|
||||
// $targetformat is 0 by default, in such case, we keep original extension
|
||||
switch($targetformat)
|
||||
{
|
||||
case IMAGETYPE_GIF: // 1
|
||||
|
||||
@ -40,8 +40,8 @@
|
||||
* @param float $pu Unit price (HT or TTC selon price_base_type)
|
||||
* @param float $remise_percent_ligne Discount for line
|
||||
* @param float $txtva 0=do not apply standard tax, Vat rate=apply
|
||||
* @param float $uselocaltax1_rate 0=do not use this localtax, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty)
|
||||
* @param float $uselocaltax2_rate 0=do not use this localtax, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty)
|
||||
* @param float $uselocaltax1_rate 0=do not use this localtax, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1.
|
||||
* @param float $uselocaltax2_rate 0=do not use this localtax, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1.
|
||||
* @param float $remise_percent_global 0
|
||||
* @param string $price_base_type HT=Unit price parameter is HT, TTC=Unit price parameter is TTC
|
||||
* @param int $info_bits Miscellaneous informations on line
|
||||
@ -49,7 +49,7 @@
|
||||
* @param Societe $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
|
||||
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
|
||||
* @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default)
|
||||
* @return result[ 0=total_ht,
|
||||
* @return array [ 0=total_ht,
|
||||
* 1=total_vat, (main vat only)
|
||||
* 2=total_ttc, (total_ht + main vat + local taxes)
|
||||
* 3=pu_ht,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
||||
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
@ -178,7 +178,6 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets VAT to collect for the given year (and given quarter or month)
|
||||
* The function gets the VAT in split results, as the VAT declaration asks
|
||||
|
||||
@ -1034,6 +1034,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$langs->load("withdrawals");
|
||||
$langs->load("banks");
|
||||
$langs->load("bills");
|
||||
$langs->load('categories');
|
||||
|
||||
// Bank-Caisse
|
||||
if (! empty($conf->banque->enabled))
|
||||
|
||||
@ -227,7 +227,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
|
||||
* Return if a code is used (by other element)
|
||||
*
|
||||
* @param DoliDB $db Handler acces base
|
||||
* @param string $code Code a verifier
|
||||
* @param string $code Code to check
|
||||
* @param Product $product Objet product
|
||||
* @return int 0 if available, <0 if KO
|
||||
*/
|
||||
@ -277,12 +277,20 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
|
||||
return '';
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this).'::verif_syntax codefortest='.$codefortest." typefortest=".$typefortest);
|
||||
|
||||
$newcodefortest=$codefortest;
|
||||
|
||||
// Special case, if mask is on 12 digits instead of 13, we remove last char into code to test
|
||||
if (in_array($typefortest,array('EAN13','ISBN'))) // We remove the CRC char not included into mask
|
||||
{
|
||||
$newcodefortest=substr($newcodefortest,0,12);
|
||||
if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$mask,$reg))
|
||||
{
|
||||
if (strlen($reg[1]) == 12) $newcodefortest=substr($newcodefortest,0,12);
|
||||
dol_syslog(get_class($this).'::verif_syntax newcodefortest='.$newcodefortest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$result=check_value($mask,$newcodefortest);
|
||||
|
||||
return $result;
|
||||
|
||||
@ -911,7 +911,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
// VAT
|
||||
foreach($this->tva as $tvakey => $tvaval)
|
||||
{
|
||||
if ($tvakey > 0) // On affiche pas taux 0
|
||||
if ($tvakey != 0) // On affiche pas taux 0
|
||||
{
|
||||
$this->atleastoneratenotnull++;
|
||||
|
||||
|
||||
@ -57,7 +57,6 @@ class pdf_proforma extends pdf_einstein
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2016 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
|
||||
@ -68,7 +69,6 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$langs->load("main");
|
||||
$langs->load("trips");
|
||||
$langs->load("project");
|
||||
$langs->load("trips");
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "";
|
||||
@ -91,8 +91,8 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$this->option_condreg = 1; // Affiche conditions reglement
|
||||
$this->option_codeproduitservice = 1; // Affiche code produit-service
|
||||
$this->option_multilang = 1; // Dispo en plusieurs langues
|
||||
$this->option_escompte = 1; // Affiche si il y a eu escompte
|
||||
$this->option_credit_note = 1; // Support credit notes
|
||||
$this->option_escompte = 0; // Affiche si il y a eu escompte
|
||||
$this->option_credit_note = 0; // Support credit notes
|
||||
$this->option_freetext = 1; // Support add of a personalised text
|
||||
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
|
||||
|
||||
@ -104,14 +104,14 @@ class pdf_standard extends ModeleExpenseReport
|
||||
|
||||
// Define position of columns
|
||||
$this->posxpiece=$this->marge_gauche+1;
|
||||
$this->posxdesc=20;
|
||||
$this->posxdate=85;
|
||||
$this->posxtype=105;
|
||||
$this->posxprojet=125;
|
||||
$this->posxtva=145;
|
||||
$this->posxup=162;
|
||||
$this->posxqty=176;
|
||||
$this->postotalttc=186;
|
||||
$this->posxcomment=$this->marge_gauche+10;
|
||||
$this->posxdate=80;
|
||||
$this->posxtype=97;
|
||||
$this->posxprojet=116;
|
||||
$this->posxtva=136;
|
||||
$this->posxup=148;
|
||||
$this->posxqty=166;
|
||||
$this->postotalttc=178;
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
$this->posxdate-=20;
|
||||
@ -127,7 +127,6 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$this->localtax1=array();
|
||||
$this->localtax2=array();
|
||||
$this->atleastoneratenotnull=0;
|
||||
$this->atleastonediscount=0;
|
||||
}
|
||||
|
||||
|
||||
@ -199,7 +198,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
// Create pdf instance
|
||||
$pdf=pdf_getInstance($this->format);
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
|
||||
$heightforinfotot = 50; // Height reserved to output the info and total part
|
||||
$heightforinfotot = 40; // Height reserved to output the info and total part
|
||||
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
|
||||
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
@ -230,15 +229,6 @@ class pdf_standard extends ModeleExpenseReport
|
||||
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
|
||||
// Positionne $this->atleastonediscount si on a au moins une remise
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
{
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
@ -249,9 +239,9 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$tab_top = 95;
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?95:10);
|
||||
$tab_height = 110;
|
||||
$tab_height_newpage = 110;
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?65:10);
|
||||
$tab_height = 130;
|
||||
$tab_height_newpage = 150;
|
||||
|
||||
// Show notes
|
||||
$notetoshow=empty($object->note_public)?'':$object->note_public;
|
||||
@ -297,7 +287,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$piece_comptable = $i +1;
|
||||
|
||||
$curY = $nexY;
|
||||
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
|
||||
$pdf->SetFont('','', $default_font_size - 2); // Into loop to work with multipage
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
@ -305,18 +295,17 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pageposbefore=$pdf->getPage();
|
||||
|
||||
// Description of product line
|
||||
$curX = $this->posxdesc-1;
|
||||
$curX = $this->posxcomment-1;
|
||||
|
||||
$showpricebeforepagebreak=1;
|
||||
|
||||
// Accountancy piece
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-1, 3, $this->posxpiece-1, $curY, $piece_comptable, 0, 1);
|
||||
|
||||
$pdf->SetXY($this->posxpiece, $curY);
|
||||
$pdf->MultiCell($this->posxcomment-$this->posxpiece-0.8, 4, $piece_comptable, 0, 'C');
|
||||
|
||||
// Comments
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->posxcomment, $curY);
|
||||
$pdf->writeHTMLCell($this->posxdate-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $object->lines[$i]->comments, 0, 1);
|
||||
$pdf->writeHTMLCell($this->posxdate-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $object->lines[$i]->comments, 0, 1);
|
||||
|
||||
//nexY
|
||||
$nexY = $pdf->GetY();
|
||||
@ -326,65 +315,51 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
|
||||
// Date
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->posxdate, $curY);
|
||||
$pdf->MultiCell($this->posxtype-$this->posxdate-1, 3,dol_print_date($object->lines[$i]->date,"day",false,$outpulangs), 0, 'C');
|
||||
$pdf->MultiCell($this->posxtype-$this->posxdate-0.8, 4,dol_print_date($object->lines[$i]->date,"day",false,$outpulangs), 0, 'C');
|
||||
|
||||
// Type
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->posxtype, $curY);
|
||||
$pdf->MultiCell($this->posxprojet-$this->posxtype-1, 3,$outputlangs->transnoentities($object->lines[$i]->type_fees_code), 0, 'C');
|
||||
$pdf->MultiCell($this->posxprojet-$this->posxtype-0.8, 4,$outputlangs->transnoentities($object->lines[$i]->type_fees_code), 0, 'C');
|
||||
|
||||
// Project
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->posxprojet, $curY);
|
||||
$pdf->MultiCell($this->posxtva-$this->posxprojet-1, 3,$object->lines[$i]->projet_ref, 0, 'C');
|
||||
$pdf->MultiCell($this->posxtva-$this->posxprojet-0.8, 4,$object->lines[$i]->projet_ref, 0, 'C');
|
||||
|
||||
// VAT Rate
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
||||
{
|
||||
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->posxtva, $curY);
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,$vat_rate, 0, 'R');
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 4,$vat_rate, 0, 'C');
|
||||
}
|
||||
|
||||
// Unit price
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->posxup, $curY);
|
||||
$pdf->MultiCell($this->posxqty-$this->posxup-1, 3,price($object->lines[$i]->value_unit), 0, 'R');
|
||||
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 4,price($object->lines[$i]->value_unit), 0, 'R');
|
||||
|
||||
// Quantity
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
$pdf->MultiCell($this->postotalttc-$this->posxqty, 3,$object->lines[$i]->qty, 0, 'C');
|
||||
$pdf->MultiCell($this->postotalttc-$this->posxqty-0.8, 4,$object->lines[$i]->qty, 0, 'C');
|
||||
|
||||
// Total with all taxes
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->postotalttc-1, $curY);
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R');
|
||||
|
||||
$nexY+=5;
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 4, price($object->lines[$i]->total_ttc), 0, 'R');
|
||||
|
||||
// Cherche nombre de lignes a venir pour savoir si place suffisante
|
||||
if ($i < ($nblignes - 1)) // If it's not last line
|
||||
{
|
||||
//on recupere la description du produit suivant
|
||||
$follow_descproduitservice = $object->lines[$i+1]->desc;
|
||||
$follow_comment = $object->lines[$i+1]->comments;
|
||||
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
|
||||
$nblineFollowDesc = dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4;
|
||||
// Et si on affiche dates de validite, on ajoute encore une ligne
|
||||
if ($object->lines[$i]->date_start && $object->lines[$i]->date_end)
|
||||
{
|
||||
$nblineFollowDesc += 4;
|
||||
}
|
||||
$nblineFollowComment = dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4;
|
||||
}
|
||||
else // If it's last line
|
||||
{
|
||||
$nblineFollowDesc = 0;
|
||||
$nblineFollowComment = 0;
|
||||
}
|
||||
|
||||
$nexY+=2; // Passe espace entre les lignes
|
||||
$nexY+=4; // Passe espace entre les lignes
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter)
|
||||
@ -590,146 +565,155 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->SetFont('','B',18);
|
||||
$pdf->SetTextColor(111,81,124);
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $object->getLibStatut(0), '', 'R');
|
||||
|
||||
if ($showaddress)
|
||||
{
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->zip).' '.$outputlangs->convToOutputCharset($this->emetteur->town);
|
||||
$carac_emetteur .= "\n";
|
||||
// Phone
|
||||
if ($this->emetteur->phone) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone")." : ".$outputlangs->convToOutputCharset($this->emetteur->phone);
|
||||
// Fax
|
||||
if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? ($this->emetteur->tel ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax")." : ".$outputlangs->convToOutputCharset($this->emetteur->fax);
|
||||
// EMail
|
||||
if ($this->emetteur->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email")." : ".$outputlangs->convToOutputCharset($this->emetteur->email);
|
||||
// Web
|
||||
if ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web")." : ".$outputlangs->convToOutputCharset($this->emetteur->url);
|
||||
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->zip).' '.$outputlangs->convToOutputCharset($this->emetteur->town);
|
||||
$carac_emetteur .= "\n";
|
||||
// Phone
|
||||
if ($this->emetteur->phone) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone")." : ".$outputlangs->convToOutputCharset($this->emetteur->phone);
|
||||
// Fax
|
||||
if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? ($this->emetteur->tel ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax")." : ".$outputlangs->convToOutputCharset($this->emetteur->fax);
|
||||
// EMail
|
||||
if ($this->emetteur->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email")." : ".$outputlangs->convToOutputCharset($this->emetteur->email);
|
||||
// Web
|
||||
if ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web")." : ".$outputlangs->convToOutputCharset($this->emetteur->url);
|
||||
// Show sender
|
||||
$posy=50;
|
||||
$posx=$this->marge_gauche;
|
||||
$hautcadre=40;
|
||||
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=118;
|
||||
|
||||
// Show sender
|
||||
$posy=50;
|
||||
$posx=$this->marge_gauche;
|
||||
$hautcadre=40;
|
||||
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=118;
|
||||
// Show sender frame
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->SetXY($posx,$posy-5);
|
||||
$pdf->MultiCell(66,5, $outputlangs->transnoentities("TripSociete")." :",'','L');
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetFillColor(224,224,224);
|
||||
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
|
||||
// Show sender frame
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->SetXY($posx,$posy-5);
|
||||
$pdf->MultiCell(66,5, $outputlangs->transnoentities("TripSociete")." :",'','L');
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetFillColor(224,224,224);
|
||||
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
// Show sender name
|
||||
$pdf->SetXY($posx+2,$posy+3);
|
||||
$pdf->SetFont('','B', $default_font_size);
|
||||
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
|
||||
|
||||
// Show sender name
|
||||
$pdf->SetXY($posx+2,$posy+3);
|
||||
$pdf->SetFont('','B', $default_font_size);
|
||||
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
|
||||
// Show sender information
|
||||
$pdf->SetXY($posx+2,$posy+8);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
|
||||
|
||||
// Show sender information
|
||||
$pdf->SetXY($posx+2,$posy+8);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
|
||||
// Show recipient
|
||||
$posy=50;
|
||||
$posx=100;
|
||||
|
||||
// Show recipient
|
||||
$posy=50;
|
||||
$posx=100;
|
||||
// Show recipient frame
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('','B',8);
|
||||
$pdf->SetXY($posx,$posy-5);
|
||||
$pdf->MultiCell(80,5, $outputlangs->transnoentities("TripNDF")." :", 0, 'L');
|
||||
$pdf->rect($posx, $posy, $this->page_largeur - $this->marge_gauche - $posx, $hautcadre);
|
||||
|
||||
// Show recipient frame
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('','B',8);
|
||||
$pdf->SetXY($posx,$posy-5);
|
||||
$pdf->MultiCell(80,5, $outputlangs->transnoentities("TripNDF")." :", 0, 'L');
|
||||
$pdf->rect($posx, $posy, $this->page_largeur - $this->marge_gauche - $posx, $hautcadre);
|
||||
// Informations for trip (dates and users workflow)
|
||||
if ($object->fk_user_author > 0)
|
||||
{
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_author); $posy+=3;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->SetFont('','',10);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHOR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateCreation")." : ".dol_print_date($object->date_create,"day",false,$outpulangs),0,'L');
|
||||
}
|
||||
|
||||
// Informations for trip (dates and users workflow)
|
||||
if ($object->fk_user_author > 0)
|
||||
{
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_author); $posy+=3;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->SetFont('','',10);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHOR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateCreation")." : ".dol_print_date($object->date_create,"day",false,$outpulangs),0,'L');
|
||||
}
|
||||
if ($object->fk_statut==99)
|
||||
{
|
||||
if ($object->fk_user_refuse > 0)
|
||||
{
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_refuse); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("REFUSEUR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_REFUS")." : ".$outputlangs->convToOutputCharset($object->detail_refuse),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_REFUS")." : ".dol_print_date($object->date_refuse,"day",false,$outpulangs),0,'L');
|
||||
}
|
||||
}
|
||||
else if($object->fk_statut==4)
|
||||
{
|
||||
if ($object->fk_user_cancel > 0)
|
||||
{
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_cancel); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("CANCEL_USER")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_CANCEL")." : ".$outputlangs->convToOutputCharset($object->detail_cancel),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_CANCEL")." : ".dol_print_date($object->date_cancel,"day",false,$outpulangs),0,'L');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->fk_user_approve > 0)
|
||||
{
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_approve); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("VALIDOR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateApprove")." : ".dol_print_date($object->date_approve,"day",false,$outpulangs),0,'L');
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->fk_statut==99)
|
||||
{
|
||||
if ($object->fk_user_refuse > 0)
|
||||
{
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_refuse); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("REFUSEUR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_REFUS")." : ".$outputlangs->convToOutputCharset($object->detail_refuse),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_REFUS")." : ".dol_print_date($object->date_refuse,"day",false,$outpulangs),0,'L');
|
||||
}
|
||||
}
|
||||
else if($object->fk_statut==4)
|
||||
{
|
||||
if ($object->fk_user_cancel > 0)
|
||||
{
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_cancel); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("CANCEL_USER")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_CANCEL")." : ".$outputlangs->convToOutputCharset($object->detail_cancel),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_CANCEL")." : ".dol_print_date($object->date_cancel,"day",false,$outpulangs),0,'L');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->fk_user_approve > 0)
|
||||
{
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_approve); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("VALIDOR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateApprove")." : ".dol_print_date($object->date_approve,"day",false,$outpulangs),0,'L');
|
||||
}
|
||||
}
|
||||
|
||||
if($object->fk_statut==6)
|
||||
{
|
||||
if ($object->fk_user_paid > 0)
|
||||
{
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_paid); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHORPAIEMENT")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_PAIEMENT")." : ".dol_print_date($object->date_paiement,"day",false,$outpulangs),0,'L');
|
||||
}
|
||||
}
|
||||
if($object->fk_statut==6)
|
||||
{
|
||||
if ($object->fk_user_paid > 0)
|
||||
{
|
||||
$userfee=new User($this->db);
|
||||
$userfee->fetch($object->fk_user_paid); $posy+=6;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHORPAIEMENT")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx+2,$posy);
|
||||
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_PAIEMENT")." : ".dol_print_date($object->date_paiement,"day",false,$outpulangs),0,'L');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche la grille des lignes de factures
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param int $tab_top Tab top
|
||||
* @param int $tab_height Tab height
|
||||
* @param int $nexY next y
|
||||
* @param Translate $outputlangs Output langs
|
||||
* @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
|
||||
* @param int $hidebottom Hide bottom bar of array
|
||||
* @return void
|
||||
*/
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Force to disable hidetop and hidebottom
|
||||
$hidebottom=0;
|
||||
if ($hidetop) $hidetop=-1;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
@ -745,56 +729,86 @@ class pdf_standard extends ModeleExpenseReport
|
||||
// Rect prend une longueur en 3eme param
|
||||
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
|
||||
// line prend une position y en 3eme param
|
||||
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
|
||||
}
|
||||
|
||||
$pdf->SetFont('','',8);
|
||||
|
||||
// Accountancy piece
|
||||
$pdf->SetXY($this->posxpiece-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxdesc-$this->posxpiece-1,1,'','','R');
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxpiece-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxcomment-$this->posxpiece-1,1,'','','R');
|
||||
}
|
||||
|
||||
// Comments
|
||||
$pdf->line($this->posxdesc-1, $tab_top, $this->posxdesc-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxdate-$this->posxdesc-1,1,$outputlangs->transnoentities("Description"),'','L');
|
||||
$pdf->line($this->posxcomment-1, $tab_top, $this->posxcomment-1, $tab_top + $tab_height);
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxcomment-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxdate-$this->posxcomment-1,1,$outputlangs->transnoentities("Description"),'','L');
|
||||
}
|
||||
|
||||
// Date
|
||||
$pdf->line($this->posxdate-1, $tab_top, $this->posxdate-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY($this->posxdate-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C');
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxdate-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C');
|
||||
}
|
||||
|
||||
// Type
|
||||
$pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY($this->posxtype-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxprojet-$this->posxtype-1,2, $outputlangs->transnoentities("Type"),'','C');
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxtype-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxprojet-$this->posxtype-1,2, $outputlangs->transnoentities("Type"),'','C');
|
||||
}
|
||||
|
||||
// Project
|
||||
$pdf->line($this->posxprojet-1, $tab_top, $this->posxprojet-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY($this->posxprojet-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C');
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxprojet-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C');
|
||||
}
|
||||
|
||||
// VAT
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
||||
{
|
||||
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY($this->posxtva-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxtva-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
|
||||
}
|
||||
}
|
||||
|
||||
// Unit price
|
||||
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY($this->posxup-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C');
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxup-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C');
|
||||
}
|
||||
|
||||
// Quantity
|
||||
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->postotalttc-$this->posxqty,2, $outputlangs->transnoentities("Qty"),'','R');
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->postotalttc-$this->posxqty,2, $outputlangs->transnoentities("Qty"),'','R');
|
||||
}
|
||||
|
||||
// Total with all taxes
|
||||
$pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height);
|
||||
$pdf->SetXY($this->postotalttc-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"),'','R');
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->postotalttc-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"),'','R');
|
||||
}
|
||||
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
}
|
||||
|
||||
@ -1109,7 +1109,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
// VAT
|
||||
foreach($this->tva as $tvakey => $tvaval)
|
||||
{
|
||||
if ($tvakey > 0) // On affiche pas taux 0
|
||||
if ($tvakey != 0) // On affiche pas taux 0
|
||||
{
|
||||
$this->atleastoneratenotnull++;
|
||||
|
||||
|
||||
@ -178,10 +178,10 @@ class modCommande extends DolibarrModules
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("commande","commande","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.label'=>'Country','co.code'=>"CountryCode",'s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.label'=>'Country','co.code'=>"CountryCode",'s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.label'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','pj.ref'=>'Text','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.label'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'pj.ref'=>'project','cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
|
||||
$this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
$keyforselect='commande'; $keyforelement='order'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
@ -193,6 +193,7 @@ class modCommande extends DolibarrModules
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande as c';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uv.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_extrafields as extra ON c.rowid = extra.fk_object';
|
||||
|
||||
@ -180,10 +180,10 @@ class modFacture extends DolibarrModules
|
||||
$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='bill';
|
||||
$this->export_permission[$r]=array(array("facture","facture","export","other"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode');
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text", 'pj.ref'=>'Text', 'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice", 'pj.ref'=>'project', 'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user');
|
||||
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
$keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
@ -195,6 +195,7 @@ class modFacture extends DolibarrModules
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';
|
||||
@ -210,10 +211,10 @@ class modFacture extends DolibarrModules
|
||||
$this->export_label[$r]='CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='bill';
|
||||
$this->export_permission[$r]=array(array("facture","facture","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'PaymentMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef');
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'PaymentMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Numeric','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','ba.ref'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text", 'pj.ref'=>'Text', 'p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','ba.ref'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice", 'pj.ref'=>'project', 'p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account');
|
||||
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
$keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
@ -221,6 +222,7 @@ class modFacture extends DolibarrModules
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';
|
||||
|
||||
@ -138,15 +138,18 @@ class modFicheinter extends DolibarrModules
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='InterventionCardsAndInterventionLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("ficheinter","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InterId",'f.ref'=>"InterRef",'f.datec'=>"InterDateCreation",'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote",'fd.rowid'=>'InterLineId','fd.date'=>"InterLineDate",'fd.duree'=>"InterLineDuration",'fd.description'=>"InterLineDesc");
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InterId",'f.ref'=>"InterRef",'f.datec'=>"InterDateCreation",'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote", 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'InterLineId','fd.date'=>"InterLineDate",'fd.duree'=>"InterLineDuration",'fd.description'=>"InterLineDesc");
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.duree'=>"Duree",'f.fk_statut'=>'Statut','f.description'=>"Text",'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean",'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",'fd.total_ht'=>"Numeric");
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.duree'=>"Duree",'f.fk_statut'=>'Statut','f.description'=>"Text",'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean",'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",'fd.total_ht'=>"Numeric");
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"intervention",'f.ref'=>"intervention",'f.datec'=>"intervention",'f.duree'=>"intervention",'f.fk_statut'=>"intervention",'f.description'=>"intervention",'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",'fd.duree'=>'inter_line','fd.description'=>'inter_line');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.duree'=>"Duree",'f.fk_statut'=>'Statut','f.description'=>"Text",'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean", 'pj.ref'=>'Text', 'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",'fd.total_ht'=>"Numeric");
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"intervention",'f.ref'=>"intervention",'f.datec'=>"intervention",'f.duree'=>"intervention",'f.fk_statut'=>"intervention",'f.description'=>"intervention", 'pj.ref'=>'project', 'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",'fd.duree'=>'inter_line','fd.description'=>'inter_line');
|
||||
$this->export_dependencies_array[$r]=array('inter_line'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'fichinter as f, '.MAIN_DB_PREFIX.'fichinterdet as fd, '.MAIN_DB_PREFIX.'societe as s)';
|
||||
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_fichinter';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'fichinter as f';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinterdet as fd ON f.rowid = fd.fk_fichinter,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s';
|
||||
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('intervention',1).')';
|
||||
$r++;
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ class modIncoterm extends DolibarrModules
|
||||
'tablib'=>array("Incoterms"), // Label of tables
|
||||
'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields
|
||||
'tabsqlsort'=>array("rowid ASC"), // Sort order
|
||||
'tabfield'=>array("code,libelle"), // List of fields (result of select to show dictionnary)
|
||||
'tabfield'=>array("code,libelle"), // List of fields (result of select to show dictionary)
|
||||
'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record)
|
||||
'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert)
|
||||
'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid')
|
||||
|
||||
@ -171,10 +171,10 @@ class modPropale extends DolibarrModules
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("propale","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note_public'=>"propal",'c.date_livraison'=>"propal",'cd.rowid'=>'propal_line','cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date', 'pj.ref'=>'Text', 'cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note_public'=>"propal",'c.date_livraison'=>"propal", 'pj.ref'=>'project', 'cd.rowid'=>'propal_line','cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
|
||||
$this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
$keyforselect='propal'; $keyforelement='propal'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
@ -186,6 +186,7 @@ class modPropale extends DolibarrModules
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s ';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'propal as c';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uv.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propal_extrafields as extra ON c.rowid = extra.fk_object';
|
||||
|
||||
@ -189,13 +189,13 @@ class modStock extends DolibarrModules
|
||||
$this->import_icon[$r]=$this->picto;
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('ps'=>MAIN_DB_PREFIX.'product_stock');
|
||||
$this->import_fields_array[$r]=array('ps.fk_product'=>"Product*",'ps.fk_entrepot'=>"Warehouse*",'ps.reel'=>"Stock*",'ps.pmp'=>"PMP" );
|
||||
$this->import_fields_array[$r]=array('ps.fk_product'=>"Product*",'ps.fk_entrepot'=>"Warehouse*",'ps.reel'=>"Stock*");
|
||||
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'ps.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product'),
|
||||
'ps.fk_entrepot'=>array('rule'=>'fetchidfromref','classfile'=>'/product/stock/class/entrepot.class.php','class'=>'Entrepot','method'=>'fetch','element'=>'label')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10",'ps.pmp'=>"25"
|
||||
$this->import_examplevalues_array[$r]=array('ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@ -64,53 +64,53 @@ class printing_printgcp extends PrintingDriver
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$this->db = $db;
|
||||
$this->google_id = $conf->global->OAUTH_GOOGLE_ID;
|
||||
$this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
|
||||
// Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
//$storage->clearToken('Google');
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
$urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$access = ($storage->hasAccessToken('Google')?'HasAccessToken':'NoAccessToken');
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService('Google', $credentials, $storage, array());
|
||||
$token_ok=true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken('Google');
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
}
|
||||
//var_dump($this->errors);exit;
|
||||
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if ($token_ok) {
|
||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
// Token expired so we refresh it
|
||||
if ($token_ok && $expire) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken('Google', $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
if (!$conf->oauth->enabled) {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'ModuleAuthNotActive', 'type'=>'info');
|
||||
} else {
|
||||
|
||||
$this->google_id = $conf->global->OAUTH_GOOGLE_ID;
|
||||
$this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
|
||||
// Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
//$storage->clearToken('Google');
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
$urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$access = ($storage->hasAccessToken('Google')?'HasAccessToken':'NoAccessToken');
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService('Google', $credentials, $storage, array());
|
||||
$token_ok=true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken('Google');
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
}
|
||||
//var_dump($this->errors);exit;
|
||||
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if ($token_ok) {
|
||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
// Token expired so we refresh it
|
||||
if ($token_ok && $expire) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken('Google', $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
if ($this->google_id != '' && $this->google_secret != '') {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info');
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_TOKEN_ACCESS', 'info'=>$access, 'type'=>'info', 'renew'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'delete'=>($storage->hasAccessToken('Google')?$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'):''));
|
||||
|
||||
@ -1073,7 +1073,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
// VAT
|
||||
foreach($this->tva as $tvakey => $tvaval)
|
||||
{
|
||||
if ($tvakey > 0) // On affiche pas taux 0
|
||||
if ($tvakey != 0) // On affiche pas taux 0
|
||||
{
|
||||
$this->atleastoneratenotnull++;
|
||||
|
||||
|
||||
@ -145,6 +145,10 @@ class mod_syslog_sentry extends LogHandler implements LogHandlerInterface
|
||||
*/
|
||||
public function export($content)
|
||||
{
|
||||
if (! $this->isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $conf;
|
||||
$dsn = $conf->global->SYSLOG_SENTRY_DSN;
|
||||
$client = new Raven_Client(
|
||||
|
||||
@ -111,7 +111,7 @@ else
|
||||
if (! empty($conf->user->enabled) && $user->rights->user->user->lire)
|
||||
{
|
||||
$langs->load("users");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/user/list.php', DOL_URL_ROOT.'/user/list.php', $langs->trans("Users"), 'user', 'sall', 'M', 'searchleftuser', img_object('','user'));
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/user/index.php', DOL_URL_ROOT.'/user/index.php', $langs->trans("Users"), 'user', 'sall', 'M', 'searchleftuser', img_object('','user'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
|
||||
$usemargins=0;
|
||||
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande')))
|
||||
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande')))
|
||||
{
|
||||
$usemargins=1;
|
||||
}
|
||||
@ -193,11 +193,17 @@ else {
|
||||
{
|
||||
$parameters=array('fk_parent_line'=>GETPOST('fk_parent_line','int'));
|
||||
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
||||
if (!empty($hookmanager->resPrint)) {
|
||||
print $hookmanager->resPrint;
|
||||
}
|
||||
}
|
||||
if (is_object($hookmanager) && ! empty($senderissupplier))
|
||||
{
|
||||
$parameters=array('htmlname'=>'addproduct');
|
||||
$reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action);
|
||||
if (!empty($hookmanager->resPrint)) {
|
||||
print $hookmanager->resPrint;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -399,18 +405,12 @@ if (! empty($usemargins) && $user->rights->margins->creer)
|
||||
jQuery(document).ready(function() {
|
||||
<?php
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?>
|
||||
$('#addline').click(function (e) {
|
||||
return checkFreeLine(e, "np_marginRate");
|
||||
});
|
||||
$("input[name='np_marginRate']:first").blur(function(e) {
|
||||
return checkFreeLine(e, "np_marginRate");
|
||||
});
|
||||
<?php
|
||||
}
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES)) { ?>
|
||||
$('#addline').click(function (e) {
|
||||
return checkFreeLine(e, "np_markRate");
|
||||
});
|
||||
$("input[name='np_markRate']:first").blur(function(e) {
|
||||
return checkFreeLine(e, "np_markRate");
|
||||
});
|
||||
@ -476,7 +476,7 @@ jQuery(document).ready(function() {
|
||||
$("#select_type").change(function()
|
||||
{
|
||||
setforfree();
|
||||
if (jQuery('#select_type').val() >= 0)
|
||||
if (jQuery('#select_type').val() >= 0)
|
||||
{
|
||||
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
|
||||
jQuery('#dp_desc').focus();
|
||||
@ -582,7 +582,7 @@ jQuery(document).ready(function() {
|
||||
<?php } ?>
|
||||
|
||||
/* To set focus */
|
||||
if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0)
|
||||
if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0)
|
||||
{
|
||||
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
|
||||
jQuery('#dp_desc').focus();
|
||||
|
||||
@ -252,6 +252,10 @@ if (! empty($conf->margin->enabled))
|
||||
jQuery("input[name='np_marginRate']:first").val('');
|
||||
jQuery("input[name='np_markRate']:first").val('');
|
||||
});
|
||||
jQuery("#qty").keyup(function() {
|
||||
jQuery("input[name='np_marginRate']:first").val('');
|
||||
jQuery("input[name='np_markRate']:first").val('');
|
||||
});
|
||||
jQuery("#remise_percent").keyup(function() {
|
||||
jQuery("input[name='np_marginRate']:first").val('');
|
||||
jQuery("input[name='np_markRate']:first").val('');
|
||||
@ -300,24 +304,18 @@ if (! empty($conf->margin->enabled))
|
||||
|
||||
/* Add rules to reset price_ht from margin info */
|
||||
<?php
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES) && !empty($conf->global->MARGIN_RESET_HT_FROM_MARGIN_FIELD))
|
||||
{
|
||||
?>
|
||||
$('#savelinebutton').click(function (e) {
|
||||
return checkEditLine(e, "np_marginRate");
|
||||
});
|
||||
/* Disabled. We must be able to click on button 'cancel'. Check must be done only on button 'save'.
|
||||
$("input[name='np_marginRate']:first").blur(function(e) {
|
||||
return checkEditLine(e, "np_marginRate");
|
||||
});*/
|
||||
<?php
|
||||
}
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES) && !empty($conf->global->MARGIN_RESET_HT_FROM_MARGIN_FIELD))
|
||||
{
|
||||
?>
|
||||
$('#savelinebutton').click(function (e) {
|
||||
return checkEditLine(e, "np_markRate");
|
||||
});
|
||||
/* Disabled. We must be able to click on button 'cancel'. Check must be done only on button 'save'.
|
||||
$("input[name='np_markRate']:first").blur(function(e) {
|
||||
return checkEditLine(e, "np_markRate");
|
||||
@ -330,6 +328,7 @@ if (! empty($conf->margin->enabled))
|
||||
|
||||
/* If margin rate field empty, do nothing. */
|
||||
/* Force content of price_ht to 0 or if a discount is set, recalculate it from margin rate */
|
||||
/* TODO This function seems no more used */
|
||||
function checkEditLine(e, npRate)
|
||||
{
|
||||
var buying_price = $("input[name='buying_price']:first");
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.0');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.1');
|
||||
|
||||
if (! defined('EURO')) define('EURO',chr(128));
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1269,7 +1270,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($vatrate,0,$mysoc, $this->thirdparty);
|
||||
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
|
||||
$vatrate = preg_replace('/\s*\(.*\)/','',$vatrate); // Remove code into vatrate.
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
|
||||
@ -680,7 +680,7 @@ class ProductFournisseur extends Product
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("suppliers");
|
||||
$out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").' (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':'');
|
||||
$out=($showunitprice?price($this->fourn_unitprice * (1 - $this->fourn_remise_percent/100) + $this->fourn_unitcharges - $this->fourn_remise).' '.$langs->trans("HT").' (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':'');
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
@ -243,7 +243,7 @@ if (! empty($conf->fournisseur->enabled))
|
||||
/*
|
||||
* List of users allowed
|
||||
*/
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname";
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.email";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."user_rights as ur";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."rights_def as rd";
|
||||
@ -276,6 +276,7 @@ if ($resql)
|
||||
$userstatic->id=$obj->rowid;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$userstatic->email=$obj->email;
|
||||
print $userstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -2227,7 +2227,11 @@ else
|
||||
// Delete
|
||||
if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
if ($object->getSommePaiement()) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecausePayments") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
} else {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
@ -283,7 +283,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print '<input type="hidden" name="socid" value="'.$obj->socid.'">';
|
||||
print '<input type="hidden" name="societe" value="'.$obj->name.'">';
|
||||
|
||||
dol_fiche_head('');
|
||||
dol_fiche_head(null);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -315,6 +315,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print '</table>';
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
$parameters=array('facid'=>$facid, 'ref'=>$ref, 'objcanvas'=>$objcanvas);
|
||||
$reshook=$hookmanager->executeHooks('paymentsupplierinvoices',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
@ -434,7 +435,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$preselectedchoice=$addwarning?'no':'yes';
|
||||
|
||||
print '<br>';
|
||||
$text=$langs->trans('ConfirmSupplierPayment',$totalpayment,$langs->trans("Currency".$conf->currency));
|
||||
$text=$langs->trans('ConfirmSupplierPayment', price($totalpayment),$langs->trans("Currency".$conf->currency));
|
||||
if (GETPOST('closepaidinvoices'))
|
||||
{
|
||||
$text.='<br>'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed");
|
||||
|
||||
@ -2217,7 +2217,7 @@ class soap_transport_http extends nusoap_base {
|
||||
}
|
||||
$this->use_curl = $use_curl;
|
||||
preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
|
||||
if (isset($rev[1])) $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')');
|
||||
$this->setHeader('User-Agent', $this->title.'/'.$this->version.(isset($rev[1])?' ('.$rev[1].')':''));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
-- Structure de la table llx_establishment
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS llx_establishment (
|
||||
CREATE TABLE llx_establishment (
|
||||
rowid integer NOT NULL auto_increment PRIMARY KEY,
|
||||
entity integer NOT NULL DEFAULT 1,
|
||||
name varchar(50),
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS llx_propal_merge_pdf_product (
|
||||
CREATE TABLE llx_propal_merge_pdf_product (
|
||||
rowid integer NOT NULL auto_increment PRIMARY KEY,
|
||||
fk_product integer NOT NULL,
|
||||
file_name varchar(200) NOT NULL,
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
CREATE TABLE IF NOT EXISTS llx_usergroup_extrafields (
|
||||
CREATE TABLE llx_usergroup_extrafields (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
fk_object integer NOT NULL,
|
||||
|
||||
@ -1494,7 +1494,7 @@ FCKeditorForProduct=WYSIWIG creation/edition of products/services description an
|
||||
FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). <font class="warning">Warning: Using this option for this case is seriously not recommended as it can create problems with special characters and page formating when building PDF files.</font>
|
||||
FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailing)
|
||||
FCKeditorForUserSignature=WYSIWIG creation/edition of user signature
|
||||
FCKeditorForMail=WYSIWIG creation/edition for all mail (except Outils->eMailing)
|
||||
FCKeditorForMail=WYSIWIG creation/edition for all mail (except Tools->eMailing)
|
||||
##### OSCommerce 1 #####
|
||||
OSCommerceErrorConnectOkButWrongDatabase=Connection succeeded but database doesn't look to be an OSCommerce database (Key %s not found in table %s).
|
||||
OSCommerceTestOk=Connection to server '%s' on database '%s' with user '%s' successfull.
|
||||
|
||||
@ -62,6 +62,9 @@ SupplierInvoiceSentByEMail=Supplier invoice %s sent by EMail
|
||||
ShippingSentByEMail=Shipment %s sent by EMail
|
||||
ShippingValidated= Shipment %s validated
|
||||
InterventionSentByEMail=Intervention %s sent by EMail
|
||||
ProposalDeleted=Proposal deleted
|
||||
OrderDeleted=Order deleted
|
||||
InvoiceDeleted=Invoice deleted
|
||||
NewCompanyToDolibarr= Third party created
|
||||
DateActionPlannedStart= Planned start date
|
||||
DateActionPlannedEnd= Planned end date
|
||||
|
||||
@ -195,3 +195,4 @@ WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Feature disabled when dis
|
||||
WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice date (%s) for invoice %s.
|
||||
WarningTooManyDataPleaseUseMoreFilters=Too many data (more than %s lines). Please use more filters or set the constant %s to a higher limit.
|
||||
WarningSomeLinesWithNullHourlyRate=Some times were recorded by users when their hourly rate was not defined. A value of 0 was used but this may result in wrong valuation of time spent.
|
||||
WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security purpose you will have to login with your new login before next action.
|
||||
|
||||
@ -175,6 +175,7 @@ PredefinedProductsAndServicesToSell=Predefined products/services to sell
|
||||
PredefinedProductsToPurchase=Predefined product to purchase
|
||||
PredefinedServicesToPurchase=Predefined services to purchase
|
||||
PredefinedProductsAndServicesToPurchase=Predefined products/services to puchase
|
||||
NotPredefinedProducts=Not predefined products/services
|
||||
GenerateThumb=Generate thumb
|
||||
ProductCanvasAbility=Use special "canvas" addons
|
||||
ServiceNb=Service #%s
|
||||
|
||||
@ -1948,7 +1948,7 @@ if (! function_exists("llxFooter"))
|
||||
print "\n<!-- JS CODE TO ENABLE tipTip on all object with class classfortooltip -->\n";
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(".classfortooltip").tipTip({maxWidth: "'.dol_size(600,'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});
|
||||
jQuery(".classfortooltip").tipTip({maxWidth: "'.dol_size(400,'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});
|
||||
});
|
||||
</script>' . "\n";
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta
|
||||
$marge_tx_ret='';
|
||||
$marque_tx_ret='';
|
||||
|
||||
if ($fk_pa > 0) {
|
||||
if ($fk_pa > 0 && empty($paht)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$product = new ProductFournisseur($db);
|
||||
if ($product->fetch_product_fournisseur_price($fk_pa))
|
||||
|
||||
@ -165,16 +165,15 @@ print '</form>';
|
||||
$sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,";
|
||||
if ($id > 0) $sql.= " d.fk_product,";
|
||||
if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
|
||||
$sql.= " sum(d.total_ht) as selling_price,";
|
||||
$sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
|
||||
$sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
|
||||
$sql.= " SUM(d.total_ht) as selling_price,";
|
||||
$sql.= " SUM(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
|
||||
$sql.= " SUM(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = d.fk_product";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
$sql.= " AND d.fk_product = p.rowid";
|
||||
$sql.= " AND f.fk_statut > 0";
|
||||
$sql.= " AND d.fk_facture = f.rowid";
|
||||
if ($id > 0)
|
||||
@ -186,8 +185,8 @@ if (!empty($enddate))
|
||||
$sql .= " AND d.buy_price_ht IS NOT NULL";
|
||||
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
|
||||
$sql .= " AND d.buy_price_ht <> 0";
|
||||
if ($id > 0) $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut";
|
||||
else $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref";
|
||||
if ($id > 0) $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut";
|
||||
else $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity";
|
||||
$sql.=$db->order($sortfield,$sortorder);
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
@ -260,13 +259,20 @@ if ($result)
|
||||
}
|
||||
else {
|
||||
print '<td>';
|
||||
$product_static->type=$objp->fk_product_type;
|
||||
$product_static->id=$objp->rowid;
|
||||
$product_static->ref=$objp->ref;
|
||||
$product_static->label=$objp->label;
|
||||
$product_static->entity=$objp->pentity;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
print $text.= ' - '.$objp->label;
|
||||
if ($objp->rowid > 0)
|
||||
{
|
||||
$product_static->type=$objp->fk_product_type;
|
||||
$product_static->id=$objp->rowid;
|
||||
$product_static->ref=$objp->ref;
|
||||
$product_static->label=$objp->label;
|
||||
$product_static->entity=$objp->pentity;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
print $text.= ' - '.$objp->label;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NotPredefinedProducts");
|
||||
}
|
||||
print "</td>\n";
|
||||
//print "<td>".$product_static->getNomUrl(1)."</td>\n";
|
||||
}
|
||||
|
||||
@ -48,6 +48,7 @@ $price_level = GETPOST('price_level', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$price_by_qty_rowid = GETPOST('pbq', 'int');
|
||||
$finished = GETPOST('finished', 'int');
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -180,9 +181,9 @@ if (! empty($action) && $action == 'fetch' && ! empty($id))
|
||||
|
||||
$form = new Form($db);
|
||||
if (empty($mode) || $mode == 1) {
|
||||
$arrayresult = $form->select_produits_list("", $htmlname, $type, "", $price_level, $searchkey, $status, 2, $outjson, $socid);
|
||||
$arrayresult = $form->select_produits_list("", $htmlname, $type, "", $price_level, $searchkey, $status, $finished, $outjson, $socid);
|
||||
} elseif ($mode == 2) {
|
||||
$arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson, $socid);
|
||||
$arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -5,13 +5,13 @@
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2007-2011 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2011-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
|
||||
* Copyright (C) 2014-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -2571,7 +2571,7 @@ class Product extends CommonObject
|
||||
$sql = "SELECT rowid, fk_product";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
|
||||
$sql.= " WHERE fk_soc = ".$id_fourn;
|
||||
$sql.= " AND ref_fourn = '".$ref_fourn."'";
|
||||
$sql.= " AND ref_fourn = '".$this->db->escape($ref_fourn)."'";
|
||||
$sql.= " AND fk_product != ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
@ -2593,7 +2593,7 @@ class Product extends CommonObject
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
|
||||
$sql.= " WHERE fk_soc = ".$id_fourn;
|
||||
if ($ref_fourn) $sql.= " AND ref_fourn = '".$ref_fourn."'";
|
||||
if ($ref_fourn) $sql.= " AND ref_fourn = '".$this->db->escape($ref_fourn)."'";
|
||||
else $sql.= " AND (ref_fourn = '' OR ref_fourn IS NULL)";
|
||||
$sql.= " AND quantity = '".$quantity."'";
|
||||
$sql.= " AND fk_product = ".$this->id;
|
||||
@ -2622,7 +2622,7 @@ class Product extends CommonObject
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".$this->id;
|
||||
$sql.= ", ".$id_fourn;
|
||||
$sql.= ", '".$ref_fourn."'";
|
||||
$sql.= ", '".$this->db->escape($ref_fourn)."'";
|
||||
$sql.= ", ".$quantity;
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", 0";
|
||||
@ -3927,7 +3927,7 @@ class Product extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text label from units dictionnary
|
||||
* Returns the text label from units dictionary
|
||||
*
|
||||
* @param string $type Label type (long or short)
|
||||
* @return string|int <0 if ko, label if ok
|
||||
@ -4123,7 +4123,11 @@ class Product extends CommonObject
|
||||
$price_min = $price * (1 - ($rules[$i]->var_min_percent/100));
|
||||
}
|
||||
|
||||
if ($price == $this->multiprices[$i] && ($price_min == $this->multiprices_min[$i])) {
|
||||
//Little check to make sure the price is modified before triggering generation
|
||||
$check_amount = (($price == $this->multiprices[$i]) && ($price_min == $this->multiprices_min[$i]));
|
||||
$check_type = ($baseprice == $this->multiprices_base_type[$i]);
|
||||
|
||||
if ($check_amount && $check_type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -361,7 +361,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$totalline=price2num($value['nb'] * $product_fourn->fourn_unitprice, 'MT');
|
||||
$totalline=price2num($value['nb'] * ($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) + $product_fourn->fourn_unitcharges - $product_fourn->fourn_remise), 'MT');
|
||||
$total+=$totalline;
|
||||
print '<td align="right">';
|
||||
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($product_fourn->fourn_unitprice,'','',0,0,-1,$conf->currency));
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Adolfo segura <adolfo.segura@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -79,6 +80,7 @@ if ($type === '0') { $contextpage='productlist'; if ($search_type=='') $search_t
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$extrafields = new ExtraFields($db);
|
||||
$form=new Form($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('product');
|
||||
@ -120,6 +122,15 @@ if (! empty($conf->barcode->enabled)) {
|
||||
$fieldstosearchall['p.barcode']='Gencod';
|
||||
}
|
||||
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
$titlesellprice=$langs->trans("SellingPrice");
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
$titlesellprice=$form->textwithpicto($langs->trans("SellingPrice"), $langs->trans("DefaultPriceRealPriceMayDependOnCustomer"));
|
||||
}
|
||||
}
|
||||
|
||||
// Definition of fields for lists
|
||||
$arrayfields=array(
|
||||
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
@ -176,7 +187,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
*/
|
||||
|
||||
$htmlother=new FormOther($db);
|
||||
$form=new Form($db);
|
||||
|
||||
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
{
|
||||
@ -210,7 +220,7 @@ else
|
||||
//$sql.= ' pfp.ref_fourn as ref_supplier, ';
|
||||
$sql.= ' MIN(pfp.unitprice) as minsellprice';
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -250,7 +260,7 @@ else
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
@ -264,7 +274,7 @@ else
|
||||
$sql.= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,";
|
||||
$sql.= ' p.datec, p.tms';
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=",ef.".$key;
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -402,16 +412,7 @@ else
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
$titlesellprice=$langs->trans("SellingPrice");
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
$titlesellprice=$form->textwithpicto($langs->trans("SellingPrice"), $langs->trans("DefaultPriceRealPriceMayDependOnCustomer"));
|
||||
}
|
||||
}
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||
@ -423,7 +424,7 @@ else
|
||||
if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desirestock","",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desiredstock","",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder);
|
||||
|
||||
@ -508,7 +508,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
$file = $reg[1];
|
||||
$classname = substr($file,4);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$file.'.php';
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
|
||||
@ -352,7 +352,7 @@ if (empty($reshook))
|
||||
$result=$object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessagess($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
@ -535,7 +535,7 @@ if ($action == 'create' && $user->rights->projet->creer)
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Create").'">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraft").'">';
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
print ' ';
|
||||
|
||||
@ -1146,14 +1146,21 @@ class Project extends CommonObject
|
||||
//Generate next ref
|
||||
$defaultref='';
|
||||
$obj = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
|
||||
if (! empty($conf->global->PROJECT_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.".php"))
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.'.php';
|
||||
$modProject = new $obj;
|
||||
$defaultref = $modProject->getNextValue(is_object($clone_project->thirdparty)?$clone_project->thirdparty->id:0,$clone_project);
|
||||
$file=dol_buildpath($reldir."core/modules/project/".$obj.'.php',0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
dol_include_once($reldir."core/modules/project/".$obj.'.php');
|
||||
$modProject = new $obj;
|
||||
$defaultref = $modProject->getNextValue(is_object($clone_project->thirdparty)?$clone_project->thirdparty:null, $clone_project);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
|
||||
|
||||
$clone_project->ref=$defaultref;
|
||||
|
||||
@ -348,8 +348,7 @@ $langs->load("orders");
|
||||
$langs->load("proposals");
|
||||
$langs->load("margins");
|
||||
|
||||
//print load_fiche_titre($langs->trans("Profit"),'','title_accountancy');
|
||||
print '<div class="center">'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'</div><br>';
|
||||
print load_fiche_titre($langs->trans("Profit"), '', 'title_accountancy');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -106,7 +106,7 @@ $hookmanager->initHooks(array($contextpage));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('project');
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('projet');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
@ -218,16 +218,15 @@ $parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid";
|
||||
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.=", ".MAIN_DB_PREFIX."element_contact as ecp";
|
||||
}
|
||||
|
||||
$sql.= " WHERE p.entity IN (".getEntity('project').')';
|
||||
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users
|
||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||
@ -274,6 +273,19 @@ if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public);
|
||||
if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale;
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
|
||||
if ($search_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_user;
|
||||
// Add where from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -481,10 +493,25 @@ if ($resql)
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
@ -66,7 +66,7 @@ $hookmanager->initHooks(array($contextpage));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('project');
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('projet_task');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// Security check
|
||||
@ -226,6 +226,7 @@ $sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."projet_task as t";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
if ($search_project_user > 0)
|
||||
{
|
||||
$sql.=", ".MAIN_DB_PREFIX."element_contact as ecp";
|
||||
@ -275,6 +276,19 @@ if ($search_projectstatus >= 0) $sql .= " AND p.fk_statut = ".$db->escape($searc
|
||||
if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public);
|
||||
if ($search_project_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_project_user;
|
||||
if ($search_task_user > 0) $sql.= " AND ect.fk_c_type_contact IN (".join(',',array_keys($listoftaskcontacttype)).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".$search_task_user;
|
||||
// Add where from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -478,14 +492,29 @@ if ($resql)
|
||||
if (! empty($arrayfields['t.duration_effective']['checked'])) print '<td></td>';
|
||||
if (! empty($arrayfields['t.progress_calculated']['checked'])) print '<td></td>';
|
||||
if (! empty($arrayfields['t.progress']['checked'])) print '<td></td>';
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -5,9 +5,6 @@
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* Version V1.1 Initial version of Philippe Berthet
|
||||
* Version V2 Change to be compatible with 3.4 and enhanced to be more generic
|
||||
*
|
||||
* 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
|
||||
@ -79,6 +76,7 @@ $langs->load("suppliers");
|
||||
$langs->load("propal");
|
||||
$langs->load("interventions");
|
||||
$langs->load("contracts");
|
||||
$langs->load("products");
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('consumptionthirdparty'));
|
||||
|
||||
@ -101,7 +101,7 @@ $hookmanager->initHooks(array($contextpage));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('thirdparty');
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('societe');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
@ -170,7 +170,6 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -200,6 +199,7 @@ if (empty($reshook))
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_nom='';
|
||||
$search_categ='';
|
||||
$search_sale='';
|
||||
$search_barcode="";
|
||||
@ -346,7 +346,7 @@ if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
// We'll need these fields in order to filter by categ
|
||||
if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_soc";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -401,7 +401,7 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
@ -592,35 +592,35 @@ if ($resql)
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only;
|
||||
print '<input class="flat" type="text" name="search_nom" size="8" value="'.dol_escape_htmltag($search_nom).'">';
|
||||
print '<input class="flat searchstring" type="text" name="search_nom" size="8" value="'.dol_escape_htmltag($search_nom).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Barcode
|
||||
if (! empty($arrayfields['s.barcode']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="sbarcode" size="6" value="'.dol_escape_htmltag($search_barcode).'">';
|
||||
print '<input class="flat searchstring" type="text" name="sbarcode" size="6" value="'.dol_escape_htmltag($search_barcode).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Customer code
|
||||
if (! empty($arrayfields['s.code_client']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="8" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).'">';
|
||||
print '<input class="flat searchstring" size="8" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Supplier code
|
||||
if (! empty($arrayfields['s.code_fournisseur']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="8" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).'">';
|
||||
print '<input class="flat searchstring" size="8" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Account Customer code
|
||||
if (! empty($arrayfields['s.code_compta']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="8" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).'">';
|
||||
print '<input class="flat searchstring" size="8" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Account Supplier code
|
||||
@ -634,14 +634,14 @@ if ($resql)
|
||||
if (! empty($arrayfields['s.town']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
|
||||
print '<input class="flat searchstring" size="6" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Zip
|
||||
if (! empty($arrayfields['s.zip']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="4" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Country
|
||||
@ -662,42 +662,42 @@ if ($resql)
|
||||
{
|
||||
// IdProf1
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="4" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).'">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.siret']['checked']))
|
||||
{
|
||||
// IdProf2
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="4" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).'">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.ape']['checked']))
|
||||
{
|
||||
// IdProf3
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="4" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).'">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.idprof4']['checked']))
|
||||
{
|
||||
// IdProf4
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="4" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).'">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.idprof5']['checked']))
|
||||
{
|
||||
// IdProf5
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="4" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).'">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.idprof6']['checked']))
|
||||
{
|
||||
// IdProf6
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="4" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -759,7 +759,18 @@ if ($resql)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
@ -1211,7 +1211,7 @@ else
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('AllocateCommercial','commercial_id').'</td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
$form->select_dolusers((! empty($object->commercial_id)?$object->commercial_id:$user->id),'commercial_id',1); // Add current user by default
|
||||
print $form->select_dolusers((! empty($object->commercial_id)?$object->commercial_id:$user->id),'commercial_id',1); // Add current user by default
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1885,7 +1885,7 @@ else
|
||||
'name' => 'soc_origin',
|
||||
'label' => $langs->trans('MergeOriginThirdparty'),
|
||||
'type' => 'other',
|
||||
'value' => $form->select_company('', 'soc_origin', 's.rowid != '.$object->id, 1, 0, 0, array(), 0, 'minwidth200')
|
||||
'value' => $form->select_company('', 'soc_origin', 's.rowid != '.$object->id, 'SelectThirdParty', 0, 0, array(), 0, 'minwidth200')
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ $useboldtitle=1;
|
||||
if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody;
|
||||
if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1='120,130,170';
|
||||
if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1=$colorbacktitle1;
|
||||
if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER=='238,246,252';
|
||||
if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER='238,246,252';
|
||||
if (! isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab;
|
||||
if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink;
|
||||
|
||||
@ -2893,12 +2893,10 @@ table.valid {
|
||||
border-radius: 4px;
|
||||
}
|
||||
#tiptip_content {
|
||||
-moz-border-radius:0px;
|
||||
-webkit-border-radius: 0px;
|
||||
border-radius: 0px;
|
||||
background-color: rgb(255,255,255);
|
||||
/* background-color: rgb(255,255,255);
|
||||
background-color: rgba(255,255,255,0.95);*/
|
||||
-moz-border-radius:0px;
|
||||
-webkit-border-radius: 0px;
|
||||
border-radius: 0px;
|
||||
background-color: rgb(255,255,255);
|
||||
line-height: 1.4em;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
@ -3,12 +3,12 @@
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
|
||||
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
*
|
||||
@ -203,7 +203,7 @@ if (empty($reshook)) {
|
||||
$object->ldap_sid = GETPOST("ldap_sid");
|
||||
$object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0;
|
||||
$object->employee = GETPOST('employee');
|
||||
|
||||
|
||||
$object->thm = GETPOST("thm") != '' ? GETPOST("thm") : '';
|
||||
$object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : '';
|
||||
$object->salary = GETPOST("salary") != '' ? GETPOST("salary") : '';
|
||||
@ -249,15 +249,15 @@ if (empty($reshook)) {
|
||||
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
$db->rollback();
|
||||
if (is_array($object->errors) && count($object->errors))
|
||||
if (is_array($object->errors) && count($object->errors))
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$action = "create"; // Go back to create page
|
||||
}
|
||||
}
|
||||
@ -283,8 +283,8 @@ if (empty($reshook)) {
|
||||
if ($result > 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@ -298,220 +298,204 @@ if (empty($reshook)) {
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
if (!$_POST["lastname"]) {
|
||||
setEventMessages($langs->trans("NameNotDefined"), null, 'errors');
|
||||
$action = "edit"; // Go back to create page
|
||||
$error ++;
|
||||
}
|
||||
if (!$_POST["login"]) {
|
||||
setEventMessages($langs->trans("LoginNotDefined"), null, 'errors');
|
||||
$action = "edit"; // Go back to create page
|
||||
$error ++;
|
||||
}
|
||||
if (!$_POST["lastname"]) {
|
||||
setEventMessages($langs->trans("NameNotDefined"), null, 'errors');
|
||||
$action = "edit"; // Go back to create page
|
||||
$error ++;
|
||||
}
|
||||
if (!$_POST["login"]) {
|
||||
setEventMessages($langs->trans("LoginNotDefined"), null, 'errors');
|
||||
$action = "edit"; // Go back to create page
|
||||
$error ++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$object->fetch($id);
|
||||
if (!$error) {
|
||||
$object->fetch($id);
|
||||
|
||||
$object->oldcopy = clone $object;
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$object->oldcopy = dol_clone($object);
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
$object->lastname = GETPOST("lastname", 'alpha');
|
||||
$object->firstname = GETPOST("firstname", 'alpha');
|
||||
$object->login = GETPOST("login", 'alpha');
|
||||
$object->gender = GETPOST("gender", 'alpha');
|
||||
$object->pass = GETPOST("password");
|
||||
$object->api_key = (GETPOST("api_key", 'alpha')) ? GETPOST("api_key", 'alpha') : $object->api_key;
|
||||
$object->admin = empty($user->admin) ? 0 : GETPOST("admin"); // A user can only be set admin by an admin
|
||||
$object->address = GETPOST('address', 'alpha');
|
||||
$object->zip = GETPOST('zipcode', 'alpha');
|
||||
$object->town = GETPOST('town', 'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
$object->office_phone = GETPOST("office_phone", 'alpha');
|
||||
$object->office_fax = GETPOST("office_fax", 'alpha');
|
||||
$object->user_mobile = GETPOST("user_mobile");
|
||||
$object->skype = GETPOST("skype", 'alpha');
|
||||
$object->email = GETPOST("email", 'alpha');
|
||||
$object->job = GETPOST("job", 'alpha');
|
||||
$object->signature = GETPOST("signature");
|
||||
$object->accountancy_code = GETPOST("accountancy_code");
|
||||
$object->openid = GETPOST("openid");
|
||||
$object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0;
|
||||
$object->employee = GETPOST('employee');
|
||||
|
||||
$object->thm = GETPOST("thm") != '' ? GETPOST("thm") : '';
|
||||
$object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : '';
|
||||
$object->salary = GETPOST("salary") != '' ? GETPOST("salary") : '';
|
||||
$object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : '';
|
||||
$object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : '';
|
||||
$object->lastname = GETPOST("lastname", 'alpha');
|
||||
$object->firstname = GETPOST("firstname", 'alpha');
|
||||
$object->login = GETPOST("login", 'alpha');
|
||||
$object->gender = GETPOST("gender", 'alpha');
|
||||
$object->pass = GETPOST("password");
|
||||
$object->api_key = (GETPOST("api_key", 'alpha')) ? GETPOST("api_key", 'alpha') : $object->api_key;
|
||||
$object->admin = empty($user->admin) ? 0 : GETPOST("admin"); // A user can only be set admin by an admin
|
||||
$object->address = GETPOST('address', 'alpha');
|
||||
$object->zip = GETPOST('zipcode', 'alpha');
|
||||
$object->town = GETPOST('town', 'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
$object->office_phone = GETPOST("office_phone", 'alpha');
|
||||
$object->office_fax = GETPOST("office_fax", 'alpha');
|
||||
$object->user_mobile = GETPOST("user_mobile");
|
||||
$object->skype = GETPOST("skype", 'alpha');
|
||||
$object->email = GETPOST("email", 'alpha');
|
||||
$object->job = GETPOST("job", 'alpha');
|
||||
$object->signature = GETPOST("signature");
|
||||
$object->accountancy_code = GETPOST("accountancy_code");
|
||||
$object->openid = GETPOST("openid");
|
||||
$object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0;
|
||||
$object->employee = GETPOST('employee');
|
||||
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
{
|
||||
if (! empty($_POST["superadmin"]))
|
||||
{
|
||||
$object->entity = 0;
|
||||
}
|
||||
else if ($conf->multicompany->transverse_mode)
|
||||
{
|
||||
$object->entity = 1; // all users in master entity
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->entity = (! GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->entity = (! GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int'));
|
||||
}
|
||||
$object->thm = GETPOST("thm") != '' ? GETPOST("thm") : '';
|
||||
$object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : '';
|
||||
$object->salary = GETPOST("salary") != '' ? GETPOST("salary") : '';
|
||||
$object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : '';
|
||||
$object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : '';
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
if ($ret < 0) {
|
||||
$error ++;
|
||||
}
|
||||
$object->color = GETPOST("color") != '' ? GETPOST("color") : '';
|
||||
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (!empty($_POST["superadmin"])) {
|
||||
$object->entity = 0;
|
||||
} else {
|
||||
if ($conf->multicompany->transverse_mode) {
|
||||
$object->entity = 1; // all users in master entity
|
||||
} else {
|
||||
$object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
|
||||
}
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
{
|
||||
if (! empty($_POST["superadmin"]))
|
||||
{
|
||||
$object->entity = 0;
|
||||
}
|
||||
else if ($conf->multicompany->transverse_mode)
|
||||
{
|
||||
$object->entity = 1; // all users in master entity
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->entity = (! GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->entity = (! GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int'));
|
||||
}
|
||||
|
||||
if (GETPOST('deletephoto')) {
|
||||
$object->photo = '';
|
||||
}
|
||||
if (!empty($_FILES['photo']['name'])) {
|
||||
$object->photo = dol_sanitizeFileName($_FILES['photo']['name']);
|
||||
}
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
if ($ret < 0) {
|
||||
$error ++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$ret = $object->update($user);
|
||||
if ($ret < 0) {
|
||||
$error ++;
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorLoginAlreadyExists", $object->login), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (GETPOST('deletephoto')) {
|
||||
$object->photo = '';
|
||||
}
|
||||
if (!empty($_FILES['photo']['name'])) {
|
||||
$object->photo = dol_sanitizeFileName($_FILES['photo']['name']);
|
||||
}
|
||||
|
||||
if (!$error && isset($_POST['contactid'])) {
|
||||
$contactid = GETPOST('contactid');
|
||||
if (!$error) {
|
||||
$ret = $object->update($user);
|
||||
if ($ret < 0) {
|
||||
$error ++;
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorLoginAlreadyExists", $object->login), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($contactid > 0) {
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($contactid);
|
||||
if (!$error && isset($_POST['contactid'])) {
|
||||
$contactid = GETPOST('contactid', 'int');
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||
$sql .= " SET fk_socpeople=".$db->escape($contactid);
|
||||
if ($contact->socid) {
|
||||
$sql .= ", fk_soc=".$db->escape($contact->socid);
|
||||
}
|
||||
$sql .= " WHERE rowid=".$object->id;
|
||||
} else {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||
$sql .= " SET fk_socpeople=NULL, fk_soc=NULL";
|
||||
$sql .= " WHERE rowid=".$object->id;
|
||||
}
|
||||
dol_syslog("fiche::update", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
}
|
||||
if ($contactid > 0) {
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($contactid);
|
||||
|
||||
if (!$error && !count($object->errors)) {
|
||||
if (GETPOST('deletephoto') && $object->photo) {
|
||||
$fileimg = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user').'/logos/'.$object->photo;
|
||||
$dirthumbs = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user').'/logos/thumbs';
|
||||
dol_delete_file($fileimg);
|
||||
dol_delete_dir_recursive($dirthumbs);
|
||||
}
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||
$sql .= " SET fk_socpeople=".$db->escape($contactid);
|
||||
if (!empty($contact->socid)) {
|
||||
$sql .= ", fk_soc=".$db->escape($contact->socid);
|
||||
}
|
||||
$sql .= " WHERE rowid=".$object->id;
|
||||
} else {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||
$sql .= " SET fk_socpeople=NULL, fk_soc=NULL";
|
||||
$sql .= " WHERE rowid=".$object->id;
|
||||
}
|
||||
dol_syslog("usercard::update", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) {
|
||||
$dir = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user');
|
||||
if (!$error && !count($object->errors)) {
|
||||
if (GETPOST('deletephoto') && $object->photo) {
|
||||
$fileimg = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user').'/logos/'.$object->photo;
|
||||
$dirthumbs = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user').'/logos/thumbs';
|
||||
dol_delete_file($fileimg);
|
||||
dol_delete_dir_recursive($dirthumbs);
|
||||
}
|
||||
|
||||
dol_mkdir($dir);
|
||||
if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) {
|
||||
$dir = $conf->user->dir_output.'/'.get_exdir($object->id, 2, 0, 1, $object, 'user');
|
||||
|
||||
if (@is_dir($dir)) {
|
||||
$newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']);
|
||||
$result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']);
|
||||
dol_mkdir($dir);
|
||||
|
||||
if (!$result > 0) {
|
||||
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
|
||||
} else {
|
||||
// Create small thumbs for company (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
if (@is_dir($dir)) {
|
||||
$newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']);
|
||||
$result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']);
|
||||
|
||||
// Create mini thumbs for company (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
}
|
||||
} else {
|
||||
$error ++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFailedToCreateDir", $dir), $mesgs, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$result > 0) {
|
||||
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
|
||||
} else {
|
||||
// Create small thumbs for company (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
|
||||
if (!$error && !count($object->errors)) {
|
||||
setEventMessages($langs->trans("UserModified"), null, 'mesgs');
|
||||
$db->commit();
|
||||
// Create mini thumbs for company (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
}
|
||||
} else {
|
||||
$error ++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFailedToCreateDir", $dir), $mesgs, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$login = $_SESSION["dol_login"];
|
||||
if ($login && $login == $object->oldcopy->login && $object->oldcopy->login != $object->login) // Current user has changed its login
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFailedToCreateDir", $dir), $mesgs, 'errors');
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($caneditpassword) // Case we can edit only password
|
||||
{
|
||||
$object->fetch($id);
|
||||
if (!$error && !count($object->errors)) {
|
||||
setEventMessages($langs->trans("UserModified"), null, 'mesgs');
|
||||
$db->commit();
|
||||
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
$ret = $object->setPassword($user, $_POST["password"]);
|
||||
if ($ret < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
$ret=$object->setPassword($user,$_POST["password"]);
|
||||
if ($ret < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$login = $_SESSION["dol_login"];
|
||||
if ($login && $login == $object->oldcopy->login && $object->oldcopy->login != $object->login) // Current user has changed its login
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->transnoentitiesnoconv("WarningYourLoginWasModifiedPleaseLogin"), null, 'warnings');
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($caneditpassword) // Case we can edit only password
|
||||
{
|
||||
dol_syslog("Not allowed to change fields, only password");
|
||||
|
||||
$object->fetch($id);
|
||||
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
$ret = $object->setPassword($user, GETPOST("password"));
|
||||
if ($ret < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Change password with a new generated one
|
||||
if ((($action == 'confirm_password' && $confirm == 'yes')
|
||||
@ -526,18 +510,18 @@ if (empty($reshook)) {
|
||||
} else {
|
||||
// Succes
|
||||
if ($action == 'confirm_passwordsend' && $confirm == 'yes') {
|
||||
if ($object->send_password($user, $newpassword) > 0)
|
||||
if ($object->send_password($user, $newpassword) > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("PasswordChangedAndSentTo", $object->email), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("PasswordChangedTo", $newpassword), null, 'errors');
|
||||
setEventMessages($langs->trans("PasswordChangedTo", $newpassword), null, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -589,8 +573,8 @@ if (empty($reshook)) {
|
||||
$ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||
}
|
||||
@ -921,7 +905,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
||||
print $formcompany->select_state($object->state_id,$object->country_code, 'state_id');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Tel
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td>';
|
||||
print '<td>';
|
||||
@ -1065,7 +1049,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
||||
print "</tr>\n";
|
||||
|
||||
// Accountancy code
|
||||
if ($conf->salaries->enabled)
|
||||
if ($conf->accounting->enabled)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
@ -1402,7 +1386,7 @@ else
|
||||
print "</tr>\n";
|
||||
|
||||
// Accountancy code
|
||||
if ($conf->salaries->enabled)
|
||||
if ($conf->accounting->enabled)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>'.$object->accountancy_code.'</td>';
|
||||
@ -1749,13 +1733,14 @@ else
|
||||
|
||||
dol_fiche_head($head, 'user', $title, 0, 'user');
|
||||
|
||||
$rowspan=17;
|
||||
$rowspan=22;
|
||||
if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $rowspan++;
|
||||
if (! empty($conf->societe->enabled)) $rowspan++;
|
||||
if (! empty($conf->adherent->enabled)) $rowspan++;
|
||||
if (! empty($conf->skype->enabled)) $rowspan++;
|
||||
if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3;
|
||||
if (! empty($conf->agenda->enabled)) $rowspan++;
|
||||
if (! empty($conf->accounting->enabled)) $rowspan++;
|
||||
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
@ -2173,7 +2158,7 @@ else
|
||||
print "</tr>\n";
|
||||
|
||||
// Accountancy code
|
||||
if ($conf->salaries->enabled)
|
||||
if ($conf->accounting->enabled)
|
||||
{
|
||||
print "<tr>";
|
||||
print '<td>'.$langs->trans("AccountancyCode").'</td>';
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2004-2012 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) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
|
||||
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
|
||||
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
@ -138,11 +138,11 @@ class User extends CommonObject
|
||||
|
||||
// For cache usage
|
||||
$this->all_permissions_are_loaded = 0;
|
||||
|
||||
// Force some default values
|
||||
|
||||
// Force some default values
|
||||
$this->admin = 0;
|
||||
$this->employee = 1;
|
||||
|
||||
|
||||
$this->conf = new stdClass();
|
||||
$this->rights = new stdClass();
|
||||
$this->rights->user = new stdClass();
|
||||
@ -162,7 +162,7 @@ class User extends CommonObject
|
||||
*/
|
||||
function fetch($id='', $login='',$sid='',$loadpersonalconf=1, $entity=-1)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $conf, $user;
|
||||
|
||||
// Clean parameters
|
||||
$login=trim($login);
|
||||
@ -202,14 +202,17 @@ class User extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
|
||||
$sql.= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
|
||||
}
|
||||
}
|
||||
else // The fetch was forced on an entity
|
||||
{
|
||||
$sql.= " WHERE u.entity IN (0, ".$conf->entity.")";
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode))
|
||||
$sql.= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
|
||||
else
|
||||
$sql.= " WHERE u.entity IN (0, ".$conf->entity.")";
|
||||
}
|
||||
|
||||
|
||||
if ($sid) // permet une recherche du user par son SID ActiveDirectory ou Samba
|
||||
{
|
||||
$sql.= " AND (u.ldap_sid = '".$this->db->escape($sid)."' OR u.login = '".$this->db->escape($login)."') LIMIT 1";
|
||||
@ -239,7 +242,7 @@ class User extends CommonObject
|
||||
$this->ldap_sid = $obj->ldap_sid;
|
||||
$this->lastname = $obj->lastname;
|
||||
$this->firstname = $obj->firstname;
|
||||
|
||||
|
||||
$this->employee = $obj->employee;
|
||||
|
||||
$this->login = $obj->login;
|
||||
@ -256,7 +259,7 @@ class User extends CommonObject
|
||||
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_id?$obj->country_code:'';
|
||||
$this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):'';
|
||||
//$this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):'';
|
||||
|
||||
$this->state_id = $obj->state_id;
|
||||
$this->state_code = $obj->state_code;
|
||||
@ -298,8 +301,8 @@ class User extends CommonObject
|
||||
|
||||
// Protection when module multicompany was set, admin was set to first entity and the module disabled,
|
||||
// then this admin user must be admin for all entities.
|
||||
if (empty($conf->multicompany->enabled) && $this->admin && $this->entity == 1) $this->entity = 0;
|
||||
|
||||
if (empty($conf->multicompany->enabled) && $this->admin && $this->entity == 1) $this->entity = 0;
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
@ -1227,7 +1230,7 @@ class User extends CommonObject
|
||||
$this->error = $langs->trans("ErrorFieldRequired",$this->login);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Update datas
|
||||
@ -1272,7 +1275,7 @@ class User extends CommonObject
|
||||
$nbrowsaffected+=$this->db->affected_rows($resql);
|
||||
|
||||
// Update password
|
||||
if ($this->pass)
|
||||
if (!empty($this->pass))
|
||||
{
|
||||
if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted)
|
||||
{
|
||||
@ -1893,7 +1896,7 @@ class User extends CommonObject
|
||||
global $menumanager;
|
||||
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
|
||||
|
||||
|
||||
$result = '';
|
||||
$companylink = '';
|
||||
$link = '';
|
||||
@ -1947,11 +1950,11 @@ class User extends CommonObject
|
||||
$link.= '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'"';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$langs->load("users");
|
||||
$label=$langs->trans("ShowUser");
|
||||
$link.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
$link.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$link.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$link.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
@ -1969,7 +1972,7 @@ class User extends CommonObject
|
||||
else $picto='<div class="inline-block valignmiddle'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('userphoto', $this, 0, 0, 0, 'loginphoto', 'mini', 0, 1).'</div>';
|
||||
$result.=$picto;
|
||||
}
|
||||
if (abs($withpictoimg) != 2)
|
||||
if (abs($withpictoimg) != 2)
|
||||
{
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='<div class="inline-block valignmiddle'.($morecss?' usertext'.$morecss:'').'">';
|
||||
if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen);
|
||||
@ -2582,8 +2585,8 @@ class User extends CommonObject
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Charge indicateurs this->nb pour le tableau de bord
|
||||
*
|
||||
@ -2618,6 +2621,6 @@ class User extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user